I am attempting to give color of the particular text in the paragraph. But I am still failed. This is my code. Any help would be appreciated.
01.
List list = document.Lists.Add(ListTemplateType.NumberedDefault);
02.
03.
var section = document.Sections.AddSection();
04.
05.
var paragraphTop = section.Blocks.AddParagraph();
06.
paragraphTop.Inlines.AddRun(
"Note that the numbering reference within the document content in the sample above contains a direct reference to the level to be applied because the <w:numPr> contains both the reference to the numbering definition (numId) and a reference to the level (ilvl). See Paragraph Properties for more on <w:numPr>. The other possible way to reference a level in content is through the referenced paragraph style. That is, in the <w:abstractNum> the appropriate subsidiary level (lvl) could contain a pStyle with a value of ListParagraph. In that case, the content contains only a reference to the numbering definition instance (numId), but it also references the paragraph style. The same style will be found in the numbering definition referenced and that level will be used for the paragraph."
);
07.
08.
var paragraphTop1 = section.Blocks.AddParagraph();
09.
paragraphTop1.Inlines.AddRun(
"okeh <p color=\"red\">this is red color</p> <font color=\"red\">This is some text!</font>"
);
10.
11.
12.
var paragraph1 = section.Blocks.AddParagraph();
13.
paragraph1.Inlines.AddRun(
"Note that the numbering reference within the document content in the sample above contains a direct reference to the level to be applied because the <w:numPr> contains both the reference to the numbering definition (numId) and a reference to the level (ilvl). See Paragraph Properties for more on <w:numPr>. The other possible way to reference a level in content is through the referenced paragraph style. That is, in the <w:abstractNum> the appropriate subsidiary level (lvl) could contain a pStyle with a value of ListParagraph. In that case, the content contains only a reference to the numbering definition instance (numId), but it also references the paragraph style. The same style will be found in the numbering definition referenced and that level will be used for the paragraph."
);
14.
paragraph1.ListId = list.Id;
15.
paragraph1.ListLevel = 0;
16.
17.
var paragraph2 = section.Blocks.AddParagraph();
18.
paragraph2.Inlines.AddRun(
"Line Two, Note that the numbering reference within the document content in the sample above contains a direct reference to the level to be applied because the <w:numPr> contains both the reference to the numbering definition (numId) and a reference to the level (ilvl). See Paragraph Properties for more on <w:numPr>. The other possible way to reference a level in content is through the referenced paragraph style. That is, in the <w:abstractNum> the appropriate subsidiary level (lvl) could contain a pStyle with a value of ListParagraph. In that case, the content contains only a reference to the numbering definition instance (numId), but it also references the paragraph style. The same style will be found in the numbering definition referenced and that level will be used for the paragraph."
);
19.
paragraph2.ListId = list.Id;
20.
paragraph2.ListLevel = 1;
21.
22.
var paragraph3 = section.Blocks.AddParagraph();
23.
paragraph3.Inlines.AddRun(
"Line three, Note that the numbering reference within the document content in the sample above contains a direct reference to the level to be applied because the <w:numPr> contains both the reference to the numbering definition (numId) and a reference to the level (ilvl). See Paragraph Properties for more on <w:numPr>. The other possible way to reference a level in content is through the referenced paragraph style. That is, in the <w:abstractNum> the appropriate subsidiary level (lvl) could contain a pStyle with a value of ListParagraph. In that case, the content contains only a reference to the numbering definition instance (numId), but it also references the paragraph style. The same style will be found in the numbering definition referenced and that level will be used for the paragraph."
);
24.
paragraph3.ListId = list.Id;
25.
paragraph3.ListLevel = 1;
26.
27.
var paragraph4 = section.Blocks.AddParagraph();
28.
paragraph4.Inlines.AddRun(
"Line four, Note that the numbering reference within the document content in the sample above contains a direct reference to the level to be applied because the <w:numPr> contains both the reference to the numbering definition (numId) and a reference to the level (ilvl). See Paragraph Properties for more on <w:numPr>. The other possible way to reference a level in content is through the referenced paragraph style. That is, in the <w:abstractNum> the appropriate subsidiary level (lvl) could contain a pStyle with a value of ListParagraph. In that case, the content contains only a reference to the numbering definition instance (numId), but it also references the paragraph style. The same style will be found in the numbering definition referenced and that level will be used for the paragraph."
);
29.
paragraph4.ListId = list.Id;
30.
paragraph4.ListLevel = 2;
31.
32.
var paragraphBottom = section.Blocks.AddParagraph();
33.
paragraphBottom.Inlines.AddRun(
"Note that the numbering reference within the document content in the sample above contains a direct reference to the level to be applied because the <w:numPr> contains both the reference to the numbering definition (numId) and a reference to the level (ilvl). See Paragraph Properties for more on <w:numPr>. The other possible way to reference a level in content is through the referenced paragraph style. That is, in the <w:abstractNum> the appropriate subsidiary level (lvl) could contain a pStyle with a value of ListParagraph. In that case, the content contains only a reference to the numbering definition instance (numId), but it also references the paragraph style. The same style will be found in the numbering definition referenced and that level will be used for the paragraph."
);