Export in Windows Forms Syntax Editor

29 Apr 20214 minutes to read

The EditControl has the ability to export its content with associated syntax highlighting information to XML, HTML, and RTF file formats.

Export as XML file

Supports to export the content with syntax highlighting appearance into XML format by using the following function.

Function Description

SaveAsXML

Export the EditControl content into XML format and save it in any desired XML file.
// Export the EditControl contents into XML format and save it into a XML file.

this.editControl1.SaveAsXML("testXML.xml");
' Export the EditControl contents into XML format and save it into a XML file.

Me.editControl1.SaveAsXML("testXML.xml")

The EditControl is also capable of providing XML source code for generating documents in the corresponding formats by using the following function.

Function Description

GetTextAsXML

Gets the source code to generate XML document for the text in the EditControl.
// Gets the source code to generate XML document.

this.editControl1.GetTextAsXML();

// Gets the source code to generate XML document for the text range specified.

this.editControl1.GetTextAsXML(coordinatePoint1, coordinatePoint2);
' Gets the source code to generate XML document.

Me.editControl1.GetTextAsXML()

' Gets the source code to generate XML document for the text range specified.

Me.editControl1.GetTextAsXML(coordinatePoint1, coordinatePoint2)

Export as HTML file

Supports to export the content with syntax highlighting appearance into HTML format using the following function.

Function Description

SaveAsHTML

Export the EditControl content into HTML format and save it in any desired HTML file.
// Export the EditControl contents into HTML format and save it into a HTML file.

this.editControl1.SaveAsHTML("testHTML.html");
' Export the EditControl contents into HTML format and save it into a HTML file.

Me.editControl1.SaveAsHTML("testHTML.html")

The EditControl is also capable of providing HTML source code for generating documents in the corresponding formats by using the following function.

Function Description

GetTextAsHTML

Gets the source code to generate HTML document for the text in the EditControl.
// Gets the source code to generate HTML document.

this.editControl1.GetTextAsHTML();

// Gets the source code to generate HTML document for the text range specified.

this.editControl1.GetTextAsHTML(coordinatePoint1, coordinatePoint2);
' Gets the source code to generate HTML document.

Me.editControl1.GetTextAsHTML()

' Gets the source code to generate HTML document for the text range specified.

Me.editControl1.GetTextAsHTML(coordinatePoint1, coordinatePoint2)

Export as RTF file

Supports to export the content with syntax highlighting appearance into RTF format.

Function Description

SaveAsRTF

Export the EditControl content into RTF format and save it in any desired RTF file.
// Export the EditControl contents into RTF format and save it into a RTF file.

this.editControl1.SaveAsRTF("testRTF.rtf");
' Export the EditControl contents into RTF format and save it into a RTF file.

Me.editControl1.SaveAsRTF("testRTF.rtf")

The EditControl is also capable of providing RTF source code for generating documents in the corresponding formats by using the following function.

Function Description

GetTextAsRTF

Gets the source code to generate RTF document for the text in the EditControl.
// Gets the source code to generate RTF document.

this.editControl1.GetTextAsRTF();

// Gets the source code to generate RTF document for the text range specified.

this.editControl1.GetTextAsRTF(coordinatePoint1, coordinatePoint2);
' Gets the source code to generate RTF document.

Me.editControl1.GetTextAsRTF()

' Gets the source code to generate RTF document for the text range specified.

Me.editControl1.GetTextAsRTF(coordinatePoint1, coordinatePoint2)

NOTE

Refer to the following sample link that demonstrates the Export functionalities:
C:\Users\<User>\AppData\Local\Syncfusion\EssentialStudio\Version Number\Windows\Edit.Windows\Samples\Export

Bitmap generation

Support to save the EditControl as image by using the CreateBitmap function.

// Creates bitmap of the EditControl.

Bitmap bmp = this.editControl1.CreateBitmap();
' Creates bitmap of the EditControl.

Dim bmp as Bitmap = Me.editControl1.CreateBitmap()

Bitmap of syntax editor