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

How to embed excel/openoffice cal in qt application



  • hi,

    i need a help to embed excel/openofficecal in my qt application.i have used setControl(Excel.Application).excel is opening as a separate application.i want to show excel in Qmainwindow.Is it possible in qt??????



  • Exactly the same question from me.....



  • I tried to do this a couple years ago and there wasn't much support. There are a couple c++ libraries out there that have wrappers to read and write to an excel workbook but that's all that I know of.

    I ended up using a QTableView / QTableWidget and styled it enough to look like an excel document and using an active X control to write to the .xls files to output the proper data to the spreadsheet on a save action. Unfortunately its quite a bit of code for such a somewhat simple task (from my experience, the active x control io is hard to error check).

    Just looking around now though, this seems like a fairly new project that will allow you to do the xls file IO.
    https://github.com/dbzhang800/QtXlsxWriter



  • Wow... Hi...
    Thank you so much for your kindly contribution. But, do you still have something similar to open a PPT, a Word documentation, etc???

    Cheers
    Pei



  • Hi, Zhang:

    It seems your open source reports a bug when I tried to build the library, I got

    bq. 1>GeneratedFiles\Debug\moc_xlsxdocument.cpp(62): error C2491: “QXlsx::Document::staticMetaObject” definition of dllimport static data member not allowed

    What happened to this variable?
    @const QMetaObject QXlsx::Document::staticMetaObject = {
    { &QObject::staticMetaObject, qt_meta_stringdata_QXlsx__Document.data,
    qt_meta_data_QXlsx__Document, qt_static_metacall, 0, 0}
    };@

    Please let me know at your convenience.

    Cheers
    Pei



  • Hi,

    In which way the library you used? If you are integrate the source code into your application directly, the following macro is needed.

    @
    XLSX_NO_LIB
    @

    This macro will be defined automatically if your are using qmake. Otherwise you need to defined it yourself.


Log in to reply