aspose 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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Reply 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: 3268

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: 35247
    
    7
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.


Android appsImageJ pluginsJava web charts
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: 35247
    
    7
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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Reading super script in Apache POI
 
Similar Threads
representing exponents like x to the power 2 3 and so on
Read MS Excel Sheet Formula Execution Value Without Opening it
How to read Microsoft Excel (97, 2003, 2007) through OpenOffice API
Splitting a String
Make cell read only using apache poi