How to use insert row in Qtxlsx. Please Help me
Moved
Unsolved
3rd Party Software
-
-
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); }