How to add extra spaces in a text field for better display?

I want more than one space to be inserted between two words in a text field. 

I have used below code, but it is not working.

a!textField(
label: "Approved: 5"& "                 Closed: 7",
readOnly: true()
)

I want to display the content in this way. Is there any way to do it.  

  Discussion posts and replies are publicly visible

Parents
  • Hi diptis,

    You can do it by using char(9) function. Here 9 is for space. You can print as your requirement.

    For example:

     a!richTextDisplayField(

         label: "",

         value: {

           a!richTextItem(

             text: "Approved: 5" & char(

               9

             ) & char(

               9

             ) & char(

               9

             ) & " Closed: 7",

             style: "STRONG",

             color: "ACCENT"

           )

         }

       )

    Or else you can do it by using Side By Side Layout (18.1 version onward)

    For Example: Refer this code...

     

    a!formLayout(
    label: "",
    contents: {
    a!richTextDisplayField(
    value: a!richTextItem(
    text: "Previous Results",
    style: "STRONG",
    color: "ACCENT"
    )
    ),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item: a!richTextDisplayField(
    value: a!richTextItem(
    text: "Approved:",
    style: "STRONG",
    color: "ACCENT"
    )
    ),
    width: "MINIMIZE"
    ),
    a!sideBySideItem(
    item: item: a!richTextDisplayField(
    value: a!richTextItem(
    text: "5",
    style: "STRONG",
    color: "ACCENT"
    )
    ),
    width: "1X"
    ),
    a!sideBySideItem(
    item: item: a!richTextDisplayField(
    value: a!richTextItem(
    text: "Closed:",
    style: "STRONG",
    color: "ACCENT"
    )
    ),
    width: "MINIMIZE"
    ),
    a!sideBySideItem(
    item: item: a!richTextDisplayField(
    value: a!richTextItem(
    text: "7",
    style: "STRONG",
    color: "ACCENT"
    )
    ),
    width: "1X"
    ),
    a!sideBySideItem(
    item: item: a!richTextDisplayField(
    value: a!richTextItem(
    text: "Violations:",
    style: "STRONG",
    color: "ACCENT"
    )
    ),
    width: "MINIMIZE"
    ),
    a!sideBySideItem(
    item: item: a!richTextDisplayField(
    value: a!richTextItem(
    text: "10",
    style: "STRONG",
    color: "ACCENT"
    )
    ),
    width: "1X"
    )
    }
    )
    }
    )

     You can use different colors also....

    Hope it is helpful

     

    Regards

    Aswini

Reply
  • Hi diptis,

    You can do it by using char(9) function. Here 9 is for space. You can print as your requirement.

    For example:

     a!richTextDisplayField(

         label: "",

         value: {

           a!richTextItem(

             text: "Approved: 5" & char(

               9

             ) & char(

               9

             ) & char(

               9

             ) & " Closed: 7",

             style: "STRONG",

             color: "ACCENT"

           )

         }

       )

    Or else you can do it by using Side By Side Layout (18.1 version onward)

    For Example: Refer this code...

     

    a!formLayout(
    label: "",
    contents: {
    a!richTextDisplayField(
    value: a!richTextItem(
    text: "Previous Results",
    style: "STRONG",
    color: "ACCENT"
    )
    ),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item: a!richTextDisplayField(
    value: a!richTextItem(
    text: "Approved:",
    style: "STRONG",
    color: "ACCENT"
    )
    ),
    width: "MINIMIZE"
    ),
    a!sideBySideItem(
    item: item: a!richTextDisplayField(
    value: a!richTextItem(
    text: "5",
    style: "STRONG",
    color: "ACCENT"
    )
    ),
    width: "1X"
    ),
    a!sideBySideItem(
    item: item: a!richTextDisplayField(
    value: a!richTextItem(
    text: "Closed:",
    style: "STRONG",
    color: "ACCENT"
    )
    ),
    width: "MINIMIZE"
    ),
    a!sideBySideItem(
    item: item: a!richTextDisplayField(
    value: a!richTextItem(
    text: "7",
    style: "STRONG",
    color: "ACCENT"
    )
    ),
    width: "1X"
    ),
    a!sideBySideItem(
    item: item: a!richTextDisplayField(
    value: a!richTextItem(
    text: "Violations:",
    style: "STRONG",
    color: "ACCENT"
    )
    ),
    width: "MINIMIZE"
    ),
    a!sideBySideItem(
    item: item: a!richTextDisplayField(
    value: a!richTextItem(
    text: "10",
    style: "STRONG",
    color: "ACCENT"
    )
    ),
    width: "1X"
    )
    }
    )
    }
    )

     You can use different colors also....

    Hope it is helpful

     

    Regards

    Aswini

Children
No Data