There are times when you need to create a PowerPoint document from a group of pre-created image files. As an example, you have been provided with some beautiful flyers by your company, and you need to combine them into a single PowerPoint document in order to display each picture in an orderly manner. In this article, you will learn how to convert image files (in any popular image format) to a PowerPoint document in C# and VB.NET using Spire.Presentation for .NET.

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 Image to Background in PowerPoint in C# and VB.NET

When images are converted as background of each slide in a PowerPoint document, they cannot be moved or scaled. The following are the steps to convert a set of images to a PowerPoint file as background images using Spire.Presentation for .NET.

  • Create a Presentation object.
  • Set the slide size type to Sreen16x9.
  • Get the image paths from a folder and save in a string array.
  • Traverse through the images.
  • Get a specific image and append it to the image collection of the document using Presentation.Images.Append() method.
  • Add a slide to the document using Presentation.Slides.Append() method.
  • Set the image as the background of the slide through the properties under ISlide.SlideBackground object.
  • Save the document to a PowerPoint file using Presentation.SaveToFile() method.
  • C#
  • VB.NET
using Spire.Presentation;
using Spire.Presentation.Drawing;
using System.Drawing;
using System.IO;

namespace ConvertImageToBackground
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a Presentation object
            Presentation presentation = new Presentation();

            //Set slide size type
            presentation.SlideSize.Type = SlideSizeType.Screen16x9;

            //Remove the default slide
            presentation.Slides.RemoveAt(0);

            //Get file paths in a string array
            string[] picFiles = Directory.GetFiles(@"C:\Users\Administrator\Desktop\Images");

            //Loop through the images 
            for (int i = 0; i < picFiles.Length; i++)
            {
                //Add a slide
                ISlide slide = presentation.Slides.Append();

                //Get a specific image 
                string imageFile = picFiles[i];
                Image image = Image.FromFile(imageFile);

                //Append it to the image collection 
                IImageData imageData = presentation.Images.Append(image);

                //Set the image as the background image of the slide
                slide.SlideBackground.Type = BackgroundType.Custom;
                slide.SlideBackground.Fill.FillType = FillFormatType.Picture;
                slide.SlideBackground.Fill.PictureFill.FillType = PictureFillType.Stretch;
                slide.SlideBackground.Fill.PictureFill.Picture.EmbedImage = imageData;
            }

            //Save to file
            presentation.SaveToFile("ImagesToBackground.pptx", FileFormat.Pptx2013);
        }
    }
}

C#/VB.NET: Convert Images (PNG, JPG, BMP, etc.) to PowerPoint

Convert Image to Shape in PowerPoint in C# and VB.NET

If you would like the images are moveable and resizable in the PowerPoint file, you can convert them as shapes. Below are the steps to convert images to shapes in a PowerPoint document using Spire.Presentation for .NET.

  • Create a Presentation object.
  • Set the slide size type to Sreen16x9.
  • Get the image paths from a folder and save in a string array.
  • Traverse through the images.
  • Get a specific image and append it to the image collection of the document using Presentation.Images.Append() method.
  • Add a slide to the document using Presentation.Slides.Append() method.
  • Add a shape with the size equal to the slide using ISlide.Shapes.AppendShape() method.
  • Fill the shape with the image through the properties under IAutoShape.Fill object.
  • Save the document to a PowerPoint file using Presentation.SaveToFile() method.
  • C#
  • VB.NET
using Spire.Presentation;
using Spire.Presentation.Drawing;
using System.Drawing;
using System.IO;

namespace ConvertImageToShape
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a Presentation object
            Presentation presentation = new Presentation();

            //Set slide size type
            presentation.SlideSize.Type = SlideSizeType.Screen16x9;

            //Remove the default slide
            presentation.Slides.RemoveAt(0);

            //Get file paths in a string array
            string[] picFiles = Directory.GetFiles(@"C:\Users\Administrator\Desktop\Images");

            //Loop through the images 
            for (int i = 0; i < picFiles.Length; i++)
            {
                //Add a slide
                ISlide slide = presentation.Slides.Append();

                //Get a specific image 
                string imageFile = picFiles[i];
                Image image = Image.FromFile(imageFile);

                //Append it to the image collection 
                IImageData imageData = presentation.Images.Append(image);

                //Add a shape with a size equal to the slide
                IAutoShape shape = slide.Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(new PointF(0, 0), presentation.SlideSize.Size));

                //Fill the shape with image
                shape.Line.FillType = FillFormatType.None;
                shape.Fill.FillType = FillFormatType.Picture;
                shape.Fill.PictureFill.FillType = PictureFillType.Stretch;
                shape.Fill.PictureFill.Picture.EmbedImage = imageData;
            }

            //Save to file
            presentation.SaveToFile("ImageToShape.pptx", FileFormat.Pptx2013);
        }
    }
}

C#/VB.NET: Convert Images (PNG, JPG, BMP, etc.) to PowerPoint

Convert Image to PowerPoint with Customized Slide Size in C# and VB.NET

If the aspect ratio of your images is not 16:9, or they are not in a standard slide size, you can create slides based on the actual size of the pictures. This will prevent the image from being over stretched or compressed. The following are the steps to convert images to a PowerPoint document with customized slide size using Spire.Presentation for .NET.

  • Create a Presentation object.
  • Create a PdfUnitConvertor object, which is used to convert pixel to point.
  • Get the image paths from a folder and save in a string array.
  • Traverse through the images.
  • Get a specific image and append it to the image collection of the document using Presentation.Images.Append() method.
  • Get the image width and height, and convert them to point.
  • Set the slide size of the presentation based on the image size through Presentation.SlideSize.Size property.
  • Add a slide to the document using Presentation.Slides.Append() method.
  • Set the image as the background image of the slide through the properties under ISlide.SlideBackground object.
  • Save the document to a PowerPoint file using Presentation.SaveToFile() method.
  • C#
  • VB.NET
using Spire.Pdf.Graphics;
using Spire.Presentation;
using Spire.Presentation.Drawing;
using System.Drawing;
using System.IO;

namespace CustomSlideSize
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a Presentation object
            Presentation presentation = new Presentation();

            //Remove the default slide
            presentation.Slides.RemoveAt(0);

            //Get file paths in a string array
            string[] picFiles = Directory.GetFiles(@"C:\Users\Administrator\Desktop\Images");

            //Create a PdfUnitConvertor object
            PdfUnitConvertor convertor = new PdfUnitConvertor();

            //Loop through the images 
            for (int i = 0; i < picFiles.Length; i++)
            {
                //Get a specific image 
                string imageFile = picFiles[i];
                Image image = Image.FromFile(imageFile);

                //Append it to the image collection 
                IImageData imageData = presentation.Images.Append(image);

                //Get image height and width in pixel
                int height = imageData.Height;   
                int width = imageData.Width;

                //Convert pixel to point
                float widthPoint = convertor.ConvertUnits(width, PdfGraphicsUnit.Pixel, PdfGraphicsUnit.Point);
                float heightPoint= convertor.ConvertUnits(height, PdfGraphicsUnit.Pixel, PdfGraphicsUnit.Point);

                //Set slide size
                presentation.SlideSize.Size = new SizeF(widthPoint, heightPoint);

                //Add a slide
                ISlide slide = presentation.Slides.Append();

                //Set the image as the background image of the slide
                slide.SlideBackground.Type = BackgroundType.Custom;
                slide.SlideBackground.Fill.FillType = FillFormatType.Picture;
                slide.SlideBackground.Fill.PictureFill.FillType = PictureFillType.Stretch;
                slide.SlideBackground.Fill.PictureFill.Picture.EmbedImage = imageData;
            }

            //Save to file
            presentation.SaveToFile("CustomizeSlideSize.pptx", FileFormat.Pptx2013);
        }
    }
}

C#/VB.NET: Convert Images (PNG, JPG, BMP, etc.) to PowerPoint

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.

Published in Conversion
Thursday, 28 July 2022 01:00

C#/VB.NET: Convert ODP to PDF

An ODP file is an OpenDocument Presentation file consisting of slides containing images, text, media, and transition effects. Since ODP files can only be opened by specified programs such as OpenOffice Impress, LibreOffice Impress, and Microsoft PowerPoint, if you want your ODP files to be viewable on more devices, you can convert them to PDF. In this article, you will learn how to programmatically convert a ODP file to PDF using Spire.Presentation for .NET.

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 OpenDocument Presentation to PDF

The detailed steps are as follows:

  • Create a Presentation instance.
  • Load an ODP file using Presentation.LoadFromFile() method.
  • Save the ODP file to PDF using Presentation.SaveToFile(String, FileFormat) method.
  • C#
  • VB.NET
using Spire.Presentation;

namespace ODPtoPDF
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a Presentation instance
            Presentation presentation = new Presentation();

            //Load an ODP file
            presentation.LoadFromFile("Sample.odp", FileFormat.ODP);

            //Convert the ODP file to PDF
            presentation.SaveToFile("OdptoPDF.pdf", FileFormat.PDF);

        }
    }
}

C#/VB.NET: Convert ODP to PDF

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.

Published in Conversion
Tuesday, 13 December 2022 09:27

C#/VB.NET: Convert PowerPoint to HTML

When you share a PowerPoint presentation online, people have to download it to their computers before they can view it. Sometimes the downloading process can be quite annoying and time-consuming, especially when the file is very large. A good solution to this problem is to convert your presentation to HTML so that people can view it directly online. In this article, we will demonstrate how to programmatically convert PowerPoint presentations to HTML format in C# and VB.NET using Spire.Presentation for .NET.

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 a PowerPoint Presentation to HTML in C# and VB.NET

In Spire.Presentation for .NET, the Presentation.SaveToFile(String, FileFormat) method is used to convert a PowerPoint presentation to other file formats such as PDF, XPS, and HTML. In the following steps, we will show you how to convert a PowerPoint presentation to HTML using Spire.Presentation for .NET:

  • Initialize an instance of the Presentation class.
  • Load a PowerPoint presentation using Presentation.LoadFromFile(String) method.
  • Save the PowerPoint presentation to HTML format using Presentation.SaveToFile(String, FileFormat) method.
  • C#
  • VB.NET
using Spire.Presentation;

namespace ConvertPowerPointToHtml
{
    class Program
    {
        static void Main(string[] args)
        {
            //Initialize an instance of the Presentation class
            Presentation ppt = new Presentation();
            //Load a PowerPoint presentation
            ppt.LoadFromFile(@"E:\Program Files\Sample.pptx");

            //Specify the file path of the output HTML file 
            String result = @"E:\Program Files\PowerPointToHtml.html";

            //Save the PowerPoint presentation to HTML format
            ppt.SaveToFile(result, FileFormat.Html);
        }
    }
}

C#/VB.NET: Convert PowerPoint to HTML

Convert a Specific PowerPoint Slide to HTML in C# and VB.NET

In some cases, you may need to convert a specific slide instead of the whole presentation to HTML. Spire.Presentation offers the ISlide.SaveToFile(String, FileFormat) method to convert a PowerPoint slide to HTML. The following are the detailed steps:

  • Initialize an instance of the Presentation class.
  • Load a PowerPoint presentation using Presentation.LoadFromFile() method.
  • Get a specific slide in the PowerPoint presentation by its index through Presentation.Slides[int] property.
  • Save the PowerPoint slide to HTML format using ISlide.SaveToFile(String, FileFormat) method.
  • C#
  • VB.NET
using Spire.Presentation;
using System;

namespace ConvertPowerPointSlideToHtml
{
    class Program
    {
        static void Main(string[] args)
        {
            //Initialize an instance of the Presentation class
            Presentation presentation = new Presentation();
            //Load the PowerPoint presentation
            presentation.LoadFromFile(@"E:\Program Files\Sample.pptx");

            //Get the first slide
            ISlide slide = presentation.Slides[0];

            //Specify the file path of the output HTML file 
            String result = @"E:\Program Files\SlideToHtml.html";

            //Save the first slide to HTML format
            slide.SaveToFile(result, FileFormat.Html);
        }
    }
}

C#/VB.NET: Convert PowerPoint to HTML

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.

Published in Conversion

SVG, short for scalable vector graphics, is a XML-based file format used to depict two-dimensional vector graphics. As SVG images are defined in XML text lines, they can be easily searched, indexed, scripted, and supported by most of the up to date web browsers. Therefore, office documents are often converted to SGV images for high fidelity viewing. Following sections will introduce how to convert PowerPoint documents to SVG images using Spire.Presentation in C# and VB.NET.

Code Snippet:

Step 1: Initialize an instance of Presentation class and load a sample PowerPoint document to it.

Presentation ppt = new Presentation();
ppt.LoadFromFile(@"C:\Users\Administrator\Desktop\sample.pptx");

Step 2: Convert PowerPoint document to byte array and store in a Queue object.

 Queue<Byte[]> svgBytes = ppt.SaveToSVG();

Step 3: Initialize an instance of the FileStream class with the specified file path and creation mode. Dequeue the data in the Queue object and write to the stream.

int len = svgBytes.Count;
for (int i = 0; i < len; i++)
{
    FileStream fs = new FileStream(string.Format("result" + "{0}.svg", i), FileMode.Create);
    byte[] bytes = svgBytes.Dequeue();
    fs.Write(bytes, 0, bytes.Length);
}

Output:

How to Convert PowerPoint Document to SVG Images in C#, VB.NET

Full Code:

[C#]
using Spire.Presentation;
using System;
using System.Collections.Generic;
using System.IO;
namespace PPTtoSVG
{
    class Program
    {
        static void Main(string[] args)
        {
            Presentation ppt = new Presentation();
            ppt.LoadFromFile(@"C:\Users\Administrator\Desktop\sample.pptx");
            Queue<byte[]> svgBytes = ppt.SaveToSVG();
            int len = svgBytes.Count;
            for (int i = 0; i < len; i++)
            {
                FileStream fs = new FileStream(string.Format("result" + "{0}.svg", i), FileMode.Create);
                byte[] bytes = svgBytes.Dequeue();
                fs.Write(bytes, 0, bytes.Length);
                ppt.Dispose();
            }
        }
    }
}
[VB.NET]
Imports Spire.Presentation
Imports System.Collections.Generic
Imports System.IO
Namespace PPTtoSVG
	Class Program
		Private Shared Sub Main(args As String())
			Dim ppt As New Presentation()
			ppt.LoadFromFile("C:\Users\Administrator\Desktop\sample.pptx")
			Dim svgBytes As Queue(Of [Byte]()) = ppt.SaveToSVG()
			Dim len As Integer = svgBytes.Count
			For i As Integer = 0 To len - 1
				Dim fs As New FileStream(String.Format("result" + "{0}.svg", i), FileMode.Create)
				Dim bytes As Byte() = svgBytes.Dequeue()
				fs.Write(bytes, 0, bytes.Length)
				ppt.Dispose()
			Next
		End Sub
	End Class
End Namespace
Published in Conversion

With the help of Spire.Presentation for .NET, we can easily save PowerPoint slides as image in C# and VB.NET. Sometimes, we need to use the resulted images for other purpose and the image size becomes very important. To ensure the image is easy and beautiful to use, we need to set the image with specified size beforehand. This example will demonstrate how to save a particular presentation slide as image with specified size by using Spire.Presentation for your .NET applications.

Note: Before Start, please download the latest version of Spire.Presentation and add Spire.Presentation.dll in the bin folder as the reference of Visual Studio.

Step 1: Create a presentation document and load the document from file.

Presentation presentation = new Presentation();
presentation.LoadFromFile("sample.pptx");

Step 2: Save the first slide to Image and set the image size to 600*400.

Image img = presentation.Slides[0].SaveAsImage(600, 400);

Step 3: Save image to file.

img.Save("result.png",System.Drawing.Imaging.ImageFormat.Png);

Effective screenshot of the resulted image with specified size:

Save a PowerPoint Slide as Image with Specified Size

Full codes:

using Spire.Presentation;
using System.Drawing;
namespace SavePowerPointSlideasImage
{
    class Program
    {
        static void Main(string[] args)
        {
            Presentation presentation = new Presentation();
            presentation.LoadFromFile("sample.pptx");

            Image img = presentation.Slides[0].SaveAsImage(600, 400);
            img.Save("result.png", System.Drawing.Imaging.ImageFormat.Png);
        }
    }
Published in Conversion

Spire.Presentation has powerful functions to export PowerPoint documents into different image file formats. In the previous articles, we have already shown you how to convert PowerPoint documents into TIFF, PNG and JPG. This article will demonstrate how to convert PowerPoint documents into EMF image. With Spire.Presentation for .NET, we can save presentation slides as an EMF image with the same size with the original slide's size and we can also set a specific size for the resulted EMF image.

Convert Presentation slides to EMF with the default size:

Step 1: Create a presentation document.

Presentation presentation = new Presentation();

Step 2: Load the PPTX file from disk.

presentation.LoadFromFile("Sample.pptx", FileFormat.Pptx2010);

Step 3: Save the presentation slide to EMF image by the method of SaveAsEMF().

presentation.Slides[2].SaveAsEMF("Result.emf");

Effective screenshot:

How to convert PowerPoint document to EMF image in C#

Convert Presentation slides to EMF with a specific size of 1075*710:

Step 1: Create a presentation document.

Presentation presentation = new Presentation();

Step 2: Load the PPTX file from disk.

presentation.LoadFromFile("sample.pptx");

Step 3: Save the presentation slide to EMF image with a specific size of 1075*710 by the method of SaveAsEMF(string filePath, int width, int height).

presentation.Slides[2].SaveAsEMF("Result2.emf", 1075, 710);

Effective screenshot:

How to convert PowerPoint document to EMF image in C#

Full codes:

using Spire.Presentation;
namespace PPStoEMF
{
    class Program
    {
        static void Main(string[] args)
        {
            Presentation presentation = new Presentation();
            presentation.LoadFromFile("Sample.pptx", FileFormat.Pptx2010);

            //presentation.Slides[2].SaveAsEMF("Result.emf");
            presentation.Slides[2].SaveAsEMF("Result2.emf", 1075, 710);
        }
    }
}
Published in Conversion

To use different versions of PowerPoint document easier, Spire.Presentation enables to convert PowerPoint Presentation 97 – 2003 to PowerPoint Presentation 2007, 2010. Spire.Presentation supports to convert PPT to PPTX, from version 2.2.17, now it starts to load .pps format document and save to .ppsx format document in C#. This article will show you how to convert PPS to PPTX in C#.

Step 1: Create a presentation document.

Presentation presentation = new Presentation();

Step 2: Load the PPS file from disk.

presentation.LoadFromFile("sample.pps");

Step 3: Save the PPS document to PPTX file format.

presentation.SaveToFile("ToPPTX.pptx", FileFormat.Pptx2010);

Step 4: Launch and view the resulted PPTX file.

System.Diagnostics.Process.Start("ToPPTX.pptx");

Full codes:

C#
using Spire.Presentation;
namespace PPStoPPTX
{
    class Program
    {
        static void Main(string[] args)
        {
            Presentation presentation = new Presentation();

            //load the PPS file from disk
            presentation.LoadFromFile("sample.pps");

            //save the PPS document to PPTX file format
            presentation.SaveToFile("ToPPTX.pptx", FileFormat.Pptx2010);
            System.Diagnostics.Process.Start("ToPPTX.pptx");
        }
    }
}
VB.NET
Imports Spire.Presentation
Namespace PPStoPPTX
	Class Program
		Private Shared Sub Main(args As String())
			Dim presentation As New Presentation()

			'load the PPS file from disk
			presentation.LoadFromFile("sample.pps")

			'save the PPS document to PPTX file format
			presentation.SaveToFile("ToPPTX.pptx", FileFormat.Pptx2010)
			System.Diagnostics.Process.Start("ToPPTX.pptx")
		End Sub
	End Class
End Namespace

The result PPTX document:

How to convert PPS document to PPTX in C#

Published in Conversion
Friday, 23 September 2022 01:06

C#/VB.NET: Convert PowerPoint to XPS

The XML Paper Specification (XPS) format is an electronic representation of digital documents based on XML. It is a paginated, fixed-layout format that enables the content and design details of a document to be maintained intact across computers. Sometimes you may need to convert a PowerPoint document to XPS for better printing or sharing, and this article will demonstrate how to accomplish this task programmatically using Spire.Presentation for .NET.

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 XPS

The detailed steps are as follows:

  • Create a Presentation instance.
  • Load a sample PowerPoint document using Presentation.LoadFromFile() method.
  • Save the PowerPoint document to XPS using Presentation.SaveToFile(String, FileFormat) method.
  • C#
  • VB.NET
using Spire.Presentation;

namespace PowerPointtoXPS
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a Presentation instance
            Presentation presentation = new Presentation();

            //Load a sample PowerPoint document
            presentation.LoadFromFile("test.pptx");

            //Save to XPS file
            presentation.SaveToFile("toXPS.xps", FileFormat.XPS);
        }
    }
}

C#/VB.NET: Convert PowerPoint to XPS

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.

Published in Conversion

Conversion from PowerPoint to TIFF may be useful in order to fax the presentation files or send them off for printing. Spire.Presentation provides straightforward method SaveToFile to do the conversion, which automatically detects presentation slides and convert them to TIFF image (one image per slide).

Step 1: Create an instance of Presentation class.

Presentation ppt = new Presentation();

Step 2: Load a PowerPoint file.

ppt.LoadFromFile("template.pptx");

Step 3: Save to TIFF format file.

ppt.SaveToFile("toTIFF.tiff", FileFormat.Tiff);

Output:

How to Convert PowerPoint Document to TIFF Image in C#, VB.NET

Full Code:

[C#]
using Spire.Presentation;
namespace PPTtoTIFF
{
    class Program
    {
        static void Main(string[] args)
        {
            Presentation ppt = new Presentation();
            ppt.LoadFromFile("template.pptx");
            ppt.SaveToFile("toTIFF.tiff", FileFormat.Tiff);
        }
    }
}
[VB.NET]
Imports Spire.Presentation
Namespace PPTtoTIFF
	Class Program
		Private Shared Sub Main(args As String())
			Dim ppt As New Presentation()
			ppt.LoadFromFile("template.pptx")
			ppt.SaveToFile("toTIFF.tiff", FileFormat.Tiff)
		End Sub
	End Class
End Namespace
Published in Conversion
Tuesday, 29 April 2014 06:31

How to convert PowerPoint to PPTX in C#?

PPT is the file format used by Microsoft PowerPoint Presentation 97 - 2003, while PPTX is created by PowerPoint Presentation 2007, 2010. PPTX file format enjoys the advantages of smaller size, higher security, and higher integration with other file formats. But the Microsoft Office version under 2007 cannot open PPTX PowerPoint presentation directly. This article will show you how to convert PPT file format to PPTX in C# with only three lines of code.

Make sure Spire.Presentation for .NET has been installed correctly and then add Spire.Presentation.dll as reference in the downloaded Bin folder though the below path: "..\Spire.Presentation\Bin\NET4.0\ Spire. Presentation.dll". Here comes to the details of how to output PPT to PPTX:

Step 1: Create a presentation document.

Presentation presentation = new Presentation();

Step 2: Load the PPT file from disk.

presentation.LoadFromFile(@"..\..\..\..\..\..\Data\sample4.ppt");

Step 3: Save the PPT document to PPTX file format.

presentation.SaveToFile("ToPPTX.pptx", FileFormat.Pptx2010);

Step4: Launch and view the resulted PPTX file.

System.Diagnostics.Process.Start("ToPPTX.pptx");

Full codes:

namespace Spire.Presentation.Demo
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void btnRun_Click(object sender, EventArgs e)
        {
            //create PPT document
            Presentation presentation = new Presentation();

            //load the PPT file from disk
            presentation.LoadFromFile(@"..\..\..\..\..\..\Data\sample4.ppt");

            //save the PPT document to PPTX file format
            presentation.SaveToFile("ToPPTX.pptx", FileFormat.Pptx2010);
            System.Diagnostics.Process.Start("ToPPTX.pptx");
        }
    }
}

Target screenshot:

Convert PPT to PPTX

 

Published in Conversion
Page 1 of 2