Advanced formatting

Prev Next

It is possible to use Rich Text Editor for formatting the products data inserted into the template. The typical case is a Product Price which sometimes needs to be formatted in a very specific style, for example

Screenshot_20.png

For doing this, the decimal price must be separated on 2 parts: integer and fractional, and then they will be formatted individually using Rich text styles.

Separating the decimal price

First, you have to create additional calculation fields for integer and fractional parts of the price.

  1. Go to the Briefing Price module Field Definition settings.

  2. Create a Price field of type decimal which will be the source of data (it can be simple decimal or calculated value as well).

  3. Create calculation field Price_Integer

    Field Content

    Output Format

    Formula

    # of decimals

    Calculation

    Decimal Number

    formatInteger(${Price})

    0

    Screenshot_36.png

  4. Create calculation field Price_Fraction

    Field Content

    Output Format

    Formula

    Calculation

    Text

    formatFractional(${Price}, '', '', 2)

    Screenshot_35.pngThe full formula template is

    formatFractional(<DecimalField>, <InCaseOfZero>, <Prefix>, <Digits After Float Point>)

    where

    • <DecimalField> — the original source decimal field.

    • <InCaseOfZero> — the value to be displayed if the source field fractional part is equal to zero. 

    • <Prefix> — some text to be placed before the result value, for example decimal separator.

    • <Digits After Float Point> — the number of digits in the fractional part to be displayed (most likely it will be equal to 2 for prices).

      Screenshot_22.png

  5. Now the price is separated to integer and fractional parts.

    Screenshot_23.png

Formatting the price using the Rich Text


  1. Go to Briefing Page Preview and switch to Layout tab.

  2. Open Template editor.

  3. Create a text element and enable Advanced Text Styling for it.

    Screenshot_27.png

  4. Create Character style for the Integer and decimal parts of the price. Note, if you want to uppercase the decimal part, use vertical align Top in the character style. Also you might need to play with Leading setting to align the value accurately.

    Screenshot_26.png

  5. On the Text Field Settings tab you will have a possibility to create a variable from the module field. This is needed for further inserting data in Rich Text Editor. Create 2 variables PriceInt and PriceFrac and map to the corresponding fields using xpath:

    PriceInt

    /preview/page/product/fields/field[@definitionId=1117]/value

    PriceFrac

    /preview/page/product/fields/field[@definitionId=1118]/value

  6. Open RTE and insert variables using placeholder syntax ${var}

    ${PriceInt},${PriceFrac}€

    Note, that you can also add static text like decimal separator or currency sign.
    Screenshot_25.png

    Save the template. The price will be rendered according to template.
    Screenshot_21.png

Strikethrough settings


The common use of strikethrough is for marking the old price that is replaced. The effect is applied to the whole text block. To configure, open the Text Field Settings properties in Template Editor:

Option

Default

Meaning

Strikethrough

None

Defines the color of the strikethrough line. To specify the color, type the necessary CMYK values in their respective boxes

Strikethrough Weight

0.0 pt

Specifies how thick the line should be.

Strikethrough Position

Horizontal

Select the type of the strikethrough from:

  • Horizontal

  • Double Horizontal

  • Diagonal Top Left

  • Diagonal Bottom Right

  • Cross

Screenshot_28.png

Screenshot_31.pngScreenshot_33.pngScreenshot_32.pngScreenshot_30.pngScreenshot_29.png