Back to Devexpress

BeforeExportEventArgs.Options Property

officefileapi-devexpress-dot-xtrarichedit-dot-beforeexporteventargs-1a81dc7b.md

latest8.4 KB
Original Source

BeforeExportEventArgs.Options Property

Provides access to the exporter options.

Namespace : DevExpress.XtraRichEdit

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
public IExporterOptions Options { get; }
vb
Public ReadOnly Property Options As IExporterOptions

Property Value

TypeDescription
IExporterOptions

An IExporterOptions interface defining export options.

|

Remarks

The e.Options property can define different objects depending on the export format and the type of exporter. Apart from the IExporterOptions.TargetUri, it specifies different exporter-specific settings.

When exporting to HTML, you can specify several HTML export options, casting the Options value to the HtmlDocumentExporterOptions type. For example, to specify whether the style sheets should be saved in separate css files, or incorporated in the main document, use the HtmlDocumentExporterOptions.CssPropertiesExportType property.

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 Options 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-a-document/CS/SaveDocument/Form1.cs#L51

csharp
RtfDocumentExporterOptions options = e.Options as RtfDocumentExporterOptions;
if (options != null)

winforms-richedit-build-a-mail-application/CS/RichEditSendMail/Form1.cs#L95

csharp
void OnBeforeExport(object sender, BeforeExportEventArgs e) {
    HtmlDocumentExporterOptions options = e.Options as HtmlDocumentExporterOptions;
    if (options != null) {

winforms-richedit-export-the-document-into-an-outlook-mail-item/CS/Form1.cs#L71

csharp
private void OnBeforeExport(object sender, BeforeExportEventArgs e) {
    HtmlDocumentExporterOptions options = e.Options as HtmlDocumentExporterOptions;
    if (options != null) {

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

csharp
{
    DevExpress.XtraRichEdit.Export.HtmlDocumentExporterOptions options = e.Options as DevExpress.XtraRichEdit.Export.HtmlDocumentExporterOptions;
    if (options != null)

word-document-api-send-mail-merge-document-as-email/CS/RichEditMailMessageExporter.cs#L43

csharp
{
    HtmlDocumentExporterOptions options = e.Options as HtmlDocumentExporterOptions;
    if (options != null)

winforms-richedit-save-a-document/VB/SaveDocument/Form1.vb#L41

vb
"Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
Dim options As RtfDocumentExporterOptions = TryCast(e.Options, RtfDocumentExporterOptions)
If options IsNot Nothing Then

winforms-richedit-build-a-mail-application/VB/RichEditSendMail/Form1.vb#L89

vb
Private Sub OnBeforeExport(ByVal sender As Object, ByVal e As BeforeExportEventArgs)
    Dim options As HtmlDocumentExporterOptions = TryCast(e.Options, HtmlDocumentExporterOptions)
    If options IsNot Nothing Then

winforms-richedit-export-the-document-into-an-outlook-mail-item/VB/Form1.vb#L70

vb
Private Sub OnBeforeExport(ByVal sender As Object, ByVal e As BeforeExportEventArgs)
    Dim options As HtmlDocumentExporterOptions = TryCast(e.Options, HtmlDocumentExporterOptions)
    If options IsNot Nothing Then

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

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

word-document-api-send-mail-merge-document-as-email/VB/RichEditMailMessageExporter.vb#L40

vb
Private Sub OnBeforeExport(ByVal sender As Object, ByVal e As BeforeExportEventArgs)
    Dim options As HtmlDocumentExporterOptions = TryCast(e.Options, HtmlDocumentExporterOptions)
    If options IsNot Nothing Then

See Also

BeforeExportEventArgs Class

BeforeExportEventArgs Members

DevExpress.XtraRichEdit Namespace