Prevent child process from creating visible windows?

前端 未结 2 434
猫巷女王i
猫巷女王i 2021-01-05 21:06

I\'m trying to use Office Automation (PIA) to convert some .pptx documents into some other formats. However, PowerPoint insists on showing a progress bar even t

2条回答
  •  抹茶落季
    2021-01-05 22:05

    You can try to leave Application.Visible property with it's default value and pass MsoTriState.msoFalse to WithWindow paremeter when you open a presentation:

    var application = new Application();
    var document = application.Presentations.Open(fileName, MsoTriState.msoFalse, MsoTriState.msoFalse, 
        WithWindow: MsoTriState.msoFalse);
    

    If you explicitly set Application.Visible property to MsoTriState.msoFalse you will get "Hiding the application window is not allowed" error.

提交回复
热议问题