DocxFormatProvider allows for import of DOCX documents and respectively export of RadDocument to DOCX. Additionally, the export settings provide modification options. The current article outlines the available settings.
DocxFormatProvider exposes ExportSettings, which allow customization in how fields are exported. By default, all fields are exported using their result value in the docx document. If you would like to save the document of the editor as a mail merge template and not include the value of the current item of the MailMergeDataSource, a new instance of DocxExportSettings should be created and assigned to the format provider. The value of the FieldResultMode of these settings must be set to FieldDisplayMode.DisplayName.
DocxFormatProvider docxFormatProvider = DocumentFormatProvidersManager.GetProviderByExtension("docx") as DocxFormatProvider; DocxExportSettings docxExportSettings = new DocxExportSettings(); docxFormatProvider.ExportSettings = docxExportSettings;
Dim docxFormatProvider As DocxFormatProvider = TryCast(DocumentFormatProvidersManager.GetProviderByExtension("docx"), DocxFormatProvider) Dim docxExportSettings As DocxExportSettings = New DocxExportSettings() docxFormatProvider.ExportSettings = docxExportSettings
The FieldResultMode property of the DocxExportSettings is an enumeration and it allows the following values:
- Code: Shows all fields codes in the current document.
- DisplayName: Shows all fields names in the current document.
- Result: Replaces the merge fields in your document with actual data from your recipient list.
- Null: When the FieldResultMode is set to null, fields' display mode is not changed. This can provide a better performance and lower memory usage while exporting.