title: phppresentation overflowing table problem
body: <p><a href="https://i.stack.imgur.com/6CdfN.png" rel="nofollow noreferrer">Table going outside the slide</a></p>
  <p>As the cell heigth increases the table height increases and makes the table go outside the slide thus i want the table to get divided and the part which is outside to come in the next slide
  Suppose the 3 rd row is coming outside the slide so send 3rd row in the next slide</p>
  <pre><code>&lt;?php
  
  include_once 'Sample_Header.php';
  
  use PhpOffice\PhpPresentation\PhpPresentation;
  use PhpOffice\PhpPresentation\Style\Border;
  use PhpOffice\PhpPresentation\Style\Color;
  use PhpOffice\PhpPresentation\Style\Fill;
  
  // Create new PHPPresentation object
  echo date('H:i:s') . ' Create new PHPPresentation object'.EOL;
  $objPHPPresentation = new PhpPresentation();
  
  // Set properties
  echo date('H:i:s') . ' Set properties'.EOL;
  $objPHPPresentation-&gt;getDocumentProperties()-&gt;setCreator('PHPOffice')
                                    -&gt;setLastModifiedBy('PHPPresentation Team')
                                    -&gt;setTitle('Sample 06 Title')
                                    -&gt;setSubject('Sample 06 Subject')
                                    -&gt;setDescription('Sample 06 Description')
                                    -&gt;setKeywords('office 2007 openxml libreoffice odt php')
                                    -&gt;setCategory('Sample Category');
  
  // Remove first slide
  echo date('H:i:s') . ' Remove first slide'.EOL;
  $objPHPPresentation-&gt;removeSlideByIndex(0);
  
  // Create slide
  echo date('H:i:s') . ' Create slide'.EOL;
  $currentSlide = createTemplatedSlide($objPHPPresentation);
  
  // Create a shape (table)
  echo date('H:i:s') . ' Create a shape (table)'.EOL;
  $shape = $currentSlide-&gt;createTableShape(3);
  $shape-&gt;setHeight(100);
  $shape-&gt;setWidth(600);
  $shape-&gt;setOffsetX(150);
  $shape-&gt;setOffsetY(150);
  
  // Add row
  echo date('H:i:s') . ' Add row'.EOL;
  $row = $shape-&gt;createRow();
  $row-&gt;getFill()-&gt;setFillType(Fill::FILL_GRADIENT_LINEAR)
                 -&gt;setRotation(90)
                 -&gt;setStartColor(new Color('FFE06B20'))
                 -&gt;setEndColor(new Color('FFFFFFFF'));
  $cell = $row-&gt;nextCell();
  $cell-&gt;setColSpan(3);
  $cell-&gt;createTextRun('askjbsakbcashbcashkbckashbkashhkasc')-&gt;getFont()-&gt;setBold(true)-&gt;setSize(16);
  $cell-&gt;getBorders()-&gt;getBottom()-&gt;setLineWidth(4)
                                  -&gt;setLineStyle(Border::LINE_SINGLE)
                                  -&gt;setDashStyle(Border::DASH_DASH);
  $cell-&gt;getActiveParagraph()-&gt;getAlignment()
      -&gt;setMarginLeft(10);
  
  // Add row
  echo date('H:i:s') . ' Add row'.EOL;
  $row = $shape-&gt;createRow();
  $row-&gt;setHeight(20);
  $row-&gt;getFill()-&gt;setFillType(Fill::FILL_GRADIENT_LINEAR)
                 -&gt;setRotation(90)
                 -&gt;setStartColor(new Color('FFE06B20'))
                 -&gt;setEndColor(new Color('FFFFFFFF'));
  $oCell = $row-&gt;nextCell();
  $oCell-&gt;createTextRun('jsdhfljadnfkljancfancjklscnajklnacsjlnsajlcnasjlcnasjlcnlasncjlasnclasncjlasncljasncjlasncljasnjsdhfljadnfkljancfancjklscnajklnacsjlnsajlcnasjlcnasjlcnlasncjlasnclasncjlasncljasncjlasncljasn')-&gt;getFont()-&gt;setBold(true);
  $oCell-&gt;getActiveParagraph()-&gt;getAlignment()-&gt;setMarginLeft(20);
  $oCell = $row-&gt;nextCell();
  $oCell-&gt;createTextRun('jsdhfljadnfkljancfancjklscnajklnacsjlnsajlcnasjlcnasjlcnlasncjlasnclasncjlasncljasncjlasncljasnjsdhfljadnfkljancfancjklscnajklnacsjlnsajlcnasjlcnasjlcnlasncjlasnclasncjlasncljasncjlasncljasn')-&gt;getFont()-&gt;setBold(true);
  $oCell = $row-&gt;nextCell();
  $oCell-&gt;createTextRun('jsdhfljadnfkljancfancjklscnajklnacsjlnsajlcnasjlcnasjlcnlasncjlasnclasncjlasncljasncjlasncljasnjsdhfljadnfkljancfancjklscnajklnacsjlnsajlcnasjlcnasjlcnlasncjlasnclasncjlasncljasncjlasncljasn')-&gt;getFont()-&gt;setBold(true);
  
  foreach ($row-&gt;getCells() as $cell) {
      $cell-&gt;getBorders()-&gt;getTop()-&gt;setLineWidth(4)
                                   -&gt;setLineStyle(Border::LINE_SINGLE)
                                   -&gt;setDashStyle(Border::DASH_DASH);
      // if($cell-&gt;getHeight()&gt;20){
      //     $nextSlide = createTemplatedSlide($objPHPPresentation);
      // }
  }
  $nextSlide = createTemplatedSlide($objPHPPresentation);
  
  // Add row
  echo date('H:i:s') . ' Add row'.EOL;
  $row = $shape-&gt;createRow();
  $row-&gt;getFill()-&gt;setFillType(Fill::FILL_SOLID)
                 -&gt;setStartColor(new Color('FFE06B20'))
                 -&gt;setEndColor(new Color('FFE06B20'));
  $oCell = $row-&gt;nextCell();
  $oCell-&gt;createTextRun('jsdhfljadnfkljancfancjklscnajklnacsjlnsajlcnasjlcnasjlcnlasncjlasnclasncjlasncljasncjlasncljasn');
  $oCell-&gt;getActiveParagraph()-&gt;getAlignment()
      -&gt;setMarginLeft(30)
      -&gt;setTextDirection(\PhpOffice\PhpPresentation\Style\Alignment::TEXT_DIRECTION_VERTICAL_270);
  $oCell = $row-&gt;nextCell();
  $oCell-&gt;createTextRun('jsdhfljadnfkljancfancjklscnajklnacsjlnsajlcnasjlcnasjlcnlasncjlasnclasncjlasncljasncjlasncljasnvjsdhfljadnfkljancfancjklscnajklnacsjlnsajlcnasjlcnasjlcnlasncjlasnclasncjlasncljasncjlasncljasn ');
  $oCell-&gt;getActiveParagraph()-&gt;getAlignment()
      -&gt;setMarginBottom(10)
      -&gt;setMarginTop(20)
      -&gt;setMarginRight(30)
      -&gt;setMarginLeft(40);
  $oCell = $row-&gt;nextCell();
  $oCell-&gt;createTextRun('vjsdhfljadnfkljancfancjklscnajklnacsjlnsajlcnasjlcnasjlcnlasncjlasnclasncjlasncljasncjlasncljasnjsdhfljadnfkljancfancjklscnajklnacsjlnsajlcnasjlcnasjlcnlasncjlasnclasncjlasncljasncjlasncljasn');
  
  // Add row
  echo date('H:i:s') . ' Add row'.EOL;
  $row = $shape-&gt;createRow();
  $row-&gt;getFill()-&gt;setFillType(Fill::FILL_SOLID)
                 -&gt;setStartColor(new Color('FFE06B20'))
                 -&gt;setEndColor(new Color('FFE06B20'));
  $oCell = $row-&gt;nextCell();
  $oCell-&gt;createTextRun('jsdhfljadnfkljancfancjklscnajklnacsjlnsajlcnasjlcnasjlcnlasncjlasnclasncjlasncljasncjlasncljasn');
  $oCell-&gt;getActiveParagraph()-&gt;getAlignment()-&gt;setMarginLeft(40);
  $oCell = $row-&gt;nextCell();
  $oCell-&gt;createTextRun('jsdhfljadnfkljancfancjklscnajklnacsjlnsajlcnasjlcnasjlcnlasncjlasnclasncjlasncljasncjlasncljasn');
  $oCell = $row-&gt;nextCell();
  $oCell-&gt;createTextRun('jsdhfljadnfkljancfancjklscnajklnacsjlnsajlcnasjlcnasjlcnlasncjlasnclasncjlasncljasncjlasncljasn');
  
  // Add row
  echo date('H:i:s') . ' Add row'.EOL;
  $row = $shape-&gt;createRow();
  $row-&gt;getFill()-&gt;setFillType(Fill::FILL_SOLID)
                 -&gt;setStartColor(new Color('FFE06B20'))
                 -&gt;setEndColor(new Color('FFE06B20'));
  $cellC1 = $row-&gt;nextCell();
  $textRunC1 = $cellC1-&gt;createTextRun('Link');
  $textRunC1-&gt;getHyperlink()-&gt;setUrl('https://github.com/PHPOffice/PHPPresentation/')-&gt;setTooltip('PHPPresentation');
  $cellC1-&gt;getActiveParagraph()-&gt;getAlignment()-&gt;setMarginLeft(50);
  $cellC2 = $row-&gt;nextCell();
  $textRunC2 = $cellC2-&gt;createTextRun('jsdhfljadnfkljancfancjklscnajklnacsjlnsajlcnasjlcnasjlcnlasncjlasnclasncjlasncljasncjlasncljasn');
  $textRunC2-&gt;getFont()-&gt;setBold(true);
  $textRunC2-&gt;getFont()-&gt;setSize(12);
  $textRunC2-&gt;getFont()-&gt;setColor(new Color('FF000000'));
  $cellC2-&gt;createBreak();
  $textRunC2 = $cellC2-&gt;createTextRun('jsdhfljadnfkljancfancjklscnajklnacsjlnsajlcnasjlcnasjlcnlasncjlasnclasncjlasncljasncjlasncljasn');
  $textRunC2-&gt;getFont()-&gt;setBold(true);
  $textRunC2-&gt;getFont()-&gt;setSize(14);
  $textRunC2-&gt;getFont()-&gt;setColor(new Color('FF0088FF'));
  $cellC3 = $row-&gt;nextCell();
  $textRunC3 = $cellC3-&gt;createTextRun('Link jsdhfljadnfkljancfancjklscnajklnacsjlnsajlcnasjlcnasjlcnlasncjlasnclasncjlasncljasncjlasncljasn');
  $textRunC3-&gt;getHyperlink()-&gt;setUrl('https://github.com')-&gt;setTooltip('GitHub');
  $cellC3-&gt;createBreak();
  $textRunC3 = $cellC3-&gt;createTextRun('Link Google');
  $textRunC3-&gt;getHyperlink()-&gt;setUrl('https://google.com')-&gt;setTooltip('Google');
  
  
  // Save file
  echo write($objPHPPresentation, basename(__FILE__, '.php'), $writers);
  if (!CLI) {
      include_once 'Sample_Footer.php';
  }
  </code></pre>