O
O
Oleg Seledets2018-08-13 23:10:59
Qt
Oleg Seledets, 2018-08-13 23:10:59

How to display those columns that are not hidden in the file?

Hello.
This is how I remove the visibility from the column:
ui->tableView->setColumnHidden(19, true);
The database header is displayed in Excel, in this way:

int rows = ui->tableView->horizontalHeader()->count();
    int columns = ui->tableView->verticalHeader()->count();
    for(int k=1; k<rows;k++)
    {
        QVariant header = ui->tableView->model()->headerData(k, Qt::Horizontal);
        QAxObject *cell = StatSheet->querySubObject("Cells(QVariant,QVariant)", 1, k);
        cell->setProperty("Value", QVariant(header));
        cell->dynamicCall("Select()"); 
        cell->dynamicCall("WrapText",1); 
    }

If the columns are not hidden, then it displays everything correctly. If the column is hidden, it will still appear in the Excel file.
How can I solve this problem, where to dig?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2018-08-14
@oleja1ee7

The horizontalHeader() method returns an object of type QHeaderView which has an isSectionHidden() method and many other useful methods. The verticalHeader() method returns the same.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question