I know that this will not help anyone but the behviour you describe is just
what Excel itself does.

This morning, using Excel, I opened a new worksheet, increased the width of
column A, clicked on cell A1 and set wrap text to true. When I typed a long
string ot text into that cell, it wrapped around and the row did resize
itself automatically.

Next, I clicked on cell A4, set Wrap Text to true and then merged cells A4
and A5. Typing a lone string into that merged cell I saw it wrap but the
row(s) did not autore-size.

However, I did find one way to make Excel do what you are after. The trick
was to set the wrap text attribute of both cells in the merged region to
true. I will not have the time to test this in POI for a few hours so to
explain what I did in Excel;

Click on cell A6 and set the wrap text attribute true. Click on cell A7 and
set the wrap text attribute to true. Merge cells A6 and A7. Type a very long
string of text into cell A6. To re-iterate, it seems that the key is to set
the wrap text attribute on the cells in the merged region; I do not know yet
how multi column merged regions will work, that is another test.

Hop that helps and I willpost some POI code later if I have the chance.

Yours

Mark B


TimShiu wrote:
> 
> In excel, the row height will be auto resized if any cell in the row is
> set as wrap-text.
> Unfortunately, this auto resizing behavior will be malfunctioned when the
> cell is a merged cell.
> 
> So, I would like to ask if there is any method in HSSF library that can
> autosize the row????
> 

-- 
View this message in context: 
http://www.nabble.com/Autosize-row-for-HSSF-library-tp24132911p24215772.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to