如何使用c#中的openxml-sdk将doc转换为docx

本文关键字:doc 转换 docx openxml-sdk 何使用 中的 | 更新日期: 2023-09-27 18:00:32

请帮助我使用open-xml-sdk或除word自动化之外的任何其他方法将.doc文件转换为.docx。

提前谢谢。

如何使用c#中的openxml-sdk将doc转换为docx

OpenXML SDK只允许您操作.docx文件,而不允许操作.doc文件。下面是一篇博客文章,说明如何使用批量转换实用程序执行.doc到.docx文件的批量转换。我担心,如果你不想使用Word Automation,你将不得不编写自己的.doc解析器,这可能是一项相当艰巨的工作。

我还没有用过,但请看一下http://b2xtranslator.sourceforge.net/.

此外,如果您的场景支持它,并且您的业务需要允许它,则有时安装SharePoint Server 2010的副本并使用Word Automation Services是有效的。有些人安装SharePoint Server 2010的副本只是为了运行Word Automation Services。Word Automation Services能够在无人值守的服务器端将DOC转换为DOCX。

根据您的情况,Word Automation可能会非常麻烦。此外,如果您使用Word Automation为一组客户提供特定功能,则可能需要考虑许可问题。请注意,Word Automation是与Word Automation Services不同的技术。看见http://blogs.msdn.com/b/ericwhite/archive/2010/12/07/what-is-the-difference-between-word-automation-and-word-automation-services.aspx了解更多信息。