I have a workbook that is created from scratch using the OpenXML APIs. It opens and prints fine. I've attempted to add changing the active cell in the first worksheet and it works just fine. When I open the workbook, I can see that the selection has changed. But when I go to print it, Excel just crashes. Checking the Event Viewer, I see this at the time of the crash:
Faulting application name: EXCEL.EXE, version: 16.0.9330.2124, time stamp: 0x5b16f725
Faulting module name: mso20win32client.dll, version: 0.0.0.0, time stamp: 0x5b16f433
Exception code: 0xc0000409
Fault offset: 0x001c31cf
Faulting process id: 0x52e8
Faulting application start time: 0x01d40ca3115dc384
Faulting application path: C:\Program Files (x86)\Microsoft Office\Root\Office16\EXCEL.EXE
Faulting module path: C:\Program Files (x86)\Common Files\Microsoft Shared\Office16\mso20win32client.dll
Report Id: ff5f88f9-9fd2-43d6-aaaa-e19142b8408f
Faulting package full name:
Faulting package-relative application ID:
If I take the same workbook and set the active cell manually and try to print it, it works and prints just fine.
When I unzip both versions of this file (the one set programmatically and the one set manually), I see quite a few differences, such as the manual file contains a docProps folder and in the [Content_Types].xml file in the manual file there are 4 more overrides.
All that should be required to set the active cell, from what I can tell from the documentation, is to add a node to the worksheet that specifies the selected tab, active cell and reference sequence. What else needs to be set to keep it from crashing when trying to print? Or is this a bug in Excel?
User contributions licensed under CC BY-SA 3.0