Package org.apache.poi.hssf.converter
Class ExcelToFoConverter
java.lang.Object
org.apache.poi.hssf.converter.AbstractExcelConverter
org.apache.poi.hssf.converter.ExcelToFoConverter
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
ConstructorsConstructorDescriptionExcelToFoConverter(FoDocumentFacade foDocumentFacade) ExcelToFoConverter(Document document) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcreatePageMaster(float tableWidthIn, String pageMasterName) protected Documentfloatprotected booleanisEmptyStyle(CellStyle cellStyle) Returns false if cell style by itself (without text, i.e.static voidJava main() interface to interact withExcelToFoConverterstatic DocumentConverts Excel file (97-2007) into XSL FO file.protected booleanprocessCell(HSSFWorkbook workbook, HSSFCell cell, Element tableCellElement, int normalWidthPx, int maxSpannedWidthPx, float normalHeightPt) protected voidprocessCellStyle(HSSFWorkbook workbook, HSSFCellStyle cellStyle, Element cellTarget, Element blockTarget) protected voidprocessCellStyleBorder(HSSFWorkbook workbook, Element cellTarget, String type, BorderStyle xlsBorder, short borderColor) protected voidprocessCellStyleFont(HSSFWorkbook workbook, Element blockTarget, HSSFFont font) protected voidprocessColumnHeaders(HSSFSheet sheet, int maxSheetColumns, Element table) protected floatprocessColumnWidths(HSSFSheet sheet, int maxSheetColumns, Element table) Creates COLGROUP element with width specified for all columns.protected voidprocessDocumentInformation(SummaryInformation summaryInformation) protected intprocessRow(HSSFWorkbook workbook, CellRangeAddress[][] mergedRanges, HSSFRow row, Element tableRowElement) protected ElementprocessRowNumber(HSSFRow row) protected booleanprocessSheet(HSSFWorkbook workbook, int sheetIndex) Process single sheet (as specified by 0-based sheet index)protected floatprocessSheet(HSSFWorkbook workbook, HSSFSheet sheet, Element flow) protected voidprocessSheetName(HSSFSheet sheet, Element flow) voidprocessWorkbook(HSSFWorkbook workbook) voidsetPageMarginInches(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
-
Constructor Details
-
ExcelToFoConverter
-
ExcelToFoConverter
-
-
Method Details
-
main
Java main() interface to interact withExcelToFoConverterUsage: ExcelToHtmlConverter infile outfile
Where infile is an input .xls file ( Word 97-2007) which will be rendered as XSL FO into outfile- Throws:
Exception
-
process
Converts Excel file (97-2007) into XSL FO file.- Parameters:
xlsFile- file to process- Returns:
- DOM representation of result XSL FO
- Throws:
Exception
-
createPageMaster
-
getDocument
- Specified by:
getDocumentin classAbstractExcelConverter
-
getPageMarginInches
public float getPageMarginInches() -
isEmptyStyle
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, Element tableCellElement, int normalWidthPx, int maxSpannedWidthPx, float normalHeightPt) -
processCellStyle
protected void processCellStyle(HSSFWorkbook workbook, HSSFCellStyle cellStyle, Element cellTarget, Element blockTarget) -
processCellStyleBorder
protected void processCellStyleBorder(HSSFWorkbook workbook, Element cellTarget, String type, BorderStyle xlsBorder, short borderColor) -
processCellStyleFont
-
processColumnHeaders
-
processColumnWidths
Creates COLGROUP element with width specified for all columns. (Except first ifAbstractExcelConverter.isOutputRowNumbers()==true)- Returns:
- table width in inches
-
processDocumentInformation
-
processRow
protected int processRow(HSSFWorkbook workbook, CellRangeAddress[][] mergedRanges, HSSFRow row, Element tableRowElement) - Returns:
- maximum 1-base index of column that were rendered, zero if none
-
processRowNumber
-
processSheet
-
processSheet
Process single sheet (as specified by 0-based sheet index)- Returns:
- true if result were added to FO document, false otherwise
-
processSheetName
-
processWorkbook
-
setPageMarginInches
public void setPageMarginInches(float pageMarginInches)
-