Free Support Forum -

How do I fix a Row Height so it is non-expandable with more text?

I have a template which I need to have a fixed size box for. At the moment, you can set the height of the cell but if there is more text within the cell then it expands. You do not have a height property for the cell (that I can find?) but just for the row, but this is not forced, and will expand when the cell is larger. I can limit the characters of what is going into the cell (a comment) but this can be negated by formatting (i.e. carriage returns)

I have tried using the following, all to no avail.

builder.RowFormat.Height = "10"
builder.RowFormat.AllowAutoFit = False

I have also tried using the HeightRule.

I am not bothered about whether text is lost 'behind' the bottom of the cell, I just want to ensure that the box is never bigger than a set size. This is possible in Word.

Any ideas?



Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I think that you should use HeightRule.Exactly. For example see the following code.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

//Set size of cell

builder.RowFormat.Height = 15;

builder.CellFormat.Width = 50;

//Set height rule

builder.RowFormat.HeightRule = HeightRule.Exactly;

//insert cell


//Insert text into the cell

builder.Write("some text inside cell");



//Save document


Hope this helps.

Best regards.

Works brilliantly. Must have missed that one in the documentation.

Many Thanks,