Class JRXlsxExporter
- java.lang.Object
-
- net.sf.jasperreports.engine.JRAbstractExporter<RC,C,OutputStreamExporterOutput,E>
-
- net.sf.jasperreports.engine.export.ExcelAbstractExporter<RC,C,E>
-
- net.sf.jasperreports.engine.export.JRXlsAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>
-
- net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter
-
- All Implemented Interfaces:
JRExporter<ExporterInput,XlsxReportConfiguration,XlsxExporterConfiguration,OutputStreamExporterOutput>,Exporter<ExporterInput,XlsxReportConfiguration,XlsxExporterConfiguration,OutputStreamExporterOutput>
public class JRXlsxExporter extends JRXlsAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>
Exports a JasperReports document to XLSX format. It has character output type and exports the document to a grid-based layout.- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
- See Also:
JRXlsAbstractExporter,XlsExporterConfiguration,XlsReportConfiguration
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classJRXlsxExporter.ExporterContext-
Nested classes/interfaces inherited from class net.sf.jasperreports.engine.export.JRXlsAbstractExporter
JRXlsAbstractExporter.SheetInfo
-
Nested classes/interfaces inherited from class net.sf.jasperreports.engine.export.ExcelAbstractExporter
ExcelAbstractExporter.NameScope, ExcelAbstractExporter.TextAlignHolder
-
Nested classes/interfaces inherited from class net.sf.jasperreports.engine.JRAbstractExporter
JRAbstractExporter.BaseExporterContext, JRAbstractExporter.PageRange
-
-
Field Summary
-
Fields inherited from class net.sf.jasperreports.engine.export.ExcelAbstractExporter
autoFilterEnd, autoFilterStart, collapseRowSpan, CURRENT_ROW_AUTOFIT, CURRENT_ROW_HEIGHT, DEFAULT_DEFINED_NAME_SCOPE, DEFAULT_DEFINED_NAME_SCOPE_SEPARATOR, DEFAULT_SHEET_NAME_PREFIX, defaultCellHidden, defaultCellLocked, defaultFont, defaultIgnoreHyperlink, defaultIgnoreTextFormatting, defaultImageAnchorType, defaultShrinkToFit, defaultUseTimeZone, defaultWrapText, definedNamesMap, detectCellType, EXCEPTION_MESSAGE_KEY_CANNOT_ADD_CELL, EXCEPTION_MESSAGE_KEY_CANNOT_MERGE_CELLS, EXCEPTION_MESSAGE_KEY_CELL_FORMAT_TEMPLATE_ERROR, EXCEPTION_MESSAGE_KEY_COLUMN_INDEX_BEYOND_LIMIT, EXCEPTION_MESSAGE_KEY_LOADED_FONTS_ERROR, EXCEPTION_MESSAGE_KEY_NEGATIVE_COLUMN_INDEX, EXCEPTION_MESSAGE_KEY_REPORT_GENERATION_ERROR, EXCEPTION_MESSAGE_KEY_TEMPLATE_NOT_FOUND, firstPageNotSet, formatPatternsMap, ignoreAnchors, imageBorderFixEnabled, invalidCharReplacement, keepTemplateSheets, loadedFonts, maxColumnIndex, nature, onePagePerSheet, onePagePerSheetMap, pageFormat, pageIndex, PROPERTY_AUTO_FILTER, PROPERTY_AUTO_FIT_COLUMN, PROPERTY_AUTO_FIT_ROW, PROPERTY_BREAK_AFTER_ROW, PROPERTY_BREAK_BEFORE_ROW, PROPERTY_CELL_FORMULA, PROPERTY_CELL_PATTERN, PROPERTY_COLUMN_NAME, PROPERTY_COLUMN_WIDTH, PROPERTY_COLUMN_WIDTH_METADATA, PROPERTY_DATA, PROPERTY_FREEZE_COLUMN_EDGE, PROPERTY_FREEZE_ROW_EDGE, PROPERTY_IGNORE_ROW_HEIGHT, PROPERTY_REPEAT_VALUE, PROPERTY_ROW_OUTLINE_LEVEL_PREFIX, PROPERTY_SHEET_NAME, renderersCache, reportIndex, sheetIndex, sheetInfo, sheetNames, sheetNamesIndex, sheetNamesMap, sheetsBeforeCurrentReport, sheetsBeforeCurrentReportMap, workbookTemplate, XLS_EXPORTER_PROPERTIES_PREFIX
-
Fields inherited from class net.sf.jasperreports.engine.JRAbstractExporter
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, fontUtil, hyperlinkProducerFactory, itemConfiguration, jasperPrint, jasperReportsContext, noBackcolorSelector, noneSelector, numberFormatCache, parameters, propertiesUtil, PROPERTY_DEFAULT_FILTER_FACTORY, PROPERTY_SUFFIX_DEFAULT_FILTER_FACTORY, rendererUtil, styledTextUtil, textValueClasses
-
-
Constructor Summary
Constructors Constructor Description JRXlsxExporter()JRXlsxExporter(JasperReportsContext jasperReportsContext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddBlankCell(JRExporterGridCell gridCell, int colIndex, int rowIndex)protected voidaddOccupiedCell(OccupiedGridCell occupiedGridCell, int colIndex, int rowIndex)protected voidaddRowBreak(int rowIndex)protected voidcloseSheet()protected voidcloseWorkbook(OutputStream os)protected voidcreateSheet(CutsInfo xCuts, JRXlsAbstractExporter.SheetInfo sheetInfo)protected voidexportFrame(JRPrintFrame frame, JRExporterGridCell gridCell, int colIndex, int rowIndex)protected voidexportGenericElement(JRGenericPrintElement element, JRExporterGridCell gridCell, int colIndex, int rowIndex, int emptyCols, int yCutsRow, JRGridLayout layout)voidexportImage(JRPrintImage image, JRExporterGridCell gridCell, int colIndex, int rowIndex, int emptyCols, int yCutsRow, JRGridLayout layout)protected voidexportLine(JRPrintLine line, JRExporterGridCell gridCell, int colIndex, int rowIndex)protected intexportPage(JRPrintPage page, CutsInfo xCuts, int startRow, String defaultSheetName)protected voidexportRectangle(JRPrintGraphicElement rectangle, JRExporterGridCell gridCell, int colIndex, int rowIndex)protected voidexportStyledText(JRStyle style, JRStyledText styledText, Locale locale, boolean isStyledText)voidexportText(JRPrintText text, JRExporterGridCell gridCell, int colIndex, int rowIndex)protected StringgetAnchorType(ImageAnchorTypeEnum anchorType)protected Class<XlsxExporterConfiguration>getConfigurationInterface()protected StringgetDefinedName(String name)protected JRPrintElementIndexgetElementIndex(JRExporterGridCell gridCell)StringgetExporterKey()StringgetExporterPropertiesPrefix()Returns the properties prefix for the current exporter.protected StringgetHyperlinkTarget(JRPrintHyperlink link)protected StringgetHyperlinkURL(JRPrintHyperlink link)JRPrintImagegetImage(ExporterInput exporterInput, JRPrintElementIndex imageIndex)protected Class<XlsxReportConfiguration>getItemConfigurationInterface()static JRPrintElementIndexgetPrintElementIndex(String imageName)protected voidinitExport()protected voidinitReport()protected voidinsertPageAnchor(int colIndex, int rowIndex)protected voidopenWorkbook(OutputStream os)protected voidresetAutoFilters()protected voidrestoreBackcolor()protected voidsetAutoFilter(String autoFilterRange)protected voidsetBackcolor(Color color)protected voidsetBackground()protected voidsetColumnWidth(int col, int width, boolean autoFit)protected voidsetFreezePane(int rowIndex, int colIndex)protected voidsetRowHeight(int rowIndex, int rowHeight, Cut yCut, XlsRowLevelInfo levelInfo)protected voidsetRowLevels(XlsRowLevelInfo levelInfo, String level)protected voidsetScale(Integer scale)protected voidsetSheetName(String sheetName)-
Methods inherited from class net.sf.jasperreports.engine.export.JRXlsAbstractExporter
configureHeaderFooter, configurePrintSettings, exportEmptyReport, exportReportToStream, exportSheet, getSheetProps, setColumnWidths
-
Methods inherited from class net.sf.jasperreports.engine.export.ExcelAbstractExporter
calculateHeightForDinAN, calculateHeightForDinBN, calculateHeightForDinCN, calculateWidthForDinAN, calculateWidthForDinBN, calculateWidthForDinCN, configureDefinedNames, configureDefinedNames, configureDefinedNames, ensureInput, ensureOutput, exportReport, getColumIndexName, getColumnIndex, getColumnName, getConvertedPattern, getDefaultFont, getFormula, getImageBorderCorrection, getMaxRowsPerSheet, getNature, getSheetName, getSheetName, getStyledText, getTextAlignHolder, hasGlobalSheetNames, isCellHidden, isCellLocked, isIgnoreTextFormatting, isShrinkToFit, isUseTimeZone, isValidScale, isWrapText, mergeAndSetRowLevels, setSheetNames, toExcelName, translateDateValue, updateHeaderFooter, updatePrintSettings
-
Methods inherited from class net.sf.jasperreports.engine.JRAbstractExporter
checkInterrupted, createFilter, defaultParseNumber, ensureJasperReportsContext, getBooleanCellValue, getCurrentConfiguration, getCurrentItemConfiguration, getCurrentJasperPrint, getDateCellValue, getDateFormat, getExporterContext, getExporterInput, getExporterOutput, getHyperlinkProducer, getJasperReportsContext, getLocale, getNumberCellValue, getNumberFormat, getOffsetX, getOffsetY, getPageRange, getParameter, getParameters, getPropertiesUtil, getRendererUtil, getReportContext, getRepository, getStyledText, getTextFormatFactoryClass, getTextLocale, getTextTimeZone, getTextValue, getTextValueString, insideFrame, reset, resetClassLoader, resetExportContext, restoreElementOffsets, setClassLoader, setConfiguration, setConfiguration, setCurrentExporterInputItem, setExporterInput, setExporterOutput, setFrameElementsOffset, setJasperReportsContext, setOffset, setOffset, setParameter, setParameters, setReportContext
-
-
-
-
Field Detail
-
XLSX_EXPORTER_KEY
public static final String XLSX_EXPORTER_KEY
The exporter key, as used inGenericElementHandlerEnviroment.getElementHandler(JRGenericElementType, String).- See Also:
- Constant Field Values
-
XLSX_EXPORTER_PROPERTIES_PREFIX
protected static final String XLSX_EXPORTER_PROPERTIES_PREFIX
- See Also:
- Constant Field Values
-
ONE_CELL
protected static final String ONE_CELL
- See Also:
- Constant Field Values
-
TWO_CELL
protected static final String TWO_CELL
- See Also:
- Constant Field Values
-
ABSOLUTE
protected static final String ABSOLUTE
- See Also:
- Constant Field Values
-
JR_PAGE_ANCHOR_PREFIX
protected static final String JR_PAGE_ANCHOR_PREFIX
- See Also:
- Constant Field Values
-
IMAGE_NAME_PREFIX
public static final String IMAGE_NAME_PREFIX
- See Also:
- Constant Field Values
-
IMAGE_NAME_PREFIX_LEGTH
protected static final int IMAGE_NAME_PREFIX_LEGTH
-
xlsxZip
protected XlsxZip xlsxZip
-
wbHelper
protected XlsxWorkbookHelper wbHelper
-
relsHelper
protected XlsxRelsHelper relsHelper
-
ctHelper
protected XlsxContentTypesHelper ctHelper
-
appHelper
protected PropsAppHelper appHelper
-
coreHelper
protected PropsCoreHelper coreHelper
-
sheetHelper
protected XlsxSheetHelper sheetHelper
-
sheetRelsHelper
protected XlsxSheetRelsHelper sheetRelsHelper
-
drawingHelper
protected XlsxDrawingHelper drawingHelper
-
drawingRelsHelper
protected XlsxDrawingRelsHelper drawingRelsHelper
-
styleHelper
protected XlsxStyleHelper styleHelper
-
sharedStringsHelper
protected XlsxSharedStringsHelper sharedStringsHelper
-
cellHelper
protected XlsxCellHelper cellHelper
-
definedNames
protected StringBuilder definedNames
-
firstSheetName
protected String firstSheetName
-
currentSheetName
protected String currentSheetName
-
rendererToImagePathMap
protected Map<String,Pair<String,ExifOrientationEnum>> rendererToImagePathMap
-
tableIndex
protected int tableIndex
-
startPage
protected boolean startPage
-
backcolorStack
protected LinkedList<Color> backcolorStack
-
backcolor
protected Color backcolor
-
sheetAutoFilter
protected String sheetAutoFilter
-
macroTemplate
protected String macroTemplate
-
oldPageFormat
protected PrintPageFormat oldPageFormat
-
currentSheetPageScale
protected Integer currentSheetPageScale
-
currentSheetFirstPageNumber
protected Integer currentSheetFirstPageNumber
-
-
Constructor Detail
-
JRXlsxExporter
public JRXlsxExporter()
- See Also:
JRXlsxExporter(JasperReportsContext)
-
JRXlsxExporter
public JRXlsxExporter(JasperReportsContext jasperReportsContext)
-
-
Method Detail
-
getConfigurationInterface
protected Class<XlsxExporterConfiguration> getConfigurationInterface()
-
getItemConfigurationInterface
protected Class<XlsxReportConfiguration> getItemConfigurationInterface()
-
initExport
protected void initExport()
- Overrides:
initExportin classExcelAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>
-
initReport
protected void initReport()
- Overrides:
initReportin classExcelAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>
-
exportPage
protected int exportPage(JRPrintPage page, CutsInfo xCuts, int startRow, String defaultSheetName) throws JRException
- Overrides:
exportPagein classJRXlsAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>- Returns:
- the number of rows added.
- Throws:
JRException
-
getImage
public JRPrintImage getImage(ExporterInput exporterInput, JRPrintElementIndex imageIndex) throws JRException
- Throws:
JRException
-
exportStyledText
protected void exportStyledText(JRStyle style, JRStyledText styledText, Locale locale, boolean isStyledText)
-
getElementIndex
protected JRPrintElementIndex getElementIndex(JRExporterGridCell gridCell)
-
getPrintElementIndex
public static JRPrintElementIndex getPrintElementIndex(String imageName)
-
setBackcolor
protected void setBackcolor(Color color)
-
restoreBackcolor
protected void restoreBackcolor()
-
getHyperlinkTarget
protected String getHyperlinkTarget(JRPrintHyperlink link)
-
getHyperlinkURL
protected String getHyperlinkURL(JRPrintHyperlink link)
-
insertPageAnchor
protected void insertPageAnchor(int colIndex, int rowIndex)
-
addBlankCell
protected void addBlankCell(JRExporterGridCell gridCell, int colIndex, int rowIndex) throws JRException
- Specified by:
addBlankCellin classJRXlsAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>- Throws:
JRException
-
closeWorkbook
protected void closeWorkbook(OutputStream os) throws JRException
- Specified by:
closeWorkbookin classExcelAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>- Throws:
JRException
-
createSheet
protected void createSheet(CutsInfo xCuts, JRXlsAbstractExporter.SheetInfo sheetInfo)
- Specified by:
createSheetin classJRXlsAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>
-
closeSheet
protected void closeSheet()
- Specified by:
closeSheetin classExcelAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>
-
exportFrame
protected void exportFrame(JRPrintFrame frame, JRExporterGridCell gridCell, int colIndex, int rowIndex) throws JRException
- Specified by:
exportFramein classJRXlsAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>- Throws:
JRException
-
exportImage
public void exportImage(JRPrintImage image, JRExporterGridCell gridCell, int colIndex, int rowIndex, int emptyCols, int yCutsRow, JRGridLayout layout) throws JRException
- Specified by:
exportImagein classJRXlsAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>- Throws:
JRException
-
exportLine
protected void exportLine(JRPrintLine line, JRExporterGridCell gridCell, int colIndex, int rowIndex) throws JRException
- Specified by:
exportLinein classJRXlsAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>- Throws:
JRException
-
exportRectangle
protected void exportRectangle(JRPrintGraphicElement rectangle, JRExporterGridCell gridCell, int colIndex, int rowIndex) throws JRException
- Specified by:
exportRectanglein classJRXlsAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>- Throws:
JRException
-
exportText
public void exportText(JRPrintText text, JRExporterGridCell gridCell, int colIndex, int rowIndex) throws JRException
- Specified by:
exportTextin classJRXlsAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>- Throws:
JRException
-
exportGenericElement
protected void exportGenericElement(JRGenericPrintElement element, JRExporterGridCell gridCell, int colIndex, int rowIndex, int emptyCols, int yCutsRow, JRGridLayout layout) throws JRException
- Specified by:
exportGenericElementin classJRXlsAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>- Throws:
JRException
-
openWorkbook
protected void openWorkbook(OutputStream os) throws JRException
- Specified by:
openWorkbookin classExcelAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>- Throws:
JRException
-
setBackground
protected void setBackground()
-
addOccupiedCell
protected void addOccupiedCell(OccupiedGridCell occupiedGridCell, int colIndex, int rowIndex)
- Specified by:
addOccupiedCellin classJRXlsAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>
-
setColumnWidth
protected void setColumnWidth(int col, int width, boolean autoFit)- Specified by:
setColumnWidthin classExcelAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>
-
setRowHeight
protected void setRowHeight(int rowIndex, int rowHeight, Cut yCut, XlsRowLevelInfo levelInfo) throws JRException- Specified by:
setRowHeightin classJRXlsAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>- Throws:
JRException
-
addRowBreak
protected void addRowBreak(int rowIndex)
- Specified by:
addRowBreakin classExcelAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>
-
getExporterKey
public String getExporterKey()
- Specified by:
getExporterKeyin classJRAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,OutputStreamExporterOutput,JRXlsxExporterContext>
-
getExporterPropertiesPrefix
public String getExporterPropertiesPrefix()
Description copied from class:JRAbstractExporterReturns the properties prefix for the current exporter.- Specified by:
getExporterPropertiesPrefixin classJRAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,OutputStreamExporterOutput,JRXlsxExporterContext>- Returns:
- the properties prefix for the current exporter
-
setFreezePane
protected void setFreezePane(int rowIndex, int colIndex)- Specified by:
setFreezePanein classExcelAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>
-
setSheetName
protected void setSheetName(String sheetName)
- Specified by:
setSheetNamein classExcelAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>
-
setAutoFilter
protected void setAutoFilter(String autoFilterRange)
- Specified by:
setAutoFilterin classExcelAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>
-
resetAutoFilters
protected void resetAutoFilters()
- Overrides:
resetAutoFiltersin classExcelAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>
-
setRowLevels
protected void setRowLevels(XlsRowLevelInfo levelInfo, String level)
- Specified by:
setRowLevelsin classExcelAbstractExporter<XlsxReportConfiguration,XlsxExporterConfiguration,JRXlsxExporterContext>
-
setScale
protected void setScale(Integer scale)
-
getAnchorType
protected String getAnchorType(ImageAnchorTypeEnum anchorType)
-
-