Encrypt and Secure Documents

To protect the PDF, Word and Excel documents that you export with the Bold Reports® ASP.NET Web Forms Report Writer from unauthorized users, set an encryption password in the PDFOptions, WordOptions or ExcelOptions of the writer. The following sections show how to encrypt each exported document type with a user-defined password.

How do I password protect an exported PDF document?

To password protect a PDF document exported by the Report Writer, set the UserPassword in the Security property of PDFOptions, as in the following code snippet:

writer.PDFOptions = new BoldReports.Writer.PDFOptions();
writer.PDFOptions.Security = new Syncfusion.Pdf.Security.PdfSecurity
{
    UserPassword = "Password"
};

How do I password protect an exported Word document?

To password protect a Word document exported by the Report Writer, set the EncryptionPassword property of WordOptions, as in the following code snippet:

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

How do I password protect an exported Excel document?

To password protect an Excel document exported by the Report Writer, set the PasswordToOpen and PasswordToModify properties of ExcelOptions, as in the following code snippet:

writer.ExcelOptions = new BoldReports.Writer.ExcelOptions()
{
    PasswordToModify = "password",
    PasswordToOpen = "password"
};

See also