@Beta public class ExcelToHtmlConverter extends AbstractExcelConverter
_formatter
Constructor and Description |
---|
ExcelToHtmlConverter(org.w3c.dom.Document doc) |
ExcelToHtmlConverter(HtmlDocumentFacade htmlDocumentFacade) |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
buildStyle(HSSFWorkbook workbook,
HSSFCellStyle cellStyle) |
java.lang.String |
getCssClassPrefixCell() |
java.lang.String |
getCssClassPrefixDiv() |
java.lang.String |
getCssClassPrefixRow() |
java.lang.String |
getCssClassPrefixTable() |
org.w3c.dom.Document |
getDocument() |
protected java.lang.String |
getStyleClassName(HSSFWorkbook workbook,
HSSFCellStyle cellStyle) |
boolean |
isUseDivsToSpan() |
static void |
main(java.lang.String[] args)
Java main() interface to interact with
ExcelToHtmlConverter |
static org.w3c.dom.Document |
process(java.io.File xlsFile)
Converts Excel file (97-2007) into HTML file.
|
static org.w3c.dom.Document |
process(HSSFWorkbook workbook)
Converts Excel file (97-2007) into HTML file.
|
static org.w3c.dom.Document |
process(java.io.InputStream xlsStream)
Converts Excel file (97-2007) into HTML file.
|
protected boolean |
processCell(HSSFCell cell,
org.w3c.dom.Element tableCellElement,
int normalWidthPx,
int maxSpannedWidthPx,
float normalHeightPt) |
protected void |
processColumnHeaders(HSSFSheet sheet,
int maxSheetColumns,
org.w3c.dom.Element table) |
protected void |
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(CellRangeAddress[][] mergedRanges,
HSSFRow row,
org.w3c.dom.Element tableRowElement) |
protected void |
processRowNumber(HSSFRow row,
org.w3c.dom.Element tableRowNumberCellElement) |
protected void |
processSheet(HSSFSheet sheet) |
protected void |
processSheetHeader(org.w3c.dom.Element htmlBody,
HSSFSheet sheet) |
void |
processWorkbook(HSSFWorkbook workbook) |
void |
setCssClassPrefixCell(java.lang.String cssClassPrefixCell) |
void |
setCssClassPrefixDiv(java.lang.String cssClassPrefixDiv) |
void |
setCssClassPrefixRow(java.lang.String cssClassPrefixRow) |
void |
setCssClassPrefixTable(java.lang.String cssClassPrefixTable) |
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).
|
getColumnName, getColumnWidth, getDefaultColumnWidth, getFontReplacer, getRowName, isOutputColumnHeaders, isOutputHiddenColumns, isOutputHiddenRows, isOutputLeadingSpacesAsNonBreaking, isOutputRowNumbers, isTextEmpty, setFontReplacer, setOutputColumnHeaders, setOutputHiddenColumns, setOutputHiddenRows, setOutputLeadingSpacesAsNonBreaking, setOutputRowNumbers
public ExcelToHtmlConverter(org.w3c.dom.Document doc)
public ExcelToHtmlConverter(HtmlDocumentFacade htmlDocumentFacade)
public static void main(java.lang.String[] args) throws java.lang.Exception
ExcelToHtmlConverter
Usage: ExcelToHtmlConverter infile outfile
Where infile is an input .xls file ( Word 97-2007) which will be rendered as HTML into outfilejava.lang.Exception
public static org.w3c.dom.Document process(java.io.File xlsFile) throws java.io.IOException, javax.xml.parsers.ParserConfigurationException
xlsFile
- workbook file to processjava.io.IOException
- If an error occurs reading or writing filesjavax.xml.parsers.ParserConfigurationException
- If configuration is incorrectpublic static org.w3c.dom.Document process(java.io.InputStream xlsStream) throws java.io.IOException, javax.xml.parsers.ParserConfigurationException
xlsStream
- workbook stream to processjava.io.IOException
- If an error occurs reading or writing filesjavax.xml.parsers.ParserConfigurationException
- If configuration is incorrectpublic static org.w3c.dom.Document process(HSSFWorkbook workbook) throws java.io.IOException, javax.xml.parsers.ParserConfigurationException
workbook
- workbook instance to processjava.io.IOException
- If an error occurs reading or writing filesjavax.xml.parsers.ParserConfigurationException
- If configuration is incorrectprotected java.lang.String buildStyle(HSSFWorkbook workbook, HSSFCellStyle cellStyle)
public java.lang.String getCssClassPrefixCell()
public java.lang.String getCssClassPrefixDiv()
public java.lang.String getCssClassPrefixRow()
public java.lang.String getCssClassPrefixTable()
public org.w3c.dom.Document getDocument()
getDocument
in class AbstractExcelConverter
protected java.lang.String getStyleClassName(HSSFWorkbook workbook, HSSFCellStyle cellStyle)
public boolean isUseDivsToSpan()
protected boolean processCell(HSSFCell cell, org.w3c.dom.Element tableCellElement, int normalWidthPx, int maxSpannedWidthPx, float normalHeightPt)
protected void processColumnHeaders(HSSFSheet sheet, int maxSheetColumns, org.w3c.dom.Element table)
protected void processColumnWidths(HSSFSheet sheet, int maxSheetColumns, org.w3c.dom.Element table)
AbstractExcelConverter.isOutputRowNumbers()
==true)protected void processDocumentInformation(SummaryInformation summaryInformation)
protected int processRow(CellRangeAddress[][] mergedRanges, HSSFRow row, org.w3c.dom.Element tableRowElement)
protected void processRowNumber(HSSFRow row, org.w3c.dom.Element tableRowNumberCellElement)
protected void processSheet(HSSFSheet sheet)
protected void processSheetHeader(org.w3c.dom.Element htmlBody, HSSFSheet sheet)
public void processWorkbook(HSSFWorkbook workbook)
public void setCssClassPrefixCell(java.lang.String cssClassPrefixCell)
public void setCssClassPrefixDiv(java.lang.String cssClassPrefixDiv)
public void setCssClassPrefixRow(java.lang.String cssClassPrefixRow)
public void setCssClassPrefixTable(java.lang.String cssClassPrefixTable)
public void setUseDivsToSpan(boolean useDivsToSpan)
Warning: after enabling this mode do not serialize result HTML with INDENT=YES option, because line breaks will make additional (unwanted) changes
Copyright 2020 The Apache Software Foundation or its licensors, as applicable.