i think you can go online and find your answer
I'm working on a free, open source, cross platform C++ library for generating both DOCX and XLSX files
but will also include a command line util and some API's for Java and PHP.
Hopefully, the first release will be ready in a couple of month.
If you'd like, I'll be happy to send you a copy as soon as it's ready.
I did write a DOCX and XLSX libraries for a different language/platform almost 2 years ago
and I'm now translating the project to C++.
Below is a link to a presentation I did last year, if you'd like to get a preview of what's coming :)