Extracting graphics from Excel?



  • How can I do it. This way for example can get values (text and numbers)from Excel

    
    QAxObject* excel     = new QAxObject("Excel.Application");
    QAxObject* workbooks = excel->querySubObject("Workbooks");
    QAxObject* workbook  = workbooks->querySubObject("Open(const QString&)","c:\\temp\\i1.xlsx");
    QAxObject* sheets    = workbook->querySubObject("Worksheets");
    QAxObject* sheet     = sheets->querySubObject("Item(int)", 1);
    excel->dynamicCall("ScreenUpdating()", false);
    i = 0;
    for (int f = 2; f <= 80; ++f){
        p = 0;
        for(int c = 2; c <= 11; ++c){
            auto cCell = sheet->querySubObject("Cells(int,int)",f,c);
            if(cCell->dynamicCall("Value()").value<int>() == NULL){
               if(c == 2){
                  a = cCell->dynamicCall("Value()").toString();
                  p +=  1;
               }else if(c == 4){
                  d = cCell->dynamicCall("Value()").toString();
                  p +=  1;
               }
            }
        }
    }
    excel->dynamicCall("Quit()");
    excel->dynamicCall("DisplayAlerts", false);
    delete excel;
    

    However, i want to pictures or statistical graphics



  • @meepo1 Maybe you should ask help from a Microsoft/Office oriented forum. Your question has nothing to do with Qt.



  • @Eeli-K there are other threads that ask about Excel in this forum and i've never seen any reply that says the same as you.
    PS: In addition, where can i find QAXOBJECT out of this forum



  • @meepo1 Sorry, I misread the class name, QAxObject is really a Qt class and the question was appropriate. But it still requires non-Qt expertise so you may not be lucky here. It's a COM wrapper and agnostic about the commands. You could ask about it in stackoverflow or some MS/COM related forum. Someone can of course know and answer here, even if a question was not Qt related.



  • Rename the excel file as zip...
    extract image like xml .. close all.
    rename back...
    or zip reader from QT..
    https://github.com/pehohlva/DocSpeacker/blob/master/src/st_lib/gzipreader.h

    https://stackoverflow.com/questions/11082278/how-to-properly-assemble-a-valid-xlsx-file-from-its-internal-sub-components

    other way...
    the best to have a sample to build qt Component..
    https://github.com/dbzhang800/QtXlsxWriter

    Documentation: http://qtxlsx.debao.me

    QtXlsx is a library that can read and write Excel files. It doesn't require Microsoft Excel and can be used in any platform that Qt5 supported. The library can be used to

    Generate a new .xlsx file from scratch
    Extract data from an existing .xlsx file
    Edit an existing .xlsx file
    Getting Started

    For linux user, if your Qt is installed through package manager tools such "apt-get", make sure that you have installed the Qt5 develop package qtbase5-private-dev
    Usage(1): Use Xlsx as Qt5's addon module


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.