How to use insert row in Qtxlsx. Please Help me



  • How to use insert row in Qtxlsx ? I didnt find this function so I ask your .
    Please help me.





  • @VRonin
    Aleady, I see that.
    So, I dont insert row? Just, Handling this lib source?



  • Assuming you want to show on the screen in the tableview.

    In this example I used QStandardItemModel:

    QXlsx::Document excel(filename);
     int row=excel.dimension().firstRow();
     while(row != excel.dimension().lastRow())
     {
           mModel->setRowCount(excel.dimension().rowCount());
           mModel->setColumnCount(excel.dimension().columnCount());
           for(int col=0; col < excel.dimension().columnCount(); ++col)
          {
                setValueAt(row, col, excel.read(row, col).value<QString>());
          }
          ++row;
    }
    void QExcelView::setValueAt(int row, int col, const QString &value)
    {
        if(!mModel->item(row,col))
            mModel->setItem(row, col, new QStandardItem(value));
        else
            mModel->item(row, col)->setText(value);
    
    }
    

Log in to reply
 

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