Class HSSFCellStyleProducer
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.modules.output.table.xls.helper.HSSFCellStyleProducer
-
- All Implemented Interfaces:
CellStyleProducer
public class HSSFCellStyleProducer extends Object implements CellStyleProducer
The cellstyle producer converts the JFreeReport content into excel cell styles. This class is able to use the POI 2.0 features to build data cells.- Author:
- Thomas Morgner
-
-
Constructor Summary
Constructors Constructor Description HSSFCellStyleProducer(org.apache.poi.ss.usermodel.Workbook workbook, boolean hardLimit, ExcelColorProducer colorProducer, ExcelColorProducer fontColorProducer)
The class does the dirty work of creating the HSSF-objects.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static org.apache.poi.ss.usermodel.HorizontalAlignment
convertHorizontalAlignment(ElementAlignment e)
Converts the given element alignment into one of the HorizontalAlignment-constants.protected static org.apache.poi.ss.usermodel.VerticalAlignment
convertVerticalAlignment(ElementAlignment e)
Converts the given element alignment into one of the VerticalAlignment-constants.org.apache.poi.ss.usermodel.CellStyle
createCellStyle(InstanceID id, StyleSheet element, CellBackground bg)
Creates a HSSFCellStyle based on the given ExcelDataCellStyle.ExcelFontFactory
getFontFactory()
protected static org.apache.poi.ss.usermodel.BorderStyle
translateStroke(BorderStyle borderStyle, long widthRaw)
Tries to translate the given stroke width into one of the predefined excel border styles.
-
-
-
Constructor Detail
-
HSSFCellStyleProducer
public HSSFCellStyleProducer(org.apache.poi.ss.usermodel.Workbook workbook, boolean hardLimit, ExcelColorProducer colorProducer, ExcelColorProducer fontColorProducer)
The class does the dirty work of creating the HSSF-objects.- Parameters:
workbook
- the workbook for which the styles should be created.
-
-
Method Detail
-
createCellStyle
public org.apache.poi.ss.usermodel.CellStyle createCellStyle(InstanceID id, StyleSheet element, CellBackground bg)
Creates a HSSFCellStyle based on the given ExcelDataCellStyle. If a similiar cell style was previously generated, then reuse that cached result.- Specified by:
createCellStyle
in interfaceCellStyleProducer
- Parameters:
element
- can be null for background only cells.bg
- the optional background style for the table cell.- Returns:
- the generated or cached HSSFCellStyle.
-
convertHorizontalAlignment
protected static org.apache.poi.ss.usermodel.HorizontalAlignment convertHorizontalAlignment(ElementAlignment e)
Converts the given element alignment into one of the HorizontalAlignment-constants.- Parameters:
e
- the JFreeReport element alignment.- Returns:
- the HorizontalAlignment-Alignment.
- Throws:
IllegalArgumentException
- if an Unknown JFreeReport alignment is given.
-
convertVerticalAlignment
protected static org.apache.poi.ss.usermodel.VerticalAlignment convertVerticalAlignment(ElementAlignment e)
Converts the given element alignment into one of the VerticalAlignment-constants.- Parameters:
e
- the JFreeReport element alignment.- Returns:
- the VerticalAlignment-Alignment.
- Throws:
IllegalArgumentException
- if an Unknown JFreeReport alignment is given.
-
translateStroke
protected static org.apache.poi.ss.usermodel.BorderStyle translateStroke(BorderStyle borderStyle, long widthRaw)
Tries to translate the given stroke width into one of the predefined excel border styles.- Parameters:
widthRaw
- the AWT-Stroke-Width.- Returns:
- the translated excel border width.
-
getFontFactory
public ExcelFontFactory getFontFactory()
- Specified by:
getFontFactory
in interfaceCellStyleProducer
-
-