Correct way to add TabStop with right align text using .NET

Hi everybody,

I am using Aspose to automatically add a Header and Footer to Word documents.
The Footer has some content on the left- and some content on the right hand side.
To position the content on the right side I am using a Tabstop that I have positioned like this:

TabStop tab = new TabStop(builder.PageSetup.PageWidth,TabAlignment.Right,TabLeader.None);

Now I am running into the Problem - that when a Document has multiple sections with different orientations. For example: A Document that hast the first page as portrait and the second page as landscape orientation. The second page TabStop will be at the same absolute (x) Position as the TabStop in Section (Page) 1.

Is it possible to position Tabstops to the right side?
TabStop tab = new TabStop(???,TabAlignment.Right,TabLeader.None);

I found that when I insert a large number like this:
TabStop tab = new TabStop(1000,TabAlignment.Right,TabLeader.None);
I will get the desired outcome, but maybe there is a better way?

Thank you in advance,

Leon

@ALPLAleonboehler

Could you please ZIP and attach your input and expected output Word documents? We will then provide you more information on it.

Hi Tahir, thanks for your help.
Attached you can find the requested word documents.

Best Regards,

Leon

Summary

documents.zip (40.9 KB)

@ALPLAleonboehler

You are setting the TabStop correctly. However, you can also achieve your requirement by inserting the table into footer with 100% width that contains two cells and one row. Set the alignment of paragraph as right in second cell of table. Set the table’s border to none. Hope this helps you.

We created the footer with table and attached it with this post for your kind reference. To make table visible, we have not removed its border. ExpectedOutput_A4_Portrait_and_Landscape.zip (21.7 KB)

Thank you! That worked for me :slight_smile:

@ALPLAleonboehler

Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.