Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Editing a spreadsheet
I want to edit a spreadsheet (Excel file) and keep the presentation (color, invisible cells,..) because i need to print the table after editing it.
What is the best way to handle this with Qt ? Convert to HTML ? to csv ? to xml ?
I'm open to any suggestions :)
If you can just select the excel XML format, i would go that route.
Then just load it as pure xml and change what you need.
But it depends on what you need to change. if you must do massive changes, xml is annoying as u must add nodes etc the right places.
I just need to add few informations (5 or 6 string).
If i use xml i will keep the excel graphic ?
ok, would be really easy with XML format.
I did not test in newer versions.
In 2007 office it did not keep
You should just test it.
For xlsx files you can try using QtXlsxWriter. it might loose some of the contents of the file if it's very complex so I'd give it a test run.
Hi @VRonin and thanks for the reply,
I don't know how to install module on Qt, can you explain me how to do it ?
The homepage, under "Getting started" has quite clear instructions
Yep my bad,
But when i include the .pri file i get compiling error about a QVectorQZipReader::FileInfo in the ZipReader::init function
Perfect ! Thank you very much for your work :)
Hi again @VRonin ,
How, do you think, can i print my xlsx doc after editing ?
@Zoptune The library has no rendering functionality i.e. has no tool to "paint" the excel document, just to edit its parts. If you have excel installed on the machine that should print the file you can try this solution and use QProcess in your program to launch the WScript.exe
@VRonin Yep, this is solution i have seen yesterday, but i don't want to have Excel installed so i use a QProcess that launch LibreOffice to do a convertion in a pdf file and then print the pdf from my app.
I'm trying to find if it is possible with QtXlsx to change the document orientation (i need it to be in landscape format).
There is a pull request on the main project that implements the feature. The author did not submit it to my fork so I did not review and merged it yet but feel free to try it
@VRonin Sorry but i never used git,
Can u explain me how to do ?
EDIT : tried but doesn't work, the output file is corrupted
EDIT 2 : It's working now :)