public abstract class JRXlsAbstractExporter<RC extends XlsReportConfiguration,C extends XlsExporterConfiguration,E extends JRExporterContext> extends JRAbstractExporter<RC,C,OutputStreamExporterOutput,E>
JRXlsExporter
implementation, which
uses the Apache POI library to export documents to the Microsoft Excel 2003 file format (XLS).
Later on, with the introduction of the Microsoft Excel 2007 file format (XLSX), a new
exporter was added to JasperReports to support it. This exporter implementation is the
JRXlsxExporter
; it does not rely
on any third party library to produce XLSX files.
Because in XLS and XLSX all document content is placed inside cells, the Excel exporters
are considered typical grid exporters, and having their known limitations.
JasperPrint
document
on one sheet (one after the another), or to put each page on a separate sheet in the resulting
Excel file. The choice is made by setting the
isOnePagePerSheet()
exporter configuration setting, which is set to Boolean.FALSE
by default.
When isOnePagePerSheet()
is set to true, or when you have to execute a batch export to XLS, multiple sheets are created in the worksheet.
You can also combine two exporter settings to customize the maximum number of rows per
page, and display each page of the report in a separate sheet. To do this, set the number
of rows per sheet for net.sf.jasperreports.export.xls.max.rows.per.sheet
property and
set true for net.sf.jasperreports.export.xls.one.page.per.sheet
property.
The JasperReports Excel exporters provide a simple but efficient sheet-naming
mechanism. They use the getSheetNames()
exporter configuration setting to read custom sheet names
from the String array passed as value. This exporter setting can hold an array of
strings, which are passed as sheet names in order. If no value is supplied for this
setting or if the value contains fewer sheet names than actually needed
by the final document, then the sheets are named by default Page i
(where i represents
the one-based sheet index).
Taking into account the sheet name's length limitation in Excel (31 characters), if a sheet
name contains more than 31 characters it will be truncated as follows: the name of the
sheet will be given by the first 31 characters minus the sheet index length characters of
the document's name, followed by the sheet index, so that the entire name has exactly 31
characters.
For example, if the second sheet name is TheQuickBrownFoxJumpsOverTheLazyDog
(35 chars), it will become TheQuickBrownFoxJumpsOverTheLa2 (the final zyDog gets
truncated, and the second sheet index 2 will end the name).
The name of the 12345-th sheet will become TheQuickBrownFoxJumpsOverT12345
(the final heLazyDog gets truncated, in order to make the exact room for 12345).
Multiple sheet names can be specified in the JRXML file as well, using the
net.sf.jasperreports.export.xls.sheet.names.<arbitrary_name>
property
at report level. Add the following to the JRXML file:
<property name="net.sf.jasperreports.export.xls.sheet.names.all" value="Sheet A/Sheet B/Sheet C" />Keep in mind the naming order is important, sheets will be named in the same order the names are provided in this property. Sheets can be also named at element level, using the
net.sf.jasperreports.export.xls.sheet.name
element property. This name will be provided for the sheet the element belongs to.
Graphics2D
or PDF format, the page breaks are visible in Excel format. Sometimes this
is not desirable. One way to make page breaks less obvious and the layout more flow-based
is to suppress all the remaining blank space between cells on the vertical axis.
When set to Boolean.TRUE
, the
isRemoveEmptySpaceBetweenRows()
exporter configuration flag ensures that all empty rows on the resulting sheet are collapsed. By
default, the exporter preserves all the white space for a precise page layout.
The provided /demo/samples/nopagebreak sample shows you how to use this
setting when exporting to XLS to produce a more flow-based document layout.
To completely ignore pagination, use the built-in fill-time parameter
IS_IGNORE_PAGINATION
.
You can modify the API to remove the empty space between rows and columns as well.
You need to set net.sf.jasperreports.export.xls.remove.empty.space.between.rows
property and/or net.sf.jasperreports.export.xls.remove.empty.space.between.columns
property to true.
Keep in mind these settings are limited by your report layout. If it is too far away
from a grid layout, these options cannot work. On a good grid layout, once you set
net.sf.jasperreports.export.xls.remove.empty.space.between.rows
property and/or
net.sf.jasperreports.export.xls.remove.empty.space.between.columns
property to
true, the empty spaces are removed.
JasperPrint
object), all text elements are
considered alphanumeric values. This means that if a numeric text field of type
java.lang.Double
is placed in the report template at design time, all
the text elements inside the JasperPrint
object
resulting from it will hold java.lang.String
values, even though
they are actually numbers. Therefore, in a sense, data type information is lost
during report filling. This is because the main goal of JasperReports is to create
documents for viewing and printing, not necessarily for further data manipulation inside
tools like Excel, where formulas could be added to numeric cells.
However, these resulting text elements found in the generated documents nowadays hold
enough data type information (in addition to the alphanumeric content) for the original
value of the text element to be re-created, if needed.
Both Excel exporters support the
isDetectCellType()
configuration flag, which forces the recreation
of the original cell value in accordance with its declared data type, as specified
in the report template.
Cell type detection is turned off by default.
You can have JasperReports automatically detect the cell type by modifying the API. Set the
net.sf.jasperreports.export.xls.detect.cell.type
property to true. When you do this, instead
of being prompted by Excel to convert the value manually, the value is automatically
converted.
getFormatPatternsMap()
export configuration setting and supply
a java.util.Map
as value. This map should contain Java format patterns as keys and
corresponding Excel format patterns as values.
Another way to adjust the format pattern to Excel-compatible values is to set the
net.sf.jasperreports.export.xls.pattern
property at element level.
isFontSizeFixEnabled()
exporter configuration flag to decrease the font size by one point when generating the cell format.
Alternatively, one can use the net.sf.jasperreports.export.xls.font.size.fix.enabled
property at report level.
JasperPrint
document normally results in empty cells on the corresponding sheet inside the Excel file.
The background color of these empty cells is specified by the configuration of the Excel
viewer itself. This makes the cells appear transparent. To force the document's background
to be white, set the
isWhitePageBackground()
exporter configuration flag to Boolean.TRUE
.
isCreateCustomPalette()
export configuration flag. If the flag is set, the nearest not yet modified color from the palette is chosen
and modified to exactly match the report color. If all the colors from the palette
are modified (the palette has a fixed size), the nearest color from the palette is
chosen for further report colors.
To see other various exporter configuration settings, please consult the
XlsReportConfiguration
and
XlsExporterConfiguration
classes.XlsExporterConfiguration
,
XlsReportConfiguration
Modifier and Type | Class and Description |
---|---|
protected static class |
JRXlsAbstractExporter.SheetInfo |
protected static class |
JRXlsAbstractExporter.TextAlignHolder |
JRAbstractExporter.BaseExporterContext, JRAbstractExporter.PageRange
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
autoFilterEnd |
protected java.lang.String |
autoFilterStart |
static java.lang.String |
DEFAULT_SHEET_NAME_PREFIX |
protected JRFont |
defaultFont |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_CANNOT_ADD_CELL |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_CANNOT_MERGE_CELLS |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_CELL_FORMAT_TEMPLATE_ERROR |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_COLUMN_INDEX_BEYOND_LIMIT |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_LOADED_FONTS_ERROR |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_NEGATIVE_COLUMN_INDEX |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_REPORT_GENERATION_ERROR |
static java.lang.String |
EXCEPTION_MESSAGE_KEY_TEMPLATE_NOT_FOUND |
protected boolean |
firstPageNotSet |
protected int |
gridColumnFreezeIndex |
protected int |
gridRowFreezeIndex |
protected java.lang.String |
invalidCharReplacement |
protected boolean |
isFreezeColumnEdge |
protected boolean |
isFreezeRowEdge |
protected java.lang.Boolean |
keepTemplateSheets |
protected java.util.List<java.lang.Object> |
loadedFonts |
protected int |
maxColumnFreezeIndex |
protected int |
maxColumnIndex |
protected int |
maxRowFreezeIndex |
protected ExporterNature |
nature |
protected java.util.Map<java.lang.Integer,java.lang.Boolean> |
onePagePerSheetMap |
protected PrintPageFormat |
pageFormat |
protected int |
pageIndex |
static java.lang.String |
PROPERTY_AUTO_FILTER
This element-level property is used to indicate the boundaries of the autofilter data range in the current sheet.
|
static java.lang.String |
PROPERTY_AUTO_FIT_COLUMN
Flag property that indicates whether Excel should autofit the current column width.
|
static java.lang.String |
PROPERTY_AUTO_FIT_ROW
Flag property that indicates whether Excel should autofit the current row height.
|
static java.lang.String |
PROPERTY_BREAK_AFTER_ROW
Element level property specifying if a sheet will break after the row displaying that element.
|
static java.lang.String |
PROPERTY_BREAK_BEFORE_ROW
Element level property specifying if a sheet will break before the row displaying that element.
|
static java.lang.String |
PROPERTY_CELL_FORMULA
Property that stores the formula which has to be applied to a given cell in an excel sheet.
|
static java.lang.String |
PROPERTY_CELL_HIDDEN
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_CELL_HIDDEN . |
static java.lang.String |
PROPERTY_CELL_LOCKED
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_CELL_LOCKED . |
static java.lang.String |
PROPERTY_CELL_PATTERN
Property that stores the pattern which has to be applied to a given cell in an excel sheet.
|
static java.lang.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.
|
static java.lang.String |
PROPERTY_COLUMN_WIDTH_RATIO
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_COLUMN_WIDTH_RATIO . |
static java.lang.String |
PROPERTY_FIRST_PAGE_NUMBER
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_FIRST_PAGE_NUMBER . |
static java.lang.String |
PROPERTY_FIT_HEIGHT
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_FIT_HEIGHT . |
static java.lang.String |
PROPERTY_FIT_WIDTH
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_FIT_WIDTH . |
static java.lang.String |
PROPERTY_FREEZE_COLUMN
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_FREEZE_COLUMN . |
static java.lang.String |
PROPERTY_FREEZE_COLUMN_EDGE
This property indicates the vertical edge of the freeze pane, relative to the current cell.
|
static java.lang.String |
PROPERTY_FREEZE_ROW
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_FREEZE_ROW . |
static java.lang.String |
PROPERTY_FREEZE_ROW_EDGE
This property indicates the horizontal edge of the freeze pane, relative to the current cell.
|
static java.lang.String |
PROPERTY_IGNORE_ANCHORS
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_IGNORE_ANCHORS . |
static java.lang.String |
PROPERTY_IGNORE_HYPERLINK
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_IGNORE_HYPERLINK . |
static java.lang.String |
PROPERTY_IMAGE_ANCHOR_TYPE
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_IMAGE_ANCHOR_TYPE . |
static java.lang.String |
PROPERTY_PAGE_SCALE
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_PAGE_SCALE . |
static java.lang.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.
|
static java.lang.String |
PROPERTY_SHEET_DIRECTION
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_SHEET_DIRECTION . |
static java.lang.String |
PROPERTY_SHEET_FOOTER_CENTER
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_SHEET_FOOTER_CENTER . |
static java.lang.String |
PROPERTY_SHEET_FOOTER_LEFT
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_SHEET_FOOTER_LEFT . |
static java.lang.String |
PROPERTY_SHEET_FOOTER_RIGHT
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_SHEET_FOOTER_RIGHT . |
static java.lang.String |
PROPERTY_SHEET_HEADER_CENTER
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_SHEET_HEADER_CENTER . |
static java.lang.String |
PROPERTY_SHEET_HEADER_LEFT
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_SHEET_HEADER_LEFT . |
static java.lang.String |
PROPERTY_SHEET_HEADER_RIGHT
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_SHEET_HEADER_RIGHT . |
static java.lang.String |
PROPERTY_SHEET_NAME
Property used to set the name of the sheet containing a given element.
|
static java.lang.String |
PROPERTY_SHOW_GRIDLINES
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_SHOW_GRIDLINES . |
static java.lang.String |
PROPERTY_USE_TIMEZONE
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_USE_TIMEZONE . |
static java.lang.String |
PROPERTY_WORKBOOK_TEMPLATE
Deprecated.
Replaced by
XlsExporterConfiguration.PROPERTY_WORKBOOK_TEMPLATE . |
static java.lang.String |
PROPERTY_WORKBOOK_TEMPLATE_KEEP_SHEETS
Deprecated.
|
static java.lang.String |
PROPERTY_WRAP_TEXT
Deprecated.
Replaced by
XlsReportConfiguration.PROPERTY_WRAP_TEXT . |
protected int |
reportIndex |
protected int |
sheetIndex
Used for counting the total number of sheets.
|
protected JRXlsAbstractExporter.SheetInfo |
sheetInfo |
protected java.lang.String[] |
sheetNames |
protected int |
sheetNamesIndex
Used for iterating through sheet names.
|
protected java.util.Map<java.lang.String,java.lang.Integer> |
sheetNamesMap
Used when indexing the identical sheet name.
|
protected int |
sheetsBeforeCurrentReport |
protected java.util.Map<java.lang.Integer,java.lang.Integer> |
sheetsBeforeCurrentReportMap |
protected java.lang.String |
workbookTemplate |
static java.lang.String |
XLS_EXPORTER_PROPERTIES_PREFIX |
allSelector, crtCompositeConfiguration, crtCompositeItemConfiguration, crtItem, dateFormatCache, EXCEPTION_MESSAGE_KEY_END_PAGE_INDEX_OUT_OF_RANGE, EXCEPTION_MESSAGE_KEY_INVALID_IMAGE_NAME, EXCEPTION_MESSAGE_KEY_INVALID_ZOOM_RATIO, EXCEPTION_MESSAGE_KEY_MIXED_CALLS_NOT_ALLOWED, EXCEPTION_MESSAGE_KEY_OUTPUT_WRITER_ERROR, EXCEPTION_MESSAGE_KEY_PAGE_INDEX_OUT_OF_RANGE, EXCEPTION_MESSAGE_KEY_START_PAGE_INDEX_OUT_OF_RANGE, exporterConfiguration, exporterContext, exporterInput, exporterOutput, filter, itemConfiguration, jasperPrint, jasperReportsContext, noBackcolorSelector, noneSelector, numberFormatCache, parameters, propertiesUtil, PROPERTY_DEFAULT_FILTER_FACTORY, PROPERTY_SUFFIX_DEFAULT_FILTER_FACTORY, styledTextUtil, textValueClasses
Constructor and Description |
---|
JRXlsAbstractExporter() |
JRXlsAbstractExporter(JasperReportsContext jasperReportsContext) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addBlankCell(JRExporterGridCell gridCell,
int colIndex,
int rowIndex) |
protected abstract void |
addOccupiedCell(OccupiedGridCell occupiedGridCell,
int colIndex,
int rowIndex) |
protected abstract void |
addRowBreak(int rowIndex) |
protected int |
calculateHeightForDinAN(int n) |
protected int |
calculateHeightForDinBN(int n) |
protected int |
calculateHeightForDinCN(int n) |
protected int |
calculateWidthForDinAN(int n) |
protected int |
calculateWidthForDinBN(int n) |
protected int |
calculateWidthForDinCN(int n) |
protected abstract void |
closeSheet() |
protected abstract void |
closeWorkbook(java.io.OutputStream os) |
protected abstract void |
createSheet(CutsInfo xCuts,
JRXlsAbstractExporter.SheetInfo sheetInfo) |
protected void |
ensureInput() |
protected void |
ensureOutput() |
protected abstract void |
exportFrame(JRPrintFrame frame,
JRExporterGridCell cell,
int colIndex,
int rowIndex) |
protected abstract void |
exportGenericElement(JRGenericPrintElement element,
JRExporterGridCell cell,
int colIndex,
int rowIndex,
int emptyCols,
int yCutsRow,
JRGridLayout layout) |
protected abstract void |
exportImage(JRPrintImage image,
JRExporterGridCell cell,
int colIndex,
int rowIndex,
int emptyCols,
int yCutsRow,
JRGridLayout layout) |
protected abstract void |
exportLine(JRPrintLine line,
JRExporterGridCell cell,
int colIndex,
int rowIndex) |
protected int |
exportPage(JRPrintPage page,
CutsInfo xCuts,
int startRow,
java.lang.String defaultSheetName) |
protected abstract void |
exportRectangle(JRPrintGraphicElement element,
JRExporterGridCell cell,
int colIndex,
int rowIndex) |
void |
exportReport()
Performs the export.
|
protected void |
exportReportToStream(java.io.OutputStream os) |
protected void |
exportSheet(CutsInfo xCuts,
CutsInfo yCuts,
int startCutIndex,
java.lang.String defaultSheetName) |
protected abstract void |
exportText(JRPrintText text,
JRExporterGridCell cell,
int colIndex,
int rowIndex) |
static java.lang.String |
getColumIndexName(int colIndex,
int maxColIndex) |
protected int |
getColumnIndex(java.lang.String columnName) |
protected java.lang.String |
getColumnName(int columnIndex) |
protected java.lang.String |
getConvertedPattern(JRPrintText text,
java.lang.String pattern) |
protected JRFont |
getDefaultFont() |
protected java.lang.String |
getFormula(JRPrintText text) |
protected int |
getImageBorderCorrection(JRPen pen) |
protected java.lang.Integer |
getMaxRowsPerSheet() |
protected ExporterNature |
getNature() |
protected JRXlsAbstractExporter.SheetInfo |
getSheetProps(CutsInfo yCuts,
int startCutIndex) |
protected JRStyledText |
getStyledText(JRPrintText textElement) |
protected static JRXlsAbstractExporter.TextAlignHolder |
getTextAlignHolder(JRPrintText textElement) |
java.lang.String |
getWorkbookTemplate()
Deprecated.
Replaced by
XlsExporterConfiguration.getWorkbookTemplate() . |
protected boolean |
hasGlobalSheetNames() |
protected void |
initExport() |
protected void |
initReport() |
protected boolean |
isCellHidden(JRPrintElement element) |
protected boolean |
isCellLocked(JRPrintElement element) |
protected boolean |
isIgnoreTextFormatting(JRPrintElement element) |
protected boolean |
isShrinkToFit(JRPrintElement element) |
protected boolean |
isUseTimeZone(JRPrintElement element) |
protected boolean |
isValidScale(java.lang.Integer scale) |
boolean |
isWorkbookTemplateKeepSheets()
Deprecated.
|
protected boolean |
isWrapText(JRPrintElement element) |
protected void |
mergeAndSetRowLevels(XlsRowLevelInfo levelInfo,
java.util.SortedMap<java.lang.String,java.lang.Boolean> rowLevelMap,
int rowIndex) |
protected abstract void |
openWorkbook(java.io.OutputStream os) |
protected void |
resetAutoFilters() |
protected abstract void |
setAutoFilter(java.lang.String autoFilterRange) |
protected abstract void |
setColumnWidth(int col,
int width,
boolean autoFit) |
protected void |
setColumnWidths(CutsInfo xCuts) |
protected void |
setFreezePane(int rowIndex,
int colIndex) |
protected abstract void |
setFreezePane(int rowIndex,
int colIndex,
boolean isRowEdge,
boolean isColumnEdge) |
protected abstract void |
setRowHeight(int rowIndex,
int lastRowHeight,
Cut yCut,
XlsRowLevelInfo levelInfo) |
protected abstract void |
setRowLevels(XlsRowLevelInfo levelInfo,
java.lang.String level) |
protected abstract void |
setSheetName(java.lang.String sheetName) |
protected void |
setSheetNames() |
void |
setWorkbookTemplate(java.lang.String workbookTemplate)
Deprecated.
Replaced by
XlsExporterConfiguration.getWorkbookTemplate() . |
void |
setWorkbookTemplateKeepSheets(boolean keepTemplateSheets)
Deprecated.
|
protected java.util.Date |
translateDateValue(JRPrintText text,
java.util.Date value) |
createFilter, defaultParseNumber, ensureJasperReportsContext, getBooleanCellValue, getConfigurationInterface, getCurrentConfiguration, getCurrentItemConfiguration, getCurrentJasperPrint, getCustomHandler, getDateCellValue, getDateFormat, getExporterContext, getExporterInput, getExporterKey, getExporterOutput, getExporterPropertiesPrefix, getHyperlinkProducer, getItemConfigurationInterface, getJasperReportsContext, getLocale, getNumberCellValue, getNumberFormat, getOffsetX, getOffsetY, getPageRange, getParameter, getParameters, getPropertiesUtil, getReportContext, getStyledText, getTextFormatFactoryClass, getTextLocale, getTextTimeZone, getTextValue, getTextValueString, insideFrame, reset, resetClassLoader, resetExportContext, restoreElementOffsets, setClassLoader, setConfiguration, setConfiguration, setCurrentExporterInputItem, setExporterInput, setExporterOutput, setFrameElementsOffset, setJasperPrint, setJasperReportsContext, setOffset, setOffset, setParameter, setParameters, setReportContext
public static final java.lang.String XLS_EXPORTER_PROPERTIES_PREFIX
public static final java.lang.String DEFAULT_SHEET_NAME_PREFIX
public static final java.lang.String EXCEPTION_MESSAGE_KEY_CANNOT_ADD_CELL
public static final java.lang.String EXCEPTION_MESSAGE_KEY_CANNOT_MERGE_CELLS
public static final java.lang.String EXCEPTION_MESSAGE_KEY_CELL_FORMAT_TEMPLATE_ERROR
public static final java.lang.String EXCEPTION_MESSAGE_KEY_COLUMN_INDEX_BEYOND_LIMIT
public static final java.lang.String EXCEPTION_MESSAGE_KEY_LOADED_FONTS_ERROR
public static final java.lang.String EXCEPTION_MESSAGE_KEY_NEGATIVE_COLUMN_INDEX
public static final java.lang.String EXCEPTION_MESSAGE_KEY_REPORT_GENERATION_ERROR
public static final java.lang.String EXCEPTION_MESSAGE_KEY_TEMPLATE_NOT_FOUND
public static final java.lang.String PROPERTY_CELL_FORMULA
public static final java.lang.String PROPERTY_CELL_PATTERN
public static final java.lang.String PROPERTY_SHEET_NAME
JRPropertiesUtil
,
Constant Field Valuespublic static final java.lang.String PROPERTY_WRAP_TEXT
XlsReportConfiguration.PROPERTY_WRAP_TEXT
.public static final java.lang.String PROPERTY_FIT_WIDTH
XlsReportConfiguration.PROPERTY_FIT_WIDTH
.public static final java.lang.String PROPERTY_FIT_HEIGHT
XlsReportConfiguration.PROPERTY_FIT_HEIGHT
.public static final java.lang.String PROPERTY_CELL_LOCKED
XlsReportConfiguration.PROPERTY_CELL_LOCKED
.public static final java.lang.String PROPERTY_CELL_HIDDEN
XlsReportConfiguration.PROPERTY_CELL_HIDDEN
.public static final java.lang.String PROPERTY_SHEET_HEADER_LEFT
XlsReportConfiguration.PROPERTY_SHEET_HEADER_LEFT
.public static final java.lang.String PROPERTY_SHEET_HEADER_CENTER
XlsReportConfiguration.PROPERTY_SHEET_HEADER_CENTER
.public static final java.lang.String PROPERTY_SHEET_HEADER_RIGHT
XlsReportConfiguration.PROPERTY_SHEET_HEADER_RIGHT
.public static final java.lang.String PROPERTY_SHEET_FOOTER_LEFT
XlsReportConfiguration.PROPERTY_SHEET_FOOTER_LEFT
.public static final java.lang.String PROPERTY_SHEET_FOOTER_CENTER
XlsReportConfiguration.PROPERTY_SHEET_FOOTER_CENTER
.public static final java.lang.String PROPERTY_SHEET_FOOTER_RIGHT
XlsReportConfiguration.PROPERTY_SHEET_FOOTER_RIGHT
.public static final java.lang.String PROPERTY_SHEET_DIRECTION
XlsReportConfiguration.PROPERTY_SHEET_DIRECTION
.public static final java.lang.String PROPERTY_FREEZE_ROW
XlsReportConfiguration.PROPERTY_FREEZE_ROW
.public static final java.lang.String PROPERTY_FREEZE_COLUMN
XlsReportConfiguration.PROPERTY_FREEZE_COLUMN
.public static final java.lang.String PROPERTY_FREEZE_ROW_EDGE
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.public static final java.lang.String PROPERTY_FREEZE_COLUMN_EDGE
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.public static final java.lang.String PROPERTY_AUTO_FIT_ROW
true
false
- this is the default value.JRPropertiesUtil
,
Constant Field Valuespublic static final java.lang.String PROPERTY_AUTO_FIT_COLUMN
true
false
- this is the default value.JRPropertiesUtil
,
Constant Field Valuespublic static final java.lang.String PROPERTY_AUTO_FILTER
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").
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.
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.
Start
value is found in the sheet, the autofilter End
value will be considered
as Start
value instead.
End
value are found in the same sheet, only the last one will be considered.
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.JRPropertiesUtil
,
Constant Field Valuespublic static final java.lang.String PROPERTY_COLUMN_WIDTH
width
attribute.
PROPERTY_COLUMN_WIDTH_RATIO
value for the current columnpublic static final java.lang.String PROPERTY_COLUMN_WIDTH_RATIO
XlsReportConfiguration.PROPERTY_COLUMN_WIDTH_RATIO
.public static final java.lang.String PROPERTY_ROW_OUTLINE_LEVEL_PREFIX
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.
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.JRPropertiesUtil
,
Constant Field Valuespublic static final java.lang.String PROPERTY_USE_TIMEZONE
XlsReportConfiguration.PROPERTY_USE_TIMEZONE
.public static final java.lang.String PROPERTY_WORKBOOK_TEMPLATE
XlsExporterConfiguration.PROPERTY_WORKBOOK_TEMPLATE
.public static final java.lang.String PROPERTY_WORKBOOK_TEMPLATE_KEEP_SHEETS
XlsExporterConfiguration.PROPERTY_WORKBOOK_TEMPLATE_KEEP_SHEETS
.public static final java.lang.String PROPERTY_IGNORE_ANCHORS
XlsReportConfiguration.PROPERTY_IGNORE_ANCHORS
.public static final java.lang.String PROPERTY_PAGE_SCALE
XlsReportConfiguration.PROPERTY_PAGE_SCALE
.public static final java.lang.String PROPERTY_FIRST_PAGE_NUMBER
XlsReportConfiguration.PROPERTY_FIRST_PAGE_NUMBER
.public static final java.lang.String PROPERTY_SHOW_GRIDLINES
XlsReportConfiguration.PROPERTY_SHOW_GRIDLINES
.public static final java.lang.String PROPERTY_IMAGE_ANCHOR_TYPE
XlsReportConfiguration.PROPERTY_IMAGE_ANCHOR_TYPE
.public static final java.lang.String PROPERTY_IGNORE_HYPERLINK
XlsReportConfiguration.PROPERTY_IGNORE_HYPERLINK
.public static final java.lang.String PROPERTY_BREAK_BEFORE_ROW
public static final java.lang.String PROPERTY_BREAK_AFTER_ROW
protected java.util.List<java.lang.Object> loadedFonts
protected ExporterNature nature
protected java.lang.String[] sheetNames
protected int reportIndex
protected int pageIndex
protected PrintPageFormat pageFormat
protected java.util.Map<java.lang.Integer,java.lang.Boolean> onePagePerSheetMap
protected int sheetsBeforeCurrentReport
protected java.util.Map<java.lang.Integer,java.lang.Integer> sheetsBeforeCurrentReportMap
protected JRFont defaultFont
protected int sheetIndex
protected int sheetNamesIndex
protected java.util.Map<java.lang.String,java.lang.Integer> sheetNamesMap
protected int gridRowFreezeIndex
protected int gridColumnFreezeIndex
protected int maxRowFreezeIndex
protected int maxColumnFreezeIndex
protected boolean isFreezeRowEdge
protected boolean isFreezeColumnEdge
protected java.lang.String autoFilterStart
protected java.lang.String autoFilterEnd
protected boolean firstPageNotSet
protected java.lang.Boolean keepTemplateSheets
protected java.lang.String workbookTemplate
protected java.lang.String invalidCharReplacement
protected int maxColumnIndex
protected JRXlsAbstractExporter.SheetInfo sheetInfo
public JRXlsAbstractExporter()
public JRXlsAbstractExporter(JasperReportsContext jasperReportsContext)
protected JRFont getDefaultFont()
public void exportReport() throws JRException
Exporter
exportReport
in interface Exporter<ExporterInput,RC extends XlsReportConfiguration,C extends XlsExporterConfiguration,OutputStreamExporterOutput>
exportReport
in class JRAbstractExporter<RC extends XlsReportConfiguration,C extends XlsExporterConfiguration,OutputStreamExporterOutput,E extends JRExporterContext>
JRException
protected void ensureInput()
ensureInput
in class JRAbstractExporter<RC extends XlsReportConfiguration,C extends XlsExporterConfiguration,OutputStreamExporterOutput,E extends JRExporterContext>
protected void ensureOutput()
ensureOutput
in class JRAbstractExporter<RC extends XlsReportConfiguration,C extends XlsExporterConfiguration,OutputStreamExporterOutput,E extends JRExporterContext>
protected void initExport()
initExport
in class JRAbstractExporter<RC extends XlsReportConfiguration,C extends XlsExporterConfiguration,OutputStreamExporterOutput,E extends JRExporterContext>
protected void initReport()
initReport
in class JRAbstractExporter<RC extends XlsReportConfiguration,C extends XlsExporterConfiguration,OutputStreamExporterOutput,E extends JRExporterContext>
protected void exportReportToStream(java.io.OutputStream os) throws JRException, java.io.IOException
JRException
java.io.IOException
protected int exportPage(JRPrintPage page, CutsInfo xCuts, int startRow, java.lang.String defaultSheetName) throws JRException
JRException
protected JRXlsAbstractExporter.SheetInfo getSheetProps(CutsInfo yCuts, int startCutIndex)
protected void exportSheet(CutsInfo xCuts, CutsInfo yCuts, int startCutIndex, java.lang.String defaultSheetName)
protected void mergeAndSetRowLevels(XlsRowLevelInfo levelInfo, java.util.SortedMap<java.lang.String,java.lang.Boolean> rowLevelMap, int rowIndex)
protected void setColumnWidths(CutsInfo xCuts)
protected JRStyledText getStyledText(JRPrintText textElement)
getStyledText
in class JRAbstractExporter<RC extends XlsReportConfiguration,C extends XlsExporterConfiguration,OutputStreamExporterOutput,E extends JRExporterContext>
protected static JRXlsAbstractExporter.TextAlignHolder getTextAlignHolder(JRPrintText textElement)
protected int getImageBorderCorrection(JRPen pen)
protected final int calculateWidthForDinAN(int n)
protected final int calculateHeightForDinAN(int n)
protected final int calculateWidthForDinBN(int n)
protected final int calculateHeightForDinBN(int n)
protected final int calculateWidthForDinCN(int n)
protected final int calculateHeightForDinCN(int n)
protected boolean isWrapText(JRPrintElement element)
protected boolean isCellLocked(JRPrintElement element)
protected boolean isShrinkToFit(JRPrintElement element)
protected boolean isIgnoreTextFormatting(JRPrintElement element)
protected java.lang.String getFormula(JRPrintText text)
protected void setSheetNames()
protected boolean hasGlobalSheetNames()
protected boolean isCellHidden(JRPrintElement element)
protected java.lang.String getConvertedPattern(JRPrintText text, java.lang.String pattern)
protected int getColumnIndex(java.lang.String columnName)
protected java.lang.String getColumnName(int columnIndex)
protected void setFreezePane(int rowIndex, int colIndex)
protected void resetAutoFilters()
protected boolean isUseTimeZone(JRPrintElement element)
protected java.util.Date translateDateValue(JRPrintText text, java.util.Date value)
protected boolean isValidScale(java.lang.Integer scale)
protected java.lang.Integer getMaxRowsPerSheet()
public boolean isWorkbookTemplateKeepSheets()
XlsExporterConfiguration.isKeepWorkbookTemplateSheets()
.public void setWorkbookTemplateKeepSheets(boolean keepTemplateSheets)
XlsExporterConfiguration.isKeepWorkbookTemplateSheets()
.public java.lang.String getWorkbookTemplate()
XlsExporterConfiguration.getWorkbookTemplate()
.public void setWorkbookTemplate(java.lang.String workbookTemplate)
XlsExporterConfiguration.getWorkbookTemplate()
.protected ExporterNature getNature()
public static java.lang.String getColumIndexName(int colIndex, int maxColIndex)
colIndex
- The 0-based integer column indexprotected abstract void openWorkbook(java.io.OutputStream os) throws JRException, java.io.IOException
JRException
java.io.IOException
protected abstract void createSheet(CutsInfo xCuts, JRXlsAbstractExporter.SheetInfo sheetInfo)
protected abstract void closeSheet()
protected abstract void closeWorkbook(java.io.OutputStream os) throws JRException, java.io.IOException
JRException
java.io.IOException
protected abstract void setColumnWidth(int col, int width, boolean autoFit)
protected abstract void setRowHeight(int rowIndex, int lastRowHeight, Cut yCut, XlsRowLevelInfo levelInfo) throws JRException
JRException
protected abstract void addRowBreak(int rowIndex)
protected abstract void addBlankCell(JRExporterGridCell gridCell, int colIndex, int rowIndex) throws JRException
JRException
protected abstract void addOccupiedCell(OccupiedGridCell occupiedGridCell, int colIndex, int rowIndex) throws JRException
JRException
protected abstract void exportText(JRPrintText text, JRExporterGridCell cell, int colIndex, int rowIndex) throws JRException
JRException
protected abstract void exportImage(JRPrintImage image, JRExporterGridCell cell, int colIndex, int rowIndex, int emptyCols, int yCutsRow, JRGridLayout layout) throws JRException
JRException
protected abstract void exportRectangle(JRPrintGraphicElement element, JRExporterGridCell cell, int colIndex, int rowIndex) throws JRException
JRException
protected abstract void exportLine(JRPrintLine line, JRExporterGridCell cell, int colIndex, int rowIndex) throws JRException
JRException
protected abstract void exportFrame(JRPrintFrame frame, JRExporterGridCell cell, int colIndex, int rowIndex) throws JRException
JRException
protected abstract void exportGenericElement(JRGenericPrintElement element, JRExporterGridCell cell, int colIndex, int rowIndex, int emptyCols, int yCutsRow, JRGridLayout layout) throws JRException
JRException
protected abstract void setFreezePane(int rowIndex, int colIndex, boolean isRowEdge, boolean isColumnEdge)
protected abstract void setSheetName(java.lang.String sheetName)
protected abstract void setAutoFilter(java.lang.String autoFilterRange)
protected abstract void setRowLevels(XlsRowLevelInfo levelInfo, java.lang.String level)
© 2001-2014 TIBCO Software Inc. www.jaspersoft.com