Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. How to use insert row in Qtxlsx. Please Help me

How to use insert row in Qtxlsx. Please Help me

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
4 Posts 3 Posters 2.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    seokwon
    wrote on last edited by
    #1

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

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      https://github.com/dbzhang800/QtXlsxWriter/issues/166

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      S 1 Reply Last reply
      2
      • VRoninV VRonin

        https://github.com/dbzhang800/QtXlsxWriter/issues/166

        S Offline
        S Offline
        seokwon
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • CatarinoC Offline
          CatarinoC Offline
          Catarino
          wrote on last edited by Catarino
          #4

          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);
          
          }
          

          Best regards,

          M. Catarino

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved