We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Text borders

Hi support,

Can I have borders for a text within a paragraph ? I know how to set the borders for the entire paragraph, but I was wondering if there is any way to do this for some word in the paragraph.

Best regards,
Milan

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Yes you can achieve this using Aspose.Words. Please see the following code:

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

//Write text withour borders

builder.Write("This is text without borders");

//Push font

builder.PushFont();

//Set text borders

builder.Font.Border.LineStyle = LineStyle.Single;

builder.Font.Border.LineWidth = 1;

builder.Font.Border.Color = Color.Red;

//Write text with borders

builder.Write("This is text with borders");

//Pop font

builder.PopFont();

//And write text without borders again

builder.Write("This is text without borders");

//Save output document

doc.Save(@"Test137\out.doc");

Hope this helps.

Best regards.