Free Support Forum - aspose.com

Merge Fields and Document Spacing

I have attach a zip file that contains a word template. This template contains merge fields that are populated from database fields. The contents of the database fields will cause text in the document to be moved when the document is merged.

If you open the attached template, the merge fields Plaintiff, Interveners and Defendants will move the text below it. Same for the PropDescription merge field. In some cases text will be moved to a second page.

My question is is there a way to control the document spacing after the merge fields have been filled?

Hi Curtis,

Thanks for your inquiry.

I'm afraid I was unable to reproduce any issue using the latest verison of Aspose.Words. You can download it from here:

http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/category1188.aspx

I used the following code for testing:

doc.MailMerge.Execute(doc.MailMerge.GetFieldNames(), ArrayList.Repeat("Field Text", doc.MailMerge.GetFieldNames().Length).ToArray());

Thanks,

I attached another zip file that contains a word template and a word document that is produced using the template. The word document will the text moved after the merge fields have been filled. Again my question is is there a way to control spacing after the merge fields have been filled.

Hi

Thank you for additional information. Unfortunately, it is still not quite clear for me what the problem is. As I can see your output document looks correct. Where I can observe the problem?

Could you please also attach the expected output? This will allow us to better understand your requirements.

Best regards,

The output is the SaleNotice.docx file.

If you look at the word template SaleNotice.dotx, you will see a merge field called Defendant. If you look at the SaleNotice.docx file, the merge field Defendant has been filled with the following data:

PALMER BERNARD PAYNE HEIR, Estate Of Myrtle Bryant; CAROLYN DYLES HEIR, Estate Of Myrtle Bryant; BRENDA JOHNSON HEIR, Estate Of Myrtle Bryant; SEBRENA COOKS AKA SEBRENA MARIE LEWIS HEIR Of Myrtle Bryant Estate; KALEN WILLIAMS HEIR Of Myrtle Bryant Estate; REGINALD NEWTON HEIR Of Myrtle Bryant Estate; DARRELL THOMAS HEIR Of Myrtle Bryant Estate; and the unknown officers, agents, successors and assigns of GOLD BOND COMPANIES, (LIENHOLDER, IN REM ONLY), if living, and if any or all of the said named defendant(s) be dead, the unknown heirs of each or all of the said named persons who may be dead; and the unknown heirs of the unknown heirs of the said named persons; and the unknown owner or owners of the described property; and the executors, administrators, guardians, legal representatives, legatees, devisees of the said named persons, and who own or claim some interest in the below described property and any and all other persons, including adverse claimants, owning or having any legal or equitable interest in or lien upon the below described property, who were duly served as required by law by means of citation by publication;

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

TERESA SOWELS,PAMELA SOWELS

CYNTHIA SOWELS

MICHAEL SOWELS HEIR of Myrtle Bryant Estate

LORETTA THOMAS HEIR, Estate of Myrtle Bryant, who was duly served with process as required by law, and who answered herein by filing a Disclaimer of Interest and was duly notified of this setting.

VOID SOWELLS, JR. HEIR of Myrtle Bryant Estate,

CITY OF FORT WORTH (LIENHOLDER, IN REM ONLY

If you look at the word template, there is text below the Defendant merge field. Now if you look at the SaleNotice.docx file, when the Defendant merge field was filled with the above data, some of the text below the Defendant merge field was moved to page 2.

Usually the Defendant merge field does not contain much information and everything fits on one page. So my question is is there a way to adjust spacing after a merge field has been filled.

Hi there,


Thanks for this additional information.

I can see that the content below that merge field is pushed onto the next page, however this is the expected behaviour as the text is very long.

I’m don’t think that adjusting spacing will help to save space as single spacing is already used. Instead you will need to reduce font size, margins or increase the page size. It’s probably a good idea to do this on the original template.

Thanks,