Free Support Forum - aspose.com

Aligning tables within Word

Hello,

We are using the document builder program to create an invoice that consists of multiple table objects. Part of the invoice involves 2 tables that are side by side and I could not find a way to specify the tables location. The table edge always begins at the left margin. I've tried using the paragraph leftindent properties but that only moves the first column of text. The borders are still against the left margin. I saw a post from 2005 that requested information on how to center a table and that new table features would be developed but I could not find anything else relating to how to position tables within the document.

Is there a way to specify the position/location of a table in a word document?

Thanks,

Phil

Hi

Thanks for your interest in Aspose products. You can use RowFormat.Alignment to specify horizontal position of table. For example see the following code snippet.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

builder.RowFormat.Alignment = RowAlignment.Center;

builder.CellFormat.Width = 20;

for (int i = 0; i < 10; i++)

{

for (int j = 0; j < 10; j++)

{

builder.InsertCell();

}

builder.EndRow();

}

builder.EndTable();

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

I hope that this will help you.

Please let me know if you would like to know something else.

Best regards.

Hello and thank you,

This did allow me to position a single table within the paragraph but what I really need to be able to do is to place 2 tables side by side. So table 1 is on the left side of the page and table 2 is on the right side of the page but both are in the same paragraph section.

Is this possible?

Thanks,

Phil

Hi

Thanks for your inquiry. Unfortunately, “Text wrapping” is not available yet. That’s why you can’t insert tables side by side. This is issue # 907.

As workaround you can insert one table having transparent borders. Also you can use columns. See the following link.
http://www.aspose.com/Products/Aspose.Words/Api/Aspose.Words.PageSetup.TextColumns.html

Please let me know if you would like to know something else.

Best regards.

The issues you have found earlier (filed as WORDSNET-581) have been fixed in this .NET update and in this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(85)