Have you ever used a Word Template in Power Apps?
If you have not, have a look at this documentation page. For the model-driven apps, it’s one of the easiest ways to quickly create standardized word documents for your entities.
Although, Word templates do come with some limitations – I won’t go into the details here since it’s not what this post is about. I use Word templates occasionally, and they work great where I don’t hit those limitations.
This was one of the projects where Word templates seemed to fit great. We had a few different document to print, there were not deep relationships to display, we could live with no conditional logic, etc. And, then, just about the time we were supposed to go live, one of the business folks was looking at it and posed a very interesting question:
“So, do I have to remember to switch the printer every time I use this?”
See, for some of the records, there would be more than one template, and they would have to be printed on different printers. One of the printers would be a regular printer, but the other one would be a plastic card printer. And, yes, if somebody did send a 10-pages long regular document to the card printer, that would be a waste of plastic cards. The opposite of that would be sending a card template to the regular printer, but that’s much less problematic.
Seems simple, right? Let’s just set the default printer and be done with it, or, at least, so I thought.
Unfortunately for us, Microsoft Word (2016 in our case) turned out to be more optimized that expected
If you have 2 printers, and if you set one of those as the default printer, you would probably expect the default printer to be selected by default?
The way it works, though, is:
- Imagine you’ve opened a document in Word
- Then you printed that document to a non-default printer
- Then you opened another document in a different Word window
- And you are trying to print that second document
The printer you’ll see selected by default is the same printer that you used for the first document:
Isn’t that awesome? You don’t need to choose, that’s the one you used before… except that we’d just waste a bunch of plastic cards in our scenario.
The problem seems to be related to the fact that there is only one winword process, no matter how many word documents you have open on the screen:
And, it seems, it’s that process that’s actually storing “current” printer selections for the user.
So, how can we work around this performance optimization in Microsoft Word?
We have to close all word windows, then the process is unloaded from memory, and the next time we open a document in Word and try sending it to the printer, Word will be using default printer again:
I wish there were a setting somewhere…
Well, there are articles suggesting to use macros in this scenario to choose the printer, but, since it’s a word template, and since there will be different users even on the same “terminal” machine, I am not sure how well this will work and if it will work at all. Might still need to try.