You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Thibaut Nicolas <th...@yahoo.fr> on 2004/12/13 15:39:10 UTC

strange behaviour using row and column styles

Hi all,

I'm having trouble using POI to modify an existing XLS file.
I create an XLS file as follow :
   - column C is formatted to use bold font
   - row 2 is formatted to have a yellow background color.
Then I use POI to insert values in this template.

When reading the sheet, I can only retrieve the cell C2 and I can easily 
insert the value inside without loosing the cell formatting.
But I can't find any other cell. Anyway I can create the other cells I 
want to put data inside.
Then I don't know where to find the stored style properties so that all 
cells added in column C are in bold and all cells added in row 2 are yellow.

Thanks in advance for any help

Thibaut

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org


Re: strange behaviour using row and column styles

Posted by Thibaut Nicolas <th...@yahoo.fr>.
Hi

thanks for the answer.

I tried this. It works fine when the style has been put explicitely on a 
cell.
But when the style is defined in Excel on a whole column / row, then the 
cell does not really exist in the HSSF workbook. I have to create it 
before using it. And when I create a blank cell, it comes with a default 
style that is not the one applied on the whole column / row.

My problem is that I don't want to loose that style and I don't kow how 
to retrieve it.

Do you have an idea ?

thanks

thibaut



Dirk.Rost@appshare.de a écrit :

> HSSFCellStyle cellStyle = cell.getCellStyle();
> 
> best regards
> 
>                    _____ __
>  ____ _____  ____ / ___// /_  ____ _________
> / __ `/ __ \/ __ \\__ \/ __ \/ __ `/ ___/ _ \
> / /_/ / /_/ / /_/ /__/ / / / / /_/ / /  /  __/
> \__,_/ .___/ .___/____/_/ /_/\__,_/_/   \___/
>    /_/   /_/             all byte - no bark
>    ---------------------------------------------
> 
> 
> 
> 
> Thibaut Nicolas wrote:
> 
>> Hi,
>>
>> Has somebody ever met this problem ? Can someone tell me how can I get 
>> existing row and column styles ? I didn't find it in HSSF api :-(
>>
>> thanks in advance,
>>
>> thibaut
>>
>>
>>
>> Thibaut Nicolas a écrit :
>>
>>> Hi all,
>>>
>>> I'm having trouble using POI to modify an existing XLS file.
>>> I create an XLS file as follow :
>>>   - column C is formatted to use bold font
>>>   - row 2 is formatted to have a yellow background color.
>>> Then I use POI to insert values in this template.
>>>
>>> When reading the sheet, I can only retrieve the cell C2 and I can 
>>> easily insert the value inside without loosing the cell formatting.
>>> But I can't find any other cell. Anyway I can create the other cells 
>>> I want to put data inside.
>>> Then I don't know where to find the stored style properties so that 
>>> all cells added in column C are in bold and all cells added in row 2 
>>> are yellow.
>>>
>>> Thanks in advance for any help
>>>
>>> Thibaut
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>>
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org


Re: strange behaviour using row and column styles

Posted by "Dirk.Rost@appshare.de" <Di...@appshare.de>.
HSSFCellStyle cellStyle = cell.getCellStyle();

best regards

                    _____ __
  ____ _____  ____ / ___// /_  ____ _________
 / __ `/ __ \/ __ \\__ \/ __ \/ __ `/ ___/ _ \
/ /_/ / /_/ / /_/ /__/ / / / / /_/ / /  /  __/
\__,_/ .___/ .___/____/_/ /_/\__,_/_/   \___/
    /_/   /_/             all byte - no bark
    ---------------------------------------------




Thibaut Nicolas wrote:

> Hi,
>
> Has somebody ever met this problem ? Can someone tell me how can I get 
> existing row and column styles ? I didn't find it in HSSF api :-(
>
> thanks in advance,
>
> thibaut
>
>
>
> Thibaut Nicolas a écrit :
>
>> Hi all,
>>
>> I'm having trouble using POI to modify an existing XLS file.
>> I create an XLS file as follow :
>>   - column C is formatted to use bold font
>>   - row 2 is formatted to have a yellow background color.
>> Then I use POI to insert values in this template.
>>
>> When reading the sheet, I can only retrieve the cell C2 and I can 
>> easily insert the value inside without loosing the cell formatting.
>> But I can't find any other cell. Anyway I can create the other cells 
>> I want to put data inside.
>> Then I don't know where to find the stored style properties so that 
>> all cells added in column C are in bold and all cells added in row 2 
>> are yellow.
>>
>> Thanks in advance for any help
>>
>> Thibaut
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org


Re: strange behaviour using row and column styles

Posted by Thibaut Nicolas <th...@yahoo.fr>.
Hi,

Has somebody ever met this problem ? Can someone tell me how can I get 
existing row and column styles ? I didn't find it in HSSF api :-(

thanks in advance,

thibaut



Thibaut Nicolas a écrit :
> Hi all,
> 
> I'm having trouble using POI to modify an existing XLS file.
> I create an XLS file as follow :
>   - column C is formatted to use bold font
>   - row 2 is formatted to have a yellow background color.
> Then I use POI to insert values in this template.
> 
> When reading the sheet, I can only retrieve the cell C2 and I can easily 
> insert the value inside without loosing the cell formatting.
> But I can't find any other cell. Anyway I can create the other cells I 
> want to put data inside.
> Then I don't know where to find the stored style properties so that all 
> cells added in column C are in bold and all cells added in row 2 are 
> yellow.
> 
> Thanks in advance for any help
> 
> Thibaut
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org