Jump to content

Changing font in a Rule


scotts

Recommended Posts

I'm sure I'm missing something simple, but I've been looking and trying different things, and can't seem to get this to work.

 

This rule builds the address line.

 

Division:<space>Street, City, State<space>Zip

( BOLD ) (Normal )

 

If the Division field if filled it will insert the Division field with the colon and a space with the font Bold, then the rest of the address line with the font Regular. Otherwise it will omit the Division, colon, and space, and just output the rest of the address line.

 

Below is my rule.

 

if ((Field("Division") != "") && (Field("Street") != ""))

{

return "<span>" + "<f name=('Times-Bold')>" + Field("Division") + ": " + "</f>" + "</span>" + Field("Street") + ", " + Field("City") + ", " + Field("State") + " " + Field("Zip");

}

else

{

return Field("Street") + ", " + Field("City") + ", " + Field("State") + " " + Field("Zip");

}

Link to comment
Share on other sites

The first line needs both parentheses because it is a conditional if statement.

 

if ((Field("Division") != "") && (Field("Street") != ""))

 

If Division is not equal to "" AND Street is not equal to "" then return.

Link to comment
Share on other sites

If the Division field if filled it will insert the Division field with the colon and a space with the font Bold, then the rest of the address line with the font Regular.

If you only want to make the text bold, you don't need to change the font family; you can just use a <b> tag (and ending </b> tag), like so:

return "<b>" +  Field("Division") + ": " + "</b>" +   Field("Street") + ", " + Field("City") + ", " + Field("State") + " " +  Field("Zip");

Link to comment
Share on other sites

scratch my last post...

make sure your font is able to have bold and regular.. add the <b> </b> to your code

 

if ((Field("Division") != "") && (Field("Street") != ""))

{

return "<span>" + "<f name=('Times')> <b>" + Field("Division") + ": " + "</b> </f>" + "</span>" + Field("Street") + ", " + Field("City") + ", " + Field("State") + " " + Field("Zip");

}

else

{

return Field("Street") + ", " + Field("City") + ", " + Field("State") + " " + Field("Zip");

}

Link to comment
Share on other sites

scratch my last post...

make sure your font is able to have bold and regular.. add the <b> </b> to your code

 

if ((Field("Division") != "") && (Field("Street") != ""))

{

return "<span>" + "<f name=('Times')> <b>" + Field("Division") + ": " + "</b> </f>" + "</span>" + Field("Street") + ", " + Field("City") + ", " + Field("State") + " " + Field("Zip");

}

else

{

return Field("Street") + ", " + Field("City") + ", " + Field("State") + " " + Field("Zip");

}

That's still not quite right if you want to change the font family as well. Try this:

return[color=Green] '<f name="Times"><b>'[/color] + Field("Division") + ": " + "</b></f>" +    Field("Street") + ", " + Field("City") + ", " + Field("State") + " " +   Field("Zip");

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...