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
Solved! Go to Solution.
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:
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.
Is there any way to do it in powerapps?
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:
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.
Check out new user group experience and if you are a leader please create your group
Did you miss the call?? Check out the Power Apps Community Call here!
See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
272 | |
257 | |
87 | |
39 | |
34 |
User | Count |
---|---|
339 | |
249 | |
130 | |
68 | |
48 |