Search results
Suggest a FeaturePDF

Word Settings

The Word export options provides properties to manage Word document export behaviors. You can set the customization properties in the WordOptions. Refer to the following code snippet to initialize the WordOptions property.

writer.WordOptions = new WordOptions();

Word document type

You can save the report to the required document version by setting the FormatType property.

writer.WordOptions.FormatType = WordFormatType.Docx;

Word document advance layout for merged cells

Eliminate the tiny columns, rows, merged cells, and render the word document elements without nested grid layout by setting the LayoutOption to TopLevel. The ParagraphSpacing is the distance value added between two elements in the document.

writer.WordOptions.LayoutOption = WordLayoutOptions.TopLevel;
writer.WordOptions.ParagraphSpacing = new BoldReports.Writer.ParagraphSpacing()
{
    Bottom = 0.5f,
    Top = 0.5f
};

A paragraph element is inserted between two tables in the exported document to overcome the Word document auto merging behavior. The table in the word document is not a stand-alone object. If you draw two tables one after another, it will automatically get merged into a single table. To prevent this merging, add an empty paragraph between two tables.

Protecting Word document from editing

You can restrict a Word document from editing either by providing a password or without password. The following are the types of protection:

  • AllowOnlyComments: Adds or modifies only the comments in the Word document.
  • AllowOnlyFormFields: Modifies the form field values in the Word document.
  • AllowOnlyRevisions: Accepts or rejects the revisions in the Word document.
  • AllowOnlyReading: Views the content only in the Word document.
  • NoProtection: Accesses or edits the Word document contents as normally.
writer.WordOptions.ProtectionType = Syncfusion.DocIO.ProtectionType.AllowOnlyReading;

Password Protected Word document

Allows you protect the exported Word document from unauthorized users by encrypting the document using encryption password. The following code snippet explains how to encrypt the exported document with user-defined password.

writer.WordOptions = new BoldReports.Writer.WordOptions()
{
    EncryptionPassword = "password"
};