alexa
Syncfusion
menu Syncfusion

MAUI

  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Search Results for

    Show / Hide Table of Contents

    Class MdImageNodeVisitedEventArgs

    Represents the event that occurs while importing Markdown file.

    Inheritance
    object
    EventArgs
    MdImageNodeVisitedEventArgs
    Inherited Members
    EventArgs.Empty
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Syncfusion.Office.Markdown
    Assembly: Syncfusion.Markdown.dll
    Syntax
    public class MdImageNodeVisitedEventArgs : EventArgs
    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);
    }
    '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

    Properties

    ImageStream

    Gets or sets the image stream.

    Declaration
    public Stream ImageStream { get; set; }
    Property Value
    Type
    Stream
    Remarks

    Setting this property during Markdown document saving does not affect the output. Use Uri to control how the image is referenced in the generated Markdown.

    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);
    }
    '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

    Uri

    Gets or sets the image URI.

    Declaration
    public string Uri { get; set; }
    Property Value
    Type
    string
    Remarks

    Setting this property while opening a Markdown document has no effect on the imported content.

    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);
    }
    '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
    In this article
    Back to top Generated by DocFX
    Copyright © 2001 - 2026 Syncfusion Inc. All Rights Reserved