gpt4 book ai didi

c# - 保存到 excel 文件导致 c# windows 中的错误

转载 作者:可可西里 更新时间:2023-11-01 10:27:37 28 4
gpt4 key购买 nike

代码如下:

try
{
if (File.Exists("c:\\Reports\\" + fileName))
{
File.Delete("c:\\Reports\\" + fileName);
}
_book.SaveAs("c:\\Reports\\" + fileName, Excel.XlFileFormat.xlWorkbookNormal,
null, null, false, false, Excel.XlSaveAsAccessMode.xlShared,
false, false, null, null, null);
}
catch (Exception ee)
{
throw ee;
}

关于保存为 excel 格式。我有以下错误如下..

System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

我使用的是 MS Office 2000 版。

Dll使用的是Interop.excel 1.4.0.0

使用 Visual Studio 2008 + c# 控制台应用程序

最佳答案

使用 _book.SaveCopyAs("c:\Reports\"+ fileName)

关于c# - 保存到 excel 文件导致 c# windows 中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10090030/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com