.NET (1322)
Children categories
Lists are a powerful tool in PowerPoint presentations that enable you to organize and present information in a clear and concise manner. Whether you're showcasing key points, summarizing ideas, or highlighting important details, utilizing lists can enhance the visual appeal, readability and professionalism of your slides. In this article, we will explore how to create numbered lists and bulleted lists in PowerPoint presentations in C# and VB.NET using Spire.Presentation for .NET.
- Create a Numbered List in PowerPoint
- Create a Symbol Bulleted List in PowerPoint
- Create an Image Bulleted List in PowerPoint
Install Spire.Presentation for .NET
To begin with, you need to add the DLL files included in the Spire.Presentation for.NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.Presentation
Create a Numbered List in PowerPoint in C# and VB.NET
A numbered list in PowerPoint is a list of items where each item is preceded by a number or a sequence of numbers. It follows a sequential order, typically starting from 1 and progressing incrementally. Numbered lists are commonly used to present steps, instructions, rankings, or any information that requires a specific order.
To create a numbered list in a PowerPoint presentation using Spire.Presentation for .NET, you can follow these steps:
- Create a Presentation object.
- Get the first slide using Presentation.Slides[0] property.
- Append a shape to the slide using ISlide.Shapes.AppendShape() method and set the shape style.
- Specify the items of the list inside a String array.
- Create paragraphs based on the list items, and set the bullet type of these paragraphs to Numbered using ParagraphProperties.BulletType property.
- Set the numbered bullet style of these paragraphs using ParagraphProperties.BulletStyle property.
- Add these paragraphs to the shape using IAutoShape.TextFrame.Paragraphs.Append() method.
- Save the document to a PowerPoint file using Presentation.SaveToFile() method.
- C#
- VB.NET
using Spire.Presentation;
using Spire.Presentation.Drawing;
using System.Drawing;
namespace CreateNumberedList
{
internal class Program
{
static void Main(string[] args)
{
//Create a Presentation object
Presentation presentation = new Presentation();
//Get the first slide
ISlide slide = presentation.Slides[0];
//Add a shape to the slide and set the shape style
IAutoShape shape = slide.Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 50, 300, 200));
shape.Fill.FillType = FillFormatType.None;
shape.Line.FillType= FillFormatType.None;
//Add text to the default paragraph
TextParagraph paragraph = shape.TextFrame.Paragraphs[0];
paragraph.Text = "Required Web Development Skills:";
paragraph.Alignment = TextAlignmentType.Left;
paragraph.TextRanges[0].Fill.FillType = FillFormatType.Solid;
paragraph.TextRanges[0].Fill.SolidColor.Color = Color.Black;
//Specify the list items
string[] listItems = new string[] {
" Command-line Unix",
" Vim",
" HTML",
" CSS",
" Python",
" JavaScript",
" SQL"
};
//Create a numbered list
foreach (string item in listItems)
{
TextParagraph textParagraph = new TextParagraph();
textParagraph.Text = item;
textParagraph.Alignment = TextAlignmentType.Left;
textParagraph.TextRanges[0].Fill.FillType = FillFormatType.Solid;
textParagraph.TextRanges[0].Fill.SolidColor.Color = Color.Black;
textParagraph.BulletType = TextBulletType.Numbered;
textParagraph.BulletStyle = NumberedBulletStyle.BulletArabicPeriod;
shape.TextFrame.Paragraphs.Append(textParagraph);
}
//Save the result document
presentation.SaveToFile("NumberedList.pptx", FileFormat.Pptx2013);
}
}
}

Create a Symbol Bulleted List in PowerPoint in C# and VB.NET
A symbol bulleted list in PowerPoint uses symbols instead of numbers to visually represent each item. Symbol bulleted lists are useful for presenting non-sequential information or a collection of points without a specific order.
To create a symbol bulleted list in a PowerPoint presentation using Spire.Presentation for .NET, you can follow these steps:
- Create a Presentation object.
- Get the first slide using Presentation.Slides[0] property.
- Append a shape to the slide using ISlide.Shapes.AppendShape() method and set the shape style.
- Specify the items of the list inside a String array.
- Create paragraphs based on the list items, and set the bullet type of these paragraphs to Symbol using ParagraphProperties.BulletType property.
- Add these paragraphs to the shape using IAutoShape.TextFrame.Paragraphs.Append() method.
- Save the document to a PowerPoint file using Presentation.SaveToFile() method.
- C#
- VB.NET
using Spire.Presentation;
using Spire.Presentation.Drawing;
using System.Drawing;
namespace CreateSymbolBulletedList
{
internal class Program
{
static void Main(string[] args)
{
//Create a Presentation object
Presentation presentation = new Presentation();
//Get the first slide
ISlide slide = presentation.Slides[0];
//Add a shape to the slide and set the shape style
IAutoShape shape = slide.Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 50, 350, 200));
shape.Fill.FillType = FillFormatType.None;
shape.Line.FillType = FillFormatType.None;
//Add text to the default paragraph
TextParagraph paragraph = shape.TextFrame.Paragraphs[0];
paragraph.Text = "Computer Science Subjects:";
paragraph.Alignment = TextAlignmentType.Left;
paragraph.TextRanges[0].Fill.FillType = FillFormatType.Solid;
paragraph.TextRanges[0].Fill.SolidColor.Color = Color.Black;
//Specify the list items
string[] listItems = new string[] {
" Data Structure",
" Algorithm",
" Computer Networks",
" Operating System",
" Theory of Computations",
" C Programming",
" Computer Organization and Architecture"
};
//Create a symbol bulleted list
foreach (string item in listItems)
{
TextParagraph textParagraph = new TextParagraph();
textParagraph.Text = item;
textParagraph.Alignment = TextAlignmentType.Left;
textParagraph.TextRanges[0].Fill.FillType = FillFormatType.Solid;
textParagraph.TextRanges[0].Fill.SolidColor.Color = Color.Black;
textParagraph.BulletType = TextBulletType.Symbol;
shape.TextFrame.Paragraphs.Append(textParagraph);
}
//Save the result document
presentation.SaveToFile("SymbolBulletedList.pptx", FileFormat.Pptx2013);
}
}
}

Create an Image Bulleted List in PowerPoint in C# and VB.NET
An image bulleted list in PowerPoint replaces the traditional bullet points with small images or icons. Instead of using numbers or symbols, each item is represented by an image that adds a visual element to the list. Image bulleted lists are commonly used when you want to incorporate visual cues or represent items with relevant icons or graphics.
To create an image bulleted list in a PowerPoint presentation using Spire.Presentation for .NET, you can follow these steps:
- Create a Presentation object.
- Get the first slide using Presentation.Slides[0] property.
- Append a shape to the slide using ISlide.Shapes.AppendShape() method and set the shape style.
- Specify the items of the list inside a String array.
- Create paragraphs based on the list items, and set the bullet type of these paragraphs to Picture using ParagraphProperties.BulletType property.
- Set the image that will be used as bullets using ParagraphProperties.BulletPicture.EmbedImage property.
- Add these paragraphs to the shape using IAutoShape.TextFrame.Paragraphs.Append() method.
- Save the document to a PowerPoint file using Presentation.SaveToFile() method.
- C#
- VB.NET
using Spire.Presentation;
using Spire.Presentation.Drawing;
using System.Drawing;
namespace CreateImageBulletedList
{
internal class Program
{
static void Main(string[] args)
{
//Create a Presentation object
Presentation presentation = new Presentation();
//Get the first slide
ISlide slide = presentation.Slides[0];
//Add a shape to the slide and set the shape style
IAutoShape shape = slide.Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 50, 400, 180));
shape.Fill.FillType = FillFormatType.None;
shape.Line.FillType = FillFormatType.None;
//Add text to the default paragraph
TextParagraph paragraph = shape.TextFrame.Paragraphs[0];
paragraph.Text = "Project Task To-Do List:";
paragraph.Alignment = TextAlignmentType.Left;
paragraph.TextRanges[0].Fill.FillType = FillFormatType.Solid;
paragraph.TextRanges[0].Fill.SolidColor.Color = Color.Black;
//Specify the list items
string[] listItems = new string[] {
" Define projects and tasks you're working on",
" Assign people to tasks",
" Define the priority levels of your tasks",
" Keep track of the progress status of your tasks",
" Mark tasks as done when completed"
};
//Create an image bulleted list
foreach (string item in listItems)
{
TextParagraph textParagraph = new TextParagraph();
textParagraph.Text = item;
textParagraph.Alignment = TextAlignmentType.Left;
textParagraph.TextRanges[0].Fill.FillType = FillFormatType.Solid;
textParagraph.TextRanges[0].Fill.SolidColor.Color = Color.Black;
textParagraph.BulletType = TextBulletType.Picture;
IImageData image = presentation.Images.Append(Image.FromFile("icon.png"));
textParagraph.BulletPicture.EmbedImage = image;
shape.TextFrame.Paragraphs.Append(textParagraph);
}
//Save the result document
presentation.SaveToFile("ImageBulletedList.pptx", FileFormat.Pptx2013);
}
}
}

Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.
Set border and shading in PowerPoint document in C#, VB.NET
2014-04-23 03:39:09 Written by AdministratorSuppose you want your doc document more attract and prominent your content. You would use a kind of border and shading style to beatify your document and give prominence to the key points. AS well as doc document the PPT document also can set shape to as border and shading.
Spire.Presentation for .NET, a professional .NET PPT component to allow users to manipulate PPT documents without automation. It can set kinds of shape types which can help users to beatify their document as their expectation
Below demonstrate the effect by a screenshot which shows a shape type in PPT document with C#, VB.NET via Spire.Presentation for .NET.

There is a guide to introduce a method to set shape type to achieve above screenshot with C#, VB.NET via Spire.Presentation for .NET.
This method is:
First, new a PPT document and set its slide. Then, new a shape and set its line color and gradient color. Last set the font and fill style for the paragraph. Now Download and install Spire.Presentation for .NET and use below code to experience this method to set shape type in PPT document.
The full code:
using System;
using System.Drawing;
using Spire.Presentation;
using Spire.Presentation.Drawing;
namespace BorderAndShading
{
class Program
{
static void Main(string[] args)
{
Presentation presentation = new Presentation();
//set background Image
string ImageFile = @" bg.png";
RectangleF rect = new RectangleF(0, 0, presentation.SlideSize.Size.Width, presentation.SlideSize.Size.Height);
presentation.Slides[0].Shapes.AppendEmbedImage(ShapeType.Rectangle, ImageFile, rect);
presentation.Slides[0].Shapes[0].Line.FillFormat.SolidFillColor.Color = Color.FloralWhite;
//append new shape
IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle,
new RectangleF(120, 70, 450, 300));
//set the LineColor
shape.ShapeStyle.LineColor.Color = Color.Green;
//set the gradient color of shape
shape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Gradient;
shape.Fill.Gradient.GradientShape = Spire.Presentation.Drawing.GradientShapeType.Rectangle;
shape.Fill.Gradient.GradientStyle = Spire.Presentation.Drawing.GradientStyle.FromTopLeftCorner;
shape.Fill.Gradient.GradientStops.Append(1f, KnownColors.GreenYellow);
shape.Fill.Gradient.GradientStops.Append(0, KnownColors.PowderBlue);
shape.AppendTextFrame("Borders and Shading");
//set the Font
shape.TextFrame.Paragraphs[0].TextRanges[0].LatinFont = new TextFont("Arial Black");
shape.TextFrame.Paragraphs[0].TextRanges[0].Fill.FillType = FillFormatType.Solid;
shape.TextFrame.Paragraphs[0].TextRanges[0].Fill.SolidColor.Color = Color.Black;
//save the document
presentation.SaveToFile("BordersAndShading.pptx", FileFormat.Pptx2007);
System.Diagnostics.Process.Start("BordersAndShading.pptx");
}
}
}
Imports System.Text
Imports System.Drawing
Imports Spire.Presentation
Imports Spire.Presentation.Drawing
Module Module1
Sub Main()
'create PPT document
Dim presentation As New Presentation()
'set background Image
Dim ImageFile As String = "bg.png"
Dim rect As New RectangleF(0, 0, presentation.SlideSize.Size.Width, presentation.SlideSize.Size.Height)
presentation.Slides(0).Shapes.AppendEmbedImage(ShapeType.Rectangle, ImageFile, rect)
presentation.Slides(0).Shapes(0).Line.FillFormat.SolidFillColor.Color = Color.FloralWhite
'append new shape
Dim shape As IAutoShape = presentation.Slides(0).Shapes.AppendShape(ShapeType.Rectangle, New RectangleF(30, 70, 550, 300))
'set the LineColor
shape.ShapeStyle.LineColor.Color = Color.Green
'set the gradient color of shape
shape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Gradient
shape.Fill.Gradient.GradientShape = Spire.Presentation.Drawing.GradientShapeType.Rectangle
shape.Fill.Gradient.GradientStyle = Spire.Presentation.Drawing.GradientStyle.FromTopLeftCorner
shape.Fill.Gradient.GradientStops.Append(1.0F, KnownColors.GreenYellow)
shape.Fill.Gradient.GradientStops.Append(0, KnownColors.PowderBlue)
shape.AppendTextFrame("Borders and Shading")
'set the Font
shape.TextFrame.Paragraphs(0).TextRanges(0).LatinFont = New TextFont("Arial Black")
shape.TextFrame.Paragraphs(0).TextRanges(0).Fill.FillType = FillFormatType.Solid
shape.TextFrame.Paragraphs(0).TextRanges(0).Fill.SolidColor.Color = Color.Black
'save the document
presentation.SaveToFile("BordersAndShading.pptx", FileFormat.Pptx2007)
System.Diagnostics.Process.Start("BordersAndShading.pptx")
End Sub
End Module
Converting PowerPoint presentations to PDF offers portability, compatibility, and secure sharing capabilities. By transforming dynamic slides into a static, universally accessible format, users ensure seamless viewing across different devices and platforms.
This article explains how to convert PowerPoint presentations to PDFs using C# and Spire.Presentation for .NET. You'll learn to customize the conversion, including options like including hidden slides, securing PDFs with passwords, and enforcing compliance standards.
- Convert PowerPoint to PDF in C#
- Convert PowerPoint to PDF/A in C#
- Convert PowerPoint to Password-Protected PDF in C#
- Convert PowerPoint to PDF with Hidden Slides in C#
- Convert PowerPoint to PDF with Custom Slide Size in C#
- Convert a Specific Slide in PowerPoint to PDF in C#
Install Spire.Presentation for .NET
To begin with, you need to add the DLL files included in the Spire.Presentation for.NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.Presentation
Convert PowerPoint to PDF in C#
To convert a PowerPoint document to PDF without any customization, you can first load the document using the Presentation.LoadFromFile() method, and then save it as a PDF file using the Presentation.SaveToFile() method.
The steps to convert a PowerPoint document to PDF using C# are as follows:
- Create a Presentation object.
- Load a PowerPoint document using Presetation.LoadFromFile() method.
- Convert it to PDF using Presentation.SaveToFile() method.
- C#
using Spire.Presentation;
namespace ConvertPowerPointToPdf
{
class Program
{
static void Main(string[] args)
{
// Create a Presentation object
Presentation presentation = new Presentation();
// Load a PowerPoint file
presentation.LoadFromFile("C:\\Users\\Administrator\\Desktop\\Input.pptx");
// Save it to PDF
presentation.SaveToFile("ToPdf.pdf", FileFormat.PDF);
// Dispose resources
presentation.Dispose();
}
}
}

Convert PowerPoint to PDF/A in C#
Spire.Presentation provides the SaveToPdfOption class, which allows you to configure the options for PowerPoint-to-PDF conversion. For instance, you can set the conformance level of the generated PDF document to Pdf/A-1a.
The steps to convert a PowerPoint presentation to a PDF/A document using C# are as follows:
- Create a Presentation object.
- Load a PowerPoint document using Presetation.LoadFromFile() method.
- Get the SaveToPdfOption object using Presentation.SaveToPdfOption property.
- Set the conformance level to Pdf_A1A using SaveToPdfOption.PdfConformanceLevel property.
- Convert the presentation to PDF using Presentation.SaveToFile() method.
- C#
using Spire.Presentation;
using Spire.Presentation.External.Pdf;
namespace ConvertPowerPointToPdfa
{
class Program
{
static void Main(string[] args)
{
// Create a Presentation object
Presentation presentation = new Presentation();
// Load a PowerPoint file
presentation.LoadFromFile("C:\\Users\\Administrator\\Desktop\\Input.pptx");
// Get the SaveToPdfOption object
SaveToPdfOption options = presentation.SaveToPdfOption;
// Set the pdf conformance level to pdf_a1a
options.PdfConformanceLevel = PdfConformanceLevel.Pdf_A1A;
// Save the presentation to PDF
presentation.SaveToFile("ToPdfa.pdf",FileFormat.PDF);
// Dispose resources
presentation.Dispose();
}
}
}

Convert PowerPoint to Password-Protected PDF in C#
The SaveToPdfOption class offers the PdfSecurity.Encrypt() method, which enables you to protect the generated PDF document with a password and set document processing permissions, such as allowing printing and filling form fields.
The steps to convert a PowerPoint presentation to a password-protected PDF using C# are as follows.
- Create a Presentation object.
- Load a PowerPoint document using Presetation.LoadFromFile() method.
- Get the SaveToPdfOption object using Presentation.SaveToPdfOption property.
- Encrypt the generated PDF with a password using SaveToPdfOption.PdfSecurity.Encrypt() method.
- Convert the presentation to PDF using Presentation.SaveToFile() method.
- C#
using Spire.Presentation;
using Spire.Presentation.External.Pdf;
namespace ConvertPowerPointToPasswordProtectedPdf
{
class Program
{
static void Main(string[] args)
{
// Create a Presentation object
Presentation presentation = new Presentation();
// Load a PowerPoint file
presentation.LoadFromFile("C:\\Users\\Administrator\\Desktop\\Input.pptx");
// Get the SaveToPdfOption object
SaveToPdfOption option = presentation.SaveToPdfOption;
// Encrypt the generated document with a password
option.PdfSecurity.Encrypt("abc-123",PdfPermissionsFlags.Print | PdfPermissionsFlags.FillFields);
// Save the presentation to PDF
presentation.SaveToFile("ToEncryptedPdf.pdf", FileFormat.PDF);
// Dispose resources
presentation.Dispose();
}
}
}
Convert PowerPoint to PDF with Hidden Slides in C#
When converting a PowerPoint document to PDF, you can include any hidden slides by setting the SaveToPdfOption.ContainHiddenSlides property to true.
The following are the steps to convert PowerPoint to PDF with hidden slides using C#.
- Create a Presentation object.
- Load a PowerPoint document using Presetation.LoadFromFile() method.
- Get the SaveToPdfOption object using Presentation.SaveToPdfOption property.
- Set the SaveToPdfOption.ContainHiddenSlides property to true to include hidden when converting PowerPoint to PDF.
- Convert the presentation to PDF using Presentation.SaveToFile() method.
- C#
using Spire.Presentation;
namespace ConvertPowerPointToPdfWithHiddenSlides
{
class Program
{
static void Main(string[] args)
{
// Create a Presentation object
Presentation presentation = new Presentation();
// Load a PowerPoint file
presentation.LoadFromFile("C:\\Users\\Administrator\\Desktop\\Input.pptx");
// Get the SaveToPdfOption object
SaveToPdfOption option = presentation.SaveToPdfOption;
// Enable ContainHiddenSlides option
option.ContainHiddenSlides = true;
// Save the presentation to PDF
presentation.SaveToFile("ToPdfWithHiddenSlides.pdf", FileFormat.PDF);
// Dispose resources
presentation.Dispose();
}
}
}
Convert PowerPoint to PDF with Custom Slide Size in C#
Customizing the slide size allows you to optimize the PDF for printing on specific paper sizes, like A4, Letter, or even custom sizes. This can be achieved by adjusting the Presentation.SlideSize.Type and Presentation.SlideSize.Size properties.
The steps to convert PowerPoint to PDF with custom slide size are as follows.
- Create a Presentation object.
- Load a PowerPoint document using Presetation.LoadFromFile() method.
- Change the slide size using Presentation.SlideSize.Type and Presentation.SlideSize.Size properties.
- Auto fit content to the slide by setting Presentation.SlideSizeAutoFit to true.
- Convert the presentation to PDF using Presentation.SaveToFile() method.
- C#
using Spire.Presentation;
using System.Drawing;
namespace ConvertPowerPointToPdfWithCustomSlideSize
{
class Program
{
static void Main(string[] args)
{
// Create a Presentation object
Presentation presentation = new Presentation();
// Load a PowerPoint file
presentation.LoadFromFile("C:\\Users\\Administrator\\Desktop\\Input.pptx");
// Set the slide size type as custom
presentation.SlideSize.Type = SlideSizeType.Custom;
// Set the custom slide size
presentation.SlideSize.Size = new SizeF(750, 500);
// Or, you can set the slide size to a standard slide size like A4
// presentation.SlideSize.Type = SlideSizeType.A4;
// Fit content to the new size of slide
presentation.SlideSizeAutoFit = true;
// Save the presentation to PDF
presentation.SaveToFile("ToPdfWithCustomSlideSize.pdf", FileFormat.PDF);
// Dispose resources
presentation.Dispose();
}
}
}
Convert a Specific Slide in PowerPoint to PDF in C#
To convert a specific slide in a PowerPoint document into a PDF file, you can use the ISlide.SaveToFile() method. Here are the detailed steps.
- Create a Presentation object.
- Load a PowerPoint document using Presetation.LoadFromFile() method.
- Get a specific slide using Presentation.Slides[index] property.
- Convert it to PDF using ISlide.SaveToFile() method.
- C#
using Spire.Presentation;
namespace ConvertSpecificSlideToPdf
{
class Program
{
static void Main(string[] args)
{
// Create a Presentation object
Presentation presentation = new Presentation();
// Load a PowerPoint file
presentation.LoadFromFile("C:\\Users\\Administrator\\Desktop\\Input.pptx");
// Get a specific slide
ISlide slide = presentation.Slides[1];
// Save it to PDF
slide.SaveToFile("SlideToPdf.pdf", FileFormat.PDF);
// Dispose resources
presentation.Dispose();
}
}
}

Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.
Generally, we tend to insert graphics, animation effects, audio frames or video frames into our PPT slides to make it more vivid and persuasive. Adding high-quality audio, background music for example, to a slide presentation can greatly increase the impact that it has on your viewers.
Spire.Presentation for .NET is a comprehensive toolkit which allows developers to process PPT slides in massive ways, including multitude of graphics and multimedia features. In this topic, we will make a simple introduction of how to insert audio into PPT using C#.
Step 1: Create a new PPT document first
Presentation presentation = new Presentation()
Step 2: Basically, we need to set a background image before inserting Audio file
string ImageFile = "bg.png";
RectangleF rect = new RectangleF(0, 0, presentation.SlideSize.Size.Width, presentation.SlideSize.Size.Height);
presentation.Slides[0].Shapes.AppendEmbedImage(ShapeType.Rectangle, ImageFile, rect);
presentation.Slides[0].Shapes[0].Line.FillFormat.SolidFillColor.Color = Color.FloralWhite;
Step 3: Load the Audio file from disk
presentation.Slides[0].Shapes.AppendAudioMedia(Path.GetFullPath("paipai_sound.wav"), new RectangleF(100, 100, 20, 20));
Step 4: Set properties of AutoShape
IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 150, 600, 250));
shape.ShapeStyle.LineColor.Color = Color.White;
shape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.None;
Step 5: Save PPT file
presentation.SaveToFile("Audio.pptx", FileFormat.Pptx2010);
System.Diagnostics.Process.Start("Audio.pptx");
Effect Screenshot:

With Spire.Presentation, you can insert audio into your PowerPoint documents and do more same thing in your any .NET(C#, VB.NET, ASP.NET) applications without PowerPoint automation and any other third party add-ins.
Different printer drivers print out the document with different numbers of rows and columns. When we need to print an excel file with header and footer, the information of how many pages in one excel file and where is the first line start becomes very important. This article will show you how to get the page count of excel file and the row and column number of page break in C# by using Spire.XLS for .NET.
Firstly, make sure that Spire.XLS for .NET (version7.3.12 or above) has been installed on your machine. And then, adds Spire.XLS.dll as reference in the downloaded Bin folder thought the below path: "..\Spire.XLS\Bin\NET4.0\ Spire.XLS.dll".
Now it comes to the details of how to get the page count of excel file in C#:
//Create a new excel document Workbook wb = new Workbook(); //load from the file wb.LoadFromFile(@"D:\test.xlsx"); //get the page info. var pageInfoList = wb.GetSplitPageInfo(); //Get the sheet count int sheetCount = pageInfoList.Count; //The page count of the first sheet int pageCount = pageInfoList[0].Count;
You could find a screenshot shows row number and column number of each Excel page.

Spire.XLS for .NET, as a professional Excel component, it enables you to generate, read, write and manipulate Excel files in C#, VB.NET in any .NET applications directly.
PPT file format is commonly used for office and educational slide shows. With Spire.Presentation, you can generate beautiful and powerful PPT files and edit them without utilizing Microsoft PowerPoint. The PPT files generated are compatible with PowerPoint.
In this document, I will introduce you how to set Font of text in PPT file. First add IAutoShape to the slide. The IAutoShape is a TextBox. You have to add it first. Then add text to the IAutoShape using the method AppendTextFrame. Then you can get the property TextRange of the shape. Using TextRange, you can set Font of text finally.
Step 1: Add the shape to the slide.
IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle,
new RectangleF(50, 70, 400, 50));
Step 2: Add the text to the shape.
shape.AppendTextFrame("This is a demo of text font and color.");
Step 3: Get the property TextRange of the text.
TextRange textRange = shape.TextFrame.TextRange;
Step 4: Set the Font of the text in shape.
textRange.FontHeight = 21;
textRange.IsItalic = TriState.True;
textRange.TextUnderlineType = TextUnderlineType.Single;
textRange.LatinFont = new TextFont("Gulim");
Step 5: Save the document.
presentation.SaveToFile("text.pptx", FileFormat.Pptx2007);
Full code:
using Spire.Presentation;
using System.Drawing;
namespace SetFont
{
class Program
{
static void Main(string[] args)
{
//create PPT document
Presentation presentation = new Presentation();
//set background Image
string ImageFile = @"..\..\..\..\..\..\Data\bg.png";
RectangleF rect = new RectangleF(0, 0, presentation.SlideSize.Size.Width, presentation.SlideSize.Size.Height);
presentation.Slides[0].Shapes.AppendEmbedImage(ShapeType.Rectangle, ImageFile, rect);
presentation.Slides[0].Shapes[0].Line.FillFormat.SolidFillColor.Color = Color.FloralWhite;
//append new shape
IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle,
new RectangleF(50, 70, 400, 50));
//set the LineColor
shape.ShapeStyle.LineColor.Color = Color.Black;
//set the color and fill style
shape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
shape.Fill.SolidColor.Color = Color.LightGray;
shape.AppendTextFrame("This is a demo of text font and color.");
//set the color of text in shape
TextRange textRange = shape.TextFrame.TextRange;
textRange.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid;
textRange.Fill.SolidColor.Color = Color.Green;
//set the Font of text in shape
textRange.FontHeight = 21;
textRange.IsItalic = TriState.True;
textRange.TextUnderlineType = TextUnderlineType.Single;
textRange.LatinFont = new TextFont("Gulim");
//save the document
presentation.SaveToFile("text.pptx", FileFormat.Pptx2007);
System.Diagnostics.Process.Start("text.pptx");
}
}
}
Screenshot:

PPT text Alignment can be taken as one kind of text format tools. It allows users to align text with the following styles: Left, Right, Center and Justify. By default, text will be aligned right. Also, users can customize alignment. Below demonstrate the effect by a screenshot which shows the text is corresponding to the alignment, for example, text Left is aligned left and Center is aligned center.

Spire.Presentation for .NET, a professional .NET PPT component to allow users to manipulate PPT documents without automation. This guide will introduce a method to align text with C#, VB.NET via Spire.Presentation for .NET.
The method is:
First, new a PPT document, and set its slide. Then, traversal all alignment and use the new paragraph to show them. Last set the font and fill style for added paragraphs.
Download and install Spire.Presentation for .NET and use below code to experience this method to align text in PPT document.
The full code:
using System;
using System.Drawing;
using Spire.Presentation;
using Spire.Presentation.Drawing;
namespace Alignment
{
class Program
{
static void Main(string[] args)
{
Presentation presentation = new Presentation();
//set background Image
string ImageFile = @"bg.png";
// set the rectangle size and position
RectangleF rect = new RectangleF(0, 0, presentation.SlideSize.Size.Width, presentation.SlideSize.Size.Height);
//set the slide's shapes,background image and rectangle .
presentation.Slides[0].Shapes.AppendEmbedImage(ShapeType.Rectangle, ImageFile, rect);
//set the shape's solidFillColor
presentation.Slides[0].Shapes[0].Line.FillFormat.SolidFillColor.Color = Color.FloralWhite;
//append new shape
IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 70, 600, 400));
shape.TextFrame.Paragraphs[0].Alignment = TextAlignmentType.Left;
shape.Fill.FillType = FillFormatType.None;
shape.TextFrame.Text = "Demo about Alignment";
foreach (TextAlignmentType textAlign in Enum.GetValues(typeof(TextAlignmentType)))
{
//create a text range
TextRange textRange = new TextRange(textAlign.ToString());
//create a new paragraph
TextParagraph paragraph = new TextParagraph();
//apend the text range
paragraph.TextRanges.Append(textRange);
//set the alignment
paragraph.Alignment = textAlign;
//append to shape
shape.TextFrame.Paragraphs.Append(paragraph);
}
//set the font and fill style
foreach (TextParagraph paragraph in shape.TextFrame.Paragraphs)
{
paragraph.TextRanges[0].LatinFont = new TextFont("Arial Black");
paragraph.TextRanges[0].Fill.FillType = FillFormatType.Solid;
paragraph.TextRanges[0].Fill.SolidColor.Color = Color.Black;
}
//save the document
presentation.SaveToFile("alignment.pptx", FileFormat.Pptx2010);
System.Diagnostics.Process.Start("alignment.pptx");
}
}
}
Imports System.Text
Imports System.Drawing
Imports Spire.Presentation
Imports Spire.Presentation.Drawing
Public Class Form1
Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRun.Click
'create PPT document
Dim presentation As New Presentation()
'set background Image
Dim ImageFile As String = "bg.png"
Dim rect As New RectangleF(0, 0, presentation.SlideSize.Size.Width, presentation.SlideSize.Size.Height)
presentation.Slides(0).Shapes.AppendEmbedImage(ShapeType.Rectangle, ImageFile, rect)
presentation.Slides(0).Shapes(0).Line.FillFormat.SolidFillColor.Color = Color.FloralWhite
'append new shape
Dim shape As IAutoShape = presentation.Slides(0).Shapes.AppendShape(ShapeType.Rectangle, New RectangleF(50, 70, 350, 200))
shape.TextFrame.Paragraphs(0).Alignment = TextAlignmentType.Left
shape.Fill.FillType = FillFormatType.None
shape.TextFrame.Text = "Demo about Alignment"
For Each textAlign As TextAlignmentType In [Enum].GetValues(GetType(TextAlignmentType))
'create a text range
Dim textRange As New TextRange(textAlign.ToString())
'create a new paragraph
Dim paragraph As New TextParagraph()
'apend the text range
paragraph.TextRanges.Append(textRange)
'set the alignment
paragraph.Alignment = textAlign
'append to shape
shape.TextFrame.Paragraphs.Append(paragraph)
Next
'set the font and fill style
For Each paragraph As TextParagraph In shape.TextFrame.Paragraphs
paragraph.TextRanges(0).LatinFont = New TextFont("Arial Black")
paragraph.TextRanges(0).Fill.FillType = FillFormatType.Solid
paragraph.TextRanges(0).Fill.SolidColor.Color = Color.Black
Next
'save the document
presentation.SaveToFile("alignment.pptx", FileFormat.Pptx2010)
System.Diagnostics.Process.Start("alignment.pptx")
End Sub
End Class
In this document, we will quickly help you finish a simple demo about Spire.Presentation using Visual Studio. As usual, it's a HelloWorld demo. Before you get started, please make sure the Spire.Presentation and Visual Studio (2005 or later) are installed on your computer.
1. In Visual Studio, click, File, New, and then Project. If you want to create a C# project, select Visual C#, Windows and choose Windows Forms Application and name the project HelloWorld. Click OK. If you want to create a Visual Basic project, select Visual Basic, Windows Forms Application and name the project HelloWorld. Click OK.
2. In Solution Explorer, right-click the project HelloWorld and click Add Reference. In the Browse tab, find the folder which you installed the Spire.Presentation in, default is "C:\ProgramFiles\e-iceblue\ Spire.Presentation", double-click the folder Bin. If the target framework of the project HelloWorld
- is .NET 2.0, double-click folder NET2.0
- is .NET 3.5, double-click folder NET3.5
- is .NET 4.0, double-click folder NET4.0
Select assembly Spire.Presentation.dll and click OK to add it to the project.
3. In Solution Explorer, double-click the file Form1.cs/Form1.vb to open the form design view, add a button into the form, and change its name to 'btnRun', change its text to 'Run'.
4. Double-click the button 'Run', you will see the code view and the following method has been added automatically:
private void btnRun_Click(object sender, EventArgs e)
Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRun.Click
5. Add the following codes to the top of the file:
using Spire.Presentation; using Spire.Presentation.Drawing;
Imports Spire.Presentation Imports Spire.Presentation.Drawing
6. Add the following codes to the method btnRun_Click
//create PPT document
Presentation presentation = new Presentation();
//add new shape to PPT document
IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle,
new RectangleF(0, 50, 200, 50));
shape.ShapeStyle.LineColor.Color = Color.White;
shape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.None;
//add text to shape
shape.AppendTextFrame("Hello World!");
//set the Font fill style of text
TextRange textRange = shape.TextFrame.TextRange;
textRange.Fill.FillType = Presentation.Drawing.FillFormatType.Solid;
textRange.Fill.SolidColor.Color = Color.Black;
textRange.LatinFont = new TextFont("Arial Black");
//save the document
presentation.SaveToFile("hello.pptx", FileFormat.Pptx2010);
System.Diagnostics.Process.Start("hello.pptx");
'create PPT document
Dim presentation As New Presentation()
'add new shape to PPT document
Dim shape As IAutoShape = presentation.Slides(0).Shapes.AppendShape(ShapeType.Rectangle, New RectangleF(0, 50, 200, 50)
shape.ShapeStyle.LineColor.Color = Color.White
shape.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.None
'add text to shape
shape.AppendTextFrame("Hello World!")
'set the Font fill style of text
Dim textRange As TextRange = shape.TextFrame.TextRange
textRange.Fill.FillType = Spire.Presentation.Drawing.FillFormatType.Solid
textRange.Fill.SolidColor.Color = Color.Black
textRange.LatinFont = New TextFont("Arial Black")
'save the document
presentation.SaveToFile("hello.pptx", FileFormat.Pptx2010)
System.Diagnostics.Process.Start("hello.pptx")
7. In Solution Explorer, right-click the project HelloWorld and click Debug, then Start new instance, you will see the opened window Form1, click the button 'Run', a PPT document will be created, edited and opened. The string "Hello, World" is filled in the first page.
The following screenshot is result of the project ran:

C#/VB.NET: Convert PowerPoint to Images (PNG, JPG, TIFF, EMF, SVG)
2022-10-19 06:53:00 Written by AdministratorYou may need to convert PowerPoint documents to images for various purposes, such as preventing other users from editing the contents of the PowerPoint documents, generating thumbnails for the PowerPoint documents, or sharing the PowerPoint documents on social media. In this article, you will learn how to convert PowerPoint documents to various image formats in C# and VB.NET using Spire.Presentation for .NET.
- Convert PowerPoint Documents to JPG or PNG Images
- Convert PowerPoint Documents to TIFF Images
- Convert PowerPoint Documents to EMF Images
- Convert PowerPoint Documents to SVG Images
Install Spire.Presentation for .NET
To begin with, you need to add the DLL files included in the Spire.Presentation for.NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.Presentation
Convert PowerPoint Documents to JPG or PNG Images in C# and VB.NET
The following are the main steps to convert a PowerPoint document to JPG or PNG image:
- Initialize an instance of Presentation class.
- Load a PowerPoint document using Presentation.LoadFromFile() method.
- Iterate through all slides in the PowerPoint document.
- Save each slide as System.Drawing.Image object using ISlide.SaveAsImage() method.
- Save the image object to PNG or JPG file using Image.Save() method.
- C#
- VB.NET
using Spire.Presentation;
using System.Drawing;
namespace ConvertPowerPointToJpgOrPngImage
{
class Program
{
static void Main(string[] args)
{
//Create a Presentation instance
Presentation presentation = new Presentation();
//Load a PowerPoint document
presentation.LoadFromFile(@"Sample.pptx");
int i = 0;
//Iterate through all slides in the PowerPoint document
foreach(ISlide slide in presentation.Slides)
{
//Save each slide as PNG image
Image image = slide.SaveAsImage();
string fileName = string.Format("ToImage-img-{0}.png", i);
image.Save(fileName, System.Drawing.Imaging.ImageFormat.Png);
i++;
}
}
}
}

Convert PowerPoint Documents to TIFF Images in C# and VB.NET
The following are the steps to convert a PowerPoint document to TIFF image:
- Initialize an instance of Presentation class.
- Load a PowerPoint document using Presentation.LoadFromFile() method.
- Convert the PowerPoint document to TIFF image using Presentation.SaveToFile(string, FileFormat) method.
- C#
- VB.NET
using Spire.Presentation;
namespace ConvertPowerPointToTiffImage
{
class Program
{
static void Main(string[] args)
{
//Create a Presentation instance
Presentation presentation = new Presentation();
//Load a PowerPoint document
presentation.LoadFromFile(@"Sample.pptx");
//Convert the PowerPoint document to TIFF image
presentation.SaveToFile("toTIFF.tiff", FileFormat.Tiff);
}
}
}

Convert PowerPoint Documents to EMF Images in C# and VB.NET
The following are the steps to convert a PowerPoint document to EMF image:
- Initialize an instance of Presentation class.
- Load a PowerPoint document using Presentation.LoadFromFile() method.
- Iterate through all slides in the PowerPoint document.
- Save each slide to EMF image using ISlide.SaveAsEMF() method.
- C#
- VB.NET
using Spire.Presentation;
namespace ConvertPowerPointToEmfImage
{
class Program
{
static void Main(string[] args)
{
//Create a Presentation instance
Presentation presentation = new Presentation();
//Load a PowerPoint document
presentation.LoadFromFile(@"Sample.pptx");
int i = 0;
//Iterate through all slides in the PowerPoint document
foreach (ISlide slide in presentation.Slides)
{
string fileName = string.Format("ToEmf-{0}.emf", i);
//Save each slide to EMF image
slide.SaveAsEMF(fileName);
//Save each slide to EMF image with specified width and height
//slide.SaveAsEMF(fileName, 1075, 710);
i++;
}
}
}
}

Convert PowerPoint Documents to SVG Images in C# and VB.NET
The following are the steps to convert a PowerPoint document to SVG images:
- Initialize an instance of Presentation class.
- Load a PowerPoint document using Presentation.LoadFromFile() method.
- Convert the PowerPoint document to SVG and save the results into a queue of byte arrays using Presentation.SaveToSVG() method.
- Iterate through the byte arrays in the queue.
- At each iteration, remove and return the byte array at the beginning of the queue using Queue.Dequeue() method.
- Initialize an instance of FileStream class and save the byte array to an SVG file using FileStream.Write() method.
- C#
- VB.NET
using Spire.Presentation;
using System.Collections.Generic;
using System.IO;
namespace ConvertPowerPointToSvgImage
{
class Program
{
static void Main(string[] args)
{
//Create a Presentation instance
Presentation presentation = new Presentation();
//Load a PowerPoint document
presentation.LoadFromFile(@"Sample.pptx");
//Convert the PowerPoint document to SVG and save the results into a queue of byte arrays
Queue<byte[]> svgBytes = presentation.SaveToSVG();
int count = svgBytes.Count;
//Iterate through the byte arrays in the queue
for (int i = 0; i < count; i++)
{
//Remove and return the byte array at the beginning of the queue
byte[] bt = svgBytes.Dequeue();
//Specify the output file name
string fileName = string.Format("ToSVG-{0}.svg", i);
//Create a FileStream instance
FileStream fs = new FileStream(fileName, FileMode.Create);
//Save the byte array to a SVG file
fs.Write(bt, 0, bt.Length);
}
}
}
}

Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.
In this document, I will introduce you how to add Spire.PDFViewer controls to Toolbox for WPF application.
How To
Right-click on the blank part of the Toolbox - "Add Tab" - name the new Tab "Spire WPF Controls":

Right-click on the blank part below "Spire WPF Controls" - "Choose Items" - "WPF Components" - "Browse" to the "Bin" folder - find the file "Spire.PdfViewer.Wpf.dll" - "Open".

Click "OK". Then you have added controls to Toolbox successfully.
