cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Arthy_A26
Regular Visitor

Changing font color of partial texts in sentence

Hi 

 

I was looking for an solution.Any way to Changing the font colour of partial texts based on start and end index. And the sentence starting and ending index are obtained from collections( API response are stored in collections)

 

Example context : David visited the restaurant yesterday. David again visited today and hoped to visit again tomorrow 

 

Collection: 

Date                 Start     End

2021/02/10    30           48

2021/02/11      61         65

2021/02/12      91         98

 

Expected Output: David visited the restaurant yesterday. David again visited today and hoped to visit again tomorrow 

 

5 REPLIES 5
RandyHayes
Super User
Super User

@Arthy_A26 

To change font colors (and other aspects) you need to utilize the HtmlText control.

So in your example (not sure how the logic relates to your collection data, but I'm sure you have that worked out) your htmltext would be:

"David visited the restaurant <font color='red'>yesterday</font>. David again visited <font color='red'>today</font> and hoped to visit again <font color='red'>tomorrow</font>"

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hy @RandyHayes 

 

Actually API response i stored in collection will vary based on user filled out in textbox. and also i want to change the font color based on the index values

 

Let me put this simpler. 

For example User enters context that contains yesterday,today,tomorrow like above mentioned example

so api response that im getting will be like 

 

DateStart indexEnd Index
11-02-20206165
12-02-20209198
10-02-20203048

im storing this api response to collection

 

so now what im looking for is to change the font color from the index 61 to 65 and 91 to 98 and 30 to 48 only

 

and my output will  David visited the restaurant yesterday. David again visited today and hoped to visit again tomorrow 

RandyHayes
Super User
Super User

@Arthy_A26 

I am sorry, I am not understanding any connection of start and end index number and a date and users entering yesterday today and tomorrow to anything.  There is no connection at all (in my interpretation of your message) to the sentence you are providing.  What does 61 to 65 have to do with David visiting the restaurant yesterday, today or tomorrow or anything?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Capture1.PNG

This is how UI looks like. When I click test button it trigger API which identifies date field with starting and ending position in the given context and api response (dates) stored in collection 

 

now im looking for solution to highlight the dates in given context using start and end index from collection

RandyHayes
Super User
Super User

@Arthy_A26 

I would suggest a Replace function then, but your index numbers do not correlate to the text.

Based on your image, 29 to 37 is "t yester" and 20 to 24 is "rest"

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,973)