net.sf.jasperreports.engine.export
Class JRXlsAbstractExporter

java.lang.Object
  extended by net.sf.jasperreports.engine.JRAbstractExporter
      extended by net.sf.jasperreports.engine.export.JRXlsAbstractExporter
All Implemented Interfaces:
JRExporter
Direct Known Subclasses:
JExcelApiExporter, JRXlsExporter, JRXlsxExporter

public abstract class JRXlsAbstractExporter
extends JRAbstractExporter

Version:
$Id: JRXlsAbstractExporter.java 4106 2010-12-22 13:03:38Z shertage $
Author:
Teodor Danciu ([email protected])

Nested Class Summary
protected static class JRXlsAbstractExporter.TextAlignHolder
           
 
Nested classes/interfaces inherited from class net.sf.jasperreports.engine.JRAbstractExporter
JRAbstractExporter.BaseExporterContext, JRAbstractExporter.ParameterOverriddenResolver, JRAbstractExporter.ParameterOverrideResolver, JRAbstractExporter.ParameterResolver
 
Field Summary
protected  boolean cellHidden
           
protected  boolean cellLocked
           
protected  boolean createCustomPalette
           
protected  JRFont defaultFont
           
protected  java.util.Map fontMap
          Deprecated.  
protected  java.util.Map formatPatternsMap
           
protected  boolean isAutoDetectCellType
           
protected  boolean isCollapseRowSpan
           
protected  boolean isDetectCellType
           
protected  boolean isFontSizeFixEnabled
           
protected  boolean isIgnoreCellBackground
           
protected  boolean isIgnoreCellBorder
           
protected  boolean isIgnoreGraphics
           
protected  boolean isIgnorePageMargins
           
protected  boolean isImageBorderFixEnabled
           
protected  boolean isOnePagePerSheet
           
protected  boolean isRemoveEmptySpaceBetweenColumns
           
protected  boolean isRemoveEmptySpaceBetweenRows
           
protected  boolean isWhitePageBackground
           
protected  java.util.List loadedFonts
           
protected  int maxRowsPerSheet
           
protected  int pageIndex
           
protected  JRExportProgressMonitor progressMonitor
           
static java.lang.String PROPERTY_CELL_HIDDEN
          This property indicates whether the cell content is hidden.
static java.lang.String PROPERTY_CELL_LOCKED
          This property indicates whether the cell is locked.
static java.lang.String PROPERTY_FIT_HEIGHT
          This property indicates the number of pages height to fit the sheet in.
static java.lang.String PROPERTY_FIT_WIDTH
          This property indicates the number of pages wide to fit the sheet in.
static java.lang.String PROPERTY_SHEET_DIRECTION
          This property indicates if the sheet is left-to-right or right-to-left oriented.
static java.lang.String PROPERTY_SHEET_FOOTER_CENTER
          This property stores the text content of the sheet footer's center.
static java.lang.String PROPERTY_SHEET_FOOTER_LEFT
          This property stores the text content of the sheet footer's left side.
static java.lang.String PROPERTY_SHEET_FOOTER_RIGHT
          This property stores the text content of the sheet footer's right side.
static java.lang.String PROPERTY_SHEET_HEADER_CENTER
          This property stores the text content of the sheet header's center.
static java.lang.String PROPERTY_SHEET_HEADER_LEFT
          This property stores the text content of the sheet header's left side.
static java.lang.String PROPERTY_SHEET_HEADER_RIGHT
          This property stores the text content of the sheet header's right side.
static java.lang.String PROPERTY_WRAP_TEXT
          This property indicates whether text wrapping is allowed in a given cell.
protected  int reportIndex
           
protected  RunDirectionEnum sheetDirection
           
protected  java.lang.String sheetFooterCenter
           
protected  java.lang.String sheetFooterLeft
           
protected  java.lang.String sheetFooterRight
           
protected  java.lang.String sheetHeaderCenter
           
protected  java.lang.String sheetHeaderLeft
           
protected  java.lang.String sheetHeaderRight
           
protected  int sheetIndex
          Used for counting the total number of sheets.
protected  java.lang.String[] sheetNames
           
protected  int sheetNamesIndex
          Used for iterating through sheet names.
protected  java.util.Map sheetNamesMap
          Used when indexing the identical sheet name.
protected  boolean wrapText
           
protected static java.lang.String XLS_EXPORTER_PROPERTIES_PREFIX
           
 
Fields inherited from class net.sf.jasperreports.engine.JRAbstractExporter
classLoader, classLoaderSet, dateFormatCache, endPageIndex, fileResolver, fileResolverSet, filter, globalOffsetX, globalOffsetY, hyperlinkProducerFactory, isModeBatch, jasperPrint, jasperPrintList, numberFormatCache, parameters, PROPERTY_CELL_FORMULA, PROPERTY_DEFAULT_FILTER_FACTORY, PROPERTY_SUFFIX_DEFAULT_FILTER_FACTORY, startPageIndex, urlHandlerFactory, urlHandlerFactorySet
 
Constructor Summary
JRXlsAbstractExporter()
           
 
Method Summary
protected abstract  void addBlankCell(JRExporterGridCell gridCell, int colIndex, int rowIndex)
           
protected abstract  void addOccupiedCell(OccupiedGridCell occupiedGridCell, int colIndex, 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 closeWorkbook(java.io.OutputStream os)
           
protected abstract  void createSheet(java.lang.String name)
           
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)
           
protected abstract  void exportImage(JRPrintImage image, JRExporterGridCell cell, int colIndex, int rowIndex, int emptyCols)
           
protected abstract  void exportLine(JRPrintLine line, JRExporterGridCell cell, int colIndex, int rowIndex)
           
protected  int exportPage(JRPrintPage page, CutsInfo xCuts, int startRow)
           
protected abstract  void exportRectangle(JRPrintGraphicElement element, JRExporterGridCell cell, int colIndex, int rowIndex)
           
 void exportReport()
          Actually starts the export process.
protected  void exportReportToStream(java.io.OutputStream os)
           
protected abstract  void exportText(JRPrintText text, JRExporterGridCell cell, int colIndex, int rowIndex)
           
protected  java.lang.String getConvertedPattern(java.lang.String pattern)
          This method is intended to modify a given format pattern so to include only the accepted proprietary format characters.
protected  JRFont getDefaultFont()
           
protected  java.lang.String getFormula(JRPrintText text)
           
protected  int getImageBorderCorrection(JRPen pen)
           
protected abstract  ExporterNature getNature()
           
protected  JRStyledText getStyledText(JRPrintText textElement)
           
protected static JRXlsAbstractExporter.TextAlignHolder getTextAlignHolder(JRPrintText textElement)
           
protected  boolean isCellHidden(JRPrintElement element)
           
protected  boolean isCellLocked(JRPrintElement element)
           
protected  boolean isWrapText(JRPrintElement element)
           
protected abstract  void openWorkbook(java.io.OutputStream os)
           
protected abstract  void removeColumn(int col)
           
protected  void removeEmptyColumns(CutsInfo xCuts)
           
protected abstract  void setBackground()
           
protected abstract  void setCell(JRExporterGridCell gridCell, int colIndex, int rowIndex)
           
protected abstract  void setColumnWidth(int col, int width)
           
protected  void setColumnWidths(CutsInfo xCuts)
           
protected  void setParameters()
           
protected abstract  void setRowHeight(int rowIndex, int lastRowHeight)
           
protected  void setSheetNames()
           
 
Methods inherited from class net.sf.jasperreports.engine.JRAbstractExporter
createFilter, defaultParseNumber, getBooleanCellValue, getBooleanParameter, getCharacterParameter, getCustomHandler, getDateCellValue, getDateFormat, getExporterKey, getFloatParameter, getHyperlinkProducer, getIntegerParameter, getLocale, getNumberCellValue, getNumberFormat, getOffsetX, getOffsetY, getParameter, getParameterResolver, getParameters, getStringArrayParameter, getStringParameter, getStringParameterOrDefault, getStyledText, getTextFormatFactoryClass, getTextLocale, getTextTimeZone, getTextValue, getTextValueString, reset, resetClassLoader, resetExportContext, restoreElementOffsets, setClassLoader, setExportContext, setFrameElementsOffset, setHyperlinkProducerFactory, setInput, setJasperPrint, setOffset, setOffset, setOutput, setPageRange, setParameter, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XLS_EXPORTER_PROPERTIES_PREFIX

protected static final java.lang.String XLS_EXPORTER_PROPERTIES_PREFIX
See Also:
Constant Field Values

PROPERTY_WRAP_TEXT

public static final java.lang.String PROPERTY_WRAP_TEXT
This property indicates whether text wrapping is allowed in a given cell.

The property itself defaults to true.

See Also:
JRProperties, Constant Field Values

PROPERTY_FIT_WIDTH

public static final java.lang.String PROPERTY_FIT_WIDTH
This property indicates the number of pages wide to fit the sheet in.

See Also:
JRProperties, Constant Field Values

PROPERTY_FIT_HEIGHT

public static final java.lang.String PROPERTY_FIT_HEIGHT
This property indicates the number of pages height to fit the sheet in.

See Also:
JRProperties, Constant Field Values

PROPERTY_CELL_LOCKED

public static final java.lang.String PROPERTY_CELL_LOCKED
This property indicates whether the cell is locked.

See Also:
JRProperties, Constant Field Values

PROPERTY_CELL_HIDDEN

public static final java.lang.String PROPERTY_CELL_HIDDEN
This property indicates whether the cell content is hidden.

See Also:
JRProperties, Constant Field Values

PROPERTY_SHEET_HEADER_LEFT

public static final java.lang.String PROPERTY_SHEET_HEADER_LEFT
This property stores the text content of the sheet header's left side.

See Also:
JRProperties, Constant Field Values

PROPERTY_SHEET_HEADER_CENTER

public static final java.lang.String PROPERTY_SHEET_HEADER_CENTER
This property stores the text content of the sheet header's center.

See Also:
JRProperties, Constant Field Values

PROPERTY_SHEET_HEADER_RIGHT

public static final java.lang.String PROPERTY_SHEET_HEADER_RIGHT
This property stores the text content of the sheet header's right side.

See Also:
JRProperties, Constant Field Values

PROPERTY_SHEET_FOOTER_LEFT

public static final java.lang.String PROPERTY_SHEET_FOOTER_LEFT
This property stores the text content of the sheet footer's left side.

See Also:
JRProperties, Constant Field Values

PROPERTY_SHEET_FOOTER_CENTER

public static final java.lang.String PROPERTY_SHEET_FOOTER_CENTER
This property stores the text content of the sheet footer's center.

See Also:
JRProperties, Constant Field Values

PROPERTY_SHEET_FOOTER_RIGHT

public static final java.lang.String PROPERTY_SHEET_FOOTER_RIGHT
This property stores the text content of the sheet footer's right side.

See Also:
JRProperties, Constant Field Values

PROPERTY_SHEET_DIRECTION

public static final java.lang.String PROPERTY_SHEET_DIRECTION
This property indicates if the sheet is left-to-right or right-to-left oriented. Possible values are: The default value is LTR.

See Also:
JRProperties, RunDirectionEnum, Constant Field Values

loadedFonts

protected java.util.List loadedFonts

isOnePagePerSheet

protected boolean isOnePagePerSheet

isRemoveEmptySpaceBetweenRows

protected boolean isRemoveEmptySpaceBetweenRows

isRemoveEmptySpaceBetweenColumns

protected boolean isRemoveEmptySpaceBetweenColumns

isWhitePageBackground

protected boolean isWhitePageBackground

isAutoDetectCellType

protected boolean isAutoDetectCellType

isDetectCellType

protected boolean isDetectCellType

isFontSizeFixEnabled

protected boolean isFontSizeFixEnabled

isImageBorderFixEnabled

protected boolean isImageBorderFixEnabled

isIgnoreGraphics

protected boolean isIgnoreGraphics

createCustomPalette

protected boolean createCustomPalette

isCollapseRowSpan

protected boolean isCollapseRowSpan

isIgnoreCellBorder

protected boolean isIgnoreCellBorder

isIgnoreCellBackground

protected boolean isIgnoreCellBackground

wrapText

protected boolean wrapText

cellLocked

protected boolean cellLocked

cellHidden

protected boolean cellHidden

maxRowsPerSheet

protected int maxRowsPerSheet

sheetNames

protected java.lang.String[] sheetNames

sheetHeaderLeft

protected java.lang.String sheetHeaderLeft

sheetHeaderCenter

protected java.lang.String sheetHeaderCenter

sheetHeaderRight

protected java.lang.String sheetHeaderRight

sheetFooterLeft

protected java.lang.String sheetFooterLeft

sheetFooterCenter

protected java.lang.String sheetFooterCenter

sheetFooterRight

protected java.lang.String sheetFooterRight

sheetDirection

protected RunDirectionEnum sheetDirection

formatPatternsMap

protected java.util.Map formatPatternsMap

progressMonitor

protected JRExportProgressMonitor progressMonitor

reportIndex

protected int reportIndex

pageIndex

protected int pageIndex

fontMap

protected java.util.Map fontMap
Deprecated. 

defaultFont

protected JRFont defaultFont

sheetIndex

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


sheetNamesIndex

protected int sheetNamesIndex
Used for iterating through sheet names.


sheetNamesMap

protected java.util.Map sheetNamesMap
Used when indexing the identical sheet name. Contains sheet names as keys and the number of occurrences of each sheet name as values.


isIgnorePageMargins

protected boolean isIgnorePageMargins
Constructor Detail

JRXlsAbstractExporter

public JRXlsAbstractExporter()
Method Detail

getDefaultFont

protected JRFont getDefaultFont()

exportReport

public void exportReport()
                  throws JRException
Description copied from interface: JRExporter
Actually starts the export process.

Specified by:
exportReport in interface JRExporter
Specified by:
exportReport in class JRAbstractExporter
Throws:
JRException

setParameters

protected void setParameters()

setBackground

protected abstract void setBackground()

exportReportToStream

protected void exportReportToStream(java.io.OutputStream os)
                             throws JRException
Throws:
JRException

exportPage

protected int exportPage(JRPrintPage page,
                         CutsInfo xCuts,
                         int startRow)
                  throws JRException
Returns:
the number of rows added.
Throws:
JRException

setColumnWidths

protected void setColumnWidths(CutsInfo xCuts)

removeEmptyColumns

protected void removeEmptyColumns(CutsInfo xCuts)

getStyledText

protected JRStyledText getStyledText(JRPrintText textElement)
Overrides:
getStyledText in class JRAbstractExporter

getTextAlignHolder

protected static JRXlsAbstractExporter.TextAlignHolder getTextAlignHolder(JRPrintText textElement)

getImageBorderCorrection

protected int getImageBorderCorrection(JRPen pen)

calculateWidthForDinAN

protected final int calculateWidthForDinAN(int n)

calculateHeightForDinAN

protected final int calculateHeightForDinAN(int n)

calculateWidthForDinBN

protected final int calculateWidthForDinBN(int n)

calculateHeightForDinBN

protected final int calculateHeightForDinBN(int n)

calculateWidthForDinCN

protected final int calculateWidthForDinCN(int n)

calculateHeightForDinCN

protected final int calculateHeightForDinCN(int n)

isWrapText

protected boolean isWrapText(JRPrintElement element)

isCellLocked

protected boolean isCellLocked(JRPrintElement element)

getFormula

protected java.lang.String getFormula(JRPrintText text)

setSheetNames

protected void setSheetNames()

isCellHidden

protected boolean isCellHidden(JRPrintElement element)

getConvertedPattern

protected java.lang.String getConvertedPattern(java.lang.String pattern)
This method is intended to modify a given format pattern so to include only the accepted proprietary format characters. The resulted pattern will possibly truncate the original pattern

Parameters:
pattern -
Returns:
pattern converted to accepted proprietary formats

getNature

protected abstract ExporterNature getNature()

openWorkbook

protected abstract void openWorkbook(java.io.OutputStream os)
                              throws JRException
Throws:
JRException

createSheet

protected abstract void createSheet(java.lang.String name)

closeWorkbook

protected abstract void closeWorkbook(java.io.OutputStream os)
                               throws JRException
Throws:
JRException

setColumnWidth

protected abstract void setColumnWidth(int col,
                                       int width)

removeColumn

protected abstract void removeColumn(int col)

setRowHeight

protected abstract void setRowHeight(int rowIndex,
                                     int lastRowHeight)
                              throws JRException
Throws:
JRException

setCell

protected abstract void setCell(JRExporterGridCell gridCell,
                                int colIndex,
                                int rowIndex)

addBlankCell

protected abstract void addBlankCell(JRExporterGridCell gridCell,
                                     int colIndex,
                                     int rowIndex)
                              throws JRException
Throws:
JRException

addOccupiedCell

protected abstract void addOccupiedCell(OccupiedGridCell occupiedGridCell,
                                        int colIndex,
                                        int rowIndex)
                                 throws JRException
Throws:
JRException

exportText

protected abstract void exportText(JRPrintText text,
                                   JRExporterGridCell cell,
                                   int colIndex,
                                   int rowIndex)
                            throws JRException
Throws:
JRException

exportImage

protected abstract void exportImage(JRPrintImage image,
                                    JRExporterGridCell cell,
                                    int colIndex,
                                    int rowIndex,
                                    int emptyCols)
                             throws JRException
Throws:
JRException

exportRectangle

protected abstract void exportRectangle(JRPrintGraphicElement element,
                                        JRExporterGridCell cell,
                                        int colIndex,
                                        int rowIndex)
                                 throws JRException
Throws:
JRException

exportLine

protected abstract void exportLine(JRPrintLine line,
                                   JRExporterGridCell cell,
                                   int colIndex,
                                   int rowIndex)
                            throws JRException
Throws:
JRException

exportFrame

protected abstract void exportFrame(JRPrintFrame frame,
                                    JRExporterGridCell cell,
                                    int colIndex,
                                    int rowIndex)
                             throws JRException
Throws:
JRException

exportGenericElement

protected abstract void exportGenericElement(JRGenericPrintElement element,
                                             JRExporterGridCell cell,
                                             int colIndex,
                                             int rowIndex,
                                             int emptyCols)
                                      throws JRException
Throws:
JRException


Copyright © 2011. All Rights Reserved.