Menu

white-space: nowrap; on WriteHTML

Help
2016-02-25
2016-02-29
  • Robert Earls

    Robert Earls - 2016-02-25

    I have certain pairs of words (forename+surname) in my HTML which should not be wrapped.

    I've tried putting the names in a non-breaking span....

    <span style='white-space: nowrap;'>Jessica Jones</span>
    

    But this is ignored, i.e. it still splits after "Jessica", if she is too close to the end to fit in "Jones", when I output using WriteHTMLCell()

    I've tried all sorts of non-breaking space characters (nbsp;... chr(160..) etc But the name is always split

    Help! Any suggestions gratefully received.

     
  • Simon

    Simon - 2016-02-29

    In my code I use GetStringWidth to check the string will fit, or make changes based on the Width, before I do the WriteHTML.

     
  • Robert Earls

    Robert Earls - 2016-02-29

    Thanks for responding. It's an interesting answer.... I use GetStringWidth for my single line output, but it's a bit more tricky when it's multi-line. In this case, it's a variable list of people's names, which could spread over 3 or 4 lines. This makes this method tricky.. I'll see what i can do,

    Thanks again.

     

Log in to post a comment.