How to Bold specific text in a paragraph.

Technical support for Spire.Doc

Moderator: iceblue support

How to Bold specific text in a paragraph.

Postby jdupee@edocuments.co.uk » 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

Re: How to Bold specific text in a paragraph.

Postby harry.support » 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

Who is online

Users browsing this forum: No registered users and 0 guests

cron