在不使用 ole 自动化的情况下以编程方式将 word docx 转换为 doc [英] programatically convert word docx to doc without using ole automation

查看:23
本文介绍了在不使用 ole 自动化的情况下以编程方式将 word docx 转换为 doc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法,可以在不使用 ole 自动化的情况下以编程方式将 docx 格式的 Word 文档转换为 doc 格式.我已经有一个 Windows 服务可以做到这一点,但这意味着在服务器上安装 Office,它有点不可靠且不受支持.我知道 aspose.words 产品,我会尝试一下,但有没有人有任何关于如何尽可能简单、可靠和便宜地做到这一点的建议?

i'm looking for a way to programatically convert word documents in docx format to doc format without using ole automation. i already have a windows service that does this but it means installing office on a server and it is a little unreliable and not supported. i am aware of the aspose.words product, and i will try it out, but has anyone any recommendations for how to do this as simply, reliably, and cheaply as possible?

推荐答案

不使用 OLE 自动化的一种选择是包装兼容包附带的转换器 dll,以便在不自动化 Office 的情况下从 docx 转换为 doc.

One option without using OLE automation would be to wrap the converter dlls coming with compatibility pack in order to convert from docx to doc without automating Office.

这只需要在机器上安装 Office 兼容包.

This requires only that the Compatibility Pack of Office is installed on the machine.

Office 转换器 dll 使用 ForeignToRtf/RtfToForeign 接口从他们支持的文档格式转换为 RTF 格式和/或从 RTF 格式转换为他们的文档格式.您可以根据需要链接转换器,将一种格式转换为另一种格式,例如做一个转换 DOCX -> RTF -> DOC.

The Office converter dlls convert from the document format that they support to RTF and/or from RTF to their document format using the interface ForeignToRtf/RtfToForeign. You can chain converters as you wish to convert from one format to another, e.g. to do a conversion DOCX -> RTF -> DOC.

您可以从以下位置获取 SDKMicrosoft,其中包括有关如何使用现有转换器的几个示例.如果我没记错的话,已经包含了一个命令行包装器示例.一切都是 C/C++ 的东西.

You can get the SDK from Microsoft, which includes several samples on how to use existing converters. If I remember correctly there is already a command line wrapper sample included. Everything is C/C++ stuff.

您可以通过查看以下注册表项找出哪些转换器 dll 负责 OpenXML 转换:

You can find out which of the converter dlls are responsible for OpenXML conversion by looking at the following registry key:

HKEY_LOCAL_MACHINESOFTWAREMicrosoftShared ToolsText ConvertersImportWord12  

如果您需要更多详细信息,请告诉我.

Let me know if you need further details on this.

这篇关于在不使用 ole 自动化的情况下以编程方式将 word docx 转换为 doc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆