EPPlus 添加带有最新版本 Office Losses All 宏的工作表
EPPlus Add Worksheet with Latest Version of Office Losses All Macros
当您 运行 在包含任何 VBA 宏的文件上执行以下代码时:
using (ExcelPackage xlPackage = new ExcelPackage(new FileInfo("Test.xlsm")))
{
xlPackage.Workbook.Worksheets.Add("TestTab");
xlPackage.Save();
}
您遇到以下问题(打开编辑后的文件):
We found a problem with some content in 'Test.xlsm'. Do you want us to
recover as much as we can? If you trust the source of this workbook,
click Yes.
(如果您单击是)
Removed Part: /xl/vbaProject.bin part. (Visual Basic for Applications
(VBA))
那你的VBA马哥就没了...我也收到了:
The Visual Basic for Applications (VBA) macros in the workbook are
corrupted and have been deleted. The macro corruption most likely
exists in the current file. To recover the macros, open a backup copy
of this file if you have one.
我只在最新更新(Office 365 Excel 1708 - 8431.2079)上看到这个问题。当我在 excel 的旧版本或尚未升级到最新版本的版本上进行测试时,我没有遇到此问题。
似乎最新的 office 更新已将此问题引入已被 EPPlus(最新 4.5.0)修改的文件(特别是插入新工作表时)。
还有其他人遇到过这个问题吗?也许有人有某种解决方法。我希望不必深入研究源代码:(
编辑:听取了派先生的建议克隆了票,也许比我聪明的人对来源有所了解:GitHub
当您 运行 在包含任何 VBA 宏的文件上执行以下代码时:
using (ExcelPackage xlPackage = new ExcelPackage(new FileInfo("Test.xlsm")))
{
xlPackage.Workbook.Worksheets.Add("TestTab");
xlPackage.Save();
}
您遇到以下问题(打开编辑后的文件):
We found a problem with some content in 'Test.xlsm'. Do you want us to recover as much as we can? If you trust the source of this workbook, click Yes.
(如果您单击是)
Removed Part: /xl/vbaProject.bin part. (Visual Basic for Applications (VBA))
那你的VBA马哥就没了...我也收到了:
The Visual Basic for Applications (VBA) macros in the workbook are corrupted and have been deleted. The macro corruption most likely exists in the current file. To recover the macros, open a backup copy of this file if you have one.
我只在最新更新(Office 365 Excel 1708 - 8431.2079)上看到这个问题。当我在 excel 的旧版本或尚未升级到最新版本的版本上进行测试时,我没有遇到此问题。
似乎最新的 office 更新已将此问题引入已被 EPPlus(最新 4.5.0)修改的文件(特别是插入新工作表时)。
还有其他人遇到过这个问题吗?也许有人有某种解决方法。我希望不必深入研究源代码:(
编辑:听取了派先生的建议克隆了票,也许比我聪明的人对来源有所了解:GitHub