XLS
Create and read Excel files, support for XLS files as XLSX files.
This feature uses the Apache POI library.
const excel = _xls.create();
const titles = _val.init()
.add(
_val.init()
.set('value', 'Name')
).add(
_val.init()
.set('value', 'Age')
);
const endPosition = excel.addDataTable(1, 1, titles)
const data = _val.init()
.add(
_val.init()
.add(
_val.init()
.set('value', 'John')
).add(
_val.init()
.set('value', 24)
)
).add(
_val.init()
.add(
_val.init()
.set('value', 'Annye')
).add(
_val.init()
.set('value', 22)
)
);
endPosition = excel.addDataTable(endPosition.row, 1, data)
excel.output("ages.xls");
activeSheet
_xls.create().activeSheet(index: int) : XLS
Description
Sets the spreadsheet that is active.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| index | int | Spreadsheet number. |
Return
( XLS )
A instância atual do recurso XLS.
_xls.create().activeSheet(sheet: org.apache.poi.ss.usermodel.Sheet) : XLS
Description
Sets the spreadsheet that is active.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| sheet | org.apache.poi.ss.usermodel.Sheet | Spreadsheet reference object. |
Return
( XLS )
The current instance of the XLS resource.
addDataTable
_xls.create().addDataTable(rowIndex: int, colIndex: int, data: java.util.List) : XLSPosition
Description
Adds a data table to the spreadsheet.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| rowIndex | int | Line number. |
| colIndex | int | Column number. |
| data | java.util.List | List of data to be inserted. |
Return
( XLSPosition )
Reference of the position of the last cell with data entered.
_xls.create().addDataTable(rowIndex: int, colIndex: int, data: java.util.List, vertical: boolean) : XLSPosition
Description
Adds a data table to the spreadsheet.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| rowIndex | int | Line number. |
| colIndex | int | Column number. |
| data | java.util.List | List of data to be inserted. |
| vertical | boolean | Insert data vertically. |
Return
( XLSPosition )
Reference of the position of the last cell with data entered.
_xls.create().addDataTable(rowIndex: int, colIndex: int, data: Values) : XLSPosition
Description
Adds a data table to the spreadsheet.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| rowIndex | int | Line number. |
| colIndex | int | Column number. |
| data | Values | List of data to be inserted. |
Return
( XLSPosition )
Reference of the position of the last cell with data entered.
_xls.create().addDataTable(rowIndex: int, colIndex: int, data: Values, vertical: boolean) : XLSPosition
Description
Adds a data table to the spreadsheet.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| rowIndex | int | Line number. |
| colIndex | int | Column number. |
| data | Values | List of data to be inserted. |
| vertical | boolean | Insert data vertically. |
Return
( XLSPosition )
Reference of the position of the last cell with data entered.
_xls.create().addDataTable(config: java.util.Map, data: java.util.List) : XLSPosition
Description
Adds a data table to the spreadsheet.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| config | java.util.Map | Configuration of the data table. |
| data | java.util.List | List of data to be inserted. |
Return
( XLSPosition )
Reference of the position of the last cell with data entered.
_xls.create().addDataTable(sheet: org.apache.poi.ss.usermodel.Sheet, rowIndex: int, colIndex: int, data: java.util.List) : XLSPosition
Description
Adds a data table to the spreadsheet.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| sheet | org.apache.poi.ss.usermodel.Sheet | Spreadsheet object. |
| rowIndex | int | Line number. |
| colIndex | int | Column number. |
| data | java.util.List | List of data to be inserted. |
Return
( XLSPosition )
Reference of the position of the last cell with data entered.
_xls.addDataTable(sheet: org.apache.poi.ss.usermodel.Sheet, rowIndex: int, colIndex: int, data: java.util.List, vertical: boolean) : XLSPosition
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| sheet | org.apache.poi.ss.usermodel.Sheet | |
| rowIndex | int | |
| colIndex | int | |
| data | java.util.List | |
| vertical | boolean |
Return
( XLSPosition )
_xls.create().addDataTable(sheet: org.apache.poi.ss.usermodel.Sheet, rowIndex: int, colIndex: int, data: Values) : XLSPosition
Description
Adds a data table to the spreadsheet.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| sheet | org.apache.poi.ss.usermodel.Sheet | Spreadsheet object. |
| rowIndex | int | Line number. |
| colIndex | int | Column number. |
| data | Values | List of data to be inserted. |
Return
( XLSPosition )
Reference of the position of the last cell with data entered.
_xls.addDataTable(sheet: org.apache.poi.ss.usermodel.Sheet, rowIndex: int, colIndex: int, data: Values, vertical: boolean) : XLSPosition
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| sheet | org.apache.poi.ss.usermodel.Sheet | |
| rowIndex | int | |
| colIndex | int | |
| data | Values | |
| vertical | boolean |
Return
( XLSPosition )
anchorType
_xls.anchorType(type: string) : org.apache.poi.ss.usermodel.ClientAnchor$AnchorType
Description
Generates the type of anchor.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| type | string | Anchor type name, supports:
|
Return
( org.apache.poi.ss.usermodel.ClientAnchor$AnchorType )
The anchor type configured with the defined type.
borderStyle
_xls.borderStyle(type: string) : org.apache.poi.ss.usermodel.BorderStyle
Description
Generates the outline style of the cell borders.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| type | string | Name of the border style type, supports:
|
Return
( org.apache.poi.ss.usermodel.BorderStyle )
The border outline style configured with the defined type.
cell
_xls.create().cell(rowIndex: int, colIndex: int) : org.apache.poi.ss.usermodel.Cell
Description
Gets a spreadsheet cell and if it does not exist then it will be created.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| rowIndex | int | Line number. |
| colIndex | int | Column number. |
Return
( org.apache.poi.ss.usermodel.Cell )
Cell representation object.
_xls.create().cell(sheet: org.apache.poi.ss.usermodel.Sheet, rowIndex: int, colIndex: int) : org.apache.poi.ss.usermodel.Cell
Description
Gets a spreadsheet cell and if it does not exist then it will be created.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| sheet | org.apache.poi.ss.usermodel.Sheet | Spreadsheet object. |
| rowIndex | int | Line number of the sheet. |
| colIndex | int | Column number. |
Return
( org.apache.poi.ss.usermodel.Cell )
Cell representation object.
cellRangeAddress
_xls.cellRangeAddress(firstRow: int, lastRow: int, firstCol: int, lastCol: int) : org.apache.poi.ss.util.CellRangeAddress
Description
Generates the region address of the cell area.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| firstRow | int | First line number. |
| lastRow | int | Last line number. |
| firstCol | int | First column number. |
| lastCol | int | Last column number. |
Return
( org.apache.poi.ss.util.CellRangeAddress )
The cell area address reference.
cellStyle
_xls.cellStyle() : org.apache.poi.ss.usermodel.CellStyle
Description
Creates a new cell style in the workbook.
Return
( org.apache.poi.ss.usermodel.CellStyle )
The new cell style created.
cellStyleFormat
_xls.cellStyleFormat(format: string) : org.apache.poi.ss.usermodel.CellStyle
Description
Creates a new cell style with an associated format in the workbook.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| format | string | Format standard definition. |
Return
( org.apache.poi.ss.usermodel.CellStyle )
The new cell style created with the configured format.
color
_xls.color(color: string) : java.lang.Object
Description
Generates the color code based on predefined names.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| color | string | Color name, supports:
|
Return
( java.lang.Object )
The color reference.
columnReference
_xls.columnReference(index: int) : string
Description
Gets the column reference (letters) based on its numeric position.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| index | int | Column number. |
Return
( string )
Reference in column letters.
_xls.columnReference(index: string) : int
Description
Gets the numeric position of the column based on the letter reference.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| index | string | Reference in column letters. |
Return
( int )
Numeric position of the column.
create
_xls.create() : XLS
Description
Creates a new Excel document.
How To Use
const excel = _xls.create();
Return
( XLS )
New XLS resource instance.
create2007
_xls.create2007() : XLS
Description
Creates a new Excel 97-2007 document, in the old format.
How To Use
const excel = _xls.create2007();
Return
( XLS )
New XLS resource instance.
createSheet
_xls.create().createSheet() : org.apache.poi.ss.usermodel.Sheet
Description
Creates a new spreadsheet.
Return
( org.apache.poi.ss.usermodel.Sheet )
Spreadsheet created.
_xls.create().createSheet(name: string) : org.apache.poi.ss.usermodel.Sheet
Description
Create a new spreadsheet and define its name.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| name | string | Spreadsheet name. |
Return
( org.apache.poi.ss.usermodel.Sheet )
Spreadsheet created.
fillPattern
_xls.fillPattern(type: string) : org.apache.poi.ss.usermodel.FillPatternType
Description
Generates the background fill pattern.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| type | string | Fill pattern type, supports:
|
Return
( org.apache.poi.ss.usermodel.FillPatternType )
The fill pattern configured with the defined type.
font
_xls.font() : org.apache.poi.ss.usermodel.Font
Description
Creates a new font style in the workbook.
Return
( org.apache.poi.ss.usermodel.Font )
The new font style created.
format
_xls.format(format: string) : short
Description
Creates a new cell format in the workbook.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| format | string | Format standard definition. |
Return
( short )
Identifier code for the new format.
getAllSheets
_xls.create().getAllSheets() : java.util.List<org.apache.poi.ss.usermodel.Sheet>
Description
List of all spreadsheets.
Return
( java.util.List )
All existing spreadsheets in the document.
getCellData
_xls.create().getCellData(rowIndex: int, colIndex: int) : Values
Description
Gets an object with data from a spreadsheet cell.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| rowIndex | int | Line number. |
| colIndex | int | Column number. |
Return
( Values )
Cell data information.
_xls.create().getCellData(cell: org.apache.poi.ss.usermodel.Cell) : Values
Description
Gets an object with data from a spreadsheet cell.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| cell | org.apache.poi.ss.usermodel.Cell | Object that represents the cell. |
Return
( Values )
Cell data information.
_xls.create().getCellData(sheet: org.apache.poi.ss.usermodel.Sheet, rowIndex: int, colIndex: int) : Values
Description
Gets an object with data from a spreadsheet cell.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| sheet | org.apache.poi.ss.usermodel.Sheet | Spreadsheet object. |
| rowIndex | int | Line number of the sheet. |
| colIndex | int | Column number. |
Return
( Values )
Cell data information.
getNumberOfSheets
_xls.create().getNumberOfSheets() : int
Description
Gets the total number of spreadsheets.
Return
( int )
The total number of spreadsheets in the document.
getSheet
_xls.create().getSheet(index: int) : org.apache.poi.ss.usermodel.Sheet
Description
Get the spreadsheet by number (index).
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| index | int | Spreadsheet number. |
Return
( org.apache.poi.ss.usermodel.Sheet )
Spreadsheet referring to the number (index).
_xls.create().getSheet(name: string) : org.apache.poi.ss.usermodel.Sheet
Description
Gets the spreadsheet by name.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| name | string | Spreadsheet name. |
Return
( org.apache.poi.ss.usermodel.Sheet )
Spreadsheet for the name.
horizontalAlignment
_xls.horizontalAlignment(type: string) : org.apache.poi.ss.usermodel.HorizontalAlignment
Description
Generates horizontal alignment.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| type | string | Horizontal alignment type name, supports:
|
Return
( org.apache.poi.ss.usermodel.HorizontalAlignment )
The horizontal alignment configured with the defined type.
insertPicture
_xls.insertPicture(sheet: org.apache.poi.ss.usermodel.Sheet, file: File, anchor: org.apache.poi.ss.usermodel.ClientAnchor) : org.apache.poi.ss.usermodel.Picture
Description
Inserts an image associated with the anchor in a specific spreadsheet.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| sheet | org.apache.poi.ss.usermodel.Sheet | Spreadsheet that will be used to insert the image. |
| file | File | Image file. |
| anchor | org.apache.poi.ss.usermodel.ClientAnchor | Anchor to associate the image. |
Return
( org.apache.poi.ss.usermodel.Picture )
The reference object of the inserted image.
_xls.insertPicture(sheet: org.apache.poi.ss.usermodel.Sheet, storage: Storage, anchor: org.apache.poi.ss.usermodel.ClientAnchor) : org.apache.poi.ss.usermodel.Picture
Description
Inserts an image associated with the anchor in a specific spreadsheet.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| sheet | org.apache.poi.ss.usermodel.Sheet | Spreadsheet that will be used to insert the image. |
| storage | Storage | Storage reference associated with an image file. |
| anchor | org.apache.poi.ss.usermodel.ClientAnchor | Anchor to associate the image. |
Return
( org.apache.poi.ss.usermodel.Picture )
The reference object of the inserted image.
_xls.create().insertPicture(file: File, linha: int, coluna: int) : org.apache.poi.ss.usermodel.Picture
Description
Insert the image into the specified cell.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| file | File | Image file. |
| linha | int | Line number. |
| coluna | int | Column number. |
Return
( org.apache.poi.ss.usermodel.Picture )
The reference object of the inserted image.
_xls.create().insertPicture(file: File, anchor: org.apache.poi.ss.usermodel.ClientAnchor) : org.apache.poi.ss.usermodel.Picture
Description
Inserts an image associated with the anchor.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| file | File | Image file. |
| anchor | org.apache.poi.ss.usermodel.ClientAnchor | Anchor to associate the image. |
Return
( org.apache.poi.ss.usermodel.Picture )
The reference object of the inserted image.
_xls.create().insertPicture(storage: Storage, linha: int, coluna: int) : org.apache.poi.ss.usermodel.Picture
Description
Insert the image into the specified cell.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| storage | Storage | Storage reference associated with an image file. |
| linha | int | Line number. |
| coluna | int | Column number. |
Return
( org.apache.poi.ss.usermodel.Picture )
The reference object of the inserted image.
_xls.create().insertPicture(storage: Storage, anchor: org.apache.poi.ss.usermodel.ClientAnchor) : org.apache.poi.ss.usermodel.Picture
Description
Inserts an image associated with the anchor.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| storage | Storage | Storage reference associated with an image file. |
| anchor | org.apache.poi.ss.usermodel.ClientAnchor | Anchor to associate the image. |
Return
( org.apache.poi.ss.usermodel.Picture )
The reference object of the inserted image.
mergedRegion
_xls.mergedRegion(firstRow: int, lastRow: int, firstCol: int, lastCol: int) : int
Description
Performs the merging of cells in the region.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| firstRow | int | First line number. |
| lastRow | int | Last line number. |
| firstCol | int | First column number. |
| lastCol | int | Last column number. |
Return
( int )
The reference of the merged cell region.
_xls.mergedRegion(sheet: org.apache.poi.ss.usermodel.Sheet, firstRow: int, lastRow: int, firstCol: int, lastCol: int) : int
Description
Performs the merging of cells in the passed region in a specific worksheet.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| sheet | org.apache.poi.ss.usermodel.Sheet | Spreadsheet that will be merged the cells. |
| firstRow | int | First line number. |
| lastRow | int | Last line number. |
| firstCol | int | First column number. |
| lastCol | int | Last column number. |
Return
( int )
The reference of the merged cell region.
open
_xls.open(input: InputStream) : XLS
Description
Opens an Excel file.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| input | InputStream | File data input stream object. |
Return
( XLS )
File opened in a new instance of the XLS resource.
_xls.open(input: InputStream, password: string) : XLS
Description
Opens an Excel file.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| input | InputStream | File data input stream object. |
| password | string | File password. |
Return
( XLS )
File opened in a new instance of the XLS resource.
_xls.open(file: File) : XLS
Description
Opens an Excel file.
Attributes
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| file | File | Excel document type file. |