I have a text in a cell of Google Sheet where each cell contain multiline text and each line contain certain amount of formatting like Bold, Italic, Superscript, Tab, etc.. I'm taking that cell as input in Google App Script and I want to create formatted body of mail. But whats happening is I'm not able to identify formatting of text from particular cell. Is there a way to identify formatting or is there a way to transfer formatted cell in htmlbody of email?
0
votes
See this. You need to write a complex script identifying text runs and convert them to appropriate html tags.
– TheMaster
Thank you for sharing that link. I checked it. But if I follow those methods then program would be so so complicated. For each and every word I'd need to test all functions and that practice is not expected.
– Rohit Sawai
1 Answers
1
votes
Yes there is (as TheMaster already mentioned in a comment).
Class RichTextValue
A stylized text string used to represent cell text. Substrings of the text can have different text styles.A run is the longest unbroken substring having the same text style. For example, the sentence "This kid has two apples." has four runs: ["This ", "kid ", "has two ", "apples."].
From a OP comment
But if I follow those methods then program would be so so complicated. For each and every word I'd need to test all functions and that practice is not expected.
No, it isn't so complicated as we could use getRuns()
to get each run rather than "each and every word".