Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space WBRIDGE and version 7.7.0

Otp
maxHLevel2

Multiexcerpt
MultiExcerptNameintroduction

With the BigExcel Generator you can create Excel documents out of simple structured bulk data.

This adapter generates "simply" structured Excel 97-2003 or Excel 2007 documents. If you have to create more complex Excel documents, have a look at Excel Generator.

Noteinfo
iconfalse

The BigExcel Generator uses the HSSF and XSSF component of Apache POI.

Multiexcerpt include
MultiExcerptNameBigExcelGenerator
nopaneltrue
PageWithExcerptINTERNAL:_examples_BRIDGE

Procedure for Using the BigExcel Generator

The generation of Excel documents involves these steps:

  1. Create an Excel 97-2003 (newXlsWorkbook()) or Excel 2007 (newXlsxWorkbook()) workbook.
  2. Specify types for the cells of the subsequent rows (setTypes()).
    This step is optional. If you do not set types, the Excel default types will be used.
  3. Specifiy formats for the cells of the subsequent rows (setFormats()).
    This step is optional. If you do not set formats, the Excel default formats will be used.
  4. Add data to the excel sheet (addRow()).
  5. Write the Excel document (generateExcel()).
  6. Release the resources used by the created workbook (dispose())

In order to minimize the data transfer between the JVM and the E2E xUML Runtime, a unique id returned by newXlsWorkbook()/ newXlsxWorkbook() is used to reference the workbook in any other operation call.

While the newXlsWorkbook() operations require the whole Excel document data structure to be hold in memory, the newXlsxWorkbook() operations require to hold only a certain number of rows in memory, while the other parts of the Excel document are swapped to a temporary file.

Operations of the BigExcel Generator

newXLSWorkbook Operations

newXlsWorkbook() : String

creates an Excel 97-2003 workbook

ParameterDirectionDescription
workbookIdreturnReference to the created workbook.

newXlsWorkbook( sheetName : String ) : String

creates an Excel 97-2003 workbook containing a single worksheet named sheetName

ParameterDirectionDescription
sheetNameinName of the worksheet to be contained in this workbook.
workbookIdreturnReference to the created workbook.

newXlsWorkbook( sheetNames : String[] ) : String

creates an Excel 97-2003 workbook

ParameterDirectionDescription
sheetNamesinAn array with the names of the worksheets to be contained in this workbook.
workbookIdreturnReference to the created workbook.

newXlsWorkbook( numberOfSheets : Integer ) : String

creates an Excel 97-2003 workbook containing numberOfSheets worksheets

ParameterDirectionDescription
numberOfSheetsinNumber of the worksheets to be contained in this workbook.
workbookIdreturnReference to the created workbook.

newXlsxWorkbook( rowWindowSize : Integer, compressTempFile : Boolean ) : String

creates an Excel 2003 workbook

ParamterDirectionDescription
rowWindowSizeinNumber of rows to be hold in memory (if -1, all rows will be hold in memory).
compressTempFileinif true, the temporary file will be compressed.
workbookIdreturnReference to the created workbook.

newXlsxWorkbook( sheetName : String, rowWindowSize : Integer, compressTempFile : Boolean ) : String

creates an Excel 2003 workbook containing a single worksheet named sheetName

ParameterDirectionDescription
sheetNameinName of the worksheet to be contained in this workbook.
rowWindowSizeinNumber of rows to be hold in memory (if -1, all rows will be hold in memory).
compressTempFileinIf true, the temporary file will be compressed.
workbookIdreturnReference to the created workbook.

newXlsxWorkbook( sheetNames : String[], rowWindowSize : Integer, compressTempFile : Boolean ) : String

creates an Excel 2003 workbook

ParameterDirectionDescription
sheetNamesinAn array with the names of the worksheets to be contained in this workbook.
rowWindowSizeinNumber of rows to be hold in memory (if -1, all rows will be hold in memory).
compressTempFileinIf true, the temporary file will be compressed.
workbookIdreturnReference to the created workbook.

newXlsxWorkbook( numberOfSheets: Integer, rowWindowSize : Integer, compressTempFile : Boolean ) : String

creates an Excel 2003 workbook containing numberOfSheets worksheets

ParameterDirectionDescription
numberOfSheetsinNumber of the worksheets to be contained in this workbook.
rowWindowSizeinNumber of rows to be hold in memory (if -1, all rows will be hold in memory).
compressTempFileinIf true, the temporary file will be compressed.
workbookIdreturnReference to the created workbook.

All of the above newXlsxWorkbook() operations have variants without rowWindowSize and compressTempFile parameters. rowWindowSize defaults to 100, compressTempFile defaults to false.

setTypes Operations

setTypes( workbookId : String, sheetName : String, types : String[])

sets the type information for the subsequently added rows

ParameterDirectionDescription
workbookIdinThe id of the workbook.
sheetNameinThe name of the worksheet.
typesinAn array of the types of the cells (valid values: "Text", "Boolean", "Number", "IsoDateTime", "TimeTicks" or NULL).

setTypes( workbookId : String, sheetIndex : String, types : String[])

sets the type information for the subsequently added rows

ParameterDirectionDescription
workbookIdinThe id of the workbook.
sheetIndexinThe index of the worksheet.
typesinAn array of the types of the cells (valid values: "Text", "Boolean", "Number", "IsoDateTime", "TimeTicks" or NULL).

setFormats Operations

setFormats( workbookId : String, sheetName : String, formats: String[])

sets the format information for the subsequently added rows

ParameterDirectionDescription
workbookIdinThe id of the workbook.
sheetNameinThe name of the worksheet.
formatsinAn array of the formats of the cells.

setFormats( workbookId : String, sheetIndex : String, formats: String[])

sets the format information for the subsequently added rows

ParameterDirectionDescription
workbookIdinThe id of the workbook.
sheetIndexinThe index of the worksheet.
formatsinAn array of the formats of the cells.
Noteinfo
iconfalse

Using setTypes() and/or setFormats() is preferable to using types and formats in addRow(), as doing so will reduce . This reduces the amount of data to be transfered transferred between the JVM and the E2E runtime xUML Runtime by each call of addRow().

addRow Operations

addRow( workbookId : String, values : String[], types : String[], formats : String[] )

add a new row to the first worksheet of the workbook referenced by workbookId

ParameterDirectionDescription
workbookIdinThe id of the workbook
valuesinAn array holding the values of the cells in that row
typesinAn array holding the types of the cells in that row; will temporarily override any values set by setTypes()
formatsinAn array holding the formats of the cells in that row; will temporarily override any values set by setFormats()

addRow( workbookId : String, sheetName : String, values : String[], types : String[], formats : String[] )

add a new row to worksheet sheetName of the workbook referenced by workbookId

ParameterDirectionDescription
workbookIdinThe id of the workbook
sheetNameinThe name of the worksheet
valuesinAn array holding the values of the cells in that row
typesinAn array holding the types of the cells in that row; will temporarily override any values set by setTypes()
formatsinAn array holding the formats of the cells in that row; will temporarily override any values set by setFormats()

addRow( workbookId : String, sheetIndex : Integer, values : String[], types : String[], formats : String[] )

add a new row to worksheet sheetIndex of the workbook referenced by workbookId

ParameterDirectionDescription
workbookIdinThe id of the workbook
sheetIndexinThe index of the worksheet
valuesinAn array holding the values of the cells in that row
typesinAn array holding the types of the cells in that row; will temporarily override any values set by setTypes()
formatsinAn array holding the formats of the cells in that row; will temporarily override any values set by setFormats()

There are variants of the addRow() operations that do not have types and formats parameters.

generateExcel Operations

generateExcel( workbookId : String, filename : String )

writes the Excel document to file filename

ParameterDirectionDescription
workbookIdinThe id of the workbook
filenameinThe name of the Excel file to be written

generateExcel( workbookId : String ) : Blob

writes the Excel document to a blob

ParameterDirectionDescription
workbookIdinThe id of the workbook
resultreturnThe blob to be written

dispose( workbookId : String )

releases the resources bound to this workbook

ParameterDirectionDescription
workbookIdinThe id of the workbook

You can extract the javadoc folder from excelgenerator.jar to get additional information on the Java methods wrapped by this adapter.