Menu

Table with fixed width and height

Help
2014-10-21
2014-10-23
  • Bruno Barberi Gnecco

    Hi,

    I'm trying to create a table whose cells must be of fixed width and height (it's for printable labels). Any tips on how to do it? I'm using writeHTMLCell but the text overflows vertically.

     
  • Simon

    Simon - 2014-10-21

    Are you saying the text is too big for the cell and you need it to auto resize the text?

     
  • Bruno Barberi Gnecco

    Yes, the text sometimes is too big. I could either resize it or just crop it. But the cells must not be resized.

     
  • Simon

    Simon - 2014-10-22

    I'd check the text using getNumLines() to get the height of the text before drawing the table and then adjust the text as necessary (by trimming or changing text size).

     
  • Bruno Barberi Gnecco

    Is there no way to just cut the overflown text? Your approach seems complex. I'd have to crop the text iteratively until it fits, and even so it seems that it could overflow anyway in the end.

     
  • Simon

    Simon - 2014-10-22

    Have you tried using css, "overflow: hidden;". I don't know if that is supported but that is what you are asking for.

     
  • Simon

    Simon - 2014-10-23

    Another option is to create each label as a separate PDF then import them back onto your printable sheets (only importing the first page of each pdf which would crop the label).

     

Log in to post a comment.