title: itext 7 - how to configure table splitting
body: <p>I have a couple of issues with tables rendered with itext 7. I use itext 7.0.2.2 (C# edition).</p>
  
  <p>First, when table starts close to the bottom of the page and page has space only for header, itext 7 renders header on the first page, and page breaks right after header. How to force keeping header and the first row together?
  <a href="https://i.stack.imgur.com/1y6J6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1y6J6.png" alt="table splits right after header"></a></p>
  
  <p>Next issue is that itext 7 splits row instead of moving whole row to the next page. I know itext 5 have setSplitLate(bool) method that configures itext to split row or not, but what to do with itext 7? See what's happens with row:
  <a href="https://i.stack.imgur.com/pXgCf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pXgCf.png" alt="table row breaks"></a>
  Note that row can be empty and should have minimum height, so setKeepTogether(true) on cell's content is not a solution. I add cells this way:</p>
  
  <pre><code>table.AddCell(new Cell().SetMinHeight(MIN_HEIGHT).Add("foo"));
  </code></pre>
  
  <p><strong>UPDATE:</strong>
  Here is a repro for row splitting (C#):</p>
  
  <pre><code>var writer = new PdfWriter(new FileStream("...", FileMode.Create));
  var pdfDoc = new PdfDocument(writer);
  using (var document = new Document(pdfDoc, PageSize.A4))
  {
      var table = new iText.Layout.Element.Table(UnitValue.CreatePercentArray(new[] { 1.3f, 1f, 1f, 1f, 1f, 1f, 1f }))
                  .SetWidthPercent(100f)
                  .SetFixedLayout();
      foreach (var i in Enumerable.Range(1, 7 * 100)) // 100 rows
      {
          var cell = new Cell().SetKeepTogether(true).SetMinHeight(45).Add(i.ToString());
          table.AddCell(cell);
      }
      document.Add(table);
  }
  </code></pre>
  
  <p>Result:
  <a href="https://i.stack.imgur.com/2DKbV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2DKbV.png" alt="enter image description here"></a></p>