We have an MVC App where some users will perform an action and a side effect is that they need to have a Word Document printed at their workstation IMMEDIATELY. We don’t want a print dialog, no prompting for the number of copies, no asking for the printer, just print right away. The users are on Windows 10 Machines with Chrome or Edge as their browser and they all have Microsoft 365 installed locally. The users are not usually Administrators.
What we do have working is invoking Word from JavaScript. The JS code is usually:
window.open(link, "_blank");
Where the link looks something like (per https://docs.microsoft.com/en-us/office/client-developer/office-uri-schemes section A-3)
'ms-word:ofe|u|http://server/api/word/document/81510062.docx'
The above works to bring up Word for editing just fine, but that’s not what we want in this case. We want the system to act as if WinWord had been opened with /mFilePrintDefault and /mFileExit.
I tried adding the switches to the end of the link but didn't have any joy.
'ms-word:ofe|u|http://server/api/word/document/81510062.docx%20/mFilePrintDefault%20/mFileExit'
resulted in
This action couldn't be performed because Office doesn't recognize the command it was given.
I will say that we build the document on the fly when the action is invoked via an XML XSLT Generator, so if there is something we can bake into the Word Document, we would consider that. However, we can't have any warning dialogs about Macros, etc.
Also, ActiveX is off the table; we used that years ago with IE, but that is the distant past!
Any Ideas?
John B. on the Delmarva Peninsula