我不确定这是“预期”,还是存在解决方法(除了显示演示文稿)。
#if DEBUG
var withWindow = Microsoft.Office.Core.MsoTriState.msoTrue;
#else
// using msoTrue fixes the error
var withWindow = Microsoft.Office.Core.MsoTriState.msoFalse;
#endif
presentation = app.Presentations.Open(templateFileName,
Microsoft.Office.Core.MsoTriState.msoTrue, // readonly
Microsoft.Office.Core.MsoTriState.msoFalse, // untitled (?)
withWindow // with window: visible or not
);
// some time later...
slide.Shapes.AddChart(); // Error HRESULT E_FAIL has been returned from a call to a COM component. ErrorCode: -214747259
自动化时无法隐藏PowerPoint演示文稿非常烦人。这个问题有没有解决方法?