简体   繁体   中英

Read/Parse/Modify MS Word document in Delphi without Word Automation

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.

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, eg 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)

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).

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+.

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM