Class HtmlImportExportSettings
Represents the HtmlImportExportSettings class.
Inheritance
Namespace: Syncfusion.Windows.Controls.RichTextBoxAdv
Assembly: Syncfusion.SfRichTextBoxAdv.WPF.dll
Syntax
public class HtmlImportExportSettings : DependencyObject
Constructors
HtmlImportExportSettings()
Declaration
public HtmlImportExportSettings()
Fields
ExportCssTypeProperty
Identifies the ExportCssType dependency property.
Declaration
public static readonly DependencyProperty ExportCssTypeProperty
Field Value
| Type | Description |
|---|---|
| System.Windows.DependencyProperty | The identifier for the ExportCssType dependency property. |
FontFamilyProperty
Identifies the FontFamily dependency property.
Declaration
public static readonly DependencyProperty FontFamilyProperty
Field Value
| Type | Description |
|---|---|
| System.Windows.DependencyProperty | The identifier for the FontFamily dependency property. |
IsOverwriteFontFamilyProperty
Identifies the IsOverwriteFontFamily dependency property.
Declaration
public static readonly DependencyProperty IsOverwriteFontFamilyProperty
Field Value
| Type | Description |
|---|---|
| System.Windows.DependencyProperty | The identifier for the IsOverwriteFontFamily dependency property. |
Properties
ExportCssType
Gets or sets a value indicating the CSS style sheet type in the exported HTML.
Declaration
public CssType ExportCssType { get; set; }
Property Value
| Type | Description |
|---|---|
| CssType | The CssType that specifies the CSS style sheet type in the exported HTML. The default value is Syncfusion.Windows.Controls.RichTextBoxAdv.CssType.Internal. |
Remarks
This property is effected only for Html exporting.
Examples
The following code example demonstrates how to define Html import and export settings for a SfRichTextBoxAdv control.
<RichTextBoxAdv:SfRichTextBoxAdv x:Name="richTextBoxAdv" LayoutType="Pages">
<RichTextBoxAdv:SfRichTextBoxAdv.HtmlImportExportSettings>
<!-- Writes style attributes as inline CSS. -->
<RichTextBoxAdv:HtmlImportExportSettings ExportCssType="Inline" />
</RichTextBoxAdv:SfRichTextBoxAdv.HtmlImportExportSettings>
</RichTextBoxAdv:SfRichTextBoxAdv>
// Defines the control.
SfRichTextBoxAdv richTextBoxAdv = new SfRichTextBoxAdv();
//Defines the html import and export settings.
HtmlImportExportSettings htmlImportExportSettings = new HtmlImportExportSettings();
htmlImportExportSettings.ExportCssType = CssType.Inline;
// Writes style attributes as inline CSS in exported Html.
richTextBoxAdv.HtmlImportExportSettings = htmlImportExportSettings;
' Defines the control.
Dim richTextBoxAdv As New SfRichTextBoxAdv()
' Defines the html import and export settings.
Dim htmlImportExportSettings As New HtmlImportExportSettings()
htmlImportExportSettings.ExportCssType = CssType.Inline
' Writes style attributes as inline CSS in exported Html.
richTextBoxAdv.HtmlImportExportSettings = htmlImportExportSettings
FontFamily
Gets or sets the font-family name to be overwritten/replaced for all elements in the exported HTML.
Declaration
public string FontFamily { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The string that specifies the font-family name to be overwritten/replaced for all elements in the exported HTML. |
Remarks
This property is effected only when IsOverwriteFontFamily property is set to true.
Examples
The following code example demonstrates how to define Html import and export settings for a SfRichTextBoxAdv control.
<RichTextBoxAdv:SfRichTextBoxAdv x:Name="richTextBoxAdv" LayoutType="Pages">
<RichTextBoxAdv:SfRichTextBoxAdv.HtmlImportExportSettings>
<!-- Writes arial font family style for all elements in exported Html. -->
<RichTextBoxAdv:HtmlImportExportSettings IsOverwriteFontFamily="True" FontFamily="Arial" />
</RichTextBoxAdv:SfRichTextBoxAdv.HtmlImportExportSettings>
</RichTextBoxAdv:SfRichTextBoxAdv>
// Defines the control.
SfRichTextBoxAdv richTextBoxAdv = new SfRichTextBoxAdv();
//Defines the html import and export settings.
HtmlImportExportSettings htmlImportExportSettings = new HtmlImportExportSettings();
htmlImportExportSettings.IsOverwriteFontFamily = true;
htmlImportExportSettings.FontFamily = "Arial";
// Writes arial font family style for all elements in exported Html.
richTextBoxAdv.HtmlImportExportSettings = htmlImportExportSettings;
' Defines the control.
Dim richTextBoxAdv As New SfRichTextBoxAdv()
' Defines the html import and export settings.
Dim htmlImportExportSettings As New HtmlImportExportSettings()
htmlImportExportSettings.IsOverwriteFontFamily = True
htmlImportExportSettings.FontFamily = "Arial"
' Writes arial font family style for all elements in exported Html.
richTextBoxAdv.HtmlImportExportSettings = htmlImportExportSettings
IsOverwriteFontFamily
Gets or sets a value indicating whether the font-family name to be overwritten/replaced for all elements in the exported HTML.
Declaration
public bool IsOverwriteFontFamily { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | True if the font-family name to be overwritten/replaced for all elements in the exported HTML; otherwise false. The default is false. |
Examples
The following code example demonstrates how to define Html import and export settings for a SfRichTextBoxAdv control.
<RichTextBoxAdv:SfRichTextBoxAdv x:Name="richTextBoxAdv" LayoutType="Pages">
<RichTextBoxAdv:SfRichTextBoxAdv.HtmlImportExportSettings>
<!-- Ignores font family style in exported Html. -->
<RichTextBoxAdv:HtmlImportExportSettings IsOverwriteFontFamily="True" />
</RichTextBoxAdv:SfRichTextBoxAdv.HtmlImportExportSettings>
</RichTextBoxAdv:SfRichTextBoxAdv>
// Defines the control.
SfRichTextBoxAdv richTextBoxAdv = new SfRichTextBoxAdv();
// Defines the html import and export settings.
HtmlImportExportSettings htmlImportExportSettings = new HtmlImportExportSettings();
htmlImportExportSettings.IsOverwriteFontFamily = true;
// Ignores font family style in exported Html.
richTextBoxAdv.HtmlImportExportSettings = htmlImportExportSettings;
' Defines the control.
Dim richTextBoxAdv As New SfRichTextBoxAdv()
' Defines the html import and export settings.
Dim htmlImportExportSettings As New HtmlImportExportSettings()
htmlImportExportSettings.IsOverwriteFontFamily = True
' Ignores font family style in exported Html.
richTextBoxAdv.HtmlImportExportSettings = htmlImportExportSettings
Events
ImageNodeVisited
Occurs when image node is visited on exporting the content of SfRichTextBoxAdv as Html.
Declaration
public event HtmlImportExportSettings.ImageNodeVisitedEventHandler ImageNodeVisited
Event Type
| Type |
|---|
| HtmlImportExportSettings.ImageNodeVisitedEventHandler |
Remarks
This event will be triggered when an image node is visited on Html export operation.
Examples
The following code example demonstrates how to export the image into external folder and refer the path in the html file.
<RichTextBoxAdv:SfRichTextBoxAdv x:Name="richTextBoxAdv" LayoutType="Pages">
<RichTextBoxAdv:SfRichTextBoxAdv.HtmlImportExportSettings>
<!-- Defines page loading settings -->
<RichTextBoxAdv:HtmlImportExportSettings ImageNodeVisited="HTMLImportExportSettings_ImageNodeVisited" />
</RichTextBoxAdv:SfRichTextBoxAdv.HtmlImportExportSettings>
</RichTextBoxAdv:SfRichTextBoxAdv>
private void HTMLImportExportSettings_ImageNodeVisited(object sender, ImageNodeVisitedEventArgs args)
{
if (args != null && args.IsSaving)
{
if (args.Stream != null)
{
// Create a file stream.
FileStream stream = new FileStream("Image-1.png", FileMode.Create, FileAccess.ReadWrite);
// Save the image stream to new image file.
args.Stream.CopyTo(stream);
// Set the new image file path as source.This source path will be referred in html file.
args.Source = stream.Name;
// Dispose stream.
stream.Dispose();
}
}
}
Private Sub HTMLImportExportSettings_ImageNodeVisited(sender As Object, args As ImageNodeVisitedEventArgs)
If args IsNot Nothing AndAlso args.IsSaving Then
If args.Stream IsNot Nothing Then
'Create a file stream.
Dim stream As New FileStream("Image-1.png", FileMode.Create, FileAccess.ReadWrite)
'Save the image stream to new image file.
args.Stream.CopyTo(stream)
'Set the new image file path as source. This source path will be referred in html file.
args.Source = stream.Name
'Dispose stream.
stream.Dispose()
End If
End If
End Sub