Manipulating .doc files with c++

Hi everyone,

I'm trying to figure out what I need to do to be able to manipulate .doc files with c++. I know how to do it with txt files, but can't seem to find any information on what I need (libraries, etc.) or if it's the same process as txt file manipulation. Any help would be appreciated greatly.

Thanks,
delx

[EDIT] I'm not looking for any source code, just trying to get pointed in the right direction, if what I'm trying to do is even possible. Thanks again.
Last edited on
closed account (z05DSL3A)
The Microsoft Office Word 97-2007 Binary File Format Specification can be found here:
http://www.microsoft.com/interop/docs/OfficeBinaryFormats.mspx
You don't care about Word format.
Use Ole Aut.
Dozens of samples in MSDN.
closed account (z05DSL3A)
delx,

What is the manipulation that you are trying to do?

There is Automation (formerly OLE Automation) as george135 suggests, but that may be a sledge hammer to crack a nut.

Three Ways to Use Automation from Visual C++
There are three basic ways you can use Automation: MFC, #import, and C/C++:

• With MFC, use the Visual C++ ClassWizard to generate "wrapper classes" from the Microsoft Office type libraries. These classes, as well as other MFC classes, such as COleVariant, COleSafeArray, and COleException, simplify the tasks of Automation. This method is usually recommended over the others, and most of the Microsoft Knowledge Base examples use MFC.

• #import, a new directive that became available with Visual C++ 5.0, creates VC++ "smart pointers" from a specified type library. It is very powerful, but often not recommended because of reference-counting problems that typically occur when used with the Microsoft Office applications.

• C/C++ Automation is much more difficult, but sometimes necessary to avoid overhead with MFC, or problems with #import. Basically, you work with such APIs as CoCreateInstance(), and COM interfaces such as IDispatch and IUnknown.

from: http://support.microsoft.com/kb/238972


There are also third party libraries/controls; such as TX Text Control, that you can pay for.

You could also take a look at the code for OpenOffice.org to see how they do it.

Or you could develop your own libray.
Last edited on
Topic archived. No new replies allowed.