1
0
mirror of https://github.com/QtExcel/QXlsx.git synced 2025-01-30 05:02:52 +08:00

Add a methon to class Document

Add a methon to class Document in order to set sheet to be actived by the index.
This commit is contained in:
SkyZhou 2022-05-15 15:12:40 +08:00 committed by Daniel Nicoletti
parent 296e01a3db
commit 9ae0d17acb
2 changed files with 11 additions and 0 deletions

View File

@ -100,6 +100,7 @@ public:
bool insertSheet(int index, const QString &name = QString(),
AbstractSheet::SheetType type = AbstractSheet::ST_WorkSheet);
bool selectSheet(const QString &name);
bool selectSheet(int index);
bool renameSheet(const QString &oldName, const QString &newName);
bool copySheet(const QString &srcName, const QString &distName = QString());
bool moveSheet(const QString &srcName, int distIndex);

View File

@ -1204,6 +1204,16 @@ bool Document::selectSheet(const QString &name)
return d->workbook->setActiveSheet(sheetNames().indexOf(name));
}
/*!
* \brief Set worksheet whose index is \a index to be active sheet.
* Returns true if success.
*/
bool Document::selectSheet(int index)
{
Q_D(Document);
return d->workbook->setActiveSheet(index);
}
/*!
* Returns the names of worksheets contained in current document.
*/