在用C#对excel编程时,由于excel中包含有宏,所以每次保存xls的时候,都会出现下面的弹出窗口,使得自动保存不能进行。
-
This document contains macros, ActiveX controls, XML expansion pack information, or web components. These may include personal information that cannot be removed by the Document Inspector
问题应该出在Document Inspector上面,在Excel 2010中,用下面办法关闭这个弹出窗口:
File->Options->Trust Center->Trust Center Settings->Privacy Options
把Remove Personal information from file properties on save的对勾去掉。
这样每次关闭的时候就不会再检查了,不会影响到C#对Excel的调用。