Skip to content

TWebXLSX

Description

TWebXLSX is a component that allows to do import and export of XLSX files from a web client application. This non-visual component can be hooked directly to a TWebStringGrid component to import plain data from the XLSX file into the grid or vice versa. In addition, the XLSX file can also be access through this non-visual component.

Properties for TWebXLSX

Property Description
Grid Possible assigned TWebStringGrid instance for which sheet data can be imported or exported
GridStartCol: integer Sets the column in the connected grid from where to start the import or export of cells to XLSX
GridStartRow: integer Sets the row in the connected grid from where to start the import or export of cells to XLSX
XlsxStartCol: integer Sets the column in the XLSX sheet from where to start the import or export of cells to the grid
XlsxStartRow: integer Sets the row in the XLSX sheet from where to start the import or export of cells to the grid
ColumnCount: integer Readonly public property holding the number of columns in a sheet
RowCount: integer Readonly public property holding the number of rows in a sheet
ActiveSheet: string Public property allowing to get or set the name of the active sheet in the workbook
SheetNameCount: integer Readonly public property returning the number of sheets in the workbook
Creator: string Public property allowing to get or set the workbook creator information in the XLSX file
LastModifiedBy: string Public property allowing to get or set the last modifed information in the XLSX file
CellAsString[ACol,ARow]: string; Readonly function returning the valuel of a cell as string
CellAsObject[ACol,ARow]: TXLSXCell; Readonly function returning the valuel of a cell as TXLSXCell object

Methods for TWebXLSX

Method Description
AddNewSheet(AsheetName: string) Creates and adds a new sheet in the XLSX workbook
RemoveSheet(AsheetName: string); Removes a sheet from the XLSX workbook
IsEmptySheet(AsheetName: string); Returns true if a sheet in the XLSX workbook does not contain any data
ExportToCSV: TJSPromise Async promise method exporting an XLSX file to CSV file
GetCellObjects(AFromCol, AFromRow, AToCol, AToRow: Integer): TXLSXCellArray; Retrieves cells specified from the active sheet in an array of cells object
Load(AArray: TJSArrayBufferRecord); Load an array of values into the active sheet of the XLSX workbook
Save(AFileName: string) Save the workbook to file

Events for TWebXLSX

Event Description
OnLoadCell Possible assigned TWebStringGrid instance for which sheet data can be imported or exported
OnNewSheetAdded Sets the column in the connected grid from where to start the import or export of cells to XLSX
OnSaveCell Event triggered just before the cell is added to the XLSX file, allowing dynamic customization of what is persisted in XLSX.
OnSheetLoaded Event triggered when a sheet of the XLSX workbook was completely loaded
OnWorkbookLoaded Event triggered when an XLSX workbook was completely loaded

In the TWebXLSX workbook sheet, the information of cells is available as object of the type TXLSXCell. Through this object, various properties of the cell can be set or retrieved.

Properties for TXLSXCell

Property Description
Text: string Value of the cell as string
Value: JSValue Value of the cell as JavaScript object
CellType Returns the type of the cell
Names Sets the column in the XLSX sheet from where to start the import or export of cells to the grid
NumericFormat: string Holds the number formatting rule for the cell
Font: TXLSXStyleFont Holds the information about the cell font as TXLSXStyleFont object
Alignment: TXLSXStyleAlignment Holds the information about the cell alignment as TXLSXStyleAlignment object
Border: TXLSXStyleBorder Holds the information about the cell border as TXLSXStyleBorder object
Protection: TXLSXStyleProtection Holds the information about the cell border as TXLSXStyleProtection object
Fill: TColor Gets or sets the background color of the cell

Properties for TXLSXStyleFont

Property Description
Theme: integer Holds the theme identifer
Name: string Holds the font-family name
Size: integer Holds the font size
Color: Tcolor Holds the font color
Style: TXLSXStyleFontStyles Holds the font style: xfsBold, xfsItalic, xfsStrike, xfsOutline
Charset: integer Holds the charset identifer
VerticalAlign: TXLSXStyleFontAlign Holds the vertical align setting: xfaDefault, xfaSuperscript, xfaSubscript
Underline: TXLSXStyleFontUnderline Holds the underline setting: xfuNone, xfuSingle, xfuDouble, xfuSingleAccounting, xfuDoubleAccounting

Properties for TXLSXStyleAlignment

Property Description
Vertical: TXLSXStyleVerticalAlignment Holds the vertical alignment setting: xvaTop, xvaMiddle, xvaBottom, xvaDistributed, xvaJustify
Horizontal: TXLSXStyleHorizontalAlignment Holds the horizontal alignment setting: xhaLeft, xhaCenter, xhaRight, xhaFill, xhaJustify, xhaCenterCont, xhaDistributed
WrapText: boolean When true, text is wordwrapped in the cell
ShrinkToFit: boolean When true, text size is adapted to fit in the cell
Indent: integer Holds the text indent
ReadingOrder: TXLSXStyleReadingOrder Holds the reading order setting: xroRTL, xroLTR
TextRotationAngle: integer Angle of rotation
VerticalText: boolean True when the text is vertically oriented

Properties for TXLSXStyleBorder

Property Description
Top: TXLSXStyleBorderBase Holds the top border setting
Left: TXLSXStyleBorderBase Holds the left border setting
Bottom: TXLSXStyleBorderBase Holds the bottom border setting
Right: TXLSXStyleBorderBase Holds the right border setting
Diagonal: TXLSXStyleBorderDiagonal Holds the diagonal border setting

Properties for TXLSXStyleBorderBase

Property Description
Style: TXLSXStyleBorderStyle Style of the border: xbsNone, xbsThin, xbsDotted, xbsDashDot, xbsHair, xbsDashDotDot, xbsSlantDashDot, xbsMediumDashed, xbsMediumDashDotDot, xbsMediumDashDot, xbsMedium, xbsDouble, xbsThick
Color: Tcolor Color of the border
Theme: integer XLSX theme identifier

Properties for TXLSXStyleBorderDiagonal

Property Description
Up: boolean, Diagonal border is up
Down: boolean Diagonal border is down