Using HTML formatting in a text field

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered
I want to display text on a exact forms plus PDF that matches the font type and size of the rest of the document.  The font and size is right, but a line break is inserted, and I'm not sure why.  [Customer Responsibility] is a formula text field.

I want it to look like this:

Customer Responsibility: Supply a PC that we can use.

But it looks like this on the PDF:

Customer Responsibility: 

Supply a PC that we can use.

If ([Add Customer Responsibility]=true,

"<div style=\"color:#000000;font-family:Calibri;font-size:11pt\"><b>Customer Responsibility:</b></div>" & 

"<div style=\"color:#000000;font-family:Calibri;font-size:11pt\">[Customer Responsibility]</div>",null)
Photo of JimLieder

JimLieder

  • 344 Points 250 badge 2x thumb

Posted 3 years ago

  • 0
  • 1
Photo of dwhawe

dwhawe, Champion

  • 804 Points 500 badge 2x thumb
I believe because you are using two  "div"s.  Try using span instead.

If ([Add Customer Responsibility]=true,

"<span style=\"color:#000000;font-family:Calibri;font-size:11pt\"><b>Customer Responsibility:</b></span>" &

"<span style=\"color:#000000;font-family:Calibri;font-size:11pt\">[Customer Responsibility]</span>",null)
Photo of JimLieder

JimLieder

  • 344 Points 250 badge 2x thumb
Thanks!  Worked perfect!
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,074 Points 20k badge 2x thumb
FWIW, you don't need to backslash escape the double quotes - use a single quote instead as it is more readable:

"<div style='color:#000000;font-family:Calibri;font-size:11pt'><b>Customer Responsibility:</b></div>" &

Also, if you attribute has no spaces in it you can drop the quotes altogether:

"<div style=color:#000000;font-family:Calibri;font-size:11pt><b>Customer Responsibility:</b></div>" &