This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Other Open Source Projects and the fly likes Reading super script in Apache POI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Reading super script in Apache POI" Watch "Reading super script in Apache POI" New topic
Author

Reading super script in Apache POI

Rohan Ramakumar
Greenhorn

Joined: Mar 08, 2011
Posts: 11
Hi,

I've just started using Apache POI, so forgive me if my question is silly.

I want to know how I can read a superscript content present in a cell. For instance, the input excel contains a cell with the following content : "ABC2" , where 2 is given as a superscript.

Now, when I read this cell using getStringCellValue(), I get the content as ABC2 (i.e) as a normal text without the superscript.

Is there anyway to read it as it was given in the input file?

Furthermore, I want to process the superscript in a specific manner. So is it possible to read the normal content and the superscript content separately ?

Thanks
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi there and welcome to the Ranch! What version of POI are you using?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41635
    
  55
There should be other methods in the Cell (or HSSFCell) class that return the cell contents in a more structured way, maybe as a CharacterRun or something like that.


Ping & DNS - my free Android networking tools app
Rohan Ramakumar
Greenhorn

Joined: Mar 08, 2011
Posts: 11
I'm using POI 3.7.

I have tried lot of methods but none of them help in processing superscript separetely.

Thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41635
    
  55
This topic discusses how to get at the styles of individual characters. It only talks about bold and italic, but the other style attributes are handled in a similar way; check the HSSFFont class for the corresponding method names.
Rohan Ramakumar
Greenhorn

Joined: Mar 08, 2011
Posts: 11
I have finally solved it. Thanks for the link Ulf it was really useful.

Thanks
 
Consider Paul's rocket mass heater.
 
subject: Reading super script in Apache POI