问题
I want to be able to parse the printer settings binary files that Excel saves inside xl\printerSettings\printerSettingsNN.bin inside the XLSX zip archive. Much searching for documentation avails little.
Is this a common format that I just don't recognize, or is it specific to Excel? Is anyone aware of where to find details on the format?
回答1:
It looks to be a Windows device-specific structure, DEVMODE.
Tracked it down via http://blogs.msdn.com/b/chrisrae/archive/2010/10/06/where-is-the-documentation-for-office-s-docx-xlsx-pptx-formats-part-2-office-2010.aspx, which links to ECMA-376, Second Edition, Part 1 - Fundamentals And Markup Language reference from www.ecma-international.org.
Except from the relevant §15.2.15 on page 160:
An instance of this part type contains information about the initialization and environment of a printer or a display device. The layout of this information is application-defined.
[Note: It is recommended that a Printer Settings Part contain well documented XML content for improved interoperability; however, there is no requirement on the format of the content contained in a Printer Settings Part. end note]
[Example: An Office Open XML producer on Windows might store the DEVMODE structure defined here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_8nle.asp, while an application on the Mac OS might choose to store the print record defined here:http://developer.apple.com/documentation/Printing/index.html. end example]
(Even 5,568 page standards suffer link rot- see DEVMODE structure.)
That means, in C# for example, you can make use of the PrinterSettings' GetHdevmode and SetHdevmode methods to interop with the structure.
来源:https://stackoverflow.com/questions/23139328/where-is-the-definition-of-the-xlsx-printersettings-bin-file-format