How to change the color of different words in a long text string?
See original GitHub issueI know how to change the font color with:
worksheet.write_rich_string(‘A3’, 'This is ', red, ‘red’, ’ and this is ', blue, ‘blue’)
Question 1:
How to use write_rich_string in a for loop (in the same cell)? The purpose here is to set the color of words in a long string according to certain condition. How to change the color of each word and append them one by one in the same cell? For example:
for word in words:
if word in a:
worksheet.write_rich_string(1, 1, word, red) # red color
else:
worksheet.write_rich_string(1, 1, word, blue) # blue color
Question 2:
As the above string is too long, how to wrap the text in that cell based on the results in question 1?
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Change the Color of Words in Text - My Online Training Hub
Change the color of each of those words (to different colors if you like); Check a single cell, or any size range; Check...
Read more >HTML: Changing colors of specific words in a string of text
formatting the text string, but want to change the color of "January 30, 2011" to #FF0000 and "summer" to #0000A0. How do I...
Read more >Changing font color of certain repeated words in a document
Open it and type in the name for Find. · Type ^& in the Replace box (means found text). · Then click on...
Read more >How to change the Text Color of a Substring in android using ...
It is easy to change the color of the whole string but to change the color of a substring we have to use...
Read more >How to Change the Text Color of a Substring - Android Studio ...
In this video we will learn, how to use the SpannableString and SpannableStringBuilder classes together with ForegroundColorSpan and ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@leefionglee You should show a small complete working program that demonstrates the issue.
Python only allows named parameters afters a
*args
parameter. In this case there isn’t a names parameter so you should include or append the cell format. Like this:Output:
i want some thing just like that but in tkinter not in xlsxwriter any one know how to do that?