Is there a dev kit/lib (written in c or c++) to write docx files? Microsoft has a dev kit, but it's written in C#.
-
A docx file is just a ZIP of a folder tree containing XML files. Can't be all that hard to deal with, right? I'd guess that you only need a few of the XML files to get Word to open it. Most of them provide for metadata and support advanced features. – RBerteig Aug 06 '10 at 01:42
-
Yeah, that's what I'm probably going to end up doing. I was just hoping that I would be able to find a comprehensive library (not via automation) that could do it for me... – Kevin Aug 06 '10 at 16:48
-
does the below answer your question? – Todd Main Jan 20 '11 at 05:28
4 Answers
Given the complexity of the XML schema behind OOXML (the Open Office XML file format behind .docx files), you might want to consider using a tool to help you create an XSLT stylesheet that can generate the required output XML. Then use one of the C based XSLT engines (XT or Xalan-c from memory) to do the transform(s) before zipping them up.
Altova's Stylevision looks to have good support for creating the stylesheets but I haven't used it myself. Might be worth a look.

- 26
- 1
Not a kit, but you can try the Word Automation Class, which would work for Word 2007/2010 as well. Details on this answer.
I don't know the answer directly but if you can't find one, can you just writed a C# managed com object that exposes what you need and then just call CoCreateInstance to access the type library from c or c++?

- 6,421
- 3
- 31
- 35
I believe Microsoft intends you to do one of the following things:
1) Have your tool output / manipulate RTF files, which can then be read in by Word 2007.
2) Programatically invoke Word to create the document itself, using its automation API.
I don't think the file format itself is something they generally expose the API to.

- 13,428
- 21
- 78
- 107