$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
RichTextBox Control for WinForms
Edit rich text content with text formatting options, mail-merge, table, and floating objects, etc.
Home > WinForms UI Controls > User Manual > Set Import and Export in RichTextBox in C#

C# Customize Content Import and Export in RichTextBox

KetticRichTextBox .NET component supports not only import and export the content of KetticRichTextBox, but customization of the import or export itself. This feature allows the users to customize the presentation of the same content of KetticRichTextBox in various document formats. To set the export and import, we can use the customization options included in the document format providers in the C# classes of KetticRichTextBox.

Customizing Import/Export of KetticRichTextBox

There are two document format providers available, the HtmlFormatProvider and the PdfFormatProvider. To customize the import and export, we should create an instance of the settings and assign the instance to the property of the format provider that will be applied. And then we are able to customize or retrieve the properties that we need.

Settings of HtmlFormatProvider

To set the HTML documents import and export, we should use the settings in the HtmlFormatProvider. There are the HtmlExportSettings and the HtmlImportSettings available for the users to customize the HTML import and export using KetticRichTextBox.
HtmlExportSettings contains a few options for the users to customize the HTML format export by using the KetticRichTextBox, such as,
  • DocumentExportLevel, this option contains the Document and Fragment values. The Document allows the users export the content to an HTML document through the html tags, like the ‹html›, ‹title›, ‹head› and ‹body›. However, the Fragment only export the content to ‹body› tag only
  • StylesExportMode, this mode contains the Inline and Classes values. The predefined C# classes customize the styles in advance and the Inline mode will allows the users to customize the exported HTML document.
  • ImageExportMode, this mode has a few different options and also allows the users specify custom implementation through the ImageExportingEvent option. For example, we can assign this mode to UriSource option to set the src property to the URL instead of exporting raw data to the document.
HtmlImportSettings contains two options for the users to customize the HTML format import by using the KetticRichTextBox, including,
  • FontPropertiesOfDefaultStylesheet, this setting is a Boolean property and is used to determine if the default font settings in the HTML will be applied to the elements whose font settings are not explicit.
  • LoadImageFromUrl event, this event is able to load images from URLs when the HtmlFormatProvider fails to load images

Settings of PdfFormatProvider

To set the export to PDF documents, we shall apply the settings in the PdfFormatProvider. The PdfExportSettings included in the provider can be used to customize the PDF export. The following are the options of PdfExportSettings.
  • ContentsCompressMode, this mode determines whether we compress the text content when exporting to the PDF document. The valid values include Deflate, Automatic, and None.
  • ContentsDeflaterCompressLevel, this property determines the level of the content that will be compressed. The valid value ranges from -1 to 9.
  • ImagesCompressMode, this mode determines if we depress the images when exporting content to PDF document. The Valid values include None, Jpeg, and Automatic.
  • ImagesDeflaterCompressLevel, this property is similar with the ContentsDeflaterCompressLevel, whereas it is applied to the image in the document and respected as an image is compressed with Deflate.
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls