I'm processing a .ods spreadsheet with the jOpenDocument library. Since I 
was processing strings, everything was ok, but when it comes to process 
numbers it's a pain.

In my code I iterate the spreadsheet and make some computations based on 
the value assumed by the cell at index x,y. Surprisingly enough, I can't 
get the class of the values I get:

> BigDecimal ferialestringa;
>      while (true) {
>                         boolean duplicate = false;
>                         value = (String) sheet.getValueAt(0, count);
>                         System.out.println(sheet.getValueAt(5, 
> count).getClass());
>                         ferialestringa = (BigDecimal) sheet.getValueAt(5, 
> count);
>
> This snippet prints out:

> class java.math.BigDecimalclass java.lang.StringException in thread "main" 
> java.lang.ClassCastException: java.lang.String cannot be cast to 
> java.math.BigDecimal
>     at InspectTwitter.main(InspectTwitter.java:78)
>
> You can see that the value appears to belong to two different classes.

If I try to parse the returned object to a string, I get also another 
ClassCastException:

> class java.math.BigDecimalException in thread "main" 
> java.lang.ClassCastException: java.math.BigDecimal cannot be cast to 
> java.lang.String
>     at InspectTwitter.main(InspectTwitter.java:78)
>
> Note that this time the class seems to be just BigDecimal.

I tried to find documentation but only Sheet.getValueAt(String) is 
available on this <http://www.jopendocument.org/docs/index.html> javadoc. 
(I've found this method in tutorials though, and it seems to be working 
very well on strings). What should I do?

(I copypasted this question straight away from StackOverflow, but then I 
thought that here I could find jOpenDocument expert more easily than on 
Stack Overflow.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"jOpenDocument" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to