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.

Since classic AWT fonts can be sometimes very different from system fonts (which are used by XLS viewers), a font mapping feature was added. By using the JRExporterParameter.FONT_MAP parameter, a logical font like "sansserif" can be mapped to a system specific font, like "Comic Sans MS". Both map keys and values are strings.

Version:
$Id: JRXlsExporter.java 2055 2008-01-11 11:55:58Z teodord $
Author:
Teodor Danciu (teodord@users.sourceforge.net)

Nested Class Summary
protected static class JRXlsExporter.BoxStyle
           
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.ParameterOverriddenResolver, JRAbstractExporter.ParameterOverrideResolver, JRAbstractExporter.ParameterResolver
 
Field Summary
protected  short backgroundMode
           
protected  short blackIndex
           
protected  org.apache.poi.hssf.usermodel.HSSFCell cell
           
protected  org.apache.poi.hssf.usermodel.HSSFDataFormat dataFormat
           
protected  org.apache.poi.hssf.usermodel.HSSFCellStyle emptyCellStyle
           
protected  java.util.Map formatPatternsMap
           
protected  java.util.Map loadedCellStyles
           
protected  ExporterNature nature
           
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
           
 
Fields inherited from class net.sf.jasperreports.engine.export.JRXlsAbstractExporter
currentSheetName, defaultFont, fontMap, hyperlinkProducerFactory, isAutoDetectCellType, isCollapseRowSpan, isDetectCellType, isFontSizeFixEnabled, isIgnoreCellBorder, isIgnoreGraphics, isOnePagePerSheet, isRemoveEmptySpaceBetweenColumns, isRemoveEmptySpaceBetweenRows, isWhitePageBackground, loadedFonts, maxRowsPerSheet, progressMonitor, reportIndex, sheetIndex, sheetNames, sheetNamesMap
 
Fields inherited from class net.sf.jasperreports.engine.JRAbstractExporter
classLoader, classLoaderSet, dateFormatCache, endPageIndex, filter, globalOffsetX, globalOffsetY, isModeBatch, jasperPrint, jasperPrintList, numberFormatCache, parameters, startPageIndex, urlHandlerFactory, urlHandlerFactorySet
 
Constructor Summary
JRXlsExporter()
           
 
Method Summary
protected  void addBlankCell(JRExporterGridCell gridCell, 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, JRXlsExporter.StyleInfo baseStyle)
           
protected  void endCreateCell(org.apache.poi.hssf.usermodel.HSSFCellStyle cellStyle)
           
protected  void exportFrame(JRPrintFrame frame, JRExporterGridCell gridCell, int x, int y)
           
protected  void exportImage(JRPrintImage image, 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)
           
protected  void exportText(JRPrintText textElement, JRExporterGridCell gridCell, int colIndex, int rowIndex)
           
protected static short getBorderStyle(JRPen pen)
           
protected  org.apache.poi.hssf.usermodel.HSSFCellStyle getLoadedCellStyle(JRXlsExporter.StyleInfo style)
           
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, JRXlsExporter.BoxStyle box)
           
protected  org.apache.poi.hssf.usermodel.HSSFFont getLoadedFont(JRFont font, short forecolor)
           
protected  ExporterNature getNature()
           
protected static org.apache.poi.hssf.util.HSSFColor getNearestColor(java.awt.Color awtColor)
           
protected  org.apache.poi.hssf.usermodel.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(int colIndex, int rowIndex)
           
protected  void setColumnWidth(int col, int width)
           
protected  void setParameters()
           
protected  void setRowHeight(int rowIndex, int lastRowHeight)
           
protected  void setStringCellValue(java.lang.String textStr)
           
 
Methods inherited from class net.sf.jasperreports.engine.export.JRXlsAbstractExporter
exportPage, exportReport, exportReportToStream, getCustomHandler, getDefaultFont, getImageBorderCorrection, getStyledText, getTextAlignHolder, removeEmptyColumns, setColumnWidths
 
Methods inherited from class net.sf.jasperreports.engine.JRAbstractExporter
defaultParseNumber, getBooleanCellValue, getBooleanParameter, getDateCellValue, getDateFormat, getIntegerParameter, getNumberCellValue, getNumberFormat, getOffsetX, getOffsetY, getParameter, getParameterResolver, getParameters, getStringParameter, getStringParameterOrDefault, getStyledText, getTextFormatFactoryClass, getTextLocale, getTextTimeZone, getTextValue, getTextValueString, reset, resetClassLoader, resetExportContext, restoreElementOffsets, setClassLoader, setExportContext, setFrameElementsOffset, setInput, 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

loadedCellStyles

protected java.util.Map loadedCellStyles

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

whiteIndex

protected short whiteIndex

blackIndex

protected short blackIndex

backgroundMode

protected short backgroundMode

dataFormat

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

formatPatternsMap

protected java.util.Map formatPatternsMap

nature

protected ExporterNature nature
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(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

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

protected 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)
                       throws JRException
Throws:
JRException

initCreateCell

protected org.apache.poi.hssf.usermodel.HSSFCellStyle initCreateCell(JRExporterGridCell gridCell,
                                                                     int colIndex,
                                                                     int rowIndex,
                                                                     JRXlsExporter.StyleInfo baseStyle)

endCreateCell

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

setStringCellValue

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

createMergeRegion

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

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)

getLoadedCellStyle

protected org.apache.poi.hssf.usermodel.HSSFCellStyle getLoadedCellStyle(JRXlsExporter.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,
                                                                         JRXlsExporter.BoxStyle box)

getBorderStyle

protected static short getBorderStyle(JRPen pen)

exportImage

protected void exportImage(JRPrintImage image,
                           JRExporterGridCell gridCell,
                           int colIndex,
                           int rowIndex,
                           int emptyCols)
Specified by:
exportImage in class JRXlsAbstractExporter

exportFrame

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

getNature

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


© 2001-2006 JasperSoft Corporation www.jaspersoft.com