Excel 使用密码时使用 Aspose 生成的文件已损坏
Excel file generated using Aspose is corrupted when using password
我正在使用 Apose.cells API
创建 excel 文件:
book.SetEncryptionOptions(EncryptionType.XOR, 40);
book.SetEncryptionOptions(EncryptionType.StrongCryptographicProvider, 128);
book.Settings.Password = "test;
当我尝试打开生成的 excel 文件时,它提示输入密码,在输入正确的密码后,文件打开并显示以下错误消息
"Excel found unreadable content". Do you want to recover the contents of this workbook? If you trust the source of this workbook, click yes
<info>Excel recovered your formulas and cell values, but some data may have been lost.</info>
这个问题似乎是您的 Excel 文件所特有的。请提供您的 Excel 文件进行测试。
我们用 most recent version i.e. 18.4.6 and it works fine. Please see the following code. It loads the Book1.xls which has Macros and after executing your code, it saves it as output.xls 测试了这个问题,它在 Microsoft Excel 中打开正常,没有任何错误,正如你提到的那样。
下载Link:
C#
Workbook book = new Workbook("Book1.xls");
book.SetEncryptionOptions(EncryptionType.XOR, 40);
book.SetEncryptionOptions(EncryptionType.StrongCryptographicProvider, 128);
book.Settings.Password = "test123";
book.Save("output.xls");
注意:我在 Aspose 担任开发人员布道师
我正在使用 Apose.cells API
创建 excel 文件:
book.SetEncryptionOptions(EncryptionType.XOR, 40);
book.SetEncryptionOptions(EncryptionType.StrongCryptographicProvider, 128);
book.Settings.Password = "test;
当我尝试打开生成的 excel 文件时,它提示输入密码,在输入正确的密码后,文件打开并显示以下错误消息
"Excel found unreadable content". Do you want to recover the contents of this workbook? If you trust the source of this workbook, click yes
<info>Excel recovered your formulas and cell values, but some data may have been lost.</info>
这个问题似乎是您的 Excel 文件所特有的。请提供您的 Excel 文件进行测试。
我们用 most recent version i.e. 18.4.6 and it works fine. Please see the following code. It loads the Book1.xls which has Macros and after executing your code, it saves it as output.xls 测试了这个问题,它在 Microsoft Excel 中打开正常,没有任何错误,正如你提到的那样。
下载Link:
C#
Workbook book = new Workbook("Book1.xls");
book.SetEncryptionOptions(EncryptionType.XOR, 40);
book.SetEncryptionOptions(EncryptionType.StrongCryptographicProvider, 128);
book.Settings.Password = "test123";
book.Save("output.xls");
注意:我在 Aspose 担任开发人员布道师