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

Announcements

News and Announcements icon
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:
  • Arthy_A26 Profile Picture
    15 on at

    Is there any way to do it in powerapps?

  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 432 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard