下面是我复制工作表并将其保存为新文件的代码,它实际上在我的本地没有宏保存,我们的环境为 Office 2003,Windows Server 2003
但是在服务器中它用宏保存,我不想要环境是 Office 2003,Windows Server 2008
C#:
try
{
wBook = xCel.Workbooks.Open(ExcelPath);
wSheet = (Excel.Worksheet)wBook.Worksheets.get_Item(1);
wSheet.Copy(Type.Missing, Type.Missing);
wSheet = (Excel.Worksheet)wBook.Sheets[1];
wSheet.SaveAs(ExcelCopyPath);
}
catch {}
finally
{
if (wBook != null)
{
wBook.Close();
wSheet = null;
wBook = null;
Thread.Sleep(500);
}
if (Excel.ProcessID > 0)
{
Process pxCel = Process.GetProcessById(Excel.ProcessID);
pxCel.Kill();
}
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
GC.WaitForPendingFinalizers();
try { Marshal.FinalReleaseComObject(wSheet);}
catch {}
try { Marshal.FinalReleaseComObject(wBook);}
catch {}
}
请检查我的问题...并提出一些答案。谢谢