Articles in this section
Category / Section

Export SSRS, RDL and RDLC report with password protection

1 min read

Syncfusion Report Writer allows you to protect the exported document from unauthorized users by encrypting the document using password. The following code snippet is used to initialize an RDLC report to the Report Writer.

 

string reportPath = @"../../ReportTemplate/Product Catalog.rdlc";
string fileName = null;
WriterFormat format;
ReportDataSourceCollection dataSources = new ReportDataSourceCollection();
dataSources.Add(new ReportDataSource { Name = "ProductCatalog", Value = ProductCatalogSource.GetData() });
ReportWriter reportWriter = new ReportWriter(reportPath, dataSources);

 

The following code snippet illustrates how to encrypt the exported document with the user password.

PDF encryption

reportWriter.PDFOptions = new PDFOptions();
reportWriter.PDFOptions.Security = new Syncfusion.Pdf.Security.PdfSecurity();
reportWriter.PDFOptions.Security.UserPassword = "password";

 

Word encryption

reportWriter.WordOptions = new WordOptions();
reportWriter.WordOptions.EncryptionPassword = "password";

 

Excel encryption

reportWriter.ExcelOptions = new ExcelOptions();
reportWriter.ExcelOptions.PasswordToOpen = "password"; 

 

PPT encryption

reportWriter.PPTOptions = new PPTOptions();
reportWriter.PPTOptions.EncryptionPassword = "password";

 

Sample

Download report writer encryption sample

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied