Class 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 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 interface CellStyleProducer
        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.