poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damaresh Dashora <damares...@gmail.com>
Subject Re: Excel Sheet Reading [Fetching Fonts for Perticular cell for complete sheet]
Date Tue, 24 Sep 2013 13:02:23 GMT
Hi Nick,

I tried to do in the same way (by using RichTextString), but it is giving
errors (different colours) for colours other than declared colours in the
HSSFExcelColorMap.
(there are some standard colors declared here in this class).

Below is the example what i am exactly doing -

I am reading string (RichTextString) character by character, fetching the
substring which have same font-index by using function getFontAtIndex().
and then i am using that font index value, to create an object of HSSFFont
(by passing font index value and HSSFWorkbook in a function that return
HSSFFont object to me).

Now, using that HSSFFont Object i'm fetching colour in this way (below
mentioned)....

int color = hssfFont.getColor();  //hssfFont is the object created
String fontColor = HSSFExcelColorMap.getHexCode(color);

Now using fontColor, i'm fetching that color in hex - value but for some
color there is no value mentioned in the HSSFExcelColorMap class.
For example : for green color, integer value (variable : color) is 50 but
there is no color mentioned in that map for that color value, and atlast it
appears orange in the output, same thing for red (standard blue is the
output for that).

I have also attached a snippet of Excel sheet cell (I take it as a test for
my code). Some of the color in that cell appears right some of them are
changed.

Damaresh.




On Tue, Sep 24, 2013 at 3:58 PM, Nick Burch <apache@gagravarr.org> wrote:

> On Tue, 24 Sep 2013, Damaresh Dashora wrote:
>
>> How to read certain text font (for specific subscript, superscript
>> uppercase lowercase, italic bold etc.) in a perticular cell's.( Not for
>> complete cell, or not to set that format for complete cell) ?
>>
>
> http://poi.apache.org/apidocs/**org/apache/poi/ss/usermodel/**
> RichTextString.html<http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/RichTextString.html>
> is probably want you want. It lets you nibble your way along the text in a
> single cell, reading off the different formatting that applies to different
> bits of it
>
> Nick
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.**org<user-unsubscribe@poi.apache.org>
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Mime
View raw message