简体   繁体   English

Excel 2007升级错误

[英]Excel 2007 upgrade error

In a Windows Forms application I'm saving some data to an Excel file. 在Windows窗体应用程序中,我将一些数据保存到Excel文件中。 Until now, i was using Excel 2003 and saving as the file as xls. 直到现在,我一直在使用Excel 2003并将其另存为xls。 with this code : 使用此代码:

exportFile.SaveAs(strPath, Excel.XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlShared, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

I've upgraded to Excel 2007 and now I want to save the data as xlsx, so i've changed the same line to : 我已经升级到Excel 2007,现在我想将数据另存为xlsx,所以我将同一行更改为:

exportFile.SaveAs(strPath, Microsoft.Office.Interop.Excel.XlFileFormat.xlOpenXMLWorkbook, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlShared, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

But now, i get an exception on that line , "Exception from HRESULT: 0x800A03EC" Do you have any idea what am i doing wrong ? 但是现在,我在该行上收到一个异常,“来自HRESULT的异常:0x800A03EC”您知道我在做什么错吗?

Thank you! 谢谢!

I've tried @david heffernan's solution and worked. 我已经尝试过@david heffernan的解决方案并工作了。 XlSaveAsAccessMode.xlNoChange did the trick XlSaveAsAccessMode.xlNoChange做到了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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