在 Delphi 中读取/解析/修改 MS Word 文档,无需 Word Automation

发布于 2024-07-24 15:41:05 字数 518 浏览 4 评论 0原文

有谁知道 Delphi 有什么好的库(免费或商业)可以读取/解析/修改 MS Word 文档(最好支持 Word 2007)无需 MS Word OLE 自动化? 我找到了一些用于.Net 的,但没有找到用于Delphi 的。

例如,这里有两个 .Net/Java 库 - Aspose, Word.net

我不想在我的应用程序中添加 .Net 依赖项。 直接在 exe 内部编译的库是最好的,但任何 ActiveX 也都可以。

谢谢。

Does anyone know any good library (free or commercial) for Delphi that can read/parse/modify MS Word documents (preferably with Word 2007 support) without MS Word OLE Automation? I've found some for .Net, but none for Delphi.

For example, here are two .Net/Java libraries - Aspose, Word.net

I don't want to add .Net dependencies in my application. A library that compiles right inside the exe will be most preferable, but any ActiveX will also work.

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

笑饮青盏花 2024-07-31 15:41:05

我知道 Excel 的(一个简单的非商业)变体,但不知道 Word 的变体。 而且不适用于非常新的。

DR:问题是需要安装Word。 上面的选项没有。 此外,OLE 可能会变得很慢,例如,当您想要在其中邮寄大量私人信件时。

我能想象的唯一的其他例程是自动化 Open Office。 但这可能有相同的速度问题(或更糟),所以这取决于你到底想要这个的原因。

Office 格式极其复杂,而且几乎所有解决方案都比仅仅复制一份单词更昂贵(大量时间)。 (使用 OOo 你甚至可以避免这种情况)

I know (a simple non-commercial) variant for Excel, but not for Word. And not for very new ones.

DR: the problem is that that needs Word installed. The options above don't. Moreover OLE can get slow, e.g. when you want to make umpteen personal letters for a mailing in it.

The only other routine I can imagine is automating Open Office. But that has the same speed problems (or worse) probably, so that would depend on why you exactly want this.

The Office format is horribly complicated, and nearly every solution will be more expensive (in either vast time or money) than just coughing up a copy of word. (and with OOo you could even avoid that)

蒗幽 2024-07-31 15:41:05

ScalabiumTSMWordDocument 组件,可以提取纯文本并且完全采用本机代码。 但它不支持修改它们或提取图形/样式。 他们的SM Export组件集允许生成Word文档,但我认为它不支持阅读它们。 我们使用 TSMWordDocument,与 COM 自动化相比,它的速度快得离谱。 我们遇到的唯一缺点是,即使它与 Delphi 2009 兼容,它仍然无法处理国际文本,除非系统代码页匹配(因此日语系统上的日语是可以的,但在英语系统上则不行)。

Scalabium has TSMWordDocument component that can extract the plain text and is entirely in native code. It doesn't support modifying them or extracting graphics/styles though. Their SM Export component set allows generating Word documents, but I don't think it supports reading them. We use the TSMWordDocument one and it's ridiculously fast compared to COM automation. The only downside we've hit is that it even though it's Delphi 2009 compatible, it still doesn't handle international text unless the system codepage matches (so Japanese on a Japanese system is ok, but not on an English one).

夏末 2024-07-31 15:41:05

您可以使用 .NET 库并为其创建一个 ActiveX/COM 包装器,您可以从 Delphi 中使用它。

本文介绍了 COM 和 .NET 之间的互操作可能性。 查看“使用 COM 中的 .NET 对象”

You could use the .NET library and create an ActiveX/COM wrapper for it, which you can use from Delphi.

This article describes the interop possibilities between COM and .NET. Look at "Using .NET Objects from COM"

楠木可依 2024-07-31 15:41:05

Microsoft 的格式非常复杂,编写一组组件并使其保持最新需要大量工作才能在没有自动化的情况下完成您想要的操作。

Winsoft 的 Office 组件套件,但您会发现它尚未更新以供使用使用最新版本的 Office 或 Delphi 2009+。

Microsoft's formats are so complex that it is a lot of work to write, and keep up to date, a set of components to do what you want without automation.

There is Winsoft's Office Component Suite, but you'll see that hasn't been updated to work with the latest version of Office, or with Delphi 2009+.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文