title: MailMerge TaleStart-TableEnd: Add enter on end of page with multiline rows
body: <p>We have a MailMerge docx which has the following table:</p>
  
  <pre><code>_____________________________________________________________________________
  Date         Id        Description                                Amount
  _____________________________________________________________________________
  {{TableStart {{Id}}    {{Description}}                            € {{Amount 
  :Lines}}{{Da                                                      \# 0,00}}{{
  te \@"dd-MM-                                                      TableEnd:Li
  yyyy"}}                                                           nes}}
  _____________________________________________________________________________
                                                          Total    € {{Total \#
                                                                   0,00}}
  _____________________________________________________________________________
  </code></pre>
  
  <p>Here is an example result row:</p>
  
  <pre><code>____________________________________________________________________________
  Date         Id        Description                                Amount
  ____________________________________________________________________________
  03-09-2015   0001      Company Name                               € 25,00
                         Buyer Name 1, Buyer Name 2
                         Product description
                         Extra description line
  </code></pre>
  
  <p>As you can see, the description has multiple lines. When the end of a page is reached, it just continues on the next page. So with the example above, the line could be like this at the end of page 1:</p>
  
  <pre><code>03-09-2015   0001      Company Name                               € 25,00
                         Buyer Name 1, Buyer Name 2
  </code></pre>
  
  <p>And like this at the start of page 2:</p>
  
  <pre><code>                       Product description
                         Extra description line
  </code></pre>
  
  <p>What I'd like instead is the following: When an item doesn't fit on the page anymore, the entire item must go to the start of the next page. Basically I want to prevent items from splitting between pages. Is there any way to accomplish this with MailMerge?</p>
  
  <p>Also, we use C# in our project. Here is the code we use for the MailMerge. I think it's a bit to ambitious to ask if there is a setting to allow the behavior I desire in the MailMerge libraries. Anyway, here is the code we use to convert the data &amp; docx to a pdf:</p>
  
  <pre><code>var pdf = _documentService.CreateTableFile(new TableFileData(date, companyId, 
      dataList.Select(x =&gt; new TableRowData
      {
          Description = x.Description,
          Amount = x.Amount,
          Date = x.Date,
          Id = x.Id
      }).ToList()));
  
  var path = Path.Combine(FileService.GetTemporaryPath(), Path.GetRandomFileName());
  var file = Path.ChangeExtension(path, "pdf");
  
  using (var fs = File.OpenWrite(file))
  {
      fs.Write(pdf, 0, pdf.Length);
  }
  
  Process.Start(file);
  </code></pre>
  
  <p>With CreateTableFile-method:</p>
  
  <pre><code>public byte[] CreateTableFile(TableFileData data)
  {
      if (data == null) throw new ArgumentNullException("data");
  
      const string fileName = "TableFile.docx";
      var path = Path.Combine(_templatePath, fileName);
  
      using (var fs = File.OpenRead(path))
      {
          var dataSource = new DocumentDataSource(data);
          return GenerateDocument(fs, dataSource);
      }
  }
  </code></pre>
  
  <p>With GenerateDocument-method:</p>
  
  <pre><code>private static byte[] GenerateDocument(Stream template, DocumentDataSource dataSource, IFieldMergingCallback fieldMergingCallback = null)
  {
      var doc = new Document(template);
  
      doc.MailMerge.FieldMergingCallback = fieldMergingCallback;
      doc.MailMerge.UseNonMergeFields = true;
      doc.MailMerge.CleanupOptions = MailMergeCleanupOptions.RemoveContainingFields |
          MailMergeCleanupOptions.RemoveUnusedFields |
          MailMergeCleanupOptions.RemoveUnusedRegions |
          MailMergeCleanupOptions.RemoveEmptyParagraphs;
  
      doc.MailMerge.Execute(dataSource);
      doc.MailMerge.ExecuteWithRegions((IMailMergeDataSourceRoot)dataSource);
  
      doc.UpdateFields();
  
      using (var ms = new MemoryStream())
      {
          var options = new PdfSaveOptions { WarningCallback = new AsposeWarningCallback() };
          doc.Save(ms, options);
          return ms.ToArray();
      }
  }
  </code></pre>