Index Workbook Format Error

Class Worksheet


Class for generating Excel spreadsheets. It represents Excel sheet and contains cells. Do not try create object of this class directly. Instead use factrory method Workbook::addWorksheet()

enum Worksheet::Paper
This enum describes paper sizes that may be set by the setPaper() function.
ConstantDescription
PAPER_DEFAULTDefault paper size
PAPER_LETTER8 1/2 x 11 in
PAPER_LETTERSMALL8 1/2 x 11 in
PAPER_TABLOID11 x 17 in
PAPER_LEDGER17 x 11 in
PAPER_LEGAL8 1/2 x 14 in
PAPER_STATEMENT5 1/2 x 8 1/2 in
PAPER_EXECUTIVE7 1/4 x 10 1/2 in
PAPER_A3297 x 420 mm
PAPER_A4210 x 297 mm
PAPER_A4SMALL210 x 297 mm
PAPER_A5148 x 210 mm
PAPER_B4250 x 354 mm
PAPER_B5182 x 257 mm
PAPER_FOLIO8 1/2 x 13 in
PAPER_QUATRO215 x 275 mm
PAPER_10x1410x14 in
PAPER_10x1711x17 in
PAPER_NOTE8 1/2 x 11 in
PAPER_ENVELOPE_93 7/8 x 8 7/8
PAPER_ENVELOPE_104 1/8 x 9 1/2
PAPER_ENVELOPE_114 1/2 x 10 3/8
PAPER_ENVELOPE_124 3/4 x 11
PAPER_ENVELOPE_145 x 11 1/2
PAPER_C_SIZE
PAPER_D_SIZE
PAPER_E_SIZE
PAPER_ENVELOPE_DL110 x 220 mm
PAPER_ENVELOPE_C3324 x 458 mm
PAPER_ENVELOPE_C4229 x 324 mm
PAPER_ENVELOPE_C5162 x 229 mm
PAPER_ENVELOPE_C6114 x 162 mm
PAPER_ENVELOPE_C65114 x 229 mm
PAPER_ENVELOPE_B4250 x 353 mm
PAPER_ENVELOPE_B5176 x 250 mm
PAPER_ENVELOPE_B6176 x 125 mm
PAPER_ENVELOPE_ITALY110 x 230 mm
PAPER_MONARCH3.875 x 7.5 in
PAPER_ENVELOPE3 5/8 x 6 1/2 in
PAPER_FANFOLD14 7/8 x 11 in
PAPER_GERMAN_STD_FANFOLD8 1/2 x 12 in
PAPER_GERMAN_LEGAL_FANFOLD8 1/2 x 13 in

void Worksheet::write(std::wstring cell, std::wstring token, Format* format = NULL)
Write value token to a cell with format.
cell - cell address, for example "A1"
token - unicode value
format - format object, can be NULL
Token can be text, number, formula, date, time, url.

void Worksheet::write(int row, int col, std::wstring token, Format* format = NULL)
Write value token to row and col with format.
row - cell's row
col - cell's column
token - unicode value
format - format object, can be NULL
Token can be text, number, formula, date, time, url.

void Worksheet::write(std::wstring cell, double token, Format* format = NULL)
Write a numeric value token to a cell with format.
cell - cell address, for example "A1"
token - numeric value
format - format object, can be NULL

void Worksheet::write(int row, int col, double token, Format* format = NULL)
Write a numeric value token to row and col with format.
row - cell's row
col - cell's column
token - numeric value
format - format object, can be NULL

void Worksheet::writeRow(std::wstring cell, std::vector<std::vector<std::wstring>> val, Format* format = NULL)
Write an array of values as a row.
cell - cell address of first value, for example "A1"
val - values
format - format object, can be NULL

void Worksheet::writeRow(int row, int col, std::vector<std::vector<std::wstring>> val, Format* format = NULL)
Write an array of values as a row.
row - row of first value
col - column of first value
val - values
format - format object, can be NULL

void Worksheet::writeCol(std::wstring cell, std::vector<std::wstring> val, Format* format = NULL)
Write an array of values as a column.
cell - cell address of first value, for example "A1"
val - values
format - format object, can be NULL

void Worksheet::writeCol(int row, int col, std::vector<std::wstring> val, Format* format = NULL)
Write an array of values as a column.
row - row of first value
col - column of first value
val - values
format - format object, can be NULL

void Worksheet::writeBlank(int row, int col, Format* format = NULL)
Write a blank cell. Use for setting format of cell without writing value.
row - cell's row
col - cell's column
format - format object, can be NULL

void Worksheet::writeNumber(int row, int col, double num, Format* format = NULL)
Write a number.
row - cell's row
col - cell's column
num - number for writing
format - format object, can be NULL

void Worksheet::writeString(int row, int col, std::wstring str, Format* format = NULL)
Write a string.
row - cell's row
col - cell's column
str - string for writing
format - format object, can be NULL

void Worksheet::writeFormula(int row, int col, std::wstring formula, Format* format = NULL)
Write a formula.
row - cell's row
col - cell's column
formula - formula for writing
format - format object, can be NULL

void Worksheet::writeUrl(int row, int col, std::wstring url, std::wstring str = L"", Format* format = NULL)
Write an url.
row - cell's row
col - cell's column
url - url for writing
str - url caption
format - format object, can be NULL

void Worksheet::writeDate(int row, int col, std::wstring date, Format* format = NULL)
Write a date.
row - cell's row
col - cell's column
date - date for writing
format - format object, can be NULL

void Worksheet::writeTime(int row, int col, std::wstring time, Format* format = NULL)
Write a time.
row - cell's row
col - cell's column
time - time for writing
format - format object, can be NULL

void Worksheet::writeDateTime(int row, int col, std::wstring datetime, Format* format = NULL)
Write date and time.
row - cell's row
col - cell's column
datetime - date and time for writing
format - format object, can be NULL

void Worksheet::writeBitmap(int row, int col, std::string filename)
Insert bitmap image in a worksheet.
row - cell's row
col - cell's column
filename - file name of bmp-file

void Worksheet::setColumn(int firstcol, int lastcol, int width, Format* format = NULL, bool hidden = false)
Set the width, format and hidden flag for column(s).
firstcol - first column
lastcol - last column
width - width of each column
format - format object, can be NULL
hidden - hidden flag

void Worksheet::setRow(int row, int height = -1, Format* format = NULL, bool hidden = false)
Set the height, format and hidden flag for a row.
row - row
height - height, for ignore use -1
format - format object, can be NULL
hidden - hidden flag

void Worksheet::setMerge(int first_row, int first_col, int last_row, int last_col)
Set a merged cell range.

void Worksheet::showScreenGridlines(bool show = true)
Show/hide gridlines on the worksheet.

void Worksheet::setZoom(int scale = 100)
Set the worksheet zoom factor.

void Worksheet::activate(bool b = true)
Set active this worksheet (displayed when the workbook is opened).

void Worksheet::select(bool b = true)
Select this worksheet (has highlighted tab).

void Worksheet::setFirstSheet()
Set this worksheet as the first visible sheet.

void Worksheet::protect(const std::string& password)
Protect this worksheet with password.

void Worksheet::setSelection(int first_row, int first_col, int last_row, int last_col)
Set selected cells in this worksheet.

void Worksheet::setPortrait()
Set portrait page orientation.

void Worksheet::setLandscape()
Set landscape page orientation.

void Worksheet::setPaper(Paper size = PAPER_DEFAULT)
Set paper size.

void Worksheet::setHeader(std::string str, double margin = 0.50)
Set page header caption.

void Worksheet::setHeader(std::wstring str, double margin = 0.50)
Set page header caption (unicode).

void Worksheet::setFooter(std::string str, double margin = 0.50)
Set page footer caption.

void Worksheet::setFooter(std::wstring str, double margin = 0.50)
Set page footer caption (unicode).

void Worksheet::centerHorizontally(bool center = true)
Center page horinzontally.

void Worksheet::centerVertically(bool center = true)
Center page vertically.

void Worksheet::setMargins(double margin)
Set all page margins to same value (inches).

void Worksheet::setMarginLeft(double margin = 0.75)
Set left margin (inches).

void Worksheet::setMarginRight(double margin = 0.75)
Set right margin (inches).

void Worksheet::setMarginTop(double margin = 1.00)
Set top margin (inches).

void Worksheet::setMarginBottom(double margin = 1.00)
Set bottom margin (inches).

void Worksheet::showGridlines(bool show = true)
Show/hide gridlines on the printed page.

void Worksheet::printRowColHeaders(bool print = true)
Set the option to print the row and column headers on the printed page.

void Worksheet::setPrintScale(int scale = 100)
Set the scale factor for the printed page.

const std::wstring& Worksheet::name() const
Get worksheet name.

See also:
Class Workbook
Class Format
Class Error