Browse our Products
Aspose.Slides for .NET 23.7 Release Notes
Public API Changes
Markdown export
The presentation can now be exported in a new format: Markdown. The default export looks like this:
New member of the SaveFormat enum has been added: SaveFormat.Md.
using (Presentation pres = new Presentation("pres.pptx"))
{
pres.Save("pres.md", SaveFormat.Md);
}
In this case, the default settings will be used:
- the export type is MarkdownExportType.TextOnly, which means that only text will be exported (pictures and other things will be omitted).
- default markdown specification: Flavor.Default.
Different dialects of markdown exports are supported:
- GitLab
- Github
- CommonMark
- Trello
- XWiki
- StackOverflow …and many others.
A new MarkdownSaveOptions class has been added to allow configure options of the resulting Markdown document.
In order to save the markdown to Github flavor you can use this code:
using (Presentation pres = new Presentation("pres.pptx"))
{
pres.Save("pres.md", SaveFormat.Md, new MarkdownSaveOptions
{
Flavor = Flavor.Github
});
}
In addition, you can export a presentation with images to markdown. There are two variants of this export:
- Sequential: render all items separately, one by one.
- Visual: render all items, items that are grouped will be rendered together.
Example:
using (Presentation pres = new Presentation("pres.pptx"))
{
pres.Save("pres.md", SaveFormat.Md, new MarkdownSaveOptions
{
ExportType = MarkdownExportType.Visual
});
}
In this case, images will be saved to the current directory of the application (and a relative path will be built for them in the markdown document).
The path and folder name for saving can also be specified via options:
using (Presentation pres = new Presentation("pres.pptx"))
{
const string outPath = "c:\\documents";
pres.Save(Path.Combine(outPath, "pres.md"), SaveFormat.Md, new MarkdownSaveOptions
{
ExportType = MarkdownExportType.Visual,
ImagesSaveFolderName = "md-images",
BasePath = outPath
});
}
HTML5 embedded images
Added new properties for Html5Options:
- EmbedImages
- OutputPath
With them, when saving in Html5, you can save images externally and the HTML document will use relative references to them.
Example:
using (Presentation pres = new Presentation("pres.pptx"))
{
const string outPath = "c:\\documents";
Html5Options options = new Html5Options()
{
EmbedImages = false,
OutputPath = outPath
};
pres.Save(Path.Combine(outPath, "pres.html"), SaveFormat.Html5, options);
}