简体   繁体   中英

Encrypt excel file using ClosedXML

We are using ClosedXML library to generate our excel reports. A new requirement form client is to password protect reports marked as confidential. There is a method XLWorkbook.Protect() with some overloads, however, none of it is encrypting a file, just locking structure at best. In other words, you can still see data after opening a file, MS Excel will not ask you for a password.

  1. Is ClosedXML even supporting excel file encryption? On their wiki which I found on GitHub, there is the only article about protecting sheets and even for formatting and structure.
  2. Was anyone able to find a way with ClosedXML? We would like to avoid using another library (like Spire.XSL; Microsoft.Office.Interop.Excel is not an option) if possible.

Thanks

After some try/fails and code disassembling I realized that ClosedXML is not supporting encryption at all; at least I was unable to find trace of it. Maybe they will add it later. We were able to convince client to give us a time to refactor the code and we are using EPPlus now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM