I have bad news. Get-WinEvent shows the following error when calling ExportAsFixedFormat inside the container:
TimeCreated Id LevelDisplayName Message
----------- -- ---------------- -------
6/27/2017 1:38:45 PM 300 Information Microsoft Excel
No printers are installed. To install a printer click the File tab, and then click Print. Click No Printers
Installed, and then click Add Printer. Follow the instructions in the Add Printer dialog box.
P1: 100964
P2: 16.0.8201.2102
P3:
P4:
As I later confirmed using ProcMon in a windows Host, Excel’s ExportAsFixedFormat uses Window’s Microsoft Print to PDF printer. This printer (or any other printer for that matter) isn’t available in the container and I doubt it can be easily installed (for starters, Windows’ Spooler service is disabled and it fails to start after enabling it manually see https://stackoverflow.com/questions/41565459/windows-2016-docker-container-error ).
So, I am giving up. Unless someone has a an alternative to ExportAsFixedFormat or a way to add a printer to the container (which feels wrong) I will move my code out of the containers.