web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Changing color of mult...
Power Apps
Answered

Changing color of multiple sentences within context

(0) ShareShare
ReportReport
Posted on by 15

Is there any way to Changing the color of multiple sentences within the same context. And the sentence starting and ending index are obtained from collections( api response are stored in collections)

Example context : Prime Minister Jacinda Ardern has claimed that New Zealand had won a big battle over the spread of coronavirus


Collection
String                   start   end
Jacinda Ardern.   16.     29
New Zealand.        48.     58
Coronavirus.          64.     74

 

Expected Output

 

Prime Minister Jacinda Ardern has claimed that New Zealand had won a big battle over the spread of coronavirus

 

 

 

 

Categories:
I have the same question (0)
  • Arthy_A26 Profile Picture
    15 on at

    Is there any way to do it in powerapps?

  • Verified answer
    v-jefferni Profile Picture
    on at

    Hi @Arthy_A26 ,

     

    Would you like to change font color of partial texts in a sentence?

     

    If so, you will need to use the HtmlText box to display the sentence with tags. Since you have already set the strings that need to change color in a collection, you could use the Substitute function to replace all strings with tags in the whole sentence.

     

    I made a test on my end:

    119.png

     

    So the steps are as follows:

    1\ Add an HtmlText box, in this screen's OnVisible or a Button's OnSelect, set formulas as below:

    ForAll(colColor,Patch(colText,First(colText),{Value:Substitute(First(colText).Value,ThisRecord.String,Concatenate("<font color=red>",ThisRecord.String,"</font>"))}))

     The colText collection is assuming that you have multiple sentences need to display. Above formula update the selected sentence by replacing strings in the collection with same string along with Html tags.

     

    2\ Set HtmlText of HtmlText box to:

    Last(colText).Value

     

    Hope this helps.

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

     

  • Arthy_A26 Profile Picture
    15 on at

    Thank you so much @v-jefferni.. You helped me a lot

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard