• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading super script in Apache POI

 
Rohan Ramakumar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there and welcome to the Ranch! What version of POI are you using?
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using POI 3.7.

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

Thanks
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have finally solved it. Thanks for the link Ulf it was really useful.

Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic