Home » excel » activex – Formatting Excel Document in Qt

activex – Formatting Excel Document in Qt

Posted by: admin March 9, 2020 Leave a comment

Questions:

I am using Qt 4.5 and Windows XP. I need to create an Microsoft Excel Document that has data (some labels and values) from the Qt application. I need to format those data with some fonts,bold,italics,color, background color etc., Besides ordinary data, there will be Picture files (JPG) also. I need to add those into the Excel. I know retrieving values from Excel using QAxWidget, QAxObject. But I don’t have a clue about the formatting options that can be applied to cells through Qt and adding images as well?? Any help regarding this are welcome.

How to&Answers:

There are a few options:

  1. Use a cross platform library
    • xlslib is one such library
  2. Use the Excel Object model directly If your program will run on a
    machine that has office installed
    you can use COM or ActiveX to tie into the
    Excel object model to create the
    workbooks. Excel has a rich and
    complete object that will let you do
    most operations.
  3. Write to an intermediate database Write the QT
    data to some type of database and
    pull the data using Excel. This
    route requires in depth Excel
    knowledge and a database.
  4. Write out an XML format that Excel can understand