All Implemented Interfaces:
DataExceptionContributor, JsonSerializable, RecordSerializable, XmlSerializable, DataWriterFactory, JavaCodeGenerator, Serializable

public class ExcelPipelineOutput extends FileSinkPipelineOutput
A pipeline output that writes to an Excel file using the ExcelWriter.

This ExcelPipelineOutput does not support Excel cell styles and formatting, but only supports data formats for different field types. See setDataFormat(FieldType, String).

See Also:
  • Constructor Details

    • ExcelPipelineOutput

      public ExcelPipelineOutput()
  • Method Details

    • getName

      public String getName()
      Description copied from class: PipelineOutput
      Returns a display name for this output, such as the destination's name followed by its format.
      Overrides:
      getName in class FileSinkPipelineOutput
    • toRecord

      public Record toRecord()
      Description copied from interface: RecordSerializable
      Converts this object's state to a record that RecordSerializable.fromRecord(Record) can load.
      Specified by:
      toRecord in interface RecordSerializable
      Overrides:
      toRecord in class Bean
    • fromRecord

      public ExcelPipelineOutput fromRecord(Record source)
      Description copied from interface: RecordSerializable
      Loads this instance's state from a record and returns this (for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.
      Specified by:
      fromRecord in interface RecordSerializable
      Overrides:
      fromRecord in class PipelineOutput
      Parameters:
      source -
      Returns:
      this instance.
    • getProviderType

      public ExcelDocument.ProviderType getProviderType()
      Returns the provider used to write the workbook (defaults to ExcelDocument.ProviderType.POI_XSSF).
    • setProviderType

      public ExcelPipelineOutput setProviderType(ExcelDocument.ProviderType providerType)
      Sets the provider used to write the workbook (defaults to ExcelDocument.ProviderType.POI_XSSF).
    • getSheetName

      public String getSheetName()
      Returns the name of the sheet to write or blank to use a generated name (defaults to null).
    • getSheetIndex

      public int getSheetIndex()
      Returns the 0-based index of the sheet to write (defaults to -1, a new sheet at the end).
    • setSheetIndex

      public ExcelPipelineOutput setSheetIndex(int sheetIndex)
      Sets the 0-based index of the sheet to write (defaults to -1, a new sheet at the end).
    • getFirstRowIndex

      public int getFirstRowIndex()
      Returns the 0-based row the header or first record is written to (defaults to 0).
    • setFirstRowIndex

      public ExcelPipelineOutput setFirstRowIndex(int firstRowIndex)
      Sets the 0-based row the header or first record is written to (defaults to 0).
    • getFirstColumnIndex

      public int getFirstColumnIndex()
      Returns the 0-based column each record's first field is written to (defaults to 0).
    • setFirstColumnIndex

      public ExcelPipelineOutput setFirstColumnIndex(int firstColumnIndex)
      Sets the 0-based column each record's first field is written to (defaults to 0).
    • isAutofitColumns

      public boolean isAutofitColumns()
      Indicates if columns are widened to fit their widest value (defaults to false).
    • setAutofitColumns

      public ExcelPipelineOutput setAutofitColumns(boolean autofitColumns)
      Indicates if columns are widened to fit their widest value (defaults to false).
    • isAutoFilterColumns

      public boolean isAutoFilterColumns()
      Indicates if drop-down filters are added to the first written row, usually the header (defaults to false).
    • setAutoFilterColumns

      public ExcelPipelineOutput setAutoFilterColumns(boolean autoFilterColumns)
      Indicates if drop-down filters are added to the first written row, usually the header (defaults to false).
    • isFieldNamesInFirstRow

      public boolean isFieldNamesInFirstRow()
      Indicates if a header row of field names is written first (defaults to true).
    • setFieldNamesInFirstRow

      public ExcelPipelineOutput setFieldNamesInFirstRow(boolean fieldNamesInFirstRow)
      Indicates if a header row of field names is written first (defaults to true).
    • getLargeCellHandler

      public LargeCellHandler getLargeCellHandler()
      Returns how text values longer than an Excel cell's 32,767 characters are handled (defaults to LargeCellHandler.FAIL).
    • setLargeCellHandler

      public ExcelPipelineOutput setLargeCellHandler(LargeCellHandler largeCellHandler)
      Sets how text values longer than an Excel cell's 32,767 characters are handled (defaults to LargeCellHandler.FAIL).
    • setSheetName

      public ExcelPipelineOutput setSheetName(String sheetName)
      Sets the name of the sheet to write or blank to use a generated name (defaults to null).
    • createDataWriter

      public DataWriter createDataWriter()
    • getFileSink

      public FileSink getFileSink()
      Specified by:
      getFileSink in class FileSinkPipelineOutput
    • setFileSink

      public ExcelPipelineOutput setFileSink(FileSink fileSink)
      Specified by:
      setFileSink in class FileSinkPipelineOutput
    • getStyleFormats

      @Deprecated public Map<FieldType,String> getStyleFormats()
      Deprecated.
      use getDataFormats() instead
    • getDataFormats

      public Map<FieldType,String> getDataFormats()
      Returns the Excel data formats set per field type, applied over the writer's defaults, or null if none were set.
    • getStyleFormats

      @Deprecated public Map<FieldType,String> getStyleFormats(boolean create)
      Deprecated.
    • getDataFormats

      public Map<FieldType,String> getDataFormats(boolean create)
      Returns the data formats per field type, first creating an empty map if create is true and there is none.
    • setStyleFormat

      @Deprecated public ExcelPipelineOutput setStyleFormat(FieldType fieldType, String dataFormat)
      Deprecated.
    • setDataFormat

      public ExcelPipelineOutput setDataFormat(FieldType fieldType, String dataFormat)
      Sets the Excel data format, such as 0.00 or m/d/yy, for cells of the given field type; neither may be null.
    • getFreezeRows

      public Integer getFreezeRows()
      Gets the number of rows to freeze (make non-scrollable) in the Excel sheet.

      Frozen rows remain visible at the top of the sheet when scrolling vertically.

      Returns:
      the number of rows to freeze, or null if no rows are frozen
    • setFreezeRows

      public ExcelPipelineOutput setFreezeRows(Integer freezeRows)
      Sets the number of rows to freeze (make non-scrollable) in the Excel sheet.

      Frozen rows remain visible at the top of the sheet when scrolling vertically.

      Parameters:
      freezeRows - the number of rows to freeze, or null to not freeze any rows
      Returns:
      this instance for method chaining
    • getFreezeColumns

      public Integer getFreezeColumns()
      Gets the number of columns to freeze (make non-scrollable) in the Excel sheet.

      Frozen columns remain visible on the left side of the sheet when scrolling horizontally.

      Returns:
      the number of columns to freeze, or null if no columns are frozen
    • setFreezeColumns

      public ExcelPipelineOutput setFreezeColumns(Integer freezeColumns)
      Sets the number of columns to freeze (make non-scrollable) in the Excel sheet.

      Frozen columns remain visible on the left side of the sheet when scrolling horizontally.

      Parameters:
      freezeColumns - the number of columns to freeze, or null to not freeze any columns
      Returns:
      this instance for method chaining
    • generateJavaCode

      public void generateJavaCode(JavaCodeBuilder code)
      Description copied from interface: JavaCodeGenerator
      Appends Java source code representing this object to the given builder.
    • generateSaveCode

      public void generateSaveCode(JavaCodeBuilder code)
      Description copied from class: FileSinkPipelineOutput
      Writes the generated code that saves the output after Job.run(reader, writer); does nothing by default.
      Overrides:
      generateSaveCode in class FileSinkPipelineOutput
    • toXmlElement

      public Element toXmlElement(Document document)
      Description copied from interface: XmlSerializable
      Returns an element, created with document, describing this object; the default implementation throws a DataException.
      Specified by:
      toXmlElement in interface XmlSerializable
      Overrides:
      toXmlElement in class PipelineOutput
    • fromXmlElement

      public ExcelPipelineOutput fromXmlElement(Element pipelineOutputElement)