Hi, below is a portion of my method which causing the exception given below while getting the CellFormat instance. Please give any solution to extract the data as it is shown in the excel file.
PROBLEM: I could not get the cell value or string content as it is in
excel.
ATTACHED: attached a sample causing exception.
try
{
style = cell.getCellStyle();
CellFormat cf =
CellFormat.getInstance(style.getDataFormatString());
if(cf != null)
{
CellFormatResult result =
cf.apply(cell);
if(!result.text.equals(EMPTY))
content =
result.text;
}
}
catch(Exception e)
{
System.out.println("row " +
i + " column " + j);
e.printStackTrace();
}
java.lang.NullPointerException
at
org.apache.poi.ss.format.CellElapsedFormatter.<init>(CellElapsedFormatter.ja
va:143)
at
org.apache.poi.ss.format.CellFormatType$4.formatter(CellFormatType.java:60)
at
org.apache.poi.ss.format.CellFormatPart.getFormatter(CellFormatPart.java:280
)
at
org.apache.poi.ss.format.CellFormatPart.<init>(CellFormatPart.java:172)
at
org.apache.poi.ss.format.CellFormat.<init>(CellFormat.java:157)
at
org.apache.poi.ss.format.CellFormat.getInstance(CellFormat.java:133)
at
com.pawaa.conversion.exceltohtml.ExcelToHtmlConverter.printSheetContentImage
s(ExcelToHtmlConverter.java:572)
Thank You
SHIVA KUMAR K R
Phone : +91 9844831440
Linkedin : <http://in.linkedin.com/in/shivakumarkr/> shiva_kumar_k_r
Invoice templet_sample.xls
Description: MS-Excel spreadsheet
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
