Hey Marc:

Oh I think I understand what you need now, you need the result of a cell after cell style application. Like the following made-up example

Cell Value: 02/03/87
Cell Style: ddmmmyyyy
Result: 02MAR2008

Something like this?

I do not know the solution to this actually, but I hope by clarifying the question it would help others in finding a solution for you.

One thing to note though, without knowing great detail about this. It is possible that the result of the format application could be a functionality of Excel App. Since POI deals with the XLS file and not the core Excel App, I am a bit uncertain as to whether POI will ever support the function you are requesting; but of course it is not up to me to decide.

As an alternative in the meantime if the user input format is fairly standard, it seems logical to use Java REGEX to extract and convert the cell values that you get from HSSFCell to your desired format. If you are lucky you might not even need to use REGEX by using the Java packaged formating classes (using quick googling if it's number you can use

http://java.sun.com/j2se/1.4.2/docs/api/java/text/DecimalFormat.html
http://java.sun.com/j2se/1.4.2/docs/api/java/text/NumberFormat.html

If it's date you can use the

http://java.sun.com/j2se/1.4.2/docs/api/java/text/DateFormat.html

I have used a little bit of the above classes but not extensively)


Hope this helps

Andy




Marc Guillemot wrote:
Hi Andy,

thanks for the response... but this is not what I'm looking for ;-(

HSSFCell.getRichStringCellValue() works only for Strings. I'm looking
for something more generic to work for instance with numeric and date
cells as well.

getCellStyle() allows to retrieve the style but I don't see any facility
to retrieve the result of the style applied on the cell content. I
can look at the data format of the style by myself, but I imagine that
it is a common requirement and was hoping to find an existing way for it.

Cheers,
Marc.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to