Read (and write) Office document custom properties without automation
I am looking for a s开发者_开发百科olution for reading (and possibly writing) custom properties of Office documents (both old and new formats) without resorting to Office automation.
I have found Dsofile.dll which seems to work good for old formats but chokes on new ones with a "class not registered". KB remarks say that a certain "Office Compatibility Pack" needs to be installed for this to work but I am really looking for an out-of-box solution.
I am not searching for a solution that reads (and writes) custom properties without Office installed. Actually, I am considering Office to be a prerequisite. It is just that I want a solution that does not require Office automation for simple custom property handling.
There is a "Microsoft Office Metadata Handler" Windows Explorer Shell Extension that shows/manages custom properties for Office documents pretty much the way I want to do it. With Dsofile.dll
I seem to have one half of the solution by covering old Office formats.
DSOFile is what to use for the binary formats.
For the newer formats, you can just use XML (Open XML SDK is a fine choice, but you can also just access the DOCX/XLSX/PPTX file formats with System.IO.Packaging
in .NET if you don't want to be all that heavy handed with yet-another-dll). See this article for accessing and setting properties: Manipulating Word 2007 Files with the Open XML Format API (Part 2 of 3)
精彩评论