Setting font size through xml

Is it possible to pass the font name and size in an xml file to define how a variable will be adjusted on a print section in designer?

thanks

Hello Cnavarro,

Yes, you can. First you need to extract the font and size information stored in your XML to data fields using the DataMapper. This way the information appears in the DataModel. Subsequently create a script in the Designer perspective to apply the respective values.

In the sample below I assigned a custom class (‘myclass’) 'to a paragraph containing two data placeholders. The first two scripts in my Scripts panel replace the placeholders with the data from the record. The third script applies the font and size set in the data.

Below the script to apply the formatting:

Selector: .myclass

Script:

results.css('font-family', record.fields.font);
results.css('font-size', record.fields.size);

The script could also be written using an array of property/value pairs:

results.css({'font-family':record.fields.font, 'font-size': record.fields.size});

More information on the css() command is found in the online help:
http://help.objectiflune.com/en/planetpress-connect-user-guide/2018.1/#designer/API/css.htm

Hope this helps,

Erik