解决C#导出excel异常来自 HRESULT:0x800A03EC的方法 .

时间:2023-03-08 17:35:58
解决C#导出excel异常来自 HRESULT:0x800A03EC的方法 .

解决C#导出excel异常来自 HRESULT:0x800A03EC的方法 .

xlBook.SaveAs(FilePath,Microsoft.Office.Interop.Excel.XlFileFormat.xlExcel8, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

发现Office.Interop.Excel.XlFileFormat.xlExcel8格式与本机安装的office对不上,用Office.Interop.Excel.XlFileFormat.xlWorkbookNormal则可以

xlBook.SaveAs(FilePath, Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing)