How can I export QTableView to Excel file (*.xlsx)
-
@Thank-You said in How can I export QTableView to Excel file (*.xlsx):
Sorry I can't understand python at all
Well that's a shame, because when I was doing Python Qt I had to adapt all examples from C++, which I managed. The important part here is really just https://doc.qt.io/qt-5/qtexttableformat.html. The example code is self-explanatory, and dead easy to convert, IMHO. Up to you what effort you want to make.
Can you send me link where there is information for printing all the data in C++
What information for "printing all the data in C++"?
-
@JonB Ya its bad
But I don't want to learn python in any way
I don't like it at all and mainly while using QT at least for nowI mean if you know about c++ code for printing QTableView then send me link
I searched today for many hours
It would be very helpful -
@JonB Do you know any method to export to any file (.xlsx or .csv or .pdf) or simply print
https://stackoverflow.com/questions/3147030/qtableview-printing
This link worked but
I have tableview with 30 columns
So Data break thereIts so important
I am continiously searching this for whole day
Please help me -
@Thank-You
Hi
It's quite different to export to CSV versus actually printing to a pdf as with
CSV file the number of columns doesn't matter but with actual printing, you have the page limits to consider.So do you need actual printing (PDF) or is data export just fine ? ( CSV)
With CSV you will get a file which you have to print using excel or other app than can import CSV file. -
-
@Thank-You
Hi
For actual printing, your only option is to reduce the font size to try to make it fit to paper.
Maybe also set it to landscape mode. But it sounds like it really cant fit if you have 30.
Page wrapping on width is hard with a table. (IMHO)For export to CSV. you can use
https://github.com/VSRonin/QtModelUtilities
it has a nice exporter
https://vsronin.github.io/QtModelUtilities/class_csv_model_serialiser.html