XAML (eXtensible Application Markup Language) is an XML-based descriptive language that is used to design graphical user interfaces. Especially, XAML is used in WPF (Windows Presentation Foundation), UWP (Universal Windows Platform), and Xamarin Forms. In this article, you will learn how to convert the slides in a PowerPoint presentation to the XAML interfaces programmatically. Particularly, the article will cover PowerPoint PPTX to XAML conversion using C#.
- API for PPTX to XAML Conversion
- Convert PowerPoint PPTX to XAML
- PowerPoint to XAML with Custom Options
C# API for PowerPoint to XAML Conversion
In order to convert a PowerPoint presentation to XAML, we will use Aspose.Slides for .NET. It is a presentation manipulation API that lets you create, modify or convert PowerPoint presentations. You can either download the API or install it using NuGet.
PM> Install-Package Aspose.Slides.NET
Convert PowerPoint PPTX to XAML in C#
The following are the steps to convert slides in a PowerPoint presentation to XAML in C#.
- First, load the PowerPoint presentation using Presentation class.
- Convert presentation to XAML files using Presentation.Save(new XamlOptions()) method.
The following code sample shows how to convert a PowerPoint PPTX to XAML.
The following is the screenshot of the files we get after performing PPTX to XAML conversion.
PowerPoint to XAML with Custom Options
You can also customize the PowerPoint to XAML conversion by setting different options. For example, you can define whether to convert hidden slides or not. The following are the steps to convert PowerPoint presentations to XAML with custom options.
- First, load the PowerPoint presentation using Presentation class.
- Create an instance of XamlOptions class and set XamlOptions.ExportHiddenSlides to true.
- Convert presentation to XAML files using Presentation.Save(XamlOptions) method.
The following code sample shows how to customize PowerPoint to XAML conversion in C#.
Get a Free API License
You can use Aspose.Slides for .NET without evaluation limitations by requesting a temporary license.
Conclusion
In this article, you have learned how to convert PowerPoint PPT or PPTX presentations to XAML using C#. You can simply install the API and integrate the provided code in your .NET applications. In addition, you can visit the documentation to explore other features of Aspose.Slides for .NET. Also, you can feel free to let us know about your queries via our forum.