Y
Y
Yuri2014-02-08 18:26:32
Qt
Yuri, 2014-02-08 18:26:32

How to generate xlsx and ods files from a Qt application?

It is necessary to generate xlsx and ods files from an application on Qt. The search for ready-made open source libraries was not successful, and the use of ActiveX and similar solutions is unacceptable - the application is cross-platform, and file generation should work natively, regardless of the platform.
Actually, the simplest option is required: a table without any formatting at all . That is, write a certain class that is filled with data somewhere in the loop and forms a file. You just need the correct cell type: float or string. There is an idea to implement it myself, using the capabilities of QtXml, of course I found the format specifications, but I almost fainted: studying documents in several parts for 5000 pages is beyond my strength.
If anyone has the opportunity to give an example of a minimally simple file read by MS Excel and LO Calc, I will be very grateful, because after saving the test file by these monsters, a lot of data is stored there, many of which (as I suspect) are optional.
Please do not offer CSV for certain reasons.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
J
Jiendarbiev, 2014-02-09
@Jiendarbiev

look towards the PHPExcel class, however, it can only create xls files, but there are traditionally no problems opening in later versions of the office.) There is even formatting support. Works on qt

A
Alexander Orlov, 2014-02-08
@alexis031182

Have you looked at this project ? I haven't tried it myself, but the description sounds like it. It certainly does not work with ods, but still.

3
39dotyt, 2014-02-20
@39dotyt

My task was to form simple docx-documents according to a template, including simple tables inside with a varying number of lines. I made a document template, dug inside document.xml, everything is clear there, in principle. To repeat the cells, I just repeat one sex several times, without any QtXML, I work with the help of a banal replace) Clumsy, but the task is solved as required. I think xlsx will work fine too. And for ods, the library seemed to be adequate for C ++.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question