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 3841 2010-06-01 10:18:32Z shertage $
Author:
Teodor Danciu (teodord@users.sourceforge.net)

Nested Class Summary
protected static class JRXlsExporter.BoxStyle
           
protected  class JRXlsExporter.ExporterContext
           
protected static class JRXlsExporter.StyleInfo
           
 
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  HSSFCell cell
           
protected  CreationHelper createHelper
           
protected  HSSFDataFormat dataFormat
           
protected  HSSFCellStyle emptyCellStyle
           
protected  JRXlsExporterContext exporterContext
           
protected  java.util.Map formatPatternsMap
           
protected  java.util.Map loadedCellStyles
           
protected  ExporterNature nature
           
protected  java.util.Map pageLinks
           
protected  java.lang.String password
           
protected  HSSFPatriarch patriarch
           
protected  HSSFRow row
           
protected  HSSFSheet sheet
           
protected  short whiteIndex
           
protected  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
currentSheetName, defaultFont, fontMap, isAutoDetectCellType, isCollapseRowSpan, isDetectCellType, isFontSizeFixEnabled, isIgnoreCellBackground, isIgnoreCellBorder, isIgnoreGraphics, isIgnorePageMargins, isImageBorderFixEnabled, isOnePagePerSheet, isRemoveEmptySpaceBetweenColumns, isRemoveEmptySpaceBetweenRows, isWhitePageBackground, loadedFonts, maxRowsPerSheet, pageIndex, progressMonitor, reportIndex, sheetIndex, sheetNames, sheetNamesMap, 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, HSSFCellStyle cellStyle)
           
protected  void createSheet(java.lang.String name)
           
protected  void createTextCell(JRPrintText textElement, JRExporterGridCell gridCell, int colIndex, int rowIndex, JRStyledText styledText, JRXlsExporter.StyleInfo baseStyle, short forecolor)
           
protected  void endCreateCell(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)
           
protected  void exportImage(JRPrintImage element, JRExporterGridCell gridCell, int colIndex, int rowIndex, int emptyCols)
           
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  java.lang.String getExporterKey()
           
protected  HSSFCellStyle getLoadedCellStyle(JRXlsExporter.StyleInfo style)
           
protected  HSSFCellStyle getLoadedCellStyle(short mode, short backcolor, short horizontalAlignment, short verticalAlignment, short rotation, HSSFFont font, JRExporterGridCell gridCell)
           
protected  HSSFCellStyle getLoadedCellStyle(short mode, short backcolor, short horizontalAlignment, short verticalAlignment, short rotation, HSSFFont font, JRXlsExporter.BoxStyle box)
           
protected  HSSFFont getLoadedFont(JRFont font, short forecolor, java.util.Map attributes, java.util.Locale locale)
           
protected  ExporterNature getNature()
           
protected static HSSFColor getNearestColor(java.awt.Color awtColor)
           
protected  HSSFRichTextString getRichTextString(JRStyledText styledText, short forecolor, JRFont defaultFont, java.util.Locale locale)
           
protected  HSSFCellStyle initCreateCell(JRExporterGridCell gridCell, int colIndex, int rowIndex, JRXlsExporter.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, getDefaultFont, getImageBorderCorrection, getStyledText, getTextAlignHolder, removeEmptyColumns, setColumnWidths
 
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 HSSFWorkbook workbook

sheet

protected HSSFSheet sheet

row

protected HSSFRow row

cell

protected HSSFCell cell

emptyCellStyle

protected HSSFCellStyle emptyCellStyle

createHelper

protected CreationHelper createHelper

whiteIndex

protected short whiteIndex

blackIndex

protected short blackIndex

backgroundMode

protected short backgroundMode

dataFormat

protected HSSFDataFormat dataFormat

formatPatternsMap

protected java.util.Map formatPatternsMap

nature

protected ExporterNature nature

patriarch

protected 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,
                              JRXlsExporter.StyleInfo baseStyle,
                              short forecolor)
                       throws JRException
Throws:
JRException

initCreateCell

protected HSSFCellStyle initCreateCell(JRExporterGridCell gridCell,
                                       int colIndex,
                                       int rowIndex,
                                       JRXlsExporter.StyleInfo baseStyle)

endCreateCell

protected void endCreateCell(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 HSSFRichTextString getRichTextString(JRStyledText styledText,
                                               short forecolor,
                                               JRFont defaultFont,
                                               java.util.Locale locale)

createMergeRegion

protected void createMergeRegion(JRExporterGridCell gridCell,
                                 int colIndex,
                                 int rowIndex,
                                 HSSFCellStyle cellStyle)

getNearestColor

protected static HSSFColor getNearestColor(java.awt.Color awtColor)

getLoadedFont

protected HSSFFont getLoadedFont(JRFont font,
                                 short forecolor,
                                 java.util.Map attributes,
                                 java.util.Locale locale)

getLoadedCellStyle

protected HSSFCellStyle getLoadedCellStyle(JRXlsExporter.StyleInfo style)

getLoadedCellStyle

protected HSSFCellStyle getLoadedCellStyle(short mode,
                                           short backcolor,
                                           short horizontalAlignment,
                                           short verticalAlignment,
                                           short rotation,
                                           HSSFFont font,
                                           JRExporterGridCell gridCell)

getLoadedCellStyle

protected HSSFCellStyle getLoadedCellStyle(short mode,
                                           short backcolor,
                                           short horizontalAlignment,
                                           short verticalAlignment,
                                           short rotation,
                                           HSSFFont font,
                                           JRXlsExporter.BoxStyle box)

getBorderStyle

protected static short getBorderStyle(JRPen pen)

exportImage

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

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)
                             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