You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Johan Engholm <jo...@aus.teleca.se> on 2003/02/12 16:09:12 UTC

Problems setting column widths

Hello,
A bit of a rookie on the HSSF-programming, but I have started to be more
fluent with it lately. I have run into a strange behavior though.  

I'm producing an Excel workbook with three sheets, based on a workbook that
I have created from an existing workbook with three sheets. Before writing
it to disc I want to make my sheets prettier by setting the column widths. I
have run into problem that I can't figure out. Of the three sheets, two are
to have their columns resized. The third sheet should keep the column widths
inherited from the workbook that this new workbook was based on. 

What happens is that only one of the sheets react on the
setColumnWidth(...)-method. The other two only get default, even-sized
columns, i.e. not only is it impossible to set the column widths but the
columns of the two problem sheets also lose the widths they once had been
given. No matter what I do I can only get one of the sheets to work
properly. Ready to give up I switch the order of the sheets in the base
workbook, for some far out reason this  does the trick. Without changes to
my program I can get the application to work/not work by changing the order
of the sheets. 

Anyone got a clue? I am getting the sheets from my base workbook by name, so
the order should not be of any significance.  

/Johan

Johan Engholm AU-System AB
Enterprise Internet Solutions
e-mail johan.engholm@aus.teleca.se 
Phone +46-8-579 11240 Mobile +46-70-213 1240
Fax +46-8-19 33 22