Word Settings
To control how the Bold Reports® ASP.NET Web Forms Report Writer exports Word documents, set the customization properties in the WordOptions. Initialize the WordOptions property with the following code snippet:
writer.WordOptions = new WordOptions();How do I set the Word document version?
To save the report to the required Word document version with the Report Writer, set the FormatType property.
writer.WordOptions.FormatType = WordFormatType.Docx;How do I remove merged cells in Word exports?
To remove tiny columns, rows and merged cells from a Word document exported by the Report Writer, set the LayoutOption to TopLevel. The Report Writer then renders the Word document elements without a nested grid layout. 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.
How do I protect a Word document from editing?
To restrict a Word document exported by the Report Writer from editing, set the ProtectionType property, with or without a 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;How do I password protect an exported Word document?
To protect a Word document exported by the Report Writer from unauthorized users, encrypt it with a password in the EncryptionPassword property. The following code snippet encrypts the exported document with a user-defined password.
writer.WordOptions = new BoldReports.Writer.WordOptions()
{
EncryptionPassword = "password"
};