Class ExcelAbstractExporter<RC extends XlsReportConfiguration,C extends XlsExporterConfiguration,E extends JRExporterContext>

java.lang.Object
net.sf.jasperreports.engine.JRAbstractExporter<RC,C,OutputStreamExporterOutput,E>
net.sf.jasperreports.engine.export.ExcelAbstractExporter<RC,C,E>
All Implemented Interfaces:
Exporter<ExporterInput,RC,C,OutputStreamExporterOutput>
Direct Known Subclasses:
JRXlsAbstractExporter, XlsxMetadataExporter

public abstract class ExcelAbstractExporter<RC extends XlsReportConfiguration,C extends XlsExporterConfiguration,E extends JRExporterContext> extends JRAbstractExporter<RC,C,OutputStreamExporterOutput,E>
Author:
Sanda Zaharia (shertage@users.sourceforge.net)
  • Field Details

    • XLS_EXPORTER_PROPERTIES_PREFIX

      public static final String XLS_EXPORTER_PROPERTIES_PREFIX
      See Also:
    • DEFAULT_SHEET_NAME_PREFIX

      public static final String DEFAULT_SHEET_NAME_PREFIX
      See Also:
    • DEFAULT_DEFINED_NAME_SCOPE

      public static final String DEFAULT_DEFINED_NAME_SCOPE
      See Also:
    • DEFAULT_DEFINED_NAME_SCOPE_SEPARATOR

      public static final String DEFAULT_DEFINED_NAME_SCOPE_SEPARATOR
      See Also:
    • EXCEPTION_MESSAGE_KEY_CANNOT_ADD_CELL

      public static final String EXCEPTION_MESSAGE_KEY_CANNOT_ADD_CELL
      See Also:
    • EXCEPTION_MESSAGE_KEY_CANNOT_MERGE_CELLS

      public static final String EXCEPTION_MESSAGE_KEY_CANNOT_MERGE_CELLS
      See Also:
    • EXCEPTION_MESSAGE_KEY_CELL_FORMAT_TEMPLATE_ERROR

      public static final String EXCEPTION_MESSAGE_KEY_CELL_FORMAT_TEMPLATE_ERROR
      See Also:
    • EXCEPTION_MESSAGE_KEY_COLUMN_INDEX_BEYOND_LIMIT

      public static final String EXCEPTION_MESSAGE_KEY_COLUMN_INDEX_BEYOND_LIMIT
      See Also:
    • EXCEPTION_MESSAGE_KEY_LOADED_FONTS_ERROR

      public static final String EXCEPTION_MESSAGE_KEY_LOADED_FONTS_ERROR
      See Also:
    • EXCEPTION_MESSAGE_KEY_NEGATIVE_COLUMN_INDEX

      public static final String EXCEPTION_MESSAGE_KEY_NEGATIVE_COLUMN_INDEX
      See Also:
    • EXCEPTION_MESSAGE_KEY_REPORT_GENERATION_ERROR

      public static final String EXCEPTION_MESSAGE_KEY_REPORT_GENERATION_ERROR
      See Also:
    • EXCEPTION_MESSAGE_KEY_TEMPLATE_NOT_FOUND

      public static final String EXCEPTION_MESSAGE_KEY_TEMPLATE_NOT_FOUND
      See Also:
    • PROPERTY_CELL_FORMULA

      public static final String PROPERTY_CELL_FORMULA
      Property that stores the formula which has to be applied to a given cell in an excel sheet.
      See Also:
    • PROPERTY_CELL_PATTERN

      public static final String PROPERTY_CELL_PATTERN
      Property that stores the pattern which has to be applied to a given cell in an excel sheet.
      See Also:
    • PROPERTY_SHEET_NAME

      public static final String PROPERTY_SHEET_NAME
      Property used to set the name of the sheet containing a given element. Its value overrides the report-level settings for the sheet name. If several elements in the sheet contain this property, the engine will consider the value of the last exported element's property.
      See Also:
    • PROPERTY_FREEZE_ROW_EDGE

      public static final String PROPERTY_FREEZE_ROW_EDGE
      This property indicates the horizontal edge of the freeze pane, relative to the current cell. If set, it overrides the PROPERTY_FREEZE_ROW value. Allowed values are:
      • Top - The current row is the first unlocked row in the sheet. All rows above are 'frozen'.
      • Bottom - The current row is the last 'frozen' row in the sheet. All rows below are unlocked.
      See Also:
    • PROPERTY_FREEZE_COLUMN_EDGE

      public static final String PROPERTY_FREEZE_COLUMN_EDGE
      This property indicates the vertical edge of the freeze pane, relative to the current cell. If set, it overrides the PROPERTY_FREEZE_COLUMN and PROPERTY_FREEZE_SHEET_COLUMNS values. Allowed values are:
      • Left - The current column is the first unlocked column in the sheet. All columns to the left are 'frozen'.
      • Right - The current column is the last 'frozen' column in the sheet. All columns to the right are unlocked.
      See Also:
    • PROPERTY_AUTO_FIT_ROW

      public static final String PROPERTY_AUTO_FIT_ROW
      Flag property that indicates whether Excel should autofit the current row height. Allowed values are:
      • true
      • false - this is the default value.
      Since:
      4.5.1
      See Also:
    • PROPERTY_IGNORE_ROW_HEIGHT

      public static final String PROPERTY_IGNORE_ROW_HEIGHT
      Flag property that indicates whether the height of the element should contribute to the current row height calculation. The current row height is given by the tallest element on the row, unless row height auto fit is activated. But in certain cases, the tallest element might span multiple rows and thus its bigger height should not be considered, especially in case of metadata based exports. Allowed values are:
      • true
      • false - this is the default value.
      Since:
      6.20.1
      See Also:
    • PROPERTY_AUTO_FIT_COLUMN

      public static final String PROPERTY_AUTO_FIT_COLUMN
      Flag property that indicates whether Excel should autofit the current column width. Allowed values are:
      • true
      • false - this is the default value.
      Since:
      4.5.1
      See Also:
    • PROPERTY_AUTO_FILTER

      public static final String PROPERTY_AUTO_FILTER
      This element-level property is used to indicate the boundaries of the autofilter data range in the current sheet. Allowed values are:
      • Start - The current cell will be marked as autofilter heading cell, and column data below/to the right of this cell can be considered as part of the autofilter data range. The starting point of the autofilter data range will be the next cell below the current cell (ie if the current cell reference is B4, the autofilter range will start with the "B5" cell reference: "B5:M20").
        If multiple autofilter Start values are found in the same sheet, only the last one will be considered. If the Start value is present but no End value is found in the sheet, then only the current column will be considered for the data range.
        If the autofilter Start value is set on the same row as the autofilter End value, the data range will include all data below this heading row, placed between the start column and the end column.
      • End - The current cell will be marked as autofilter ending cell, and column data in this cell and above/to the left can be considered as part of the autofilter data range. The ending cell in the data range is the current cell reference (ie if the current cell reference is M20, the autofilter range will end in "M20": "B5:M20"). The heading cell for the current column will be placed in the same column on the row containing the autofilter Start value.
        Caution: If no autofilter Start value is found in the sheet, the autofilter End value will be considered as Start value instead.
        If multiple autofilter End value are found in the same sheet, only the last one will be considered.
        If the autofilter Start value is set on the same row as the autofilter End value, the data range will include all data below this heading row, placed between the start column and the end column.
      See Also:
    • PROPERTY_COLUMN_WIDTH

      public static final String PROPERTY_COLUMN_WIDTH
      Element-level property used to adjust the column width to values suitable for Excel output, taking into account that column widths are measured in Excel in Normal style default character width units. The pixel-to-character width translation depends on the default normal style character width, so it cannot be always accurately fitted. In this case, one can adjust the current column width by setting this property with an integer value measured in pixels. The JR engine will perform the pixel-to-character width mapping using this value instead of the element's width attribute.
      If defined, this property will override the PROPERTY_COLUMN_WIDTH_RATIO value for the current column
      See Also:
    • PROPERTY_AVERAGE_CHAR_WIDTH_FACTOR

      public static final String PROPERTY_AVERAGE_CHAR_WIDTH_FACTOR
      Property specifying the multiplication factor to be used when calculating the column width for auto fit columns on top of the fill-time calculated average char width.
      See Also:
    • PROPERTY_ROW_OUTLINE_LEVEL_PREFIX

      public static final String PROPERTY_ROW_OUTLINE_LEVEL_PREFIX
      Property prefix used to indicate the current outline row level, and when necessary, the ending row of the current outline row group with the given level. The suffix of these properties is associated with the outline level, while the property value indicates if the current row group should continue or should end. The most recommended practice is to use the outline level itself as property suffix, although this is not mandatory. The suffix may take any other string value, but one has to keep in mind that suffixes are used as sorted row level descriptors. For instance, because "aaa" < "bbb", the outline level associated with the "aaa" suffix will be smaller than the level associated with the "bbb" suffix. The most intuitive representation of the row levels uses the row level as property suffix.
      In such a case, the net.sf.jasperreports.export.xls.outline.level.2 property means that its value is correlated with the outline level 2, so the current row belongs to a level 2 row group. Based on Office Open XML specs, allowed values for outline levels are positive integers from 1 to 7.
      The value of this property could be any expression (including null). When such a property occurrence is met, the suffix indicates the outline level for that row. If multiple properties with the same prefix are defined for the same row, the deepest outline level is considered for that row. To end an outline row group one has to set the related outline level property with the End value. This is a special property value instructing the JR engine that the current row group of that level ends on the current row.
      See Also:
    • PROPERTY_BREAK_BEFORE_ROW

      public static final String PROPERTY_BREAK_BEFORE_ROW
      Element level property specifying if a sheet will break before the row displaying that element. It is very useful especially when displaying each report's group on a separate sheet is intended.
      See Also:
    • PROPERTY_BREAK_AFTER_ROW

      public static final String PROPERTY_BREAK_AFTER_ROW
      Element level property specifying if a sheet will break after the row displaying that element. It is very useful especially when displaying each report's group on a separate sheet is intended.
      See Also:
    • PROPERTY_COLUMN_NAME

      public static final String PROPERTY_COLUMN_NAME
      A string that represents the name for the column that should appear in the XLS export. It must be one of the values in XlsMetadataReportConfiguration.getColumnNames(), if provided.
      See Also:
    • PROPERTY_REPEAT_VALUE

      public static final String PROPERTY_REPEAT_VALUE
      Property that specifies whether the value associated with PROPERTY_COLUMN_NAME should be repeated or not when it is missing.

      The property itself defaults to false.

      See Also:
    • PROPERTY_DATA

      public static final String PROPERTY_DATA
      Property that specifies what value to associate with PROPERTY_COLUMN_NAME.

      The property itself defaults to the text value of the report element that this property is assigned to.

      See Also:
    • PROPERTY_COLUMN_WIDTH_METADATA

      public static final String PROPERTY_COLUMN_WIDTH_METADATA
      Element-level property used to adjust the column width to values suitable for Excel metadata output, taking into account that when column headers are included in the report, they come with no available width settings. Also keep in mind that column widths are measured in Excel in Normal style default character width units. The pixel-to-character width translation depends on the default normal style character width, so it cannot be always accurately fitted. In this case, one can adjust the current column width by setting this property with an integer value measured in pixels. The JR engine will perform the pixel-to-character width mapping using this value instead of the element's width attribute.
      If defined, this property will override both the PROPERTY_COLUMN_WIDTH value for the current column and the the element's width attribute
      See Also:
    • CURRENT_ROW_HEIGHT

      public static final String CURRENT_ROW_HEIGHT
      See Also:
    • CURRENT_ROW_AUTOFIT

      public static final String CURRENT_ROW_AUTOFIT
      See Also:
    • loadedFonts

      protected List<Object> loadedFonts
    • nature

      protected ExporterNature nature
    • sheetNames

      protected String[] sheetNames
    • reportIndex

      protected int reportIndex
    • pageIndex

      protected int pageIndex
    • pageFormat

      protected PrintPageFormat pageFormat
    • onePagePerSheetMap

      protected Map<Integer,Boolean> onePagePerSheetMap
    • sheetsBeforeCurrentReport

      protected int sheetsBeforeCurrentReport
    • sheetsBeforeCurrentReportMap

      protected Map<Integer,Integer> sheetsBeforeCurrentReportMap
    • renderersCache

      protected RenderersCache renderersCache
    • defaultFont

      protected JRFont defaultFont
    • sheetInfo

      protected JRXlsAbstractExporter.SheetInfo sheetInfo
    • sheetIndex

      protected int sheetIndex
      Used for counting the total number of sheets.
    • sheetNamesIndex

      protected int sheetNamesIndex
      Used for iterating through sheet names.
    • sheetNamesMap

      protected Map<String,Integer> sheetNamesMap
      Used when indexing the identical sheet name. Contains sheet names as keys and the number of occurrences of each sheet name as values.
    • autoFilterStart

      protected String autoFilterStart
    • autoFilterEnd

      protected String autoFilterEnd
    • firstPageNotSet

      protected boolean firstPageNotSet
    • keepTemplateSheets

      protected Boolean keepTemplateSheets
    • workbookTemplate

      protected String workbookTemplate
    • invalidCharReplacement

      protected String invalidCharReplacement
    • maxColumnIndex

      protected int maxColumnIndex
    • definedNamesMap

    • formatPatternsMap

      protected Map<String,String> formatPatternsMap
    • onePagePerSheet

      protected boolean onePagePerSheet
    • defaultShrinkToFit

      protected boolean defaultShrinkToFit
    • defaultWrapText

      protected boolean defaultWrapText
    • defaultCellLocked

      protected boolean defaultCellLocked
    • defaultCellHidden

      protected boolean defaultCellHidden
    • defaultIgnoreTextFormatting

      protected boolean defaultIgnoreTextFormatting
    • ignoreAnchors

      protected boolean ignoreAnchors
    • detectCellType

      protected boolean detectCellType
    • defaultImageAnchorType

      protected ImageAnchorTypeEnum defaultImageAnchorType
    • collapseRowSpan

      protected boolean collapseRowSpan
    • defaultUseTimeZone

      protected boolean defaultUseTimeZone
    • imageBorderFixEnabled

      protected boolean imageBorderFixEnabled
  • Constructor Details

  • Method Details