Home Index Book Sheet Format Font AutoFilter FilterColumn RichString FormControl
ConditionalFormatting ConditionalFormat CoreProperties Table Examples
ConditionalFormatting ConditionalFormat CoreProperties Table Examples
TXLSheet class reference
-
function getCellType(row: Integer; col: Integer): CellType Returns cell's type.
CellType value Description CELLTYPE_EMPTY empty, the cell doesn't exist CELLTYPE_NUMBER number value CELLTYPE_STRING string value CELLTYPE_BOOLEAN boolean value CELLTYPE_BLANK blank, the cell contains only format information CELLTYPE_ERROR error -
function isFormula(row: Integer; col: Integer): boolean Checks that cell contains a formula.
-
function cellFormat(row: Integer; col: Integer): TXLFormat Returns cell's format. It can be changed by user.
-
procedure setCellFormat(row: Integer; col: Integer; format: TXLFormat) Sets cell's format.
-
function readStr(row: Integer; col: Integer): WideString Reads a string from cell.
-
function readStr(row: Integer; col: Integer; var format: TXLFormat): WideString Reads a string and its format from cell.
-
function writeStr(row: Integer; col: Integer; value: PWideChar): boolean Writes a string into cell.
-
function writeStr(row: Integer; col: Integer; value: PWideChar; format: TXLFormat): boolean Writes a string into cell with specified format.
-
function readRichStr(row: Integer; col: Integer): TXLRichString Reads a rich string with multiple fonts from the cell. It's possible to check if the specified cell contains a rich string with the Sheet::isRichString() method.
-
function readRichStr(row: Integer; col: Integer; var format: TXLFormat): TXLRichString Reads a rich string with multiple fonts and its format from the cell. It's possible to check if the specified cell contains a rich string with the Sheet::isRichString() method.
-
function writeRichStr(row: Integer; col: Integer; value: TRichString): boolean Writes a rich string with multiple fonts into the cell with the specified format. Add a new rich string with the Book::addRichString() method. Returns false if an error occurs.
-
function writeRichStr(row: Integer; col: Integer; value: TRichString; format: TFormat): boolean Writes a rich string with multiple fonts into the cell with the specified format. Add a new rich string with the Book::addRichString() method. Returns false if an error occurs.
-
function readNum(row: Integer; col: Integer): double
Reads a number or date/time from the cell. Use Book::dateUnpack() for extract date/time parts from double.
-
function readNum(row: Integer; col: Integer; var format: TXLFormat): double
Reads a number or date/time and its format from cell. Use Book::dateUnpack() for extract date/time parts from double.
-
function writeNum(row: Integer; col: Integer; value: double): boolean Writes a number or date/time into the cell. Use the Book::datePack() for packing date/time parts to double.
-
function writeNum(row: Integer; col: Integer; value: double; format: TXLFormat): boolean
Writes a number or date/time into cell with specified format. Use Book::datePack() for packing date/time parts to double.
-
function readBool(row: Integer; col: Integer): boolean Reads a bool value from cell.
-
function readBool(row: Integer; col: Integer; var format: TXLFormat): boolean Reads a bool value and its format from cell.
-
function writeBool(row: Integer; col: Integer; value: boolean): boolean Writes a bool value into cell.
-
function writeBool(row: Integer; col: Integer; value: boolean; format: TFormat): boolean Writes a bool value into cell with specified format.
-
function readBlank(row: Integer; col: Integer; var format: TXLFormat): boolean Reads format from blank cell.
-
function writeBlank(row: Integer; col: Integer; format: TXLFormat): boolean Writes blank cell with specified format.
-
function readFormula(row: Integer; col: Integer): WideString
Reads a formula string from cell.
-
function readFormula(row: Integer; col: Integer; var format: TXLFormat): WideString
Reads a formula string and its format from cell.
-
function writeFormula(row: Integer; col: Integer; value: PWideChar): boolean Writes a formula into cell.
-
procedure writeFormula(row: Integer; col: Integer; value: PWideChar; format: TXLFormat) Writes a formula into cell with specified format.
-
function writeFormulaNum(row: Integer; col: Integer; expr: PWideChar; value: double): boolean Writes a formula expression with precalculated double value into cell.
-
procedure writeFormulaNum(row: Integer; col: Integer; expr: PWideChar; value: double; format: TXLFormat) Writes a formula expression with precalculated double value into cell with specified format.
-
function writeFormulaStr(row: Integer; col: Integer; expr: PWideChar; value: PWideChar): boolean Writes a formula expression with precalculated string value into cell.
-
function writeFormulaStr(row: Integer; col: Integer; expr: PWideChar; value: PWideChar; format: TXLFormat): boolean Writes a formula expression with precalculated string value into cell with specified format.
-
function writeFormulaBool(row: Integer; col: Integer; expr: PWideChar; value: boolean): boolean Writes a formula expression with precalculated boolean value into cell.
-
function writeFormulaBool(row: Integer; col: Integer; expr: PWideChar; value: boolean; format: TXLFormat): boolean Writes a formula expression with precalculated boolean value into cell with specified format.
-
function readComment(row: Integer; col: Integer): WideString Reads a comment from specified cell (only for xls format).
-
procedure writeComment(row: Integer; col: Integer; value: PWideChar; author: PWideChar; width, height: Integer) Writes a comment to the cell (only for xls format).
Parameters:
(row, col) - cell's position;
value - comment string;
author - author string;
width - width of text box in pixels;
height - height of text box in pixels. -
procedure removeComment(row: Integer; col: Integer) Removes a comment from the cell (only for xls format).
-
function isDate(row, col: Integer): boolean Checks that the cell contains a date or time value. If return value is true read it with the Sheet::readNum() method and unpack it with the Book::dateUnpack() method.
-
function isRichStr(row, col: Integer): boolean Checks that the cell contains a rich string with multiple fonts. If return value is true read it with the Sheet::readRichStr() method.
-
function readError(row, col: Integer): ErrorType Reads error from cell.
ErrorType value Description ERRORTYPE_NULL #NULL! ERRORTYPE_DIV_0 #DIV/0! ERRORTYPE_VALUE #VALUE! ERRORTYPE_REF #REF! ERRORTYPE_NAME #NAME? ERRORTYPE_NUM #NUM! ERRORTYPE_NA #N/A ERRORTYPE_NOERROR no error -
procedure writeError(row, col: Integer; error: ErrorType) Writes error into the cell.
-
procedure writeError(row, col: Integer; error: ErrorType; format: TXLFormat) Writes error into the cell with specified format.
-
function colWidth(col: Integer): double Returns column width. Column width is measured as the number of characters of the maximum digit width of the numbers 0, 1, 2, ..., 9 as rendered in the normal style's font.
-
function rowHeight(col: Integer): double Returns row height in typographical points. Point is 1/72 inch.
-
function colWidthPx(col: Integer): Integer Returns column width in pixels.
-
function rowHeightPx(col: Integer): Integer Returns row height in pixels.
-
function colFormat(col: Integer): TXLFormat Returns column's format.
-
function rowFormat(row: Integer): TXLFormat Returns row's format.
-
function setCol(col: Integer; width: double): boolean Sets column width for column col. Column width measured as the number of characters of the maximum digit width of the numbers 0, 1, 2, ..., 9 as rendered in the normal style's font. Value -1 is used for autofit column widths.
-
function setCol(colFirst, colLast: Integer; width: double): boolean Sets column width for all columns from colFirst to colLast. Column width measured as the number of characters of the maximum digit width of the numbers 0, 1, 2, ..., 9 as rendered in the normal style's font.
-
function setCol(col: Integer; width: double; format: TXLFormat): boolean Sets column width and format for colum col. Column width measured as the number of characters of the maximum digit width of the numbers 0, 1, 2, ..., 9 as rendered in the normal style's font.
-
function setCol(colFirst, colLast: Integer; width: double; format: TXLFormat): boolean Sets column width and format for all columns from colFirst to colLast. Column width measured as the number of characters of the maximum digit width of the numbers 0, 1, 2, ..., 9 as rendered in the normal style's font.
-
function setCol(col: Integer; width: double; format: TXLFormat; hidden: boolean): boolean Sets column width and format for column col. Column width measured as the number of characters of the maximum digit width of the numbers 0, 1, 2, ..., 9 as rendered in the normal style's font. Column may be hidden.
-
function setCol(colFirst, colLast: Integer; width: double; format: TXLFormat; hidden: boolean): boolean Sets column width and format for all columns from colFirst to colLast. Column width measured as the number of characters of the maximum digit width of the numbers 0, 1, 2, ..., 9 as rendered in the normal style's font. Columns may be hidden.
-
function setColPx(col: Integer; widthPx: Integer): boolean Sets column width in pixels for column col. Value -1 is used for autofit column widths.
-
function setColPx(colFirst, colLast: Integer; widthPx: Integer): boolean Sets column width in pixels for all columns from colFirst to colLast.
-
function setColPx(col: Integer; widthPx: Integer; format: TXLFormat): boolean Sets column width in pixels and format for colum col.
-
function setColPx(colFirst, colLast: Integer; widthPx: Integer; format: TXLFormat): boolean Sets column width in pixels and format for all columns from colFirst to colLast.
-
function setColPx(col: Integer; widthPx: Integer; format: TXLFormat; hidden: boolean): boolean Sets column width in pixels and format for column col. Column may be hidden.
-
function setColPx(colFirst, colLast: Integer; widthPx: Integer; format: TXLFormat; hidden: boolean): boolean Sets column width in pixels and format for all columns from colFirst to colLast. Columns may be hidden.
-
function setRow(row: Integer; height: double): boolean
Sets row height. Row height measured in point size.
-
function setRow(row: Integer; height: double; format: TXLFormat): boolean
Sets row height and format. Row height measured in point size.
-
function setRow(row: Integer; height: double; format: TXLFormat; hidden: boolean): boolean
Sets row height and format. Row height measured in point size. Row may be hidden.
-
function setRowPx(row: Integer; heightPx: Integer): boolean
Sets row height in pixels.
-
function setRowPx(row: Integer; heightPx: Integer; format: TXLFormat): boolean
Sets row height in pixels and format.
-
function setRowPx(row: Integer; heightPx: Integer; format: TXLFormat; hidden: boolean): boolean
Sets row height in pixels and format. Row may be hidden.
-
function rowHidden(row: Integer): boolean Returns whether row is hidden.
-
function setRowHidden(row: Integer; hidden: boolean): boolean Hides row.
-
function colHidden(row: Integer): boolean Returns whether column is hidden.
-
function setColHidden(col: Integer; hidden: boolean): boolean Hides column.
-
function defaultRowHeight(): double Returns the default row height measured in point size.
-
procedure setDefaultRowHeight(height: double) Sets the default row height measured in point size.
-
function getMerge(row, col: Integer; var rowFirst, rowLast, colFirst, colLast: Integer): boolean Gets merged cells for cell at row, col. Result is written in rowFirst, rowLast, colFirst, colLast.
-
function setMerge(rowFirst, rowLast, colFirst, colLast: Integer): boolean Sets merged cells for range: rowFirst - rowLast, colFirst - colLast.
-
function delMerge(row, col: Integer): boolean Removes merged cells.
-
function mergeSize(): Integer Returns a number of merged cells in this worksheet.
-
function merge(index: Integer; var rowFirst, rowLast, colFirst, colLast: Integer): boolean Gets the merged cells by index.
-
function delMergeByIndex(index: Integer): boolean Removes merged cells by index.
-
function pictureSize(): Integer Returns a number of pictures in this worksheet.
-
function getPicture(index: Integer): Integer
Returns a workbook picture index at position index in worksheet.
Use Book::getPicture() for extracting binary data of picture by workbook picture index. -
function getPicture(index: Integer; var rowTop, colLeft, rowBottom, colRight: Integer): Integer
Returns a workbook picture index at position index in worksheet. Output parameters:
(rowTop, colLeft) - top left position of picture;
(rowBottom, colRight) - bottom right position of picture.
Use Book::getPicture() for extracting binary data of picture by workbook picture index. -
function getPicture(index: Integer; var rowTop, colLeft, rowBottom, colRight, width, height: Integer): Integer
Returns a workbook picture index at position index in worksheet. Output parameters:
(rowTop, colLeft) - top left position of picture;
(rowBottom, colRight) - bottom right position of picture;
width - width of picture in pixels;
height - height of picture in pixels.
Use Book::getPicture() for extracting binary data of picture by workbook picture index. -
function getPicture(index: Integer; var rowTop, colLeft, rowBottom, colRight, width, height, offset_x, offset_y: Integer): Integer
Returns a workbook picture index at position index in worksheet. Output parameters:
(rowTop, colLeft) - top left position of picture;
(rowBottom, colRight) - bottom right position of picture;
width - width of picture in pixels;
height - height of picture in pixels;
offset_x - horizontal offset of picture in pixels;
offset_y - vertical offset of picture in pixels.
Use Book::getPicture() for extracting binary data of picture by workbook picture index. -
function removePictureByIndex(index: Integer): boolean Removes a picture from the worbook by index.
-
procedure setPicture(row, col, pictureId: Integer) Sets a picture with pictureId identifier at position row and col. Use Book::addPicture() for adding a new picture and getting an identifier.
-
procedure setPicture(row, col, pictureId: Integer; scale: double)
Sets a picture with pictureId identifier at position row and col with scale factor. Use Book::addPicture() for adding a new picture and getting an identifier. The picture can be aligned to the left top corner of the cell, to the center of the cell or stretched inside the cell:
scale > 0 - the picture is aligned to the left top corner of the cell or merged area with the specified scale factor
scale = 0 - the picture is stretched inside the specified cell or merged area
scale < 0 - the picture is aligned to the center of the cell or merged area with the specified scale factor -
procedure setPicture(row, col, pictureId, width, height: Integer)
Sets a picture with pictureId identifier at position row and col with custom size. Use Book::addPicture() for adding a new picture and getting an identifier.
-
function removePicture(row, col: Integer): boolean Removes a picture from the worbook at the specified position.
-
function getHorPageBreak(index: Integer): Integer Returns row with horizontal page break at position index.
-
function getHorPageBreakSize(): Integer Returns a number of horizontal page breaks in the sheet.
-
function getVerPageBreak(index: Integer): Integer Returns column with vertical page break at position index.
-
function getVerPageBreakSize(): Integer Returns a number of vertical page breaks in the sheet.
-
function setHorPageBreak(row: Integer): boolean Sets a horizontal page break.
-
function delHorPageBreak(row: Integer): boolean Removes a horizontal page break.
-
function setVerPageBreak(col: Integer): boolean Sets a vertical page break.
-
function delVerPageBreak(col: Integer): boolean Removes a vertical page break.
-
procedure split(row, col: Integer) Splits a sheet at position (row, col) or specifies the position of frozen pane. This function allows to freeze a header at top position or freeze some columns on the right.
-
function splitInfo(var row, col: Integer): boolean Gets the split information (position of frozen pane) in the sheet:
row - vertical position of the split;
col - horizontal position of the split. -
function groupRows(rowFirst, rowLast: Integer; collapsed: boolean): boolean Groups rows from rowFirst to rowLast.
-
function groupCols(colFirst, colLast: Integer; collapsed: boolean): boolean Groups columns from colFirst to colLast.
-
property groupSummaryBelow: boolean If true then grouping rows summary is below else summary is above.
-
property groupSummaryRight: boolean If true then grouping columns summary is right else summary is left.
-
function clear(rowFirst, rowLast: Integer; colFirst, colLast: Integer): boolean Clears all cells in the specified area.
-
function insertRow(rowFirst, rowLast: Integer): boolean Inserts rows from rowFirst to rowLast.
-
function insertCol(colFirst, colLast: Integer): boolean Inserts columns from colFirst to colLast.
-
function removeRow(rowFirst, rowLast: Integer): boolean Removes rows from rowFirst to rowLast.
-
function removeCol(colFirst, colLast: Integer): boolean Removes columns from colFirst to colLast.
-
function copyCell(rowSrc, colSrc, rowDst, colDst: Integer): boolean Copies cell with format from (rowSrc, colSrc) to (rowDst, colDst).
-
function firstRow: Integer Returns the zero-based index of the first row in the sheet that contains a used cell, including blank cells only with formatting.
-
function lastRow: Integer Returns the zero-based index of the row after the last row in the sheet that contains a used cell, including blank cells only with formatting.
-
function firstCol: Integer Returns the zero-based index of the first column in the sheet that contains a used cell, including blank cells only with formatting.
-
function lastCol: Integer Returns the zero-based index of the column after the last column in the sheet that contains a used cell, including blank cells only with formatting.
-
function firstFilledRow: Integer Returns the zero-based index of the first row in the sheet that contains a filled cell with a value. Ignores blank cells only with formatting.
-
function lastFilledRow: Integer Returns the zero-based index of the row after the last row in the sheet that contains a filled cell with a value. Ignores blank cells only with formatting.
-
function firstFilledCol: Integer Returns the zero-based index of the first column in the sheet that contains a filled cell with a value. Ignores blank cells only with formatting.
-
function lastFilledCol: Integer Returns the zero-based index of the column after the last column in the sheet that contains a filled cell with a value. Ignores blank cells only with formatting.
-
property displayGridlines: boolean
Display gridlines property: true if gridlines are displayed and false if aren't.
-
property printGridlines: boolean Print gridlines property: true if gridlines are printed and false if aren't.
-
property zoom: Integer The zoom level of the current view as a percentage. 100 is a usual view.
-
property printZoom: Integer The scaling factor for printing as a percentage.
-
function getPrintFit(var wPages, hPages: Integer): boolean Returns whether fit to page option is enabled. Output parameters:
wPages - number of pages the sheet width is fit to;
hPages - number of pages the sheet height is fit to. -
procedure setPrintFit(wPages, hPages: Integer) Fits sheet width and sheet height to wPages and hPages respectively.
-
property landscape: boolean Page orientation mode: true - landscape mode, false - portrait mode.
-
property paper: Paper The paper size.
Paper value Description PAPER_DEFAULT Default paper size PAPER_LETTER US Letter 8 1/2 x 11 in PAPER_LETTERSMALL US Letter Small 8 1/2 x 11 in PAPER_TABLOID US Tabloid 11 x 17 in PAPER_LEDGER US Ledger 17 x 11 in PAPER_LEGAL US Legal 8 1/2 x 14 in PAPER_STATEMENT US Statement 5 1/2 x 8 1/2 in PAPER_EXECUTIVE US Executive 7 1/4 x 10 1/2 in PAPER_A3 A3 297 x 420 mm PAPER_A4 A4 210 x 297 mm PAPER_A4SMALL A4 Small 210 x 297 mm PAPER_A5 A5 148 x 210 mm PAPER_B4 B4 (JIS) 250 x 354 PAPER_B5 B5 (JIS) 182 x 257 mm PAPER_FOLIO Folio 8 1/2 x 13 in PAPER_QUATRO Quarto 215 x 275 mm PAPER_10x14 10 x 14 in PAPER_10x17 11 x 17 in PAPER_NOTE US Note 8 1/2 x 11 in PAPER_ENVELOPE_9 US Envelope #9 3 7/8 x 8 7/8 PAPER_ENVELOPE_10 US Envelope #10 4 1/8 x 9 1/2 PAPER_ENVELOPE_11 US Envelope #11 4 1/2 x 10 3/8 PAPER_ENVELOPE_12 US Envelope #12 4 3/4 x 11 PAPER_ENVELOPE_14 US Envelope #14 5 x 11 1/2 PAPER_C_SIZE C size sheet PAPER_D_SIZE D size sheet PAPER_E_SIZE E size sheet PAPER_ENVELOPE_DL Envelope DL 110 x 220mm PAPER_ENVELOPE_C5 Envelope C5 162 x 229 mm PAPER_ENVELOPE_C3 Envelope C3 324 x 458 mm PAPER_ENVELOPE_C4 Envelope C4 229 x 324 mm PAPER_ENVELOPE_C6 Envelope C6 114 x 162 mm PAPER_ENVELOPE_C65 Envelope C65 114 x 229 mm PAPER_ENVELOPE_B4 Envelope B4 250 x 353 mm PAPER_ENVELOPE_B5 Envelope B5 176 x 250 mm PAPER_ENVELOPE_B6 Envelope B6 176 x 125 mm PAPER_ENVELOPE Envelope 110 x 230 mm PAPER_ENVELOPE_MONARCH US Envelope Monarch 3.875 x 7.5 in PAPER_US_ENVELOPE US Envelope 3 5/8 x 6 1/2 in PAPER_FANFOLD US Std Fanfold 14 7/8 x 11 in PAPER_GERMAN_STD_FANFOLD German Std Fanfold 8 1/2 x 12 in PAPER_GERMAN_LEGAL_FANFOLD German Legal Fanfold 8 1/2 x 13 in -
property header: AnsiString The header text of the sheet when printed. The text appears at the top of every page when printed. The length of the text must be less than or equal to 255. The header text can contain special commands, for example a placeholder for the page number, current date or text formatting attributes. Special commands are represented by single letter with a leading ampersand ("&").
Code Description &L specifies the beginning of the left section &P specifies the current page number &N specifies the total number of pages &\d{1,3} specifies the text font size, where font size is measured in points, for example: &9 or &36 &S specifies whether the strikethrough text style is on or off &X specifies whether the superscript text style is on or off &Y specifies whether the subscript text style is on or off &C specifies the beginning of the center section &D specifies a date &T specifies a time &U specifies whether the single underline text style is on or off &E specifies whether the double underline text style is on or off &R specifies the beginning of the right section &Z specifies a workbook file path &F specifies a workbook file name &A specifies a sheet name &"fontname" specifies the text font, for example: &"Comic Sans MS" &B specifies whether the bold text style is on or off &I specifies whether the italic text style is on or off && specifies an ampersand character (&) -
property headerMargin: double The header margin in inches.
-
property footer: AnsiString The footer text of the sheet when printed. The footer text appears at the bottom of every page when printed. The length of the text must be less than or equal to 255. The footer text can contain special commands, for example a placeholder for the page number, current date or text formatting attributes. See header for details.
-
property footerMargin: double The footer margin in inches.
-
property hCenter: boolean If true then the sheet is centered horizontally when printed.
-
property vCenter: boolean If true then the sheet is centered vertically when printed.
-
property marginLeft: double The left margin of the sheet in inches.
-
property marginRight: double The right margin of the sheet in inches.
-
property marginTop: double The top margin of the sheet in inches.
-
property marginBottom: double The bottom margin of the sheet in inches.
-
property printRowCol: boolean If true then the row and column headers are printed.
-
function printRepeatRows(var rowFirst, rowLast: Integer): boolean Gets repeated rows on each page from rowFirst to rowLast. Returns false if repeated rows aren't found.
-
procedure setPrintRepeatRows(rowFirst, rowLast: Integer) Sets repeated rows on each page from rowFirst to rowLast.
-
function printRepeatCols(var colFirst, colLast: Integer): boolean Gets repeated columns on each page from colFirst to colLast. Returns false if repeated columns aren't found.
-
procedure setPrintRepeatCols(colFirst, colLast: Integer) Sets repeated columns on each page from colFirst to colLast.
-
function printArea(var rowFirst, rowLast, colFirst, colLast: Integer): boolean Gets the print area. Returns false if print area isn't found.
-
procedure setPrintArea(rowFirst, rowLast, colFirst, colLast: Integer) Sets the print area.
-
procedure clearPrintRepeats() Clears repeated rows and columns on each page.
-
procedure clearPrintArea() Clears the print area.
-
function getNamedRange(const name: PWideChar; var rowFirst, rowLast, colFirst, colLast: Integer): boolean Gets the named range coordianates by name. Returns false if specified named range isn't found.
-
function getNamedRange(const name: PWideChar; var rowFirst, rowLast, colFirst, colLast: Integer; scopeId: Integer): boolean Gets the named range coordianates by local or global name.
scopeId - index of sheet for local named range or -1 for a global named range.
Returns false if specified named range isn't found. -
function getNamedRange(const name: PWideChar; var rowFirst, rowLast, colFirst, colLast: Integer; scopeId: Integer; var hidden: boolean): boolean Gets the named range coordianates by local or global name.
scopeId - index of sheet for local named range or -1 for a global named range.
hidden - true if named range is hidden and false if isn't.
Returns false if specified named range isn't found. -
procedure setNamedRange(const name: PWideChar; rowFirst, rowLast, colFirst, colLast: Integer) Sets the named range.
-
procedure setNamedRange(const name: PWideChar; rowFirst, rowLast, colFirst, colLast, scopeId: Integer) Sets the named range.
scopeId - index of sheet for local named range or -1 for a global named range. -
procedure delNamedRange(const name: PWideChar) Deletes the named range by name.
-
procedure delNamedRange(const name: PWideChar; scopeId: Integer) Deletes the named range by name.
scopeId - index of sheet for local named range or -1 for a global named range. -
function namedRangeSize(): Integer Returns the number of named ranges in the sheet.
-
function namedRange(index: Integer; var rowFirst, rowLast, colFirst, colLast: Integer): WideString Gets the named range coordianates by index.
-
function namedRange(index: Integer; var rowFirst, rowLast, colFirst, colLast, scopeId: Integer): WideString Gets the named range coordianates by index.
scopeId - index of sheet for local named range or -1 for a global named range. -
function namedRange(index: Integer; var rowFirst, rowLast, colFirst, colLast, scopeId: Integer; var hidden: boolean): WideString Gets the named range coordianates by index.
scopeId - index of sheet for local named range or -1 for a global named range.
hidden - true if named range is hidden and false if isn't. -
function getTable(const name: PWideChar; var rowFirst, rowLast, colFirst, colLast, headerRowCount, totalsRowCount: Integer): boolean Gets the table parameters by name.
headerRowCount - the number of header rows showing at the top of the table. 0 means that the header row is not shown.
totalsRowCount - the number of totals rows that shall be shown at the bottom of the table. 0 means that the totals row is not shown.
Returns true if the table is found. -
function tableSize(): Integer Returns the number of tables in the sheet.
-
function table(index: Integer; var rowFirst, rowLast, colFirst, colLast, headerRowCount, totalsRowCount: Integer): WideString Gets the table parameters by index.
headerRowCount - the number of header rows showing at the top of the table. 0 means that the header row is not shown.
totalsRowCount - the number of totals rows that shall be shown at the bottom of the table. 0 means that the totals row is not shown.
Returns a string representing the name of the table. -
Adds a table to the sheet with the specified name, range and style (only for xlsx files).
name - the name of the table;
rowFirst - the first row of the table;
rowLast - the last row of the table;
rowLast - the last row of the table;
colFirst - the first column of the table;
colLast - the last column of the table;
hasHeaders - does the specified range include headers or not;
tableStyle - the table style.
Returns the table if successed, 0 if failed. -
function hyperlinkSize(): Integer Returns the number of hyperlinks in the sheet.
-
function hyperlink(index: Integer; var rowFirst, rowLast, colFirst, colLast: Integer): WideString Gets the hyperlink and its coordianates by index.
-
function delHyperlink(index: Integer): boolean Removes hyperlink by index.
-
procedure addHyperlink(const hyperlink: PWideChar; rowFirst, rowLast, colFirst, colLast: Integer) Adds the new hyperlink.
-
function hyperlinkIndex(row, col: Integer): Integer Checks if the cell contains a hyperlink. Returns an index of hyperlink if exists, -1 if there is no hyperlink in this cell.
-
function isAutoFilter(): boolean Returns true if the AutoFilter already exists (only for xlsx files).
-
function autoFilter(): TXLAutoFilter Returns the AutoFilter. Creates it if it doesn't exist (only for xlsx files).
-
procedure applyFilter() Applies all available autofilters to the sheet (only for xlsx files).
-
Applies only the specified AutoFilter to the sheet (only for xlsx files).
-
procedure removeFilter() Removes the AutoFilter from the sheet (only for xlsx files).
-
property name: WideString The name of the sheet.
-
property protect: boolean If true then the sheet is protected.
-
procedure setProtect(protect: boolean; const password: PWideChar) Protects the sheet with the password.
-
procedure setProtect(protect: boolean; const password: PWideChar; const prot: EnhancedProtection) Protects the sheet with the password and enchanced parameters below.
EnhancedProtection value Description PROT_DEFAULT Default protection. PROT_ALL Nothing is allowed except cell selections. PROT_OBJECTS Objects are locked when the sheet is protected. PROT_SCENARIOS Scenarios are locked when the sheet is protected. PROT_FORMAT_CELLS Formatting cells is allowed when the sheet is protected. PROT_FORMAT_COLUMNS Formatting columns is allowed when the sheet is protected. PROT_FORMAT_ROWS Formatting rows is allowed when the sheet is protected. PROT_INSERT_COLUMNS Inserting columns is allowed when the sheet is protected. PROT_INSERT_ROWS Inserting rows is allowed when the sheet is protected. PROT_INSERT_HYPERLINKS Inserting hyperlinks is allowed when the sheet is protected. PROT_DELETE_COLUMNS Deleting columns is allowed when the sheet is protected. PROT_DELETE_ROWS Deleting rows is allowed when the sheet is protected. PROT_SEL_LOCKED_CELLS Selection of locked cells is locked when the sheet is protected. PROT_SORT Sorting is allowed when the sheet is protected. PROT_AUTOFILTER Autofilters are allowed when the sheet is protected. PROT_PIVOTTABLES Pivot tables are allowed when the sheet is protected. PROT_SEL_UNLOCKED_CELLS Selection of unlocked cells is locked when the sheet is protected. -
property rightToLeft: boolean Property that specifies whether the text is displayed in right-to-left mode:
true - the text is displayed in right-to-left mode,
false - the text is displayed in left-to-right mode. -
property hidden: SheetState Specifies the visible state of this sheet.
SheetState value Description SHEETSTATE_VISIBLE sheet is visible SHEETSTATE_HIDDEN sheet is hidden, but can be shown via the user interface SHEETSTATE_VERYHIDDEN sheet is hidden and cannot be shown in the user interface -
procedure getTopLeftView(var row, col: Integer) Extracts the first visible row and the leftmost visible column of the sheet.
-
procedure setTopLeftView(row, col: Integer) Sets the first visible row and the leftmost visible column of the sheet.
-
procedure setAutoFitArea(rowFirst, colFirst, rowLast, colLast: Integer) Sets the borders for autofit column widths feature. The procedure Sheet::setCol() with -1 width value will affect only to the specified limited area.
-
procedure addrToRowCol(const addr: PWideChar; var row, col: Integer) Converts a cell reference to row and column:
addr - the cell reference, can be relative and absolute, for example C5 or $C$5;
row - the extracted row from the cell reference;
col - the extracted column from the cell reference;
rowRelative - true if row is relative, false if row is absolute;
colRelative - true if column is relative, false if column is absolute. -
procedure addrToRowCol(const addr: PWideChar; var row, col: Integer; var rowRelative, colRelative: boolean) Converts a cell reference to row and column:
addr - the cell reference, can be relative and absolute, for example C5 or $C$5;
row - the extracted row from the cell reference;
col - the extracted column from the cell reference;
rowRelative - true if row is relative, false if row is absolute;
colRelative - true if column is relative, false if column is absolute. -
function rowColToAddr(row, col: Integer): WideString Converts row and column to a cell reference:
row - the row for the cell reference;
col - the column for the cell reference;
rowRelative - true if row should be relative, false if row should be absolute;
colRelative - true if column should be relative, false if column should be absolute;
Returns the cell reference, can be relative and absolute, for example C5 or $C$5. -
function rowColToAddr(row, col: Integer; rowRelative, colRelative: boolean): WideString Converts row and column to a cell reference:
row - the row for the cell reference;
col - the column for the cell reference;
rowRelative - true if row should be relative, false if row should be absolute;
colRelative - true if column should be relative, false if column should be absolute;
Returns the cell reference, can be relative and absolute, for example C5 or $C$5. -
function tabColor(): Color Returns the sheet's tab color.
-
procedure setTabColor(color: Color) Sets the color for the sheet's tab.
-
function getTabColor(var red, green, blue: Integer): boolean Returns the sheet's tab RGB color.
-
procedure setTabColor(red: Integer; green: Integer; blue: Integer) Sets the RGB color for the sheet's tab.
-
function setBorder(rowFirst: Integer; rowLast: Integer; colFirst: Integer; colLast: Integer; borderStyle: BorderStyle; borderColor: Color): boolean Sets the border in the specified range of cells.
rowFirst - the first row of range;
rowLast - the last row of range;
colFirst - the first column of range;
colLast - the last column of range;
borderStyle - the border style;
borderColor - the border color. -
function addIgnoredError(rowFirst: Integer; colFirst: Integer; rowLast: Integer; colLast: Integer; iError: IgnoredError): boolean Adds the ignored error for specified range. It allows to hide green triangles on left sides of cells. For example, if a cell is formatted as text but contains a numeric value, this is considered to be a potential error because the number won't be treated as a number, for example, in calculations. Returns false if error occurs.
IgnoredError value Description IERR_EVAL_ERROR Ignore errors when cells contain formulas that result in an error. IERR_EMPTY_CELLREF Ignore errors when formulas refer to empty cells. IERR_NUMBER_STORED_AS_TEXT Ignore errors when numbers are formatted as text or are preceded by an apostrophe. IERR_INCONSIST_RANGE Ignore errors when formulas omit certain cells in a region. IERR_INCONSIST_FMLA Ignore errors when a formula in a region of your worksheet differs from other formulas in the same region. IERR_TWODIG_TEXTYEAR Ignore errors when formulas contain text formatted cells with years represented as 2 digits. IERR_UNLOCK_FMLA Ignore errors when unlocked cells contain formulas. IERR_DATA_VALIDATION Ignore errors when a cell's value in a Table does not comply with the Data Validation rules specified. -
procedure addDataValidation(vtype: DataValidationType; op: DataValidationOperator; rowFirst: Integer; rowLast: Integer; colFirst: Integer; colLast: Integer; const value: PWideChar)
Adds a data validation for the specified range (only for xlsx files).
type - the type of data validation:DataValidationType value Description VALIDATION_TYPE_NONE No data validation. VALIDATION_TYPE_WHOLE Data validation which checks for whole number values satisfying the given condition. VALIDATION_TYPE_DECIMAL Data validation which checks for decimal values satisfying the given condition. VALIDATION_TYPE_LIST Data validation which checks for a value matching one of list of values. VALIDATION_TYPE_DATE Data validation which checks for date values satisfying the given condition. VALIDATION_TYPE_TIME Data validation which checks for time values satisfying the given condition. VALIDATION_TYPE_TEXTLENGTH Data validation which checks for text values, whose length satisfies the given condition. VALIDATION_TYPE_CUSTOM Data validation which uses a custom formula to check the cell value.
op - the relational operator of data validation:DataValidationOperator value Description VALIDATION_OP_BETWEEN Data validation which checks if a value is between two other values. VALIDATION_OP_NOTBETWEEN Data validation which checks if a value is not between two other values. VALIDATION_OP_EQUAL Data validation which checks if a value is equal to a specified value. VALIDATION_OP_NOTEQUAL Data validation which checks if a value is not equal to a specified value. VALIDATION_OP_LESSTHAN Data validation which checks if a value is less than a specified value. VALIDATION_OP_LESSTHANOREQUAL Data validation which checks if a value is less than or equal to a specified value. VALIDATION_OP_GREATERTHAN Data validation which checks if a value is greater than a specified value. VALIDATION_OP_GREATERTHANOREQUAL Data validation which checks if a value is greater than or equal to a specified value.
rowFirst - the first row of range;
rowLast - the last row of range;
colFirst - the first column of range;
colLast - the last column of range;
value - the value for relational operator, use double quotes if you want to specify a list of values directly
(for example "A,B,C") and don't use quotes if you want to specify a reference to area with values
(for example A1:A6). -
procedure addDataValidation(vtype: DataValidationType; op: DataValidationOperator; rowFirst: Integer; rowLast: Integer; colFirst: Integer; colLast: Integer; const value1: PWideChar; const value2: PWideChar)
Adds a data validation for the specified range with two values for relational operator (only for xlsx files). See parameter description in the Sheet::addDataValidation() function. -
procedure addDataValidation(vtype: DataValidationType; op: DataValidationOperator; rowFirst: Integer; rowLast: Integer; colFirst: Integer; colLast: Integer; const value1: PWideChar; const value2: PWideChar; allowBlank: boolean; hideDropDown: boolean; showInputMessage: boolean; showErrorMessage: boolean; const promptTitle: PWideChar; const prompt: PWideChar; const errorTitle: PWideChar; const error: PWideChar; errorStyle: DataValidationErrorStyle)
Adds a data validation for the specified range with extended parameters (only for xlsx files).
type, op, rowFirst, rowLast, colFirst, colLast, value1, value2 - see description in Sheet::addDataValidation();
allowBlank - a boolean value indicating whether the data validation treats empty or blank entries as valid, 'true' means empty entries are OK and do not violate the validation constraints;
hideDropDown - a boolean value indicating whether to display the dropdown combo box for a list type data validation (VALIDATION_TYPE_LIST);
showInputMessage - a boolean value indicating whether to display the input prompt message;
showErrorMessage - a boolean value indicating whether to display the error alert message when an invalid value has been entered, according to the criteria specified;
promptTitle - title bar text of input prompt;
prompt - message text of input prompt;
errorTitle - title bar text of error alert;
error - message text of error alert;
errorStyle - the style of error alert used for this data validation:DataValidationErrorStyle value Description VALIDATION_ERRSTYLE_STOP This data validation error style uses a stop icon in the error alert. VALIDATION_ERRSTYLE_WARNING This data validation error style uses a warning icon in the error alert. VALIDATION_ERRSTYLE_INFORMATION This data validation error style uses an information icon in the error alert.
-
procedure addDataValidationDouble(vtype: DataValidationType; op: DataValidationOperator; rowFirst: Integer; rowLast: Integer; colFirst: Integer; colLast: Integer; value: double)
Adds a data validation for the specified range with double or date value for the relational operator (only for xlsx files). See parameters in the Sheet::addDataValidation() method. -
procedure addDataValidationDouble(vtype: DataValidationType; op: DataValidationOperator; rowFirst: Integer; rowLast: Integer; colFirst: Integer; colLast: Integer; value1: double; value2: double)
Adds a data validation for the specified range with double or date values for the relational operator (only for xlsx files). See parameters in the Sheet::addDataValidation() method. -
procedure addDataValidationDouble(vtype: DataValidationType; op: DataValidationOperator; rowFirst: Integer; rowLast: Integer; colFirst: Integer; colLast: Integer; value1: double; value2: double; allowBlank: boolean; hideDropDown: boolean; showInputMessage: boolean; showErrorMessage: boolean; const promptTitle: PWideChar; const prompt: PWideChar; const errorTitle: PWideChar; const error: PWideChar; errorStyle: DataValidationErrorStyle)
Adds a data validation for the specified range with double or date values for the relational operator with extended parameters (only for xlsx files). See parameters in the Sheet::addDataValidation() method. -
procedure removeDataValidations() Removes all data validations for the sheet (only for xlsx files).
-
function formControlSize(): Integer Returns a number of form controls in this worksheet (only for xlsx files).
-
function formControl(index: Integer): TXLFormControl Returns a form control with the specified index (only for xlsx files). The index must be less than the return value of the formControlSize() method.
-
function addConditionalFormatting(): TXLConditionalFormatting Adds a conditional formatting rules to the sheet (only for xlsx files).
-
function getActiveCell(var row, col: Integer): boolean Gets an active cell of the sheet. Returns true if an active cell is found otherwise returns false.
-
procedure setActiveCell(row, col: Integer) Sets an active cell of the sheet.
-
function selectionRange(): WideString Returns a range of the selection.
-
procedure addSelectionRange(sqref: PWideChar) Adds a range to the selection.
-
procedure removeSelection() Removes all selection.