Worksheet Class

Represent one worksheet in the workbook. More...

Header: #include <Worksheet>
Inherits: AbstractSheet.

Public Functions

~Worksheet()
bool addConditionalFormatting(const ConditionalFormatting & cf)
bool addDataValidation(const DataValidation & validation)
Cell * cellAt(const CellReference & row_column) const
Cell * cellAt(int row, int column) const
Format columnFormat(int column)
double columnWidth(int column)
CellRange dimension() const
bool groupColumns(int colFirst, int colLast, bool collapsed = true)
bool groupColumns(const CellRange & range, bool collapsed = true)
bool groupRows(int rowFirst, int rowLast, bool collapsed = true)
Chart * insertChart(int row, int column, const QSize & size)
bool insertImage(int row, int column, const QImage & image)
bool isColumnHidden(int column)
bool isFormulasVisible() const
bool isGridLinesVisible() const
bool isOutlineSymbolsVisible() const
bool isRightToLeft() const
bool isRowColumnHeadersVisible() const
bool isRowHidden(int row)
bool isRulerVisible() const
bool isSelected() const
bool isWhiteSpaceVisible() const
bool isWindowProtected() const
bool isZerosVisible() const
bool mergeCells(const CellRange & range, const Format & format = Format())
QList<CellRange> mergedCells() const
QVariant read(int row, int column) const
QVariant read(const CellReference & row_column) const
Format rowFormat(int row)
double rowHeight(int row)
bool setColumnFormat(const CellRange & range, const Format & format)
bool setColumnFormat(int colFirst, int colLast, const Format & format)
bool setColumnHidden(const CellRange & range, bool hidden)
bool setColumnHidden(int colFirst, int colLast, bool hidden)
bool setColumnWidth(const CellRange & range, double width)
bool setColumnWidth(int colFirst, int colLast, double width)
void setFormulasVisible(bool visible)
void setGridLinesVisible(bool visible)
void setOutlineSymbolsVisible(bool visible)
void setRightToLeft(bool enable)
void setRowColumnHeadersVisible(bool visible)
bool setRowFormat(int rowFirst, int rowLast, const Format & format)
bool setRowHeight(int rowFirst, int rowLast, double height)
bool setRowHidden(int rowFirst, int rowLast, bool hidden)
void setRulerVisible(bool visible)
void setSelected(bool select)
void setWhiteSpaceVisible(bool visible)
void setWindowProtected(bool protect)
void setZerosVisible(bool visible)
bool unmergeCells(const CellRange & range)
bool write(int row, int column, const QVariant & value, const Format & format = Format())
bool write(const CellReference & row_column, const QVariant & value, const Format & format = Format())
bool writeBlank(int row, int column, const Format & format = Format())
bool writeBlank(const CellReference & row_column, const Format & format = Format())
bool writeBool(int row, int column, bool value, const Format & format = Format())
bool writeBool(const CellReference & row_column, bool value, const Format & format = Format())
bool writeDateTime(int row, int column, const QDateTime & dt, const Format & format = Format())
bool writeDateTime(const CellReference & row_column, const QDateTime & dt, const Format & format = Format())
bool writeFormula(int row, int column, const CellFormula & formula_, const Format & format = Format(), double result = 0)
bool writeFormula(const CellReference & row_column, const CellFormula & formula, const Format & format = Format(), double result = 0)
bool writeHyperlink(int row, int column, const QUrl & url, const Format & format = Format(), const QString & display = QString(), const QString & tip = QString())
bool writeHyperlink(const CellReference & row_column, const QUrl & url, const Format & format = Format(), const QString & display = QString(), const QString & tip = QString())
bool writeInlineString(int row, int column, const QString & value, const Format & format = Format())
bool writeInlineString(const CellReference & row_column, const QString & value, const Format & format = Format())
bool writeNumeric(int row, int column, double value, const Format & format = Format())
bool writeNumeric(const CellReference & row_column, double value, const Format & format = Format())
bool writeString(int row, int column, const RichString & value, const Format & format = Format())
bool writeString(const CellReference & row_column, const RichString & value, const Format & format = Format())
bool writeString(const CellReference & row_column, const QString & value, const Format & format = Format())
bool writeString(int row, int column, const QString & value, const Format & format = Format())
bool writeTime(int row, int column, const QTime & t, const Format & format = Format())
bool writeTime(const CellReference & row_column, const QTime & t, const Format & format = Format())

Additional Inherited Members

Detailed Description

Represent one worksheet in the workbook.

Member Function Documentation

Worksheet::~Worksheet()

Destroys this workssheet.

bool Worksheet::addConditionalFormatting(const ConditionalFormatting & cf)

Add one ConditionalFormatting cf to the sheet. Returns true on success.

bool Worksheet::addDataValidation(const DataValidation & validation)

Add one DataValidation validation to the sheet. Returns true on success.

Cell * Worksheet::cellAt(const CellReference & row_column) const

Returns the cell at the given row_column. If there is no cell at the specified position, the function returns 0.

Cell * Worksheet::cellAt(int row, int column) const

Returns the cell at the given row and column. If there is no cell at the specified position, the function returns 0.

Format Worksheet::columnFormat(int column)

Returns formatting of the column. Columns are 1-indexed.

See also setColumnFormat().

double Worksheet::columnWidth(int column)

Returns width of the column in characters of the normal font. Columns are 1-indexed.

See also setColumnWidth().

CellRange Worksheet::dimension() const

Return the range that contains cell data.

bool Worksheet::groupColumns(int colFirst, int colLast, bool collapsed = true)

Groups columns from colFirst to colLast with the given collapsed. Returns false if error occurs.

bool Worksheet::groupColumns(const CellRange & range, bool collapsed = true)

This is an overloaded function.

Groups columns with the given range and collapsed.

bool Worksheet::groupRows(int rowFirst, int rowLast, bool collapsed = true)

Groups rows from rowFirst to rowLast with the given collapsed.

Returns false if error occurs.

Chart * Worksheet::insertChart(int row, int column, const QSize & size)

Creates an chart with the given size and insert at the position row, column. The chart will be returned.

bool Worksheet::insertImage(int row, int column, const QImage & image)

Insert an image at the position row, column Returns true on success.

bool Worksheet::isColumnHidden(int column)

Returns true if column is hidden. Columns are 1-indexed.

bool Worksheet::isFormulasVisible() const

Return whether formulas instead of their calculated results shown in cells

bool Worksheet::isGridLinesVisible() const

Return whether gridlines is shown or not.

bool Worksheet::isOutlineSymbolsVisible() const

Return whether is outline symbols is shown.

bool Worksheet::isRightToLeft() const

Return whether the sheet is shown right-to-left or not.

bool Worksheet::isRowColumnHeadersVisible() const

Return whether is row and column headers is vislbe.

bool Worksheet::isRowHidden(int row)

Returns true if row is hidden.

bool Worksheet::isRulerVisible() const

Return whether is ruler is shown.

bool Worksheet::isSelected() const

Return whether this tab is selected.

bool Worksheet::isWhiteSpaceVisible() const

Return whether is white space is shown.

bool Worksheet::isWindowProtected() const

Returns whether sheet is protected.

bool Worksheet::isZerosVisible() const

Return whether is cells that have zero value show a zero.

bool Worksheet::mergeCells(const CellRange & range, const Format & format = Format())

Merge a range of cells. The first cell should contain the data and the others should be blank. All cells will be applied the same style if a valid format is given. Returns true on success.

Note: All cells except the top-left one will be cleared.

QList<CellRange> Worksheet::mergedCells() const

Returns all the merged cells.

QVariant Worksheet::read(int row, int column) const

Return the contents of the cell (row, column).

QVariant Worksheet::read(const CellReference & row_column) const

This is an overloaded function.

Return the contents of the cell row_column.

Format Worksheet::rowFormat(int row)

Returns format of row.

See also setRowFormat().

double Worksheet::rowHeight(int row)

Returns height of row in points.

See also setRowHeight().

bool Worksheet::setColumnFormat(const CellRange & range, const Format & format)

Sets format property of a range of columns to format. Columns are 1-indexed. Returns true on success.

See also columnFormat().

bool Worksheet::setColumnFormat(int colFirst, int colLast, const Format & format)

Sets format property of a range of columns [colFirst, colLast] to format. Columns are 1-indexed. Returns true on success.

bool Worksheet::setColumnHidden(const CellRange & range, bool hidden)

Sets hidden property of a range of columns to hidden. Columns are 1-indexed. Hidden columns are not visible. Returns true on success.

See also isColumnHidden().

bool Worksheet::setColumnHidden(int colFirst, int colLast, bool hidden)

Sets hidden property of a range of columns [colFirst, colLast] to hidden. Columns are 1-indexed. Returns true on success.

bool Worksheet::setColumnWidth(const CellRange & range, double width)

Sets width in characters of a range of columns to width. Returns true on success.

See also columnWidth().

bool Worksheet::setColumnWidth(int colFirst, int colLast, double width)

Sets width in characters for columns [colFirst, colLast] to width. Columns are 1-indexed. Returns true on success.

void Worksheet::setFormulasVisible(bool visible)

Show formulas in cells instead of their calculated results when visible is true.

See also isFormulasVisible().

void Worksheet::setGridLinesVisible(bool visible)

Show or hide the gridline based on visible

See also isGridLinesVisible().

void Worksheet::setOutlineSymbolsVisible(bool visible)

Show or hide the outline symbols based ib visible.

See also isOutlineSymbolsVisible().

void Worksheet::setRightToLeft(bool enable)

Enable or disable the right-to-left based on enable.

See also isRightToLeft().

void Worksheet::setRowColumnHeadersVisible(bool visible)

Show or hide the row column headers based on visible

See also isRowColumnHeadersVisible().

bool Worksheet::setRowFormat(int rowFirst, int rowLast, const Format & format)

Sets the format of the rows including and between rowFirst and rowLast. Rows are 1-indexed.

Returns true if success.

See also rowFormat().

bool Worksheet::setRowHeight(int rowFirst, int rowLast, double height)

Sets the height of the rows including and between rowFirst and rowLast. Row height measured in point size. Rows are 1-indexed.

Returns true if success.

See also rowHeight().

bool Worksheet::setRowHidden(int rowFirst, int rowLast, bool hidden)

Sets the hidden proeprty of the rows including and between rowFirst and rowLast. Rows are 1-indexed. If hidden is true rows will not be visible.

Returns true if success.

See also isRowHidden().

void Worksheet::setRulerVisible(bool visible)

Show or hide the ruler based on visible.

See also isRulerVisible().

void Worksheet::setSelected(bool select)

Select this sheet if select is true.

See also isSelected().

void Worksheet::setWhiteSpaceVisible(bool visible)

Show or hide the white space based on visible.

See also isWhiteSpaceVisible().

void Worksheet::setWindowProtected(bool protect)

Protects/unprotects the sheet based on protect.

See also isWindowProtected().

void Worksheet::setZerosVisible(bool visible)

Show a zero in cells that have zero value if visible is true.

See also isZerosVisible().

bool Worksheet::unmergeCells(const CellRange & range)

Unmerge the cells in the range. Returns true on success.

bool Worksheet::write(int row, int column, const QVariant & value, const Format & format = Format())

Write value to cell (row, column) with the format. Both row and column are all 1-indexed value.

Returns true on success.

bool Worksheet::write(const CellReference & row_column, const QVariant & value, const Format & format = Format())

This is an overloaded function.

Write value to cell row_column with the format. Both row and column are all 1-indexed value. Returns true on success.

bool Worksheet::writeBlank(int row, int column, const Format & format = Format())

Write a empty cell (row, column) with the format. Returns true on success.

bool Worksheet::writeBlank(const CellReference & row_column, const Format & format = Format())

This is an overloaded function.

Write a empty cell row_column with the format. Returns true on success.

bool Worksheet::writeBool(int row, int column, bool value, const Format & format = Format())

Write a bool value to the cell (row, column) with the format. Returns true on success.

bool Worksheet::writeBool(const CellReference & row_column, bool value, const Format & format = Format())

This is an overloaded function.

Write a bool value to the cell row_column with the format. Returns true on success.

bool Worksheet::writeDateTime(int row, int column, const QDateTime & dt, const Format & format = Format())

Write a QDateTime dt to the cell (row, column) with the format. Returns true on success.

bool Worksheet::writeDateTime(const CellReference & row_column, const QDateTime & dt, const Format & format = Format())

This is an overloaded function.

Write a QDateTime dt to the cell row_column with the format. Returns true on success.

bool Worksheet::writeFormula(int row, int column, const CellFormula & formula_, const Format & format = Format(), double result = 0)

Write formula_ to the cell (row, column) with the format and result. Returns true on success.

bool Worksheet::writeFormula(const CellReference & row_column, const CellFormula & formula, const Format & format = Format(), double result = 0)

This is an overloaded function.

Write formula to the cell row_column with the format and result. Returns true on success.

bool Worksheet::writeHyperlink(int row, int column, const QUrl & url, const Format & format = Format(), const QString & display = QString(), const QString & tip = QString())

Write a QUrl url to the cell (row, column) with the given format display and tip. Returns true on success.

bool Worksheet::writeHyperlink(const CellReference & row_column, const QUrl & url, const Format & format = Format(), const QString & display = QString(), const QString & tip = QString())

This is an overloaded function.

Write a QUrl url to the cell row_column with the given format display and tip. Returns true on success.

bool Worksheet::writeInlineString(int row, int column, const QString & value, const Format & format = Format())

Write string value to the cell (row, column) with the format. Returns true on success.

bool Worksheet::writeInlineString(const CellReference & row_column, const QString & value, const Format & format = Format())

This is an overloaded function.

Write string value to the cell row_column with the format

bool Worksheet::writeNumeric(int row, int column, double value, const Format & format = Format())

Write numeric value to the cell (row, column) with the format. Returns true on success.

bool Worksheet::writeNumeric(const CellReference & row_column, double value, const Format & format = Format())

This is an overloaded function.

Write numeric value to the cell row_column with the format. Returns true on success.

bool Worksheet::writeString(int row, int column, const RichString & value, const Format & format = Format())

Write string value to the cell (row, column) with the format. Returns true on success.

bool Worksheet::writeString(const CellReference & row_column, const RichString & value, const Format & format = Format())

This is an overloaded function.

Write string value to the cell row_column with the format.

Returns true on success.

bool Worksheet::writeString(const CellReference & row_column, const QString & value, const Format & format = Format())

This is an overloaded function.

Write string value to the cell row_column with the format.

bool Worksheet::writeString(int row, int column, const QString & value, const Format & format = Format())

This is an overloaded function.

Write string value to the cell (row, column) with the format. Returns true on success.

bool Worksheet::writeTime(int row, int column, const QTime & t, const Format & format = Format())

Write a QTime t to the cell (row, column) with the format. Returns true on success.

bool Worksheet::writeTime(const CellReference & row_column, const QTime & t, const Format & format = Format())

This is an overloaded function.

Write a QTime t to the cell row_column with the format. Returns true on success.