You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
T> You can also save the markdown file as [HTML](https://help.syncfusion.com/document-processing/word/word-library/net/html), [PDF](https://help.syncfusion.com/document-processing/word/conversions/word-to-pdf/net/word-to-pdf), [Image](https://help.syncfusion.com/document-processing/word/conversions/word-to-image/net/word-to-image), and [Word](https://help.syncfusion.com/document-processing/word/conversions/markdown-to-word-conversion)
67
60
68
-
N> 1. In Markdown to PowerPoint Presentation conversion, invalid images are replaced with a red "X" image instead of the original image.
61
+
N> 1. Hook the event handler before opening a PowerPoint presentation as per the below code example.
62
+
N> 2. In Markdown to PowerPoint Presentation conversion, invalid images are replaced with a red "X" image instead of the original image.
63
+
64
+
## Load Options
65
+
66
+
When opening an existing Markdown document, the .NET PowerPoint library provides custom import settings through the **LoadOptions** class. This allows you to customize how the Markdown content is parsed and imported into a PowerPoint Presentation.
67
+
68
+
### Customize image data
69
+
70
+
The .NET PowerPoint library provides an `ImageNodeVisited` event, which customizes image data while importing a Markdown file. Implement the logic to customize the image data by using this `ImageNodeVisited` event.
71
+
72
+
The following code example shows how to load image data based on the image source path when importing the Markdown files.
73
+
74
+
{% tabs %}
75
+
76
+
{% highlight c# tabtitle="C# [Cross-platform]" %}
77
+
// Create load options.
78
+
LoadOptions loadOptions = new LoadOptions();
79
+
// Specify the format type as Markdown.
80
+
loadOptions.FormatType = FormatType.Markdown;
81
+
// Initialize Markdown import settings for the LoadOptions instance.
82
+
loadOptions.MdImportSettings = new Syncfusion.Office.Markdown.MdImportSettings();
83
+
// Hook the event to customize the image while importing Markdown document.
Private Shared Sub MdImportSettings_ImageNodeVisited(ByVal sender As Object, ByVal args As Syncfusion.Office.Markdown.MdImageNodeVisitedEventArgs)
176
+
'Set the image stream based on the image name from the input Markdown.
177
+
If args.Uri Is "Image_1.png" Then
178
+
args.ImageStream = New FileStream("Image_1.png", FileMode.Open)
179
+
ElseIf args.Uri Is "Image_2.png" Then
180
+
args.ImageStream = New FileStream("Image_2.png", FileMode.Open)
181
+
'Retrieve the image from the website and use it.
182
+
ElseIf args.Uri.StartsWith("https://") Then
183
+
Dim client As WebClient = New WebClient()
184
+
'Download the image as a stream.
185
+
Dim image As Byte() = client.DownloadData(args.Uri)
186
+
Dim stream As Stream = New MemoryStream(image)
187
+
'Set the retrieved image from the input Markdown.
188
+
args.ImageStream = stream
189
+
End If
190
+
End Sub
191
+
{% endhighlight %}
192
+
193
+
{% endtabs %}
194
+
195
+
N> Hook the event handler before opening a PowerPoint Presentation as per the above code example.
196
+
197
+
### Encoding
198
+
199
+
The .NET PowerPoint library provides an `Encoding` property to specify the character encoding to use when opening a Markdown file. This property is useful when you need to open Markdown files that are saved with specific character encodings such as UTF-8, UTF-16, ASCII, or other encodings.
200
+
201
+
The following code example shows how to open a Markdown file with a specific encoding.
202
+
203
+
{% tabs %}
204
+
205
+
{% highlight c# tabtitle="C# [Cross-platform]" %}
206
+
// Create load options.
207
+
LoadOptions loadOptions = new LoadOptions();
208
+
// Specify the format type as Markdown.
209
+
loadOptions.FormatType = FormatType.Markdown;
210
+
// Initialize Markdown import settings for the LoadOptions instance.
211
+
loadOptions.MdImportSettings = new Syncfusion.Office.Markdown.MdImportSettings();
Using presentation As IPresentation = Presentation.Open("Input.md", loadOptions)
250
+
'Save as a PowerPoint document.
251
+
presentation.Save("MarkdownToPPTX.pptx")
252
+
End Using
253
+
{% endhighlight %}
254
+
255
+
{% endtabs %}
256
+
257
+
N> Provide the encoding values before opening a PowerPoint Presentation as per the above code example.
258
+
259
+
### Use Thematic Break As ContentBreak
260
+
261
+
The .NET PowerPoint library provides a `UseThematicBreakAsContentBreak` property to control how thematic breaks (horizontal lines) in Markdown are handled during conversion. When set to `true`, each thematic break is treated as a content boundary that splits the Markdown content into separate slides in the PowerPoint Presentation.
262
+
263
+
The following code example shows how to use thematic breaks to split content into multiple slides.
264
+
265
+
{% tabs %}
266
+
267
+
{% highlight c# tabtitle="C# [Cross-platform]" %}
268
+
// Create load options.
269
+
LoadOptions loadOptions = new LoadOptions();
270
+
// Specify the format type as Markdown.
271
+
loadOptions.FormatType = FormatType.Markdown;
272
+
// Initialize Markdown import settings for the LoadOptions instance.
273
+
loadOptions.MdImportSettings = new Syncfusion.Office.Markdown.MdImportSettings();
274
+
// Set UseThematicBreakAsContentBreak to split slides based on thematic breaks.
0 commit comments