File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Soft Skills this week in the Jobs Discussion 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: 42908
    
  69
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.
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: 42908
    
  69
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading super script in Apache POI