Back to Devexpress

HtmlDocumentExporterOptions.CssPropertiesExportType Property

officefileapi-devexpress-dot-xtrarichedit-dot-export-dot-htmldocumentexporteroptions-edb462ec.md

latest8.1 KB
Original Source

HtmlDocumentExporterOptions.CssPropertiesExportType Property

Gets or sets how the style sheets properties are exported.

Namespace : DevExpress.XtraRichEdit.Export

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
public CssPropertiesExportType CssPropertiesExportType { get; set; }
vb
Public Property CssPropertiesExportType As CssPropertiesExportType

Property Value

TypeDescription
CssPropertiesExportType

A CssPropertiesExportType enumeration value specifying the export type.

|

Available values:

NameDescription
ExportToCurrentFile

Obsolete. Saves style sheets incorporated in the main document.

| | ExportToSeparateFile |

Obsolete. Saves style sheets in a separate CSS file.

| | Style |

CSS is included in a <STYLE> tag.

| | Link |

CSS is included as a link to an external CSS-file.

| | Inline |

CSS is embedded by placing it as an attribute to an HTML tag.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to CssPropertiesExportType
RichEditDocumentExportOptions

.Html .CssPropertiesExportType

|

Remarks

Handle the RichEditControl.BeforeExport or RichEditDocumentServer.BeforeExport event and specify the css export type - that is, the location of stylesheets - via the BeforeExportEventArgs.Options property of the event arguments.

The following code snippet illustrates this:

View Example

csharp
private void richEditControl_BeforeExport(object sender, DevExpress.XtraRichEdit.BeforeExportEventArgs e) {
    DevExpress.XtraRichEdit.Export.HtmlDocumentExporterOptions options = e.Options as DevExpress.XtraRichEdit.Export.HtmlDocumentExporterOptions;
    if (options != null) 
{
        options.CssPropertiesExportType = DevExpress.XtraRichEdit.Export.Html.CssPropertiesExportType.Link;
        options.HtmlNumberingListExportFormat = DevExpress.XtraRichEdit.Export.Html.HtmlNumberingListExportFormat.HtmlFormat;
        options.TargetUri = Path.GetFileNameWithoutExtension(this.fileName);
    }
}
vb
Private Sub richEditControl_BeforeExport(ByVal sender As Object, ByVal e As DevExpress.XtraRichEdit.BeforeExportEventArgs)
    Dim options As DevExpress.XtraRichEdit.Export.HtmlDocumentExporterOptions = TryCast(e.Options, DevExpress.XtraRichEdit.Export.HtmlDocumentExporterOptions)
    If options IsNot Nothing Then
        options.CssPropertiesExportType = DevExpress.XtraRichEdit.Export.Html.CssPropertiesExportType.Link
        options.HtmlNumberingListExportFormat = DevExpress.XtraRichEdit.Export.Html.HtmlNumberingListExportFormat.HtmlFormat
        options.TargetUri = Path.GetFileNameWithoutExtension(Me.fileName)
    End If
End Sub

The following code snippets (auto-collected from DevExpress Examples) contain references to the CssPropertiesExportType property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-richedit-save-text-from-a-range-in-different-formats/CS/GetTextMethodsExample/Form1.cs#L250

csharp
{
    options.CssPropertiesExportType = DevExpress.XtraRichEdit.Export.Html.CssPropertiesExportType.Link;
    options.HtmlNumberingListExportFormat = DevExpress.XtraRichEdit.Export.Html.HtmlNumberingListExportFormat.HtmlFormat;

how-to-customize-copy-and-paste-commands/CS/RichEditCustomCopyPaste/CustomCommands.cs#L44

csharp
if (exporterOptions != null) {
    exporterOptions.CssPropertiesExportType = CssPropertiesExportType.Inline;
    exporterOptions.ExportRootTag = ExportRootTag.Body;

word-document-api-examples/CS/CodeExamples/ExportActions.cs#L148

csharp
{
    options.CssPropertiesExportType = CssPropertiesExportType.Link;
    options.HtmlNumberingListExportFormat = HtmlNumberingListExportFormat.HtmlFormat;

word-processing-customize-html-export/CS/Program.cs#L67

csharp
options.ExportRootTag = htmlExportType;
options.CssPropertiesExportType = cssExportType;
options.TargetUri = Path.GetFileNameWithoutExtension(fileName);

winforms-richedit-save-text-from-a-range-in-different-formats/VB/GetTextMethodsExample/Form1.vb#L190

vb
If options IsNot Nothing Then
    options.CssPropertiesExportType = DevExpress.XtraRichEdit.Export.Html.CssPropertiesExportType.Link
    options.HtmlNumberingListExportFormat = DevExpress.XtraRichEdit.Export.Html.HtmlNumberingListExportFormat.HtmlFormat

how-to-customize-copy-and-paste-commands/VB/CustomCommands.vb#L45

vb
If exporterOptions IsNot Nothing Then
    exporterOptions.CssPropertiesExportType = CssPropertiesExportType.Inline
    exporterOptions.ExportRootTag = ExportRootTag.Body

word-document-api-examples/VB/CodeExamples/ExportActions.vb#L132

vb
If options IsNot Nothing Then
    options.CssPropertiesExportType = Html.CssPropertiesExportType.Link
    options.HtmlNumberingListExportFormat = Html.HtmlNumberingListExportFormat.HtmlFormat

word-processing-customize-html-export/VB/Program.vb#L65

vb
options.ExportRootTag = htmlExportType
options.CssPropertiesExportType = cssExportType
options.TargetUri = Path.GetFileNameWithoutExtension(fileName)

See Also

HtmlDocumentExporterOptions Class

HtmlDocumentExporterOptions Members

DevExpress.XtraRichEdit.Export Namespace