问题描述
有没有人知道这个的语法?我一直在寻找无处不在,我可以找到的是C ++代码。我正在使用System.IO.Packaging命名空间来编程地密码保护excel文件。任何想法?
附加说明:
我没有使用Excel interop,而是使用System.IO.Packaging命名空间来加密和密码保护excel文件。
如果你想要一个Excel密码,你需要的是这样的:
使用Microsoft.Office.Interop.Excel
//在此创建您的电子表格
WorkbookObject.Password =密码;
WorkbookObject.SaveAs(spreadsheet.xls)
这需要安装Excel。
与 System.IO.Packaging
无关,所以您可能需要重申您的问题。 ..
Does anyone know the syntax for this? I've been looking everywhere and all I can find is C++ code for this. I'm trying to password protect an excel file programatically using the System.IO.Packaging namespace.
Any ideas?
Additional notes:
I'm NOT using the Excel interop--but instead the System.IO.Packaging namespace to encrypt and password protect the excel file.
If you want an Excel password all you need is something like this:
using Microsoft.Office.Interop.Excel
//create your spreadsheet here...
WorkbookObject.Password = password;
WorkbookObject.SaveAs("spreadsheet.xls")
This requires Excel to be installed.
That's nothing to do with System.IO.Packaging
of course, so you might need to restate your question...
这篇关于密码保护C#中的Excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!