Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space WBRIDGE and version 24.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.

Info
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 the following steps. We recommend to implement all workbook handling to a sub-activity (see step 2).

  1. Create an Excel 97-2003 (newXlsWorkbook()) or Excel 2007 (newXlsxWorkbook()) workbook.
  2. Create a sub-activity and pass the workbook ID. Implement all workbook handling here, like
    • 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.
    • Specify 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.
    • Add data to the excel sheet (addRow()).
    • Write the Excel document (generateExcel()).
  3. After the sub-activity, implement some error handling.
  4. Release the resources used by the created workbook (dispose()).

    Multiexcerpt
    MultiExcerptNamehint_dispose
    Info
    iconfalse

    It is important to release the used resources using dispose() after having generated the Excel file as well as in case of error. Not releasing them may lead to unexpected side effects.

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

Operations of the BigExcel Generator

Info
iconfalse

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.

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.
Info
iconfalse

Using setTypes() and/or setFormats() is preferable to using types and formats in addRow(). This reduces the amount of data to be transferred between the JVM and the 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

Multiexcerpt include
MultiExcerptNamehint_dispose
nopaneltrue
PageWithExcerptBig Excel Generator

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

Anchor
dispose
dispose

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.

Panel
titleOn this Page:
Table of Contents