Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Fri Mar 18, 2011 2:22 pm

I wish to create a new paragraph of "DefaultParagraphFont", and within the paragraph make some of the text bold, how do I write this ?

jdupee@edocuments.co.uk
 
Posts: 3
Joined: Wed Mar 09, 2011 2:56 pm

Mon Mar 21, 2011 10:09 am

Hi friend,
Thanks for your inquiry.
Please try:
Code: Select all
Document document = new Document();
Section section = document.AddSection();
Paragraph paragraph = section.AddParagraph();
paragraph.AppendText("Normal ");

TextRange text = paragraph.AppendText("Bold");
text.CharacterFormat.Bold = true;

paragraph.AppendText(" ");

text = paragraph.AppendText("Italic");
text.CharacterFormat.Italic = true;

paragraph.AppendText(" ");

text = paragraph.AppendText("ItalicBold");
text.CharacterFormat.Italic = true;
text.CharacterFormat.Bold = true;

paragraph.AppendText(" Normal ");

document.SaveToFile("test.doc");
document.Close();
Harry
Technical Support / Developer,
e-iceblue Support Team
User avatar

harry.support
 
Posts: 180
Joined: Mon Nov 08, 2010 3:11 pm

Return to Spire.Doc