Categories > OpenTBS with XLSX >

adjust cell height of xlsx

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Le
Date: 2013-10-14
Time: 18:57

adjust cell height of xlsx

When merging a new long text to a cell in xlsx template, is there any way to adjust cell height automatically to fit with the new content?
Thank you.
By: Skrol29
Date: 2013-10-15
Time: 02:09

Re: adjust cell height of xlsx


Did you try with "Format Cells / Alignment / Text control / Wrap text" ?
By: Le
Date: 2013-10-15
Time: 20:34

Re: adjust cell height of xlsx

Thank you for your answer.
Yes, I did.
It affects only when I open Excel and input text by hand.
When I use OpenTBS to modify the text, the cell's height does not change.

Moreover, I'm trying changing value of xml tag.
<cNvPr descr="[new.x;att=col#val]"/>

It will become: <col val="$x">1</col>
How to change it into": <col>$x</col>
By: Ken Tanzer
Date: 2014-07-12
Time: 23:46

Re: adjust cell height of xlsx

Hi.  I'm wrestling with essentially the same issue.  (In my case, the cells have merged data on multiple lines, not from wrapping, but from explicit line breaks.)  So far I do not see a way to really make this happen.  If there is a way, it would be great to know.

Alternatively, the workaround seems to be to embed some macro like this in the source template, and have it run when the document opens.

Sub AutofitRows()
    For Each CL In UsedRange
        If CL.WrapText Then CL.Rows.AutoFit
End Sub

(This macro comes from:

This link covers making your macros auto-run:

Any better suggestions for handling this?  Thanks.
By: Hameed
Date: 2016-06-09
Time: 07:07

Re: adjust cell height of xlsx

Hi there. I am struggling with the same issue too. I did the suggestions mentioned above but was unable to solve it.