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

Free Support Forum - aspose.com

How to align page field with tabs using C#

We are in the process of evaluating Aspose.Words. We’ve run into a snag and were wondering if you can help. Our needs are to take several word documents, replace existing “fields” with data, then merge the documents and export to PDF. We managed to do all that with relatively few lines of code using Aspose.Words. However, when we try to add page numbers to the footer of each document, we cannot get the same behavior we do when using Word Interop. The documents already have text in the footer (aligned to the right). When we add the page numbers, we use “InsertAlignmentTab” to get the page numbers to be aligned to the Left and the original footer text aligned to the right. We cannot reproduce this behavior with Aspose.Words. I am attaching a copy of the DocumentBuilderDemo.cs that comes with your examples. We have changed the code in there to try to do what we need. I am also attaching the two sample documents we are merging.

Regards,

Peter G.

Hi Peter,

Thanks for your query. I have tried to understand your problem statement but unfortunately I have not completely understand the issue. It would be great, If you share some more detail about your issue.

Hi Peter,


Thanks for your inquiry.

Your footer contains two tabstops. Therefore to get the text to appear on the left hand side of the page you need two tabs instead of just one. If you duplicate the builder.Write(ControlChar.Tab) line then the output should look correct.

If we can help with anything else, please feel free to ask.

Thanks,