Auto-expand Cell Height for Text Orientation


I noticed that when using an upwards or downwards text orientation, the
table cell’s height does not adjust to fit the text. I also don’t
see a Height property for the CellFormat class. Can you add a
property that supports auto-adjusting a cell’s height and width to fit
the text?

Thanks, Natan.


Looks like the RowFormat.HeightRule property is what I’m looking for
but it doesn’t seem to support vertical text orientation. My code
looks something like this:



// insert the text


// insert the text

RowFormat.HeightRule = HeightRule.Auto



Any ideas?


I'm also not able to get MS Word to automatically adjust height of the rows with vertical text. Try this yourself in MS Word. It starts off with a row 0.79" high, HeightRule.AtLeast. If I type more text, the height does not grow. If switch off the height (effectively setting HeightRule.Auto) it makes the height very small.

In general, Aspose.Word can't make it so the cells are automatically resized to the correct width or height. There are several factors that combine and end up in this behaviour. The most important reason is that although MS Word has the AutoFit contents into a cell option, even if Aspose.Word sets it, MS Word still requires cell widths explicitly calculated and uses those widths. When you change the direction to vertical it seems this rule applies to heights.

At the moment you have to specify width explicitly (and for vertical text - height explicitly) if you want to build tables with a meaningful layout. In the future we plan to provide a way to auto fit the table. So far the work was to auto fit cell widths only, but I will log it as a request to auto fit heights too.


Thanks. Setting the row height should be fine for now.