简体   繁体   中英

how to add many colors to single paragraph

i try to make multi color in same line list but i get a wrong result

i need to make something like the below image :

在此处输入图片说明

my current code :

paragraph = range.Paragraphs.Add();
paragraph.Range.Text = "Test";
paragraph.Range.Font.Color = Word.WdColor.wdColorSkyBlue;

paragraph = range.Paragraphs.Add();
paragraph.Range.Text = "Word";
paragraph.Range.Font.Color = Word.WdColor.wdColorRed;

paragraph = range.Paragraphs.Add();
paragraph.Range.Text = "Color";
paragraph.Range.Font.Color = Word.WdColor.wdColorBrown;

the result show 3 lines

Since I need 50 rep to comment, I'll mark it as an answer. From what I am reading, you should make a Sentence class and when you're done the sentence add it into your paragraph.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM