以编程方式将word docx转换为doc,而无需使用ole自动化 [英] programatically convert word docx to doc without using ole automation

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

问题描述

我正在寻找一种无需使用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.

您可以从以下网站获取 SDK Microsoft ,其中包含有关如何使用现有转换器的几个示例.如果我没记错的话,已经包含了命令行包装器示例.一切都是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_MACHINE\SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\Word12  

如果您需要进一步的详细信息,请告诉我.

Let me know if you need further details on this.

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

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