Skip to content
Reference > Classes

SpreadSheetBuilder

Definition

SpreadSheetBuilder var = .... ;

Extends

Extended By

None

Description

Builder for generating a Spreadsheet

Method Summary

Owner Name Return Type Description
SpreadSheetBuilder constructor() SpreadSheetBuilder Creates a builder for generating a Spreadsheet
SpreadSheetBuilder addFlexSheet(name) Boolean Creates a new empty flex sheet with the given name. Note that if used alongside the loadExisting functionality, this should be added after otherwise loading behavior is undefined
SpreadSheetBuilder addSheet(tablePanel, sheetName, onlySelectedRows, shouldFormat) Boolean Adds a sheet into the spreadsheet workbook. Returns true if operation is sucessful; false in any other case including passing null as parameter(s).
SpreadSheetBuilder addSheet(tab, onlySelectedRows, shouldFormat) Boolean Finds all the tables contained by the tab and builds sheets off of them. Returns true if operation is successful; false in any other case including passing null as parameter(s).
SpreadSheetBuilder build() Binary Builds and returns a binary containing the spreadsheet. The spreadsheet builder will be reset after this is called.
SpreadSheetBuilder deleteSheet(sheetName) Boolean Deletes the specified spreadsheet
Object getClassName() String Returns the string name of this object's class type.
SpreadSheetBuilder getExcelPosition(position) String Returns the alphabetical representation of the zero-based position (based upon excel's format)
SpreadSheetBuilder getSheetNames() Set Returns a set containing the names of the sheets added by the builder.
SpreadSheetBuilder getSheetsCount() Integer Returns the number of sheets built by the builder.
SpreadSheetBuilder getWorksheet(worksheetName) Object Returns an existing worksheet with the input name. (Returned type is a base class of either AmiWebSpreadsheet or AmiWebFlexsheet
SpreadSheetBuilder hideSheet(sheetName) Boolean Hides the specified spreadsheet
SpreadSheetBuilder loadExistingSheets(data) Boolean Loads an existing xlsx file into individual flex sheets
SpreadSheetBuilder loadExistingSheets(data, sheetNames) Boolean Loads specified sheets from an existing xlsx file into individual flex sheets
SpreadSheetBuilder renameSheet(sheetName, newSheetName) Boolean Renames the specified spreadsheet
SpreadSheetBuilder setTimezoneOffset(timezone) Boolean Sets the spreadsheet's timezone offset value based on a given timezone. Offsets are used for computing datetime values and are offsetted from GMT+0 and uses the current date to determine the offset value (affected by daylight savings). For more precision, pass in the expected offset with a long value
SpreadSheetBuilder setTimezoneOffset(timezone) Boolean Sets the spreadsheet's timezone offset value based on a given offset.
SpreadSheetBuilder showSheet(sheetName) Boolean Shows the specified hidden spreadsheet
Object toJson() String Returns a json representation of this object.

Method Definitions


constructor()

SpreadSheetBuilder spreadsheetbuilder = new SpreadSheetBuilder()

Description

Creates a builder for generating a Spreadsheet


addFlexSheet(name)

Boolean SpreadSheetBuilder::addFlexSheet(String name)

Description

Creates a new empty flex sheet with the given name. Note that if used alongside the loadExisting functionality, this should be added after otherwise loading behavior is undefined

Parameter Definition

Name Type Description
name String 

addSheet(tablePanel,sheetName,onlySelectedRows,shouldFormat)

Boolean SpreadSheetBuilder::addSheet(TablePanel tablePanel, String sheetName, Boolean onlySelectedRows, Boolean shouldFormat)

Description

Adds a sheet into the spreadsheet workbook. Returns true if operation is sucessful; false in any other case including passing null as parameter(s).

Parameter Definition

Name Type Description
tablePanel TablePanel  The table to build the spreadsheet off of
sheetName String  name of the sheet
onlySelectedRows Boolean  true to only include selectedRows, false to build the entire table
shouldFormat Boolean  true to include table format (bg color, greybar color etc.), false to use default formatting

addSheet(tab,onlySelectedRows,shouldFormat)

Boolean SpreadSheetBuilder::addSheet(Tab tab, Boolean onlySelectedRows, Boolean shouldFormat)

Description

Finds all the tables contained by the tab and builds sheets off of them. Returns true if operation is successful; false in any other case including passing null as parameter(s).

Parameter Definition

Name Type Description
tab Tab  tab containing tables
onlySelectedRows Boolean  true to only include selectedRows, false to build entire tables contained in the tab
shouldFormat Boolean  true to include table format (bg color, greybar color etc.), false to use default formatting

build()

Binary SpreadSheetBuilder::build()

Description

Builds and returns a binary containing the spreadsheet. The spreadsheet builder will be reset after this is called.


deleteSheet(sheetName)

Boolean SpreadSheetBuilder::deleteSheet(String sheetName)

Description

Deletes the specified spreadsheet

Parameter Definition

Name Type Description
sheetName String  Name of sheet to be deleted

getExcelPosition(position)

String SpreadSheetBuilder::getExcelPosition(Integer position)

Description

Returns the alphabetical representation of the zero-based position (based upon excel's format)

Parameter Definition

Name Type Description
position Integer  Position to be converted to excel based position, starts from 0=A,1=B,26=AA,...

getSheetNames()

Set SpreadSheetBuilder::getSheetNames()

Description

Returns a set containing the names of the sheets added by the builder.


getSheetsCount()

Integer SpreadSheetBuilder::getSheetsCount()

Description

Returns the number of sheets built by the builder.


getWorksheet(worksheetName)

Object SpreadSheetBuilder::getWorksheet(String worksheetName)

Description

Returns an existing worksheet with the input name. (Returned type is a base class of either AmiWebSpreadsheet or AmiWebFlexsheet

Parameter Definition

Name Type Description
worksheetName String 

hideSheet(sheetName)

Boolean SpreadSheetBuilder::hideSheet(String sheetName)

Description

Hides the specified spreadsheet

Parameter Definition

Name Type Description
sheetName String  Name of sheet to be hidden

loadExistingSheets(data)

Boolean SpreadSheetBuilder::loadExistingSheets(Binary data)

Description

Loads an existing xlsx file into individual flex sheets

Parameter Definition

Name Type Description
data Binary 

loadExistingSheets(data,sheetNames)

Boolean SpreadSheetBuilder::loadExistingSheets(Binary data, List sheetNames)

Description

Loads specified sheets from an existing xlsx file into individual flex sheets

Parameter Definition

Name Type Description
data Binary  Byte data of the spreadsheet file
sheetNames List  List of names of sheets to be loaded

renameSheet(sheetName,newSheetName)

Boolean SpreadSheetBuilder::renameSheet(String sheetName, String newSheetName)

Description

Renames the specified spreadsheet

Parameter Definition

Name Type Description
sheetName String  Name of sheet to be renamed
newSheetName String  New name to use

setTimezoneOffset(timezone)

Boolean SpreadSheetBuilder::setTimezoneOffset(String timezone)

Description

Sets the spreadsheet's timezone offset value based on a given timezone. Offsets are used for computing datetime values and are offsetted from GMT+0 and uses the current date to determine the offset value (affected by daylight savings). For more precision, pass in the expected offset with a long value

Parameter Definition

Name Type Description
timezone String  Timezone to be used for date parsing

setTimezoneOffset(timezone)

Boolean SpreadSheetBuilder::setTimezoneOffset(Long timezone)

Description

Sets the spreadsheet's timezone offset value based on a given offset.

Parameter Definition

Name Type Description
timezone Long  Timezone offset to be used for date parsing

showSheet(sheetName)

Boolean SpreadSheetBuilder::showSheet(String sheetName)

Description

Shows the specified hidden spreadsheet

Parameter Definition

Name Type Description
sheetName String  Name of sheet to be unhidden