fix the bug that office program will shutdown once running the OfficeToPDF.exe command line tool #54
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is for issue #53
While I am using outlook to view and deal with messages, and at same time I want to convert some messages into PDF, but whenever I run the command line .\OfficeToPDF.exe '.\outlookmessage.msg' 'convertedNewFile.pdf' it will shutdown the Word.exe and Outlook.exe, which is very inconvenient, why it would act like this, (from source code, seems it will release the session?
After debugging, I found that
in OutlookConverter.cs
try { app = (Microsoft.Office.Interop.Outlook.Application)Marshal.GetActiveObject("Outlook.Application"); } catch(System.Exception) { app = new Microsoft.Office.Interop.Outlook.Application(); running = false; } )
// If we were not already running, quit and release the outlook object if (app != null && !running) { ((Microsoft.Office.Interop.Outlook._Application)app).Quit(); }
Why would we affect the current running app and session? Could we not shutdown the Outlook and Word app when running the converting job?
I tried to fix it to make the initial variable
options["noquit"]
to true. I think it makes more sense.