无需自动化即可读取(和写入)Office 文档自定义属性
我正在寻找一种解决方案,用于读取(并可能写入)Office 文档(旧格式和新格式)的自定义属性,而无需诉诸 Office 自动化。
我发现 Dsofile.dll 似乎适用于旧格式,但对新格式却感到窒息“类未注册”。 KB 评论说,需要安装某个“Office 兼容包”才能正常工作,但我确实在寻找开箱即用的解决方案。
我并不是在寻找在未安装 Office 的情况下读取(和写入)自定义属性的解决方案。事实上,我认为 Office 是一个先决条件。只是我想要一个不需要 Office 自动化来进行简单的自定义属性处理的解决方案。
有一个“Microsoft Office 元数据处理程序”Windows Explorer Shell 扩展,它几乎按照我想要的方式显示/管理 Office 文档的自定义属性。有了Dsofile.dll
,我似乎通过覆盖旧的 Office 格式已经解决了一半问题。
I am looking for a solution 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DSOFile 是用于二进制格式的文件。
对于较新的格式,您可以仅使用 XML(Open XML SDK 是一个不错的选择,但您也可以在 .NET 中使用
System.IO.Packaging
访问 DOCX/XLSX/PPTX 文件格式,如果你不想对 Yet-another-dll 采取那么严厉的态度)。有关访问和设置属性的信息,请参阅此文章:操作 Word 2007 年使用 Open XML Format API 的文件(第 2 部分,共 3 部分)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)