diff --git a/src/xlsx/xlsxdocument.cpp b/src/xlsx/xlsxdocument.cpp index a5f1048..f39b2ba 100644 --- a/src/xlsx/xlsxdocument.cpp +++ b/src/xlsx/xlsxdocument.cpp @@ -592,6 +592,15 @@ Workbook *Document::workbook() const return d->workbook.data(); } +/*! + * Returns the worksheet object named \a sheetName. + */ +Worksheet *Document::worksheet(const QString &sheetName) const +{ + Q_D(const Document); + return d->workbook->worksheet(worksheetNames().indexOf(sheetName)); +} + /*! * Creates and append an document with name \a name. * Return true if success. diff --git a/src/xlsx/xlsxdocument.h b/src/xlsx/xlsxdocument.h index fa020d8..9b95de9 100644 --- a/src/xlsx/xlsxdocument.h +++ b/src/xlsx/xlsxdocument.h @@ -92,6 +92,7 @@ public: bool deleteWorksheet(const QString &name); Workbook *workbook() const; + Worksheet *worksheet(const QString &sheetName) const; Worksheet *currentWorksheet() const; Q_DECL_DEPRECATED bool setSheetName(const QString &name); Q_DECL_DEPRECATED void setCurrentWorksheet(int index);