Browse Source

Add new worksheet() API for Document class

master
Debao Zhang 11 years ago
parent
commit
a7e2ee7430
  1. 9
      src/xlsx/xlsxdocument.cpp
  2. 1
      src/xlsx/xlsxdocument.h

9
src/xlsx/xlsxdocument.cpp

@ -592,6 +592,15 @@ Workbook *Document::workbook() const
return d->workbook.data(); 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. * Creates and append an document with name \a name.
* Return true if success. * Return true if success.

1
src/xlsx/xlsxdocument.h

@ -92,6 +92,7 @@ public:
bool deleteWorksheet(const QString &name); bool deleteWorksheet(const QString &name);
Workbook *workbook() const; Workbook *workbook() const;
Worksheet *worksheet(const QString &sheetName) const;
Worksheet *currentWorksheet() const; Worksheet *currentWorksheet() const;
Q_DECL_DEPRECATED bool setSheetName(const QString &name); Q_DECL_DEPRECATED bool setSheetName(const QString &name);
Q_DECL_DEPRECATED void setCurrentWorksheet(int index); Q_DECL_DEPRECATED void setCurrentWorksheet(int index);

Loading…
Cancel
Save