org.apache.poi.hssf.converter

## Class ExcelToFoConverter

- java.lang.Object
- - org.apache.poi.hssf.converter.AbstractExcelConverter
  - - org.apache.poi.hssf.converter.ExcelToFoConverter

-     @Beta
      public class ExcelToFoConverter
      extends AbstractExcelConverter

  Converts xls files (97-2007) to XSL FO.
  Author:
    Sergey Vladimirov (vlsergey {at} gmail {dot} com)

- - ### Field Summary

    - ### Fields inherited from class org.apache.poi.hssf.converter.AbstractExcelConverter

      `_formatter`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExcelToFoConverter(org.w3c.dom.Document document)`
    `ExcelToFoConverter(FoDocumentFacade foDocumentFacade)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.lang.String` | `createPageMaster(float tableWidthIn, java.lang.String pageMasterName)`
    `protected org.w3c.dom.Document` | `getDocument()`
    `float` | `getPageMarginInches()`
    `protected boolean` | `isEmptyStyle(CellStyle cellStyle)` Returns `false` if cell style by itself (without text, i.e.
    `static void` | `main(java.lang.String[] args)` Java main() interface to interact with `ExcelToFoConverter`
    `static org.w3c.dom.Document` | `process(java.io.File xlsFile)` Converts Excel file (97-2007) into XSL FO file.
    `protected boolean` | `processCell(HSSFWorkbook workbook, HSSFCell cell, org.w3c.dom.Element tableCellElement, int normalWidthPx, int maxSpannedWidthPx, float normalHeightPt)`
    `protected void` | `processCellStyle(HSSFWorkbook workbook, HSSFCellStyle cellStyle, org.w3c.dom.Element cellTarget, org.w3c.dom.Element blockTarget)`
    `protected void` | `processCellStyleBorder(HSSFWorkbook workbook, org.w3c.dom.Element cellTarget, java.lang.String type, BorderStyle xlsBorder, short borderColor)`
    `protected void` | `processCellStyleFont(HSSFWorkbook workbook, org.w3c.dom.Element blockTarget, HSSFFont font)`
    `protected void` | `processColumnHeaders(HSSFSheet sheet, int maxSheetColumns, org.w3c.dom.Element table)`
    `protected float` | `processColumnWidths(HSSFSheet sheet, int maxSheetColumns, org.w3c.dom.Element table)` Creates COLGROUP element with width specified for all columns.
    `protected void` | `processDocumentInformation(SummaryInformation summaryInformation)`
    `protected int` | `processRow(HSSFWorkbook workbook, CellRangeAddress[][] mergedRanges, HSSFRow row, org.w3c.dom.Element tableRowElement)`
    `protected org.w3c.dom.Element` | `processRowNumber(HSSFRow row)`
    `protected float` | `processSheet(HSSFWorkbook workbook, HSSFSheet sheet, org.w3c.dom.Element flow)`
    `protected boolean` | `processSheet(HSSFWorkbook workbook, int sheetIndex)` Process single sheet (as specified by 0-based sheet index)
    `protected void` | `processSheetName(HSSFSheet sheet, org.w3c.dom.Element flow)`
    `void` | `processWorkbook(HSSFWorkbook workbook)`
    `void` | `setPageMarginInches(float pageMarginInches)`

    - ### Methods inherited from class org.apache.poi.hssf.converter.AbstractExcelConverter

      `getColumnName, getColumnWidth, getDefaultColumnWidth, getFontReplacer, getRowName, isOutputColumnHeaders, isOutputHiddenColumns, isOutputHiddenRows, isOutputLeadingSpacesAsNonBreaking, isOutputRowNumbers, isTextEmpty, setFontReplacer, setOutputColumnHeaders, setOutputHiddenColumns, setOutputHiddenRows, setOutputLeadingSpacesAsNonBreaking, setOutputRowNumbers`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ExcelToFoConverter

          public ExcelToFoConverter(org.w3c.dom.Document document)

    - #### ExcelToFoConverter

          public ExcelToFoConverter(FoDocumentFacade foDocumentFacade)

  - ### Method Detail

    - #### main

          public static void main(java.lang.String[] args)
                           throws java.lang.Exception

      Java main() interface to interact with `ExcelToFoConverter`

      Usage: ExcelToHtmlConverter infile outfile

      Where infile is an input .xls file ( Word 97-2007) which will be rendered as XSL FO into outfile
      Throws:
        `java.lang.Exception`

    - #### process

          public static org.w3c.dom.Document process(java.io.File xlsFile)
                                              throws java.lang.Exception

      Converts Excel file (97-2007) into XSL FO file.
      Parameters:
        `xlsFile` - file to process
      Returns:
        DOM representation of result XSL FO
      Throws:
        `java.lang.Exception`

    - #### createPageMaster

          protected java.lang.String createPageMaster(float tableWidthIn,
                                                      java.lang.String pageMasterName)

    - #### getDocument

          protected org.w3c.dom.Document getDocument()

      Specified by:
        `getDocument` in class `AbstractExcelConverter`

    - #### getPageMarginInches

          public float getPageMarginInches()

    - #### isEmptyStyle

          protected boolean isEmptyStyle(CellStyle cellStyle)

      Returns `false` if cell style by itself (without text, i.e. borders, fill, etc.) worth a mention, `true` otherwise
      Returns:
        `false` if cell style by itself (without text, i.e. borders, fill, etc.) worth a mention, `true` otherwise

    - #### processCell

          protected boolean processCell(HSSFWorkbook workbook,
                                        HSSFCell cell,
                                        org.w3c.dom.Element tableCellElement,
                                        int normalWidthPx,
                                        int maxSpannedWidthPx,
                                        float normalHeightPt)

    - #### processCellStyle

          protected void processCellStyle(HSSFWorkbook workbook,
                                          HSSFCellStyle cellStyle,
                                          org.w3c.dom.Element cellTarget,
                                          org.w3c.dom.Element blockTarget)

    - #### processCellStyleBorder

          protected void processCellStyleBorder(HSSFWorkbook workbook,
                                                org.w3c.dom.Element cellTarget,
                                                java.lang.String type,
                                                BorderStyle xlsBorder,
                                                short borderColor)

    - #### processCellStyleFont

          protected void processCellStyleFont(HSSFWorkbook workbook,
                                              org.w3c.dom.Element blockTarget,
                                              HSSFFont font)

    - #### processColumnHeaders

          protected void processColumnHeaders(HSSFSheet sheet,
                                              int maxSheetColumns,
                                              org.w3c.dom.Element table)

    - #### processColumnWidths

          protected float processColumnWidths(HSSFSheet sheet,
                                              int maxSheetColumns,
                                              org.w3c.dom.Element table)

      Creates COLGROUP element with width specified for all columns. (Except first if ``AbstractExcelConverter.isOutputRowNumbers()`==true`)
      Returns:
        table width in inches

    - #### processDocumentInformation

          protected void processDocumentInformation(SummaryInformation summaryInformation)

    - #### processRow

          protected int processRow(HSSFWorkbook workbook,
                                   CellRangeAddress[][] mergedRanges,
                                   HSSFRow row,
                                   org.w3c.dom.Element tableRowElement)

      Returns:
        maximum 1-base index of column that were rendered, zero if none

    - #### processRowNumber

          protected org.w3c.dom.Element processRowNumber(HSSFRow row)

    - #### processSheet

          protected float processSheet(HSSFWorkbook workbook,
                                       HSSFSheet sheet,
                                       org.w3c.dom.Element flow)

    - #### processSheet

          protected boolean processSheet(HSSFWorkbook workbook,
                                         int sheetIndex)

      Process single sheet (as specified by 0-based sheet index)
      Returns:
        `true` if result were added to FO document, `false` otherwise

    - #### processSheetName

          protected void processSheetName(HSSFSheet sheet,
                                          org.w3c.dom.Element flow)

    - #### processWorkbook

          public void processWorkbook(HSSFWorkbook workbook)

    - #### setPageMarginInches

          public void setPageMarginInches(float pageMarginInches)

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.