Sandesh Karade
Sandesh Karade

Reputation: 65

Set TableRow height using OOXML

I want to set the height of table row in OOXML
Following is my code

TableRow rowHeader = new TableRow();
TableRowProperties rowProperties = new TableRowProperties();
TableRowHeight tableRowheight = new TableRowHeight();
tableRowheight.Val = 100;
rowProperties.Append(tableRowheight);
rowHeader.Append(rowProperties);

But it's not working, can someone please suggest.

Upvotes: 1

Views: 1044

Answers (1)

user1427008
user1427008

Reputation:

I don't know which API you are using, but there are two potential issues based on a reading of ISO 29500-1 (specifically sec. 17.4.80):

  • The val attribute is in units of Twips (twentieths of a point). So your row height is 5 pts, which is very small.
  • There is a second (optional) attribute for the trHeight element called hRule. It can have the values auto, atLeast, or exactly. If you do not specify hRule, then its value defaults to auto. auto means that the row height is automatically determined based on the height of the content, and the val attribute is igored (that's what is happening in your case).

To fix it, specify hRule to be atLeast or exact, then set your height appropriately, paying attention to the units.

Upvotes: 1

Related Questions