Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

converting excel sheet to pdf in qt cpp



  • how to convert excel sheet to pdf using qt cpp



  • @harsha123
    Hello and welcome.

    You need to provide more context about your environment and what exactly you want to achieve. For example, I see at least 3 high-level approcahes you may be starting from:

    1. You are running under Windows, and wish to use Automation to talk from your Qt app to a running Excel program to ask it to select the sheet and do the printing for you.

    2. You have a .xls/.xlsx saved file and want to read that in and print it. (And then you have the sub-issue of how much formatting you expect to be respected, e.g. column widths.)

    3. You have exported a .csv file and want to read that and print a table from it.



  • I want to read .xlsx already existing file and convert to pdf file ,no need to print it just need to create only pdf file from that .xlsx file this i need to do in windows qt cpp .



  • @harsha123
    I do not think there is a C++ library for Qt which can read a .xlsx and understand enough about it to actually render/print/export to PDF. I think at best it can parse it. There may be a library for Python which can accomplish this, but not C++.

    I stand to be corrected by someone more knowledgeable, I may be mistaken.

    Maybe I am wrong. What about https://qtexcel.github.io/QXlsx/ ? I see it has

    Qt-Table-Printer is under BSD 3-Clause license. https://github.com/T0ny0/Qt-Table-Printer

    at https://github.com/T0ny0/Qt-Table-Printer. Maybe that can leveraged to produce PDF file (which is why I talked abour "printing" earlier, do print-to-PDF-file).


Log in to reply