Skip to content

Commit 8586300

Browse files
898185-change-format-after-append-html
1 parent 6b4e254 commit 8586300

File tree

1 file changed

+1
-8
lines changed
  • HTML-conversions/Change-format-after-append-html/.NET/Change-format-after-append-html

1 file changed

+1
-8
lines changed

HTML-conversions/Change-format-after-append-html/.NET/Change-format-after-append-html/Program.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static void Main(string[] args)
1919
int paraIndex = section.Body.Paragraphs.Count - 1;
2020

2121
// Append HTML content to the document with formatting in <p> tag.
22-
document.LastParagraph.AppendHTML("<p style='color:blue; font-weight:bold;'>The Giant</p><p style='color:green; font-style:italic;'>Panda</p>");
22+
document.LastParagraph.AppendHTML("<p>The Giant</p><p>Panda</p>");
2323

2424
// Iterate through the paragraphs in the section's body.
2525
for (int i = paraIndex; i < section.Body.ChildEntities.Count; i++)
@@ -31,13 +31,6 @@ static void Main(string[] args)
3131
// Set the paragraph formatting spacing to 0.
3232
paragraph.ParagraphFormat.BeforeSpacing = 0;
3333
paragraph.ParagraphFormat.AfterSpacing = 0;
34-
35-
// Iterate through the items in the paragraph to chnage formatting.
36-
foreach (var item in paragraph.ChildEntities)
37-
{
38-
if (item is WTextRange textRange)
39-
textRange.CharacterFormat.TextColor = Syncfusion.Drawing.Color.DarkGreen; // Change text color
40-
}
4134
}
4235
}
4336
// Save the modified document.

0 commit comments

Comments
 (0)