page 192

The PST files are used to store information that pertains to the e-mail folders, addresses, contact information, email messages and other data that is saved within Outlook and Exchange programs. Spire.Email supports to read PST files and get the folder information such as folder name, message count and unread message count.

Step 1: Load a PST file from disk into an instance of OutlookFile class.

OutlookFile olf = new OutlookFile(@"C:\Users\jack\Documents\Outlook Files\Sample.pst");

Step 2: Get the folders collection.

OutlookFolderCollection folderCollection = olf.RootOutlookFolder.GetSubFolders();

Step 3: Traverse the collection and get the folder information of each element in the collection.

foreach (OutlookFolder folder in folderCollection)
{
    Console.WriteLine("Folder: " + folder.Name);
    Console.WriteLine("Total items: " + folder.ItemCount);
    Console.WriteLine("Total unread items: " + folder.UnreadItemCount);
    Console.WriteLine("Whether this folder has subfolders: {0}", (folder.HasSubFolders)?"Yes":"No");
    Console.WriteLine("------------------Next Folder--------------------");
}

Output:

Get Folder Information from PST File in C#, VB.NET

Full Code:

[C#]
using Spire.Email;
using Spire.Email.Outlook;
using System;

namespace GetFolderInformation 
{
    class Program
    {
        static void Main(string[] args)
        {
            OutlookFile olf = new OutlookFile(@"C:\Users\jack\Documents\Outlook Files\Sample.pst");
            OutlookFolderCollection folderCollection = olf.RootOutlookFolder.GetSubFolders();

            foreach (OutlookFolder folder in folderCollection)
            {
                Console.WriteLine("Folder: " + folder.Name);
                Console.WriteLine("Total items: " + folder.ItemCount);
                Console.WriteLine("Total unread items: " + folder.UnreadItemCount);
                Console.WriteLine("Whether this folder has subfolders: {0}", (folder.HasSubFolders) ? "Yes" : "No");
                Console.WriteLine("------------------Next Folder--------------------");
            }
            Console.WriteLine("Completed");
        }
    }
}
[VB.NET]
Imports Spire.Email
Imports Spire.Email.Outlook

Namespace GetFolderInformation
	Class Program
		Private Shared Sub Main(args As String())
			Dim olf As New OutlookFile("C:\Users\jack\Documents\Outlook Files\Sample.pst")
			Dim folderCollection As OutlookFolderCollection = olf.RootOutlookFolder.GetSubFolders()

			For Each folder As OutlookFolder In folderCollection
				Console.WriteLine("Folder: " + folder.Name)
				Console.WriteLine("Total items: " + folder.ItemCount)
				Console.WriteLine("Total unread items: " + folder.UnreadItemCount)
				Console.WriteLine("Whether this folder has subfolders: {0}", If((folder.HasSubFolders), "Yes", "No"))
				Console.WriteLine("------------------Next Folder--------------------")
			Next
			Console.WriteLine("Completed")
		End Sub
	End Class
End Namespace

This article demonstrates how to set the row height and column width of an existing table in PowerPoint document using Spire.Presentation in C# and VB.NET.

The following screenshot shows the table before setting row height and column width.

Set Table Row Height and Column Width in PowerPoint

Detail steps:

Step 1: Instantiate a Presentation object and load the PowerPoint document.

Presentation ppt = new Presentation();
ppt.LoadFromFile("Input.pptx");

Step 2: Get the first slide.

ISlide slide = ppt.Slides[0];

Step 3: Get the first table on the slide.

ITable table = ppt.Slides[0].Shapes[0] as ITable;

Step 4: Set table row height and column width.

table.TableRows[1].Height = 50;
table.ColumnsList[1].Width = 100;

Step 5: Save the document.

ppt.SaveToFile("Output.pptx", FileFormat.Pptx2013);

Screenshot:

Set Table Row Height and Column Width in PowerPoint

Full code:

[C#]
using Spire.Presentation;

namespace Set_table_column_width_and_row_height
{
    class Program
    {
        static void Main(string[] args)
        {
            Presentation ppt = new Presentation();
            ppt.LoadFromFile("Input.pptx");

            ISlide slide = ppt.Slides[0];            

            ITable table = ppt.Slides[0].Shapes[0] as ITable;

            table.TableRows[1].Height = 50;
            table.ColumnsList[1].Width = 100;

            ppt.SaveToFile("Output.pptx", FileFormat.Pptx2013);
        }
    }
}
[VB.NET]
Imports Spire.Presentation

Namespace Set_table_column_width_and_row_height
	Class Program
		Private Shared Sub Main(args As String())
			Dim ppt As New Presentation()
			ppt.LoadFromFile("Input.pptx")

			Dim slide As ISlide = ppt.Slides(0)

			Dim table As ITable = TryCast(ppt.Slides(0).Shapes(0), ITable)

			table.TableRows(1).Height = 50
			table.ColumnsList(1).Width = 100

			ppt.SaveToFile("Output.pptx", FileFormat.Pptx2013)
		End Sub
	End Class
End Namespace

A file with the EMLX or EML file extension is a Mail Message file used to store an email message. EML/EMLX file can converted to MHTML or MSG file format with few lines of core code by using Spire.Email.

Convert EML/EMLX to MHTML

[C#]
using Spire.Email;
using System;

namespace ConvertEMLandEMLXtoMHTML 
{
    class Program
    {
        static void Main(string[] args)
        {
            MailMessage message = MailMessage.Load("example.eml");
            message.Save("ToMhtml.mhtml", MailMessageFormat.Mhtml);
            Console.WriteLine("Done");
        }
    }
}
[VB.NET]
Imports Spire.Email

Namespace ConvertEMLandEMLXtoMHTML
	Class Program
		Private Shared Sub Main(args As String())
			Dim message As MailMessage = MailMessage.Load("example.eml")
			message.Save("ToMhtml.mhtml", MailMessageFormat.Mhtml)
			Console.WriteLine("Done")
		End Sub
	End Class
End Namespace

Convert EML/EMLX to MSG

[C#]
using Spire.Email;
using System;

namespace ConvertEMLandEMLXtoMSG 
{
    class Program
    {
        static void Main(string[] args)
        {
            MailMessage message = MailMessage.Load("example.eml");
            message.Save("ToMsg.msg", MailMessageFormat.Msg);
            Console.WriteLine("Done");
        }
    }
}
[VB.NET]
Imports Spire.Email

Namespace ConvertEMLandEMLXtoMSG
	Class Program
		Private Shared Sub Main(args As String())
			Dim message As MailMessage = MailMessage.Load("example.eml")
			message.Save("ToMsg.msg", MailMessageFormat.Msg)
			Console.WriteLine("Done")
		End Sub
	End Class
End Namespace
page 192