I have a document that is a letter and the reference number is repeated throughout the document. Each row in the datatable adds another copy of the document to the output and the reference number correctly appears through the document.
In the mailmerge example the document appears to have the same features, repeated fields in a document, however when merging in the datatable each field (label) gets data from each row in the datatable.
What is it that makes these different? What makes the mailing labels have a different record per label?
To make my question clearer, how would I make the mailing label sample print one page of identical labels for each customer?
Aspose.Word selects next record from the datatable in any of the following cases:
1. End of region is reached (TableEnd)
2. End of document is reached (similar to p.1 as whole document is considered a region when no regions are explicitly defined)
3. NEXT field is found.
Customer Labels demo that you can see on the website use NEXT fields in every table cell excluding the first cell. This causes next table record select for every cell.
NEXT fields are sometimes not visible in Word.
In Word, if you go to Tools/Options menu, select View Tab and check Field Codes you will see the NEXT fields.
I think for your case you need to remove the NEXT fields and you will get one page of identical labels. As soon as the end of the document is reached (could be one page or many) Aspose.Word will go to next record (next customer).
Spot on…I did look for the next fields in the mailing label document as I thought that was the likely way of doing it…but you were quite right Word was hiding them.