net.sf.jasperreports.engine.export
Class JRXlsExporter

java.lang.Object
  extended by net.sf.jasperreports.engine.JRAbstractExporter
      extended by net.sf.jasperreports.engine.export.JRXlsAbstractExporter
          extended by net.sf.jasperreports.engine.export.JRXlsExporter
All Implemented Interfaces:
JRExporter

public class JRXlsExporter
extends JRXlsAbstractExporter

Exports a JasperReports document to XLS format. It has binary output type and exports the document to a grid-based layout.

Version:
$Id: JRXlsExporter.java 4218 2011-02-28 12:53:17Z teodord $
Author:
Teodor Danciu (teodord@users.sourceforge.net)

Nested Class Summary
protected  class JRXlsExporter.ExporterContext
           
 
Nested classes/interfaces inherited from class net.sf.jasperreports.engine.export.JRXlsAbstractExporter
JRXlsAbstractExporter.TextAlignHolder
 
Nested classes/interfaces inherited from class net.sf.jasperreports.engine.JRAbstractExporter
JRAbstractExporter.BaseExporterContext, JRAbstractExporter.ParameterOverriddenResolver, JRAbstractExporter.ParameterOverrideResolver, JRAbstractExporter.ParameterResolver
 
Field Summary
protected  java.util.Map anchorLinks
           
protected  java.util.Map anchorNames
           
protected  short backgroundMode
           
protected  short blackIndex
           
protected  org.apache.poi.hssf.usermodel.HSSFCell cell
           
protected  org.apache.poi.ss.usermodel.CreationHelper createHelper
           
protected  org.apache.poi.hssf.usermodel.HSSFDataFormat dataFormat
           
protected  org.apache.poi.hssf.usermodel.HSSFCellStyle emptyCellStyle
           
protected  JRXlsExporterContext exporterContext
           
protected  java.util.Map loadedCellStyles
           
protected  ExporterNature nature
           
protected  java.util.Map pageLinks
           
protected  java.lang.String password
           
protected  org.apache.poi.hssf.usermodel.HSSFPatriarch patriarch
           
protected  org.apache.poi.hssf.usermodel.HSSFRow row
           
protected  org.apache.poi.hssf.usermodel.HSSFSheet sheet
           
protected  short whiteIndex
           
protected  org.apache.poi.hssf.usermodel.HSSFWorkbook workbook
           
static java.lang.String XLS_EXPORTER_KEY
          The exporter key, as used in GenericElementHandlerEnviroment.getHandler(net.sf.jasperreports.engine.JRGenericElementType, String).
 
Fields inherited from class net.sf.jasperreports.engine.export.JRXlsAbstractExporter
cellHidden, cellLocked, createCustomPalette, defaultFont, fontMap, formatPatternsMap, isAutoDetectCellType, isCollapseRowSpan, isDetectCellType, isFontSizeFixEnabled, isIgnoreCellBackground, isIgnoreCellBorder, isIgnoreGraphics, isIgnorePageMargins, isImageBorderFixEnabled, isOnePagePerSheet, isRemoveEmptySpaceBetweenColumns, isRemoveEmptySpaceBetweenRows, isWhitePageBackground, loadedFonts, maxRowsPerSheet, pageIndex, progressMonitor, PROPERTY_CELL_HIDDEN, PROPERTY_CELL_LOCKED, PROPERTY_FIT_HEIGHT, PROPERTY_FIT_WIDTH, PROPERTY_SHEET_DIRECTION, PROPERTY_SHEET_FOOTER_CENTER, PROPERTY_SHEET_FOOTER_LEFT, PROPERTY_SHEET_FOOTER_RIGHT, PROPERTY_SHEET_HEADER_CENTER, PROPERTY_SHEET_HEADER_LEFT, PROPERTY_SHEET_HEADER_RIGHT, PROPERTY_WRAP_TEXT, reportIndex, sheetDirection, sheetFooterCenter, sheetFooterLeft, sheetFooterRight, sheetHeaderCenter, sheetHeaderLeft, sheetHeaderRight, sheetIndex, sheetNames, sheetNamesIndex, sheetNamesMap, wrapText, 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
JRXlsExporter()
           
 
Method Summary
protected  void addBlankCell(JRExporterGridCell gridCell, int colIndex, int rowIndex)
           
protected  void addOccupiedCell(OccupiedGridCell occupiedGridCell, int colIndex, int rowIndex)
           
protected  void closeWorkbook(java.io.OutputStream os)
           
protected  void createMergeRegion(JRExporterGridCell gridCell, int colIndex, int rowIndex, org.apache.poi.hssf.usermodel.HSSFCellStyle cellStyle)
           
protected  void createSheet(java.lang.String name)
           
protected  void createTextCell(JRPrintText textElement, JRExporterGridCell gridCell, int colIndex, int rowIndex, JRStyledText styledText, net.sf.jasperreports.engine.export.StyleInfo baseStyle, short forecolor)
           
protected  void endCreateCell(org.apache.poi.hssf.usermodel.HSSFCellStyle cellStyle)
           
protected  void exportFrame(JRPrintFrame frame, JRExporterGridCell gridCell, int x, int y)
           
protected  void exportGenericElement(JRGenericPrintElement element, JRExporterGridCell gridCell, int colIndex, int rowIndex, int emptyCols, int yCutsRow, JRGridLayout layout)
           
protected  void exportImage(JRPrintImage element, JRExporterGridCell gridCell, int colIndex, int rowIndex, int emptyCols, int yCutsRow, JRGridLayout layout)
           
protected  void exportLine(JRPrintLine line, JRExporterGridCell gridCell, int colIndex, int rowIndex)
           
protected  void exportRectangle(JRPrintGraphicElement element, JRExporterGridCell gridCell, int colIndex, int rowIndex)
           
 void exportText(JRPrintText textElement, JRExporterGridCell gridCell, int colIndex, int rowIndex)
           
protected static short getBorderStyle(JRPen pen)
           
protected  double getColumnRelativePosition(JRGridLayout layout, int col, int offset)
           
protected  java.lang.String getExporterKey()
           
protected  org.apache.poi.hssf.usermodel.HSSFCellStyle getLoadedCellStyle(short mode, short backcolor, short horizontalAlignment, short verticalAlignment, short rotation, org.apache.poi.hssf.usermodel.HSSFFont font, net.sf.jasperreports.engine.export.BoxStyle box)
           
protected  org.apache.poi.hssf.usermodel.HSSFCellStyle getLoadedCellStyle(short mode, short backcolor, short horizontalAlignment, short verticalAlignment, short rotation, org.apache.poi.hssf.usermodel.HSSFFont font, net.sf.jasperreports.engine.export.BoxStyle box, boolean isCellLocked, boolean isCellHidden)
           
protected  org.apache.poi.hssf.usermodel.HSSFCellStyle getLoadedCellStyle(short mode, short backcolor, short horizontalAlignment, short verticalAlignment, short rotation, org.apache.poi.hssf.usermodel.HSSFFont font, JRExporterGridCell gridCell)
           
protected  org.apache.poi.hssf.usermodel.HSSFCellStyle getLoadedCellStyle(short mode, short backcolor, short horizontalAlignment, short verticalAlignment, short rotation, org.apache.poi.hssf.usermodel.HSSFFont font, JRExporterGridCell gridCell, boolean isCellLocked, boolean isCellHidden)
           
protected  org.apache.poi.hssf.usermodel.HSSFCellStyle getLoadedCellStyle(net.sf.jasperreports.engine.export.StyleInfo style)
           
protected  org.apache.poi.hssf.usermodel.HSSFFont getLoadedFont(JRFont font, short forecolor, java.util.Map attributes, java.util.Locale locale)
           
protected  ExporterNature getNature()
           
protected static org.apache.poi.hssf.util.HSSFColor getNearestColor(java.awt.Color awtColor)
           
protected  org.apache.poi.hssf.usermodel.HSSFRichTextString getRichTextString(JRStyledText styledText, short forecolor, JRFont defaultFont, java.util.Locale locale)
           
protected  double getRowRelativePosition(JRGridLayout layout, int row, int offset)
           
protected static org.apache.poi.hssf.util.HSSFColor getWorkbookColor(java.awt.Color awtColor)
           
protected  org.apache.poi.hssf.usermodel.HSSFCellStyle initCreateCell(JRExporterGridCell gridCell, int colIndex, int rowIndex, net.sf.jasperreports.engine.export.StyleInfo baseStyle)
           
protected  void openWorkbook(java.io.OutputStream os)
           
protected  void removeColumn(int colIndex)
           
protected  void setBackground()
           
protected  void setCell(JRExporterGridCell gridCell, int colIndex, int rowIndex)
           
protected  void setColumnWidth(int col, int width)
           
protected  void setHyperlinkCell(JRPrintHyperlink hyperlink)
           
protected  void setParameters()
           
protected  void setRichTextStringCellValue(JRStyledText styledText, short forecolor, JRFont defaultFont, java.util.Locale locale)
           
protected  void setRowHeight(int rowIndex, int lastRowHeight)
           
protected  void setStringCellValue(java.lang.String textStr)
           
 
Methods inherited from class net.sf.jasperreports.engine.export.JRXlsAbstractExporter
calculateHeightForDinAN, calculateHeightForDinBN, calculateHeightForDinCN, calculateWidthForDinAN, calculateWidthForDinBN, calculateWidthForDinCN, exportPage, exportReport, exportReportToStream, getConvertedPattern, getDefaultFont, getFormula, getImageBorderCorrection, getStyledText, getTextAlignHolder, isCellHidden, isCellLocked, isWrapText, removeEmptyColumns, setColumnWidths, setSheetNames
 
Methods inherited from class net.sf.jasperreports.engine.JRAbstractExporter
createFilter, defaultParseNumber, getBooleanCellValue, getBooleanParameter, getCharacterParameter, getCustomHandler, getDateCellValue, getDateFormat, 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_KEY

public static final java.lang.String XLS_EXPORTER_KEY
The exporter key, as used in GenericElementHandlerEnviroment.getHandler(net.sf.jasperreports.engine.JRGenericElementType, String).

See Also:
Constant Field Values

loadedCellStyles

protected java.util.Map loadedCellStyles

anchorLinks

protected java.util.Map anchorLinks

pageLinks

protected java.util.Map pageLinks

anchorNames

protected java.util.Map anchorNames

workbook

protected org.apache.poi.hssf.usermodel.HSSFWorkbook workbook

sheet

protected org.apache.poi.hssf.usermodel.HSSFSheet sheet

row

protected org.apache.poi.hssf.usermodel.HSSFRow row

cell

protected org.apache.poi.hssf.usermodel.HSSFCell cell

emptyCellStyle

protected org.apache.poi.hssf.usermodel.HSSFCellStyle emptyCellStyle

createHelper

protected org.apache.poi.ss.usermodel.CreationHelper createHelper

whiteIndex

protected short whiteIndex

blackIndex

protected short blackIndex

backgroundMode

protected short backgroundMode

dataFormat

protected org.apache.poi.hssf.usermodel.HSSFDataFormat dataFormat

nature

protected ExporterNature nature

patriarch

protected org.apache.poi.hssf.usermodel.HSSFPatriarch patriarch

password

protected java.lang.String password

exporterContext

protected JRXlsExporterContext exporterContext
Constructor Detail

JRXlsExporter

public JRXlsExporter()
Method Detail

setParameters

protected void setParameters()
Overrides:
setParameters in class JRXlsAbstractExporter

setBackground

protected void setBackground()
Specified by:
setBackground in class JRXlsAbstractExporter

openWorkbook

protected void openWorkbook(java.io.OutputStream os)
Specified by:
openWorkbook in class JRXlsAbstractExporter

createSheet

protected void createSheet(java.lang.String name)
Specified by:
createSheet in class JRXlsAbstractExporter

closeWorkbook

protected void closeWorkbook(java.io.OutputStream os)
                      throws JRException
Specified by:
closeWorkbook in class JRXlsAbstractExporter
Throws:
JRException

setColumnWidth

protected void setColumnWidth(int col,
                              int width)
Specified by:
setColumnWidth in class JRXlsAbstractExporter

setRowHeight

protected void setRowHeight(int rowIndex,
                            int lastRowHeight)
Specified by:
setRowHeight in class JRXlsAbstractExporter

setCell

protected void setCell(JRExporterGridCell gridCell,
                       int colIndex,
                       int rowIndex)
Specified by:
setCell in class JRXlsAbstractExporter

removeColumn

protected void removeColumn(int colIndex)
Specified by:
removeColumn in class JRXlsAbstractExporter

addBlankCell

protected void addBlankCell(JRExporterGridCell gridCell,
                            int colIndex,
                            int rowIndex)
Specified by:
addBlankCell in class JRXlsAbstractExporter

addOccupiedCell

protected void addOccupiedCell(OccupiedGridCell occupiedGridCell,
                               int colIndex,
                               int rowIndex)
Specified by:
addOccupiedCell in class JRXlsAbstractExporter

exportLine

protected void exportLine(JRPrintLine line,
                          JRExporterGridCell gridCell,
                          int colIndex,
                          int rowIndex)
Specified by:
exportLine in class JRXlsAbstractExporter

exportRectangle

protected void exportRectangle(JRPrintGraphicElement element,
                               JRExporterGridCell gridCell,
                               int colIndex,
                               int rowIndex)
Specified by:
exportRectangle in class JRXlsAbstractExporter

exportText

public void exportText(JRPrintText textElement,
                       JRExporterGridCell gridCell,
                       int colIndex,
                       int rowIndex)
                throws JRException
Specified by:
exportText in class JRXlsAbstractExporter
Throws:
JRException

createTextCell

protected void createTextCell(JRPrintText textElement,
                              JRExporterGridCell gridCell,
                              int colIndex,
                              int rowIndex,
                              JRStyledText styledText,
                              net.sf.jasperreports.engine.export.StyleInfo baseStyle,
                              short forecolor)
                       throws JRException
Throws:
JRException

initCreateCell

protected org.apache.poi.hssf.usermodel.HSSFCellStyle initCreateCell(JRExporterGridCell gridCell,
                                                                     int colIndex,
                                                                     int rowIndex,
                                                                     net.sf.jasperreports.engine.export.StyleInfo baseStyle)

endCreateCell

protected void endCreateCell(org.apache.poi.hssf.usermodel.HSSFCellStyle cellStyle)

setStringCellValue

protected final void setStringCellValue(java.lang.String textStr)

setRichTextStringCellValue

protected final void setRichTextStringCellValue(JRStyledText styledText,
                                                short forecolor,
                                                JRFont defaultFont,
                                                java.util.Locale locale)

getRichTextString

protected org.apache.poi.hssf.usermodel.HSSFRichTextString getRichTextString(JRStyledText styledText,
                                                                             short forecolor,
                                                                             JRFont defaultFont,
                                                                             java.util.Locale locale)

createMergeRegion

protected void createMergeRegion(JRExporterGridCell gridCell,
                                 int colIndex,
                                 int rowIndex,
                                 org.apache.poi.hssf.usermodel.HSSFCellStyle cellStyle)

getWorkbookColor

protected static org.apache.poi.hssf.util.HSSFColor getWorkbookColor(java.awt.Color awtColor)

getNearestColor

protected static org.apache.poi.hssf.util.HSSFColor getNearestColor(java.awt.Color awtColor)

getLoadedFont

protected org.apache.poi.hssf.usermodel.HSSFFont getLoadedFont(JRFont font,
                                                               short forecolor,
                                                               java.util.Map attributes,
                                                               java.util.Locale locale)

getLoadedCellStyle

protected org.apache.poi.hssf.usermodel.HSSFCellStyle getLoadedCellStyle(net.sf.jasperreports.engine.export.StyleInfo style)

getLoadedCellStyle

protected org.apache.poi.hssf.usermodel.HSSFCellStyle getLoadedCellStyle(short mode,
                                                                         short backcolor,
                                                                         short horizontalAlignment,
                                                                         short verticalAlignment,
                                                                         short rotation,
                                                                         org.apache.poi.hssf.usermodel.HSSFFont font,
                                                                         JRExporterGridCell gridCell)

getLoadedCellStyle

protected org.apache.poi.hssf.usermodel.HSSFCellStyle getLoadedCellStyle(short mode,
                                                                         short backcolor,
                                                                         short horizontalAlignment,
                                                                         short verticalAlignment,
                                                                         short rotation,
                                                                         org.apache.poi.hssf.usermodel.HSSFFont font,
                                                                         JRExporterGridCell gridCell,
                                                                         boolean isCellLocked,
                                                                         boolean isCellHidden)

getLoadedCellStyle

protected org.apache.poi.hssf.usermodel.HSSFCellStyle getLoadedCellStyle(short mode,
                                                                         short backcolor,
                                                                         short horizontalAlignment,
                                                                         short verticalAlignment,
                                                                         short rotation,
                                                                         org.apache.poi.hssf.usermodel.HSSFFont font,
                                                                         net.sf.jasperreports.engine.export.BoxStyle box)

getLoadedCellStyle

protected org.apache.poi.hssf.usermodel.HSSFCellStyle getLoadedCellStyle(short mode,
                                                                         short backcolor,
                                                                         short horizontalAlignment,
                                                                         short verticalAlignment,
                                                                         short rotation,
                                                                         org.apache.poi.hssf.usermodel.HSSFFont font,
                                                                         net.sf.jasperreports.engine.export.BoxStyle box,
                                                                         boolean isCellLocked,
                                                                         boolean isCellHidden)

getBorderStyle

protected static short getBorderStyle(JRPen pen)

exportImage

protected void exportImage(JRPrintImage element,
                           JRExporterGridCell gridCell,
                           int colIndex,
                           int rowIndex,
                           int emptyCols,
                           int yCutsRow,
                           JRGridLayout layout)
                    throws JRException
Specified by:
exportImage in class JRXlsAbstractExporter
Throws:
JRException

getColumnRelativePosition

protected double getColumnRelativePosition(JRGridLayout layout,
                                           int col,
                                           int offset)

getRowRelativePosition

protected double getRowRelativePosition(JRGridLayout layout,
                                        int row,
                                        int offset)

exportFrame

protected void exportFrame(JRPrintFrame frame,
                           JRExporterGridCell gridCell,
                           int x,
                           int y)
Specified by:
exportFrame in class JRXlsAbstractExporter

exportGenericElement

protected void exportGenericElement(JRGenericPrintElement element,
                                    JRExporterGridCell gridCell,
                                    int colIndex,
                                    int rowIndex,
                                    int emptyCols,
                                    int yCutsRow,
                                    JRGridLayout layout)
                             throws JRException
Specified by:
exportGenericElement in class JRXlsAbstractExporter
Throws:
JRException

getNature

protected ExporterNature getNature()
Specified by:
getNature in class JRXlsAbstractExporter

setHyperlinkCell

protected void setHyperlinkCell(JRPrintHyperlink hyperlink)

getExporterKey

protected java.lang.String getExporterKey()
Specified by:
getExporterKey in class JRAbstractExporter


© 2001-2010 Jaspersoft Corporation www.jaspersoft.com