Class JROdsExporter
- 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<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>
-
- net.sf.jasperreports.engine.export.oasis.JROdsExporter
-
- All Implemented Interfaces:
Exporter<ExporterInput,OdsReportConfiguration,OdsExporterConfiguration,OutputStreamExporterOutput>
public class JROdsExporter extends JRXlsAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>
Exports a JasperReports document to Open Document Spreadsheet format. It has character output type and exports the document to a grid-based layout. TheJROdsExporterexporter implementation produces documents that comply with the Open Document Format for Office Applications specifications for spreadsheets. These documents use the.odsfile extension. Because spreadsheet documents are made of sheets containing cells, this exporter is a grid exporter, as well, therefore having the known limitations of grid exporters. Special exporter configuration settings, that can be applied to aJROdsExporterinstance to control its behavior, can be found inOdsReportConfigurationand in itsXlsReportConfigurationsuperclass.- Author:
- Teodor Danciu (teodord@users.sourceforge.net)
- See Also:
OdsReportConfiguration,XlsReportConfiguration
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classJROdsExporter.ExporterContextprotected classJROdsExporter.OdsDocumentBuilderprotected classJROdsExporter.OdsTableBuilder-
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 Modifier and Type Field Description protected Map<Integer,String>columnStylesprotected static StringDEFAULT_ADDRESSprotected static StringDEFAULT_COLUMNprotected DocumentBuilderdocumentBuilderprotected static StringJR_PAGE_ANCHOR_PREFIXprotected StringBuildernamedExpressionsprotected OasisZipoasisZipstatic StringODS_EXPORTER_KEYThe exporter key, as used inGenericElementHandlerEnviroment.getElementHandler(JRGenericElementType, String).protected static StringODS_EXPORTER_PROPERTIES_PREFIXprotected PrintPageFormatoldPageFormatprotected intpageFormatIndexprotected Map<Integer,String>rowStylesprotected booleanstartPageprotected StyleBuilderstyleBuilderprotected StyleCachestyleCacheprotected WriterHelperstylesWriterprotected TableBuildertableBuilderprotected ExportZipEntrytempBodyEntryprotected WriterHelpertempBodyWriterprotected ExportZipEntrytempStyleEntryprotected WriterHelpertempStyleWriter-
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_AVERAGE_CHAR_WIDTH_FACTOR, 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_EMPTY_INPUT_SOURCE_IN_BATCH_MODE, EXCEPTION_MESSAGE_KEY_END_PAGE_INDEX_OUT_OF_RANGE, EXCEPTION_MESSAGE_KEY_INVALID_IMAGE_NAME, EXCEPTION_MESSAGE_KEY_INVALID_ZOOM_RATIO, EXCEPTION_MESSAGE_KEY_NO_INPUT_SOURCE, EXCEPTION_MESSAGE_KEY_NO_OUTPUT_SPECIFIED, 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, propertiesUtil, PROPERTY_DEFAULT_FILTER_FACTORY, PROPERTY_SUFFIX_DEFAULT_FILTER_FACTORY, rendererUtil, styledTextUtil, textValueClasses
-
-
Constructor Summary
Constructors Constructor Description JROdsExporter()JROdsExporter(JasperReportsContext jasperReportsContext)
-
Method Summary
All 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 voidexportEmptyReport()protected voidexportFrame(JRPrintFrame frame, JRExporterGridCell cell, 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)voidexportText(JRPrintText text, JRExporterGridCell gridCell, int colIndex, int rowIndex)protected StringgetCellAddress(int row, int col)protected Class<OdsExporterConfiguration>getConfigurationInterface()StringgetExporterKey()StringgetExporterPropertiesPrefix()Returns the properties prefix for the current exporter.protected Class<OdsReportConfiguration>getItemConfigurationInterface()protected voidinitExport()protected voidinitReport()protected voidinsertPageAnchor(TableBuilder tableBuilder)protected voidopenWorkbook(OutputStream os)protected voidsetAutoFilter(String autoFilterRange)protected voidsetColumnWidth(int col, int width, boolean autoFit)protected voidsetFreezePane(int rowIndex, int colIndex)protected voidsetRowHeight(int rowIndex, int lastRowHeight, Cut yCut, XlsRowLevelInfo levelInfo)protected voidsetRowLevels(XlsRowLevelInfo levelInfo, String level)protected voidsetSheetName(String sheetName)-
Methods inherited from class net.sf.jasperreports.engine.export.JRXlsAbstractExporter
configureHeaderFooter, configurePrintSettings, exportReportToStream, exportSheet, getSheetProps, setColumnWidths
-
Methods inherited from class net.sf.jasperreports.engine.export.ExcelAbstractExporter
calculateHeightForDinAN, calculateHeightForDinBN, calculateHeightForDinCN, calculateWidthForDinAN, calculateWidthForDinBN, calculateWidthForDinCN, configureDefinedNames, configureDefinedNames, configureDefinedNames, ensureInput, exportReport, getColumIndexName, getColumnIndex, getColumnName, getConvertedPattern, getDefaultFont, getFormula, getImageBorderCorrection, getMaxRowsPerSheet, getNature, getSheetName, getSheetName, getStyledText, getTextAlignHolder, hasGlobalSheetNames, isCellHidden, isCellLocked, isIgnoreTextFormatting, isShrinkToFit, isUseTimeZone, isValidScale, isWrapText, mergeAndSetRowLevels, resetAutoFilters, setSheetNames, toExcelName, translateDateValue, updateHeaderFooter, updatePrintSettings
-
Methods inherited from class net.sf.jasperreports.engine.JRAbstractExporter
checkInterrupted, createFilter, defaultParseNumber, ensureJasperReportsContext, ensureOutput, getBooleanCellValue, getCurrentConfiguration, getCurrentItemConfiguration, getCurrentJasperPrint, getDateCellValue, getDateFormat, getExporterConfiguration, getExporterContext, getExporterInput, getExporterOutput, getHyperlinkProducer, getJasperReportsContext, getLocale, getNumberCellValue, getNumberFormat, getOffsetX, getOffsetY, getPageRange, getPropertiesUtil, getRendererUtil, getReportContext, getReportExportConfiguration, getRepository, getStyledText, getTextFormatFactoryClass, getTextLocale, getTextTimeZone, getTextValue, getTextValueString, insideFrame, reset, resetExportContext, restoreElementOffsets, setConfiguration, setConfiguration, setCurrentExporterInputItem, setExporterInput, setExporterOutput, setFrameElementsOffset, setJasperReportsContext, setOffset, setOffset, setReportContext
-
-
-
-
Field Detail
-
JR_PAGE_ANCHOR_PREFIX
protected static final String JR_PAGE_ANCHOR_PREFIX
- See Also:
- Constant Field Values
-
DEFAULT_COLUMN
protected static final String DEFAULT_COLUMN
- See Also:
- Constant Field Values
-
DEFAULT_ADDRESS
protected static final String DEFAULT_ADDRESS
- See Also:
- Constant Field Values
-
oasisZip
protected OasisZip oasisZip
-
tempBodyEntry
protected ExportZipEntry tempBodyEntry
-
tempStyleEntry
protected ExportZipEntry tempStyleEntry
-
tempBodyWriter
protected WriterHelper tempBodyWriter
-
tempStyleWriter
protected WriterHelper tempStyleWriter
-
stylesWriter
protected WriterHelper stylesWriter
-
styleCache
protected StyleCache styleCache
-
documentBuilder
protected DocumentBuilder documentBuilder
-
tableBuilder
protected TableBuilder tableBuilder
-
styleBuilder
protected StyleBuilder styleBuilder
-
startPage
protected boolean startPage
-
oldPageFormat
protected PrintPageFormat oldPageFormat
-
pageFormatIndex
protected int pageFormatIndex
-
namedExpressions
protected StringBuilder namedExpressions
-
ODS_EXPORTER_PROPERTIES_PREFIX
protected static final String ODS_EXPORTER_PROPERTIES_PREFIX
- See Also:
- Constant Field Values
-
ODS_EXPORTER_KEY
public static final String ODS_EXPORTER_KEY
The exporter key, as used inGenericElementHandlerEnviroment.getElementHandler(JRGenericElementType, String).- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JROdsExporter
public JROdsExporter()
- See Also:
JROdsExporter(JasperReportsContext)
-
JROdsExporter
public JROdsExporter(JasperReportsContext jasperReportsContext)
-
-
Method Detail
-
openWorkbook
protected void openWorkbook(OutputStream os) throws JRException, IOException
- Specified by:
openWorkbookin classExcelAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>- Throws:
JRExceptionIOException
-
exportPage
protected int exportPage(JRPrintPage page, CutsInfo xCuts, int startRow, String defaultSheetName) throws JRException
- Overrides:
exportPagein classJRXlsAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>- Returns:
- the number of rows added.
- Throws:
JRException
-
createSheet
protected void createSheet(CutsInfo xCuts, JRXlsAbstractExporter.SheetInfo sheetInfo)
- Specified by:
createSheetin classJRXlsAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>
-
closeSheet
protected void closeSheet()
- Specified by:
closeSheetin classExcelAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>
-
closeWorkbook
protected void closeWorkbook(OutputStream os) throws JRException, IOException
- Specified by:
closeWorkbookin classExcelAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>- Throws:
JRExceptionIOException
-
setColumnWidth
protected void setColumnWidth(int col, int width, boolean autoFit)- Specified by:
setColumnWidthin classExcelAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>
-
setRowHeight
protected void setRowHeight(int rowIndex, int lastRowHeight, Cut yCut, XlsRowLevelInfo levelInfo) throws JRException- Specified by:
setRowHeightin classJRXlsAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>- Throws:
JRException
-
addRowBreak
protected void addRowBreak(int rowIndex)
- Specified by:
addRowBreakin classExcelAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>
-
addBlankCell
protected void addBlankCell(JRExporterGridCell gridCell, int colIndex, int rowIndex)
- Specified by:
addBlankCellin classJRXlsAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>
-
addOccupiedCell
protected void addOccupiedCell(OccupiedGridCell occupiedGridCell, int colIndex, int rowIndex) throws JRException
- Specified by:
addOccupiedCellin classJRXlsAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>- Throws:
JRException
-
exportText
public void exportText(JRPrintText text, JRExporterGridCell gridCell, int colIndex, int rowIndex) throws JRException
- Specified by:
exportTextin classJRXlsAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>- 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<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>- Throws:
JRException
-
getCellAddress
protected String getCellAddress(int row, int col)
-
exportRectangle
protected void exportRectangle(JRPrintGraphicElement rectangle, JRExporterGridCell gridCell, int colIndex, int rowIndex) throws JRException
- Specified by:
exportRectanglein classJRXlsAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>- Throws:
JRException
-
exportLine
protected void exportLine(JRPrintLine line, JRExporterGridCell gridCell, int colIndex, int rowIndex) throws JRException
- Specified by:
exportLinein classJRXlsAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>- Throws:
JRException
-
exportFrame
protected void exportFrame(JRPrintFrame frame, JRExporterGridCell cell, int colIndex, int rowIndex) throws JRException
- Specified by:
exportFramein classJRXlsAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>- 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<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>- Throws:
JRException
-
setFreezePane
protected void setFreezePane(int rowIndex, int colIndex)- Specified by:
setFreezePanein classExcelAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>
-
setSheetName
protected void setSheetName(String sheetName)
- Specified by:
setSheetNamein classExcelAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>
-
setAutoFilter
protected void setAutoFilter(String autoFilterRange)
- Specified by:
setAutoFilterin classExcelAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>
-
setRowLevels
protected void setRowLevels(XlsRowLevelInfo levelInfo, String level)
- Specified by:
setRowLevelsin classExcelAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>
-
getConfigurationInterface
protected Class<OdsExporterConfiguration> getConfigurationInterface()
-
getItemConfigurationInterface
protected Class<OdsReportConfiguration> getItemConfigurationInterface()
-
initExport
protected void initExport()
- Overrides:
initExportin classExcelAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>
-
initReport
protected void initReport()
- Overrides:
initReportin classExcelAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>
-
getExporterKey
public String getExporterKey()
- Specified by:
getExporterKeyin classJRAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,OutputStreamExporterOutput,JROdsExporterContext>
-
getExporterPropertiesPrefix
public String getExporterPropertiesPrefix()
Description copied from class:JRAbstractExporterReturns the properties prefix for the current exporter.- Specified by:
getExporterPropertiesPrefixin classJRAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,OutputStreamExporterOutput,JROdsExporterContext>- Returns:
- the properties prefix for the current exporter
-
insertPageAnchor
protected void insertPageAnchor(TableBuilder tableBuilder)
-
exportEmptyReport
protected void exportEmptyReport() throws JRException, IOException- Overrides:
exportEmptyReportin classJRXlsAbstractExporter<OdsReportConfiguration,OdsExporterConfiguration,JROdsExporterContext>- Throws:
JRExceptionIOException
-
-