KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Certain 4D Write Pro attributes must be set in a particular order
PRODUCT: 4D | VERSION: 18 | PLATFORM: Mac & Win
Published On: July 6, 2020

When working with 4D Write Pro attributes, note that certain attributes may need to be set in a particular order. For example, let's say the text on the document needs to be bold, italicized, and Arial font. If the code were to look something like below, notice that the text is set to Arial correctly, but not italicized nor bold.

C_OBJECT($range_o)
$range_o:=WP Selection range(WParea)

WP SET ATTRIBUTES($range_o;wk font bold;wk true)
WP SET ATTRIBUTES($range_o;wk font italic;wk true)
WP SET ATTRIBUTES($range_o;wk font;"Arial")




The catch here is that setting the wk font attribute will actually reset any styling including bold and italicized. To resolve this issue, make sure to set the font first before stylizing anything with bold or italicized.

C_OBJECT($range_o)
$range_o:=WP Selection range(WParea)

WP SET ATTRIBUTES($range_o;wk font;"Arial")
WP SET ATTRIBUTES($range_o;wk font bold;wk true)
WP SET ATTRIBUTES($range_o;wk font italic;wk true)