MdImportSettings Class
Represents the import Settings while importing markdown document.
Inheritance
Namespace: Syncfusion.Office.Markdown
Assembly: Syncfusion.Markdown.dll
Syntax
public class MdImportSettings : Object
Examples
The following code example demonstrates how to invoke the MdImageNodeVisited event of MarkdownImportSettings class to set the image while importing Markdown file.
//Creates a new instance of WordDocument
using(WordDocument document = new WordDocument())
{
//Hooks the ImageNodeVisited event to open the image from a specific location
document.MdImportSettings.ImageNodeVisited += OpenImage;
//Opens the input Markdown document
document.Open("Input.md", FormatType.Markdown);
//Unhooks the ImageNodeVisited event after loading Markdown
document.MdImportSettings.ImageNodeVisited -= OpenImage;
//Saves the Word document
document.Save("MdtoWord.docx", FormatType.Docx);
//Closes the WordDocument instance
document.Close();
}
private void OpenImage(object sender, Syncfusion.Office.Markdown.MdImageNodeVisitedEventArgs args)
{
//Read the image from the specified (args.Uri) path
args.ImageStream = System.IO.File.OpenRead(args.Uri);
}</code></pre>
'Creates a new instance of WordDocument
Using Dim document As WordDocument = New WordDocument()
'Opens the input Markdown document
document.Open("Input.md", FormatType.Markdown)
'Hooks the ImageNodeVisited event to open the image from a specific location
AddHandler document.MdImportSettings.ImageNodeVisited , AddressOf OpenImage
'Save the Word document
document.Save("MdtoWord.docx", FormatType.Docx)
'Unhooks the ImageNodeVisited event after loading Markdown
RemoveHandler document.MdImportSettings.ImageNodeVisited , AddressOf OpenImage
'Closes the WordDocument instance
document.Close()
End Using
Private Sub OpenImage(sender As Object, args As Syncfusion.Office.Markdown.MdImageNodeVisitedEventArgs)
'Read the image from the specified (args.Uri) path
args.ImageStream = System.IO.File.OpenRead(args.Uri)
End Sub
Constructors
MdImportSettings()
Declaration
public MdImportSettings()
Properties
Encoding
Gets or sets the text encoding to use when importing Markdown documents. Default value is Encoding.UTF8.
Declaration
public Encoding Encoding { get; set; }
Property Value
| Type |
|---|
| System.Text.Encoding |
UseThematicBreakAsContentBreak
Gets or sets a value indicating whether thematic breaks should be treated as content breaks.
When set to true, each thematic break is considered a boundary that splits the content into separate slides.
Declaration
public bool UseThematicBreakAsContentBreak { get; set; }
Property Value
| Type |
|---|
| System.Boolean |
Remarks
This property is used to split PPTX slides and excel sheets based on thematic breaks.
Methods
add_ImageNodeVisited(MdImageNodeVisitedEventHandler)
Declaration
public void add_ImageNodeVisited(MdImageNodeVisitedEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| MdImageNodeVisitedEventHandler | value |
remove_ImageNodeVisited(MdImageNodeVisitedEventHandler)
Declaration
public void remove_ImageNodeVisited(MdImageNodeVisitedEventHandler value)
Parameters
| Type | Name | Description |
|---|---|---|
| MdImageNodeVisitedEventHandler | value |
Events
ImageNodeVisited
Occurs during Markdown import when an image node is encountered in the Markdown file.
Declaration
public event MdImageNodeVisitedEventHandler ImageNodeVisited
Event Type
| Type |
|---|
| MdImageNodeVisitedEventHandler |
Examples
The following code example demonstrates how to invoke the MdImageNodeVisited event of MarkdownImportSettings class to set the image while importing Markdown file.
//Creates a new instance of WordDocument
using(WordDocument document = new WordDocument())
{
//Hooks the ImageNodeVisited event to open the image from a specific location
document.MdImportSettings.ImageNodeVisited += OpenImage;
//Opens the input Markdown document
document.Open("Input.md", FormatType.Markdown);
//Unhooks the ImageNodeVisited event after loading Markdown
document.MdImportSettings.ImageNodeVisited -= OpenImage;
//Saves the Word document
document.Save("MdtoWord.docx", FormatType.Docx);
//Closes the WordDocument instance
document.Close();
}
private void OpenImage(object sender, Syncfusion.Office.Markdown.MdImageNodeVisitedEventArgs args)
{
//Read the image from the specified (args.Uri) path
args.ImageStream = System.IO.File.OpenRead(args.Uri);
}</code></pre>
'Creates a new instance of WordDocument
Using Dim document As WordDocument = New WordDocument()
'Opens the input Markdown document
document.Open("Input.md", FormatType.Markdown)
'Hooks the ImageNodeVisited event to open the image from a specific location
AddHandler document.MdImportSettings.ImageNodeVisited , AddressOf OpenImage
'Save the Word document
document.Save("MdtoWord.docx", FormatType.Docx)
'Unhooks the ImageNodeVisited event after loading Markdown
RemoveHandler document.MdImportSettings.ImageNodeVisited , AddressOf OpenImage
'Closes the WordDocument instance
document.Close()
End Using
Private Sub OpenImage(sender As Object, args As Syncfusion.Office.Markdown.MdImageNodeVisitedEventArgs)
'Read the image from the specified (args.Uri) path
args.ImageStream = System.IO.File.OpenRead(args.Uri)
End Sub