I have a doc that is used as a template which contains a table and mail merge fields. The document gets created from pulling data from SQL. The resulting document does not maintain the margins set in the template document. I think one problem is part of the data being pulled from SQL is h HTML table. It seems that the document resizes because of the table. I call UpdateTableLayout but it does not help. I attached the template doc and output doc. I noticed that if I manually set the margin widths the HTML table gets clipped rather than resized. I don’t think there is a width set in the HTML.
Thanks for reporting this problem to us. I will research this issue and will let you know of the results tomorrow.
I can see the problem. To reproduce and fix it, however, we will need the merged data. Can you please serialize the merged data set to XML and attach it here? DataSet object can be serialized in .NET using DataSet.WriteXml method.
I serialized the data and also attached the code that builds the page. You already have the template doc.
Thanks, I will research the problem and let you know.
Actually, I am wrong, there is a width set on the html table. Does this prevent UpdateTableLayout from resizing the table?
I have reproduced your document generation except TOC part which is not included in the attached code. And I have found that the resulting document is different. The table width is not increased to accomodate Product Nos table but stays the same and as a result the right part of the html table is clipped by the containing table borders. That seems like an expected behavior as inserted HTML table has width defined. Please make sure you are using the latest Aspose.Words version. I can send you a test code and the output if necessary.
Best regards,