0

此代码在后台打开 excel,在 Windows 7 和 8 上没有问题,但在 Windows 10 上它会弹出“另存为”提示。您知道如何摆脱“另存为”提示吗?

object misValue = System.Reflection.Missing.Value;
xlApp = new Excel.Application();
//xlApp.Visible = false; // this does not help to get rid of save as
//xlApp.DisplayAlerts = false; // this does not help to get rid of save as
//xlApp.ScreenUpdating = false; // this does not help to get rid of save as
xlWorkBook = xlApp.Workbooks.Open(excelFileURL, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
xlWorkSheet = xlWorkBook.Worksheets.get_Item(1);
4

2 回答 2

0

尝试这个:

excelWorkbook.SaveAs(excelFileURL, AccessMode: Excel.XlSaveAsAccessMode.xlExclusive);
于 2016-01-28T14:02:07.923 回答
0

在 Office 2016 上关闭 excel 时弹出另存为 它与 Windows 10 无关

在没有“另存为”提示的情况下关闭

xlWorkBook.Close(false, misValue, misValue);
于 2016-01-28T21:08:10.847 回答