Important: Please read the Qt Code of Conduct -

How to generate report in PDF/CSV format

  • Hi, i am trying to generate a report using test results to a table. How can i generate a table and push the test results to the table using QT. Can a table be drawn as shown in the sample reference image below and fill data in blank spaces from code. Kindly help me


  • @Rajesh-Panati
    In a word, you're going to have write whatever code yourself. You can probably achieve the output above with a dedicated form layout hand-designed, though it will take some work. The literal text will be QLabels and the "blanks" will be QWidgets like QLineEdit. You could have a custom data model behind it, possibly with a QDataWidgetMapper if you want to tie the widgets input/output to the model. It will not be a "click in blanks to type" in the way it can be in, say a PDF form editor, though you could make it such if you really wanted, but not straightforward.

    You can write code to read/write a CSV file mapped to the model, or directly to the widgets. Once you have your form filled in, you can send it as the visual page to a PDF printer/exporter.

  • Lifetime Qt Champion


    There are third party packages like QtRPT that you might find interesting.

  • @JonB Thanks for your suggestion, will try it out.

  • @SGaist Thank you for the response. I will try that.

Log in to reply