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

Free Support Forum - aspose.com

Define Multiple Tab Stop Positions for Text Alignments in Paragraph in a Single Line C# .NET

Hi guys.

I’m testing your evaluate version and learning how to use it.
So far so good. After a few bumps my document is almost ready.

I have a few lines in it that have diferent alignments.
For example, one part of the text align right and some other part align center.
In other line (this one is in footer) I like to the PAGE NUMBER variable to be align center and some other text align at right after the PAGE NUMBER information.
There ir a line the will have 2 images, on centered and the other align right.

So, I’ve searched a little and I guess I’ll have to use TabStops, right?
But I´m having some difficults understading how to.


Hi Rafael,

Thanks for your inquiry. Please attach your expected Word document here for our reference. We will investigate the structure of your expected document as to how you want your final output be generated like. You can create expected document using Microsoft Word. We will then provide you code to achieve the same using Aspose.Words.

Best regards,

Here it is.

On footer, there’s the current page and total pages to display either (centered, as well).


1) 05/50/78 -> Align Right and SUBTITLE -> Align Center

2) [Footer]: Some_Number Variable -> Align Left and the Page_Number and Page_Total -> Align Center

3) There’s 2 images I want to put before the title. One align center and the other one, in the same line, align right


Hi Rafael,

Thanks for your inquiry. You can set TabStops as well as alignment of paragraphs. For TabStops, please see the following code and for setting paragraph's alignment, please use para.getParagraphFormat().setAlignment(ParagraphAlignment.RIGHT) property.
Document document = new Document();
DocumentBuilder builder = new DocumentBuilder(document);

ParagraphFormat paragraphFormat = builder.getParagraphFormat();
paragraphFormat.getTabStops().add(288, TabAlignment.LEFT, TabLeader.NONE);

builder.writeln(“Source:” + ControlChar.TAB + “Name”);

paragraphFormat = builder.getParagraphFormat();
paragraphFormat.getTabStops().add(396, TabAlignment.LEFT, TabLeader.DOTS);

builder.writeln(“Source:” + ControlChar.TAB + “Name”);

document.save(getMyDir() + “15.6.0.docx”);

I hope, this helps.

Best regards,