DocxFormatProvider allows for import of docx documents and respectively export of RadFlowDocument to docx. Additionally, the import/export settings provide modification options. The current article outlines the available settings.
The export settings which you can specify are as follows:
This setting allows you to define the action which should be executed in case the RadFlowDocument that is about to be exported is not compliant with Open Office XML standard. The possible values for the enumeration are:
None: The RadFlowDocument will be exported as is without making any validations. This can result in invalid document that may not be opened correctly.
ThrowAnException: DocxFormatProvider runs validation over the document passed for export. If the document is invalid, the provider throws an InvalidDocumentException which contains the list with the validation errors. This is particularly useful when you want to assure you are building valid docx documents.
Repair: DocxFormatProvider runs validation over the document passed for export. If there is a validation exception, the provider tries to repair it. The result is a valid docx document, but the method changes the structure of the input document.
The AutoUpdateFields setting indicates if fields should be auto-updated when the exported document is opened. The default value is False.
Example 1 shows how you can create and specify particular export settings to DocxFormatProvider.
Example 1: Create DocxExportSettings
DocxFormatProvider provider = new DocxFormatProvider(); DocxExportSettings exportSettings = new DocxExportSettings(); exportSettings.AutoUpdateFields = true; exportSettings.InvalidDocumentAction = InvalidDocumentAction.ThrowException; provider.ExportSettings = exportSettings;