reading integer values from excel using java - interprets it as float
Hello,
Am using Jakarta POI libraries for reading excel file using Java. Reading string value is really easy and no issues with that. But when it comes to reading a integer value like 112, its interpreting and displaying it as 112.0 So all my data in the output sheet looks like transformed to float values. This is how I write the data Code:
HSSFRow targetRow = targetWorkSheet.getRow(row); http://www.linuxquestions.org/questi...t-java-658520/ I see that both the issues are definitely unrelated. Could you please provide some pointers on this ? |
Why don't you read a more stable format like csv or good quality xml based ones?
In R programming, we strictly avoid the excel format. |
Thanks for the reply.
But I don't have any control over the input file format. |
Hi -
I agree - this is a seperate issue from your other post. But my advice is similar: "don't assume anything - carefully check each of your intermediate values carefully". For example: Code:
HSSFRow targetRow = targetWorkSheet.getRow(row); If you print out "hsfData" (as a seperate value), at least you know it's correct before you put it into the cell. Then you might try "setCellStyle()" (or something like that) to see if that changes the way it appears. Moreover, I'd strongly suggest writing a standalone Java/POI "hello world" with dummy data. Do this *before* you actually try to write your translator. I think having the standalone test program will make life *much* easier for you as you attempt to troubleshoot your actual project. IMHO .. PSM PS: Here's a good link that might help with your POI "hello world": http://www.devx.com/java/Article/17301/1954 |
All times are GMT -5. The time now is 01:20 AM. |