Spacing in html text

What would be the best way of removing the leading and trailing whitespace of some given html without using explicit replace? Attached an example report with some HTML as an example, showing the spacing that I want to get rid of.

As you can see the purple cell holds the html, and the spacing above and below is what I want to remove, but if there is spacing within (multiple paragraphs for example) then I don't want to remove that spacing. Only the leading and trailing whitespace.

Any help greatly appreciated :smile:

Comments

  • Change your code to:
    <div><VALUE-OF>row["CUSTOMERNAME"]</VALUE-OF></div>

    The paragraph (p) tag is adding the extra space, so I changed it to div. The table will be placed inside the document body, so I also removed the html and body tags.

    Jeff F.
    Customer Support Engineer I
    OpenText
  • Think I may have worded it badly.

    The problem with changing it manually is the report will be pulling in html data from a database, so I need to be able to remove the paragraph spacing at runtime.

  • The row["CUSTOMERNAME"] was just using the example database

  • You need to parse the values from the database. You can do that in the query, or you can create a computed column in the data set. In a computed column, you would use JavaScript String methods like slice(), substr(), and replace() to remove or modify the tags returned in row["column_name"].

    Jeff F.
    Customer Support Engineer I
    OpenText
Sign In or Register to comment.