But, I want to style just some word's in a string, and maybe add some special caracter like "•"
How can I do that?
Styled string example:
• WARNING: How should I do this?
• WARNING: How should I do this?
Document document = new Document();
Section section = document.AddSection();
Paragraph paragraph = section.AddParagraph();
String text1 = "WARNING";
TextRange textRange1=new TextRange(document);
textRange1.Text = text1;
textRange1.CharacterFormat.FontName = "Arial";
textRange1.CharacterFormat.FontSize = 10;
textRange1.CharacterFormat.Bold=true;
textRange1.CharacterFormat.UnderlineStyle= UnderlineStyle.Single;
paragraph.ChildObjects.Add(textRange1);
String text2 = ": How should I do this?";
TextRange textRange2 = new TextRange(document);
textRange2.Text = text2;
textRange2.CharacterFormat.FontName = "Arial";
textRange2.CharacterFormat.FontSize = 10;
paragraph.ChildObjects.Add(textRange2);
//If you want to add some special caracter like "•" in an existing paragraph
TextRange textRange0 = new TextRange(document);
textRange0.Text = "• ";
paragraph.ChildObjects.Insert(0, textRange0);
document.SaveToFile(output, FileFormat.Docx2013);