Full API Reference
Classes
DataSetExcelWorkbook ⇐ ServoyExcelWorkbook
FoundSetExcelWorkbook ⇐ ServoyExcelWorkbook
Members
copies : Number
The number of copies
draft : Boolean
Whether it is in draft mode
fitHeight : Number
The number of pages high to fit the sheet in
fitWidth : Number
The number of pages high to fit the sheet in
landscape : Boolean
Whether to print in landscape
mergedRegionType : Object
noColor : Boolean
Whether it is black and white
paperSize : Number
The paper size
Functions
createPrintSetup() ⇒ PrintSetup
Creates a PrintSetup object that can be used in ExcelSheet.setPrintSetup() or to set the default print setup used when workbooks are created from FoundSet or DataSet
createWorkbook([templateOrFileType]) ⇒ ExcelWorkbook
Returns an empty ExcelWorkbook
createWorkbookFromDataSet(dataset, [columns], [headers], [templateOrFileType], [sheetNameToUse]) ⇒ DataSetExcelWorkbook
Creates an ExcelWorkbook from the given dataset
If a template is provided, the dataset will be inserted in the given sheet
createWorkbookFromFoundSet(foundset, dataproviders, [headers], [templateOrFileType], [sheetNameToUse]) ⇒ FoundSetExcelWorkbook
Creates an ExcelWorkbook from the given foundset
If a templateOrFileType is provided, the foundset will be inserted in the given sheet
getCellReferenceFromRange(firstRow, lastRow, firstColumn, lastColumn) ⇒ String
Creates a cell reference (e.g. "A4:C92") from the given range
getRangeFromCellReference(cellReference) ⇒ Object
Converts a cell reference (e.g. "B4:AK234" or "C6") to an object holding first and last row and column
getWorkbook(original) ⇒ ExcelWorkbook
Returns an ExcelWorkbook from the given file or media URL
isLoaded() ⇒ Boolean
If true, all required libraries are present and the scope can be used
Sets the default print setup used when workbooks are created from FoundSet or DataSet
DataSetExcelWorkbook ⇐ ServoyExcelWorkbook
ServoyExcelWorkbook
Extends: ServoyExcelWorkbook
DataSetExcelWorkbook ⇐
ServoyExcelWorkbook
inner
~dataFilled :
Boolean
instance
.getBytes() ⇒
[ 'Array' ].<byte>
.getDataSet() ⇒
JSDataSet
.getNumberOfSheets() ⇒
Number
.getSheetNameAt(index) ⇒
String
.getSheetNames() ⇒
[ 'Array' ].<String>
.writeToFile(targetFile) ⇒
Boolean
.autoSizeColumns :
Boolean
.columnFormats :
[ 'Array' ].<String>
.dataset :
JSDataSet
.defaultDateFormat :
String
.defaultNumberFormat :
String
.freezeFirstRow :
Boolean
.setAutoFilter :
Boolean
.sheetName :
String
.startColumn :
Number
.startRow :
Number
.wb :
Packages.org.apache.poi.ss.usermodel.Workbook
DataSetExcelWorkbook~dataFilled : Boolean
Boolean
dataSetExcelWorkbook.cloneCellStyle(cellStyle) ⇒ ExcelCellStyle
ExcelCellStyle
Clones the given ExcelCellStyle
cellStyle
dataSetExcelWorkbook.cloneFont(font) ⇒ ExcelFont
ExcelFont
Clones the given font and returns a new ExcelFont
font
dataSetExcelWorkbook.cloneSheet(indexToClone) ⇒ ExcelSheet
ExcelSheet
Creates an ExcelSheet from an existing sheet in the Workbook
Returns: ExcelSheet
- clone
indexToClone
Number
one based
dataSetExcelWorkbook.close()
Closes this workbook
dataSetExcelWorkbook.createCellStyle() ⇒ ExcelCellStyle
ExcelCellStyle
Creates an empty ExcelCellStyle
dataSetExcelWorkbook.createColumnStyle(columnIndex) ⇒ ExcelCellStyle
ExcelCellStyle
Creates and returns an ExcelCellStyle used for a specific column
columnIndex
Number
dataSetExcelWorkbook.createFont() ⇒ ExcelFont
ExcelFont
Creates a font
dataSetExcelWorkbook.createHeaderStyle() ⇒ ExcelCellStyle
ExcelCellStyle
Creates and returns an ExcelCellStyle used for the header row
dataSetExcelWorkbook.createRowStyle() ⇒ ExcelCellStyle
ExcelCellStyle
Creates and returns an ExcelCellStyle used for a data row
dataSetExcelWorkbook.createSheet(sheetName) ⇒ ExcelSheet
ExcelSheet
Creates a sheet with the given name
This method makes sure that no illegal names are provided and might change the name if needed
sheetName
String
dataSetExcelWorkbook.fillData()
Fills the sheet with the data of the foundset
This is automatically done when writeToFile()
or getBytes()
is called
Overrides: fillData
dataSetExcelWorkbook.getBytes() ⇒ [ 'Array' ].<byte>
[ 'Array' ].<byte>
Returns the data of this workbook as a byte[]
Returns: [ 'Array' ].<byte>
- bytes
dataSetExcelWorkbook.getDataSet() ⇒ JSDataSet
JSDataSet
Returns the dataset used to create this workbook
dataSetExcelWorkbook.getNumberOfSheets() ⇒ Number
Number
Returns the number of spreadsheets in the workbook
dataSetExcelWorkbook.getSheet(sheetName) ⇒ ExcelSheet
ExcelSheet
Returns the sheet with the given name (case insensitive match)
sheetName
String
dataSetExcelWorkbook.getSheetAt(index) ⇒ ExcelSheet
ExcelSheet
Returns the ExcelSheet object at the given index
index
Number
dataSetExcelWorkbook.getSheetNameAt(index) ⇒ String
String
Returns the name of the sheet at the given index
Returns: String
- sheetName
index
Number
dataSetExcelWorkbook.getSheetNames() ⇒ [ 'Array' ].<String>
[ 'Array' ].<String>
Returns all sheet names
dataSetExcelWorkbook.removeSheetAt(index)
Removes the sheet at the given index
index
Number
dataSetExcelWorkbook.setFormatForColumn(columnIndex, format)
Sets a date or number format used for the given column
columnIndex
Number
format
String
dataSetExcelWorkbook.setSheetNameAt(index, name)
Sets the sheet name
index
Number
name
String
dataSetExcelWorkbook.writeToFile(targetFile) ⇒ Boolean
Boolean
Writes this workbook to the given file
Returns: Boolean
- success
targetFile
String
| plugins.file.JSFile
dataSetExcelWorkbook.autoSizeColumns : Boolean
Boolean
Whether or not all data columns should be auto sized
dataSetExcelWorkbook.columnFormats : [ 'Array' ].<String>
[ 'Array' ].<String>
dataSetExcelWorkbook.columnStyles : [ 'Array' ].<ExcelCellStyle>
[ 'Array' ].<ExcelCellStyle>
dataSetExcelWorkbook.dataset : JSDataSet
JSDataSet
The dataset used to create this workbook
dataSetExcelWorkbook.defaultDateFormat : String
String
The default format used to format date values
This can be overriden for specific columns by calling setFormatForColumn()
dataSetExcelWorkbook.defaultNumberFormat : String
String
The default format used to format number values
This can be overriden for specific columns by calling setFormatForColumn()
dataSetExcelWorkbook.freezeFirstRow : Boolean
Boolean
Whether the header row is frozen or not
Overrides: freezeFirstRow
dataSetExcelWorkbook.headerStyle : ExcelCellStyle
ExcelCellStyle
The style used for the header of the data
Overrides: headerStyle
dataSetExcelWorkbook.rowStyle : ExcelCellStyle
ExcelCellStyle
The style used for a data cell
Overrides: rowStyle
dataSetExcelWorkbook.setAutoFilter : Boolean
Boolean
Whether or not the data columns should be auto filtered or not
Overrides: setAutoFilter
dataSetExcelWorkbook.sheet : ExcelSheet
ExcelSheet
The ExcelSheet used or created
dataSetExcelWorkbook.sheetName : String
String
The name of the sheet to be used
When a template is used, data will be inserted in the sheet with this name or the first best if not found
dataSetExcelWorkbook.startColumn : Number
Number
The first column where data will be inserted (one based)
dataSetExcelWorkbook.startRow : Number
Number
The first row where data will be inserted (one based)
dataSetExcelWorkbook.wb : Packages.org.apache.poi.ss.usermodel.Workbook
Packages.org.apache.poi.ss.usermodel.Workbook
The internal workbook object
dataSetExcelWorkbook.workbook : ExcelWorkbook
ExcelWorkbook
The ExcelWorkbook created
new DataSetExcelWorkbook(dataset, [columns], [headers], [templateOrFileType], [sheetNameToUse])
A DataSet based Excel workbook
dataset
JSDataSet
the dataset
[columns]
[ 'Array' ].<Number>
the column numbers to be included in the sheet
[headers]
[ 'Array' ].<String>
the text to be used as column headers
[templateOrFileType]
String
| plugins.file.JSFile
| Number
either file or media URL pointing to an existing Excel to be used as template or one of the FILE_FORMAT constants when creating empty workbooks
[sheetNameToUse]
String
when a template is used, this is the name of the sheet to be filled
Example
ExcelWorkbook
Suppresswarnings(deprecated): needs to be added to prevent warnings from deprecated WorkbookFactory.create(Object)
.getBytes() ⇒
[ 'Array' ].<byte>
.getNumberOfSheets() ⇒
Number
.getSheetNameAt(index) ⇒
String
.getSheetNames() ⇒
[ 'Array' ].<String>
.writeToFile(targetFile) ⇒
Boolean
.wb :
Packages.org.apache.poi.ss.usermodel.Workbook
excelWorkbook.cloneCellStyle(cellStyle) ⇒ ExcelCellStyle
ExcelCellStyle
Clones the given ExcelCellStyle
cellStyle
excelWorkbook.cloneFont(font) ⇒ ExcelFont
ExcelFont
Clones the given font and returns a new ExcelFont
font
excelWorkbook.cloneSheet(indexToClone) ⇒ ExcelSheet
ExcelSheet
Creates an ExcelSheet from an existing sheet in the Workbook
Returns: ExcelSheet
- clone
indexToClone
Number
one based
excelWorkbook.close()
Closes this workbook
excelWorkbook.createCellStyle() ⇒ ExcelCellStyle
ExcelCellStyle
Creates an empty ExcelCellStyle
excelWorkbook.createFont() ⇒ ExcelFont
ExcelFont
Creates a font
excelWorkbook.createSheet(sheetName) ⇒ ExcelSheet
ExcelSheet
Creates a sheet with the given name
This method makes sure that no illegal names are provided and might change the name if needed
sheetName
String
excelWorkbook.getBytes() ⇒ [ 'Array' ].<byte>
[ 'Array' ].<byte>
Returns this workbook as a byte[] array
excelWorkbook.getNumberOfSheets() ⇒ Number
Number
Returns the number of spreadsheets in the workbook
excelWorkbook.getSheet(sheetName) ⇒ ExcelSheet
ExcelSheet
Returns the sheet with the given name (case insensitive match)
sheetName
String
excelWorkbook.getSheetAt(index) ⇒ ExcelSheet
ExcelSheet
Returns the ExcelSheet object at the given index
index
Number
excelWorkbook.getSheetNameAt(index) ⇒ String
String
Returns the name of the sheet at the given index
Returns: String
- sheetName
index
Number
excelWorkbook.getSheetNames() ⇒ [ 'Array' ].<String>
[ 'Array' ].<String>
Returns all sheet names
excelWorkbook.removeSheetAt(index)
Removes the sheet at the given index
index
Number
excelWorkbook.setSheetNameAt(index, name)
Sets the sheet name
index
Number
name