Sign In  Sign Up Live-Chat

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

Last post 05-13-2008, 5:11 AM by ppsoftnet. 2 replies.
Sort Posts: Previous Next
  •  05-12-2008, 11:00 AM 126532

    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?

    Thanks

    Greg

     
  •  05-12-2008, 11:36 AM 126537 in reply to 126532

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

    Hi

     

    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

    builder.InsertCell();

    //Insert text into the cell

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

    builder.EndRow();

    builder.EndTable();

    //Save document

    doc.Save(@"Test169\out.doc");

     

    Hope this helps.

     

    Best regards.


    Alexey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
  •  05-13-2008, 5:11 AM 126638 in reply to 126537

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

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

     

    Many Thanks,
    Greg

     
View as RSS news feed in XML