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

Free Support Forum - aspose.com

Horizontal alignment of tables within a section

Hi to all

I wish to make a pdf with content all in one section and arranged by making use of separate tables within that section. (Attached is an example of the current result). Unfortunately not all of the tables are ending up with the same horizontal alignment.
I believe that I am keeping the ‘construction’ of each table consistent when I create and add it (apart from column counts).
Is there a way that I can export the pdf to xml in a reverse of the creation of a pdf from already existing xml file to help track down where there mis-alignment is creeping in?

This was done using version 4.1.0


Ralph Price
GIS Analyst and Application Developer
Rotorua District Council

This message was posted using Page2Forum (attachment) from Working with Tables - Aspose.Pdf for .NET

Hi to all

I note that there are now two new releases since the version that I am using. Will check to see if the latest version solves the problem.



…unfortunately updating to version 4.1.2 did not make the difference hoped for…

I have now attached a test_pdf.aspx set of code to generate a one page sample that create a result with the same problem. Hopefully it is not something really stupid that I have missed spotting.

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

Thanks for using our products.

As far as I can understand, you need to Horizontally align the middle "detailsTable" table. As per my observation, if you set the value of detailsTable.Margin.Left property to 0, all the three tables would he horizontally aligned. Please add this property inside the AddDetailsTable(...) method. I've created a sample PDF document after this update and is in attachment, please take a look.

In case I've not properly understood your requirement, can you please share some more details and if possible can you please share some picture which can help us to understand the porblem easily.

We apologize for your inconvenience.

Hi Nayyer,

I would like all of the tables to be with a centered horizontal alignment even though each table is a different width. I have only specified the table widths using defined column widths such as 60%, 40% (for a 100% total) etc and different margins if I recall correctly but they still need to be centered horizontally.

Hopefully that is clearer


Ralph Price

Hello Ralph,

Sorry for replying you so late.

I've further investigated the issue and have found that tables are not center aligned because you've specified some Margin information in StdTableMargin(...) method. In order to center aligned the tables please add detailsTable.Left = 20 to AddDetailsTable(...) method and comment the 'imageTable.Margin = StdTableMargin() inside AddHeadstonesToDoc(....) method.

Please take a look over the attached resultant PDF that I've generated and in case you still face any issue, or you've any further query, please feel free to contact.

Hi Nayyer

that worked perfectly. I guess I need to do some more reading on margins and padding to understand the layout issues that I obviously caused. Do you have any documentation page that you would suggest as to being the most appropriate for this issue?

Thanks very much for locating the issue. I have been away for the last week so didn’t see your post until now.

Best regards

Ralph Price

Hello Ralph,

Please visit the following link for required information on how to Set Border Style, Margins and Padding of the Table.

In case of any further query, please feel free to contact.