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.
Constant | Description |
---|---|
PAPER_DEFAULT | Default paper size |
PAPER_LETTER | 8 1/2 x 11 in |
PAPER_LETTERSMALL | 8 1/2 x 11 in |
PAPER_TABLOID | 11 x 17 in |
PAPER_LEDGER | 17 x 11 in |
PAPER_LEGAL | 8 1/2 x 14 in |
PAPER_STATEMENT | 5 1/2 x 8 1/2 in |
PAPER_EXECUTIVE | 7 1/4 x 10 1/2 in |
PAPER_A3 | 297 x 420 mm |
PAPER_A4 | 210 x 297 mm |
PAPER_A4SMALL | 210 x 297 mm |
PAPER_A5 | 148 x 210 mm |
PAPER_B4 | 250 x 354 mm |
PAPER_B5 | 182 x 257 mm |
PAPER_FOLIO | 8 1/2 x 13 in |
PAPER_QUATRO | 215 x 275 mm |
PAPER_10x14 | 10x14 in |
PAPER_10x17 | 11x17 in |
PAPER_NOTE | 8 1/2 x 11 in |
PAPER_ENVELOPE_9 | 3 7/8 x 8 7/8 |
PAPER_ENVELOPE_10 | 4 1/8 x 9 1/2 |
PAPER_ENVELOPE_11 | 4 1/2 x 10 3/8 |
PAPER_ENVELOPE_12 | 4 3/4 x 11 |
PAPER_ENVELOPE_14 | 5 x 11 1/2 |
PAPER_C_SIZE | |
PAPER_D_SIZE | |
PAPER_E_SIZE | |
PAPER_ENVELOPE_DL | 110 x 220 mm |
PAPER_ENVELOPE_C3 | 324 x 458 mm |
PAPER_ENVELOPE_C4 | 229 x 324 mm |
PAPER_ENVELOPE_C5 | 162 x 229 mm |
PAPER_ENVELOPE_C6 | 114 x 162 mm |
PAPER_ENVELOPE_C65 | 114 x 229 mm |
PAPER_ENVELOPE_B4 | 250 x 353 mm |
PAPER_ENVELOPE_B5 | 176 x 250 mm |
PAPER_ENVELOPE_B6 | 176 x 125 mm |
PAPER_ENVELOPE_ITALY | 110 x 230 mm |
PAPER_MONARCH | 3.875 x 7.5 in |
PAPER_ENVELOPE | 3 5/8 x 6 1/2 in |
PAPER_FANFOLD | 14 7/8 x 11 in |
PAPER_GERMAN_STD_FANFOLD | 8 1/2 x 12 in |
PAPER_GERMAN_LEGAL_FANFOLD | 8 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.
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.
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.
void Worksheet::write(int row, int col, double token, Format* format = NULL)
Write a numeric value token to row and col with format.
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
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
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
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
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.
void Worksheet::writeNumber(int row, int col, double num, Format* format = NULL)
Write a number.
void Worksheet::writeString(int row, int col, std::wstring str, Format* format = NULL)
Write a string.
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
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
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.
void Worksheet::writeTime(int row, int col, std::wstring time, Format* format = NULL)
Write a time.
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
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
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
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
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