|Summary:||Getting double value from the method "cell" of interface "SheetContentsHandler" of "XSSFSheetXMLHandler" class|
|Component:||XSSF||Assignee:||POI Developers List <dev>|
|Attachments:||Changes that give the double value of the cell to output|
Description Phaneeswar 2017-12-05 12:57:44 UTC
Created attachment 35586 [details] Changes that give the double value of the cell to output Hi. There are two things I think will be helpful with this patch: 1) When in Excel the cell date format and the system date format are same, the underlying cell format is not considered when reading and the value.Value is generated based on the local system date format where we are reading the Excel file.In such a case if I get the cell value in the string format, there is nothing much I can do to get the value in the format which I required as output.This can be possible If I have the double value of that cell. 2) When the cell is Number say with format(5,000).If I get the value as String, I will get it as 5,000. If I want to convert it into a Double by parsing the value 5,000 It will throw an error. If I have a double value in this case things can be done easily.
Comment 1 PJ Fanning 2017-12-05 22:14:19 UTC
Thanks Phaneeswar for the proposed patch. It does modify a public API (the cell method) and this is not something that we don't do without deprecating the existing method. The replacement method can be added and the deprecated version can call the replacement version. It's not generally required but I personally much prefer to review patches added via github - see https://github.com/apache/poi My view on the patch, as is, is that it may not be necessary. If you look at the XLSX2CSV example in Poi, you will see that you can provide your own DataFormatter and with a custom DataFormatter, you could omit the number formatting and just represent the numbers in plain format. https://github.com/apache/poi/blob/trunk/src/examples/src/org/apache/poi/xssf/eventusermodel/XLSX2CSV.java
Comment 2 Dominik Stadler 2017-12-26 09:58:21 UTC
Please provide an updated patch or state if the proposed workaround is sufficient for you. Please also note that producing a minimal patch without whitespace-changes is preferred as it minimizes the work needed to review the patch and thus increases the chances of having it integrated.
Comment 3 Phaneeswar 2017-12-27 06:06:49 UTC
Hi Thanks for the example it really helps for Number format case.But the provided work around would be sufficient if I want to show output as 5,000. But what if I want to show the value as 5000.00. Having only the string value 5,000 known to me. And I think for handling Date format issue still we need to know the double value. By which for both cases the change same.So I don't think an updated patch is required.
Comment 4 Mark Murphy 2018-04-20 15:24:58 UTC
Sorry, wrong bug.