Package org.apache.poi.hssf.converter
Class ExcelToHtmlConverter
java.lang.Object
org.apache.poi.hssf.converter.AbstractExcelConverter
org.apache.poi.hssf.converter.ExcelToHtmlConverter
Converts xls files (97-2007) to HTML file.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic voidJava main() interface to interact with ExcelToHtmlConverterstatic DocumentConverts Excel file (97-2007) into HTML file.static Documentprocess(InputStream xlsStream) Converts Excel file (97-2007) into HTML file.static Documentprocess(HSSFWorkbook workbook) Converts Excel file (97-2007) into HTML file.voidprocessWorkbook(HSSFWorkbook workbook) voidsetCssClassPrefixCell(String cssClassPrefixCell) voidsetCssClassPrefixDiv(String cssClassPrefixDiv) voidsetCssClassPrefixRow(String cssClassPrefixRow) voidsetCssClassPrefixTable(String cssClassPrefixTable) voidsetUseDivsToSpan(boolean useDivsToSpan) Allows converter to wrap content into two additional DIVs with tricky styles, so it will wrap across empty cells (like in Excel).Methods inherited from class org.apache.poi.hssf.converter.AbstractExcelConverter
getFontReplacer, isOutputColumnHeaders, isOutputHiddenColumns, isOutputHiddenRows, isOutputLeadingSpacesAsNonBreaking, isOutputRowNumbers, setFontReplacer, setOutputColumnHeaders, setOutputHiddenColumns, setOutputHiddenRows, setOutputLeadingSpacesAsNonBreaking, setOutputRowNumbers
-
Constructor Details
-
ExcelToHtmlConverter
-
ExcelToHtmlConverter
-
-
Method Details
-
main
Java main() interface to interact with ExcelToHtmlConverterUsage: ExcelToHtmlConverter infile outfile
Where infile is an input .xls file ( Word 97-2007) which will be rendered as HTML into outfile- Throws:
Exception
-
process
Converts Excel file (97-2007) into HTML file.- Parameters:
xlsFile- workbook file to process- Returns:
- DOM representation of result HTML
- Throws:
IOException- If an error occurs reading or writing filesParserConfigurationException- If configuration is incorrectRuntimeException- a number of runtime exceptions can be thrown, especially if there are problems with the input format
-
process
public static Document process(InputStream xlsStream) throws IOException, ParserConfigurationException Converts Excel file (97-2007) into HTML file.- Parameters:
xlsStream- workbook stream to process- Returns:
- DOM representation of result HTML
- Throws:
IOException- If an error occurs reading or writing filesParserConfigurationException- If configuration is incorrectRuntimeException- a number of runtime exceptions can be thrown, especially if there are problems with the input format
-
process
public static Document process(HSSFWorkbook workbook) throws IOException, ParserConfigurationException Converts Excel file (97-2007) into HTML file.- Parameters:
workbook- workbook instance to process- Returns:
- DOM representation of result HTML
- Throws:
IOException- If an error occurs reading or writing filesParserConfigurationException- If configuration is incorrectRuntimeException- a number of runtime exceptions can be thrown, especially if there are problems with the input format
-
getCssClassPrefixCell
-
getCssClassPrefixDiv
-
getCssClassPrefixRow
-
getCssClassPrefixTable
-
getDocument
-
isUseDivsToSpan
public boolean isUseDivsToSpan() -
processWorkbook
-
setCssClassPrefixCell
-
setCssClassPrefixDiv
-
setCssClassPrefixRow
-
setCssClassPrefixTable
-
setUseDivsToSpan
public void setUseDivsToSpan(boolean useDivsToSpan) Allows converter to wrap content into two additional DIVs with tricky styles, so it will wrap across empty cells (like in Excel).Warning: after enabling this mode do not serialize result HTML with INDENT=YES option, because line breaks will make additional (unwanted) changes
-