Introduction

Microsoft Office documents offer multiple protection methods. For instance, users can restrict editing for the entire document or specific sections (depending on the document type), and also prevent unauthorized access to the document. These protection features can be combined, with each method requiring its own distinct password.

Beginning with version 2023.4, we have integrated the described functionality into our products. Now, when exporting reports to Microsoft Office documents, users can secure them against unauthorized access. Furthermore, for Word and Excel documents, it is now possible to restrict editing of page content. Further details on this enhancement will be discussed below. It is worth noting that previously, we only partially implemented editing protection, lacking the ability to set a password.

Security measures for opening documents

Now, when exporting reports, you have the option to protect the document from unauthorized access. This feature is available for Word, Excel, and PowerPoint documents.

How to implement this in the viewer: In the export settings menu, locate the Document Security group and enter a password for the Encrypt with Password option.


When exporting a report from code, the password must be included in the export settings. For instance, when exporting to Word, it would look as follows:

Code used in our products BEFORE version 2024.2.1
var settings = new StiWord2007ExportSettings();
settings.EncryptionPassword = "123456";
report.ExportDocument(StiExportFormat.Word2007, "Report.docx", settings);
Code used in our products AFTER version 2024.2.1
var settings = new StiWordExportSettings();
settings.EncryptionPassword = "123456";
report.ExportDocument(StiExportFormat.Word, "Report.docx", settings);

Document editing security

The functionality for protecting documents from being edited (applicable to Word and Excel documents) has been enhanced. As before, you can select the type of editing protection by using the Restrict Editing parameter. Now, you can also set a password for this protection, allowing document editing in Word and Excel only after the correct password is entered.

How to implement this in the viewer: In the export settings menu, within the Document Security group, set the Restrict Editing parameter and also specify the password as the value of the Password parameter.


When exporting a report from code, the protection type and password must be configured in the export settings. For instance, exporting to Word would look like this:

Code used in our products BEFORE version 2024.2.1
var settings = new StiWord2007ExportSettings();
settings.RestrictEditing = StiWord2007RestrictEditing.ExceptEditableFields;
settings.ProtectionPassword = "123456";
report.ExportDocument(StiExportFormat.Word2007, "Report.docx", settings);
Code used in our products AFTER version 2024.2.1
var settings = new StiWordExportSettings();
settings.RestrictEditing = StiWordRestrictEditing.ExceptEditableFields;
settings.ProtectionPassword = "123456";
report.ExportDocument(StiExportFormat.Word, "Report.docx", settings);
If you have any inquiries or require assistance regarding the process of protecting MS Office documents within Stimulsoft products, please do not hesitate to reach out to us. We are here to provide guidance and support to ensure your documents remain secure.
By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.