Skip to content

Instantly share code, notes, and snippets.

@aspose-com-kb
Last active September 3, 2023 04:52
How to Convert PPTX to Markdown using C#. For more details: https://kb.aspose.com/slides/net/how-to-convert-pptx-to-markdown-using-csharp/
using System;
using Aspose.Slides;
using Aspose.Slides.Export;
namespace TestSlides
{
public class PresentationToMd
{
public static void ConvertToMD()
{
String path = @"/KnowledgeBase/TestData/";
// Setting the license for the product to convert a presentation to MD
License SlideToMdLicense = new License();
SlideToMdLicense.SetLicense(path + "Conholdate.Total.Product.Family.lic");
// Load the source presentation file to convert to MD file
using (Presentation presToMd = new Presentation(path + "Source.pptx"))
{
MarkdownSaveOptions markdownSaveOptions = new MarkdownSaveOptions
{
ShowHiddenSlides = true,
ShowSlideNumber = true,
Flavor = Flavor.Github,
ExportType = MarkdownExportType.Sequential,
NewLineType = NewLineType.Windows
};
// Save the slides 1 to 3 as MD on the disk
presToMd.Save("Exported.md", new[] { 1, 2, 3}, SaveFormat.Md, markdownSaveOptions);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment