Hi,

What is the cell-format at this cell in Excel? And what is the content
of style.getDataFormatString() when it fails?

Thanks... Dominik.

On Thu, Jul 9, 2015 at 12:49 PM, Shiva Kumar <[email protected]> wrote:
> 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.java: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.printSheetContentImages(ExcelToHtmlConverter.java:572)
>
>
>
> Thank You
>
>
>
> SHIVA KUMAR K R
>
> Phone : +91 9844831440
>
> Linkedin : shiva_kumar_k_r
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to