我不确定这是否是“有意的”,或者是否存在解决方法(除了显示演示文稿)。
#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 演示文稿非常烦人。有没有解决这个问题的方法?