|
|
@@ -3,6 +3,8 @@
|
|
|
/** @noinspection PhpUndefinedMethodInspection */
|
|
|
/** @noinspection PhpUnusedLocalVariableInspection */
|
|
|
|
|
|
+use PhpOffice\PhpPresentation\PhpPresentation;
|
|
|
+use PhpOffice\PhpPresentation\Shape\Table;
|
|
|
use PhpOffice\PhpPresentation\Slide;
|
|
|
use PhpOffice\PhpPresentation\Style\Alignment;
|
|
|
|
|
|
@@ -505,12 +507,13 @@ class Chart {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * @param PhpPresentation $presentation
|
|
|
* @param Slide $slide
|
|
|
* @param int $offset_x
|
|
|
* @param int $offset_y
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
- public function addDataTable(Slide $slide, int $offset_x = 30, int $offset_y = 540): void {
|
|
|
+ public function addDataTable(PhpPresentation $presentation, Slide $slide, int $offset_x = 30, int $offset_y = 540): void {
|
|
|
$data = $this->getDataTableData();
|
|
|
|
|
|
$header_row = $data["headerRow"];
|
|
|
@@ -519,10 +522,17 @@ class Chart {
|
|
|
|
|
|
$column_count = count($header_row);
|
|
|
|
|
|
- $table = $slide->createTableShape($column_count)
|
|
|
- ->setWidth(900)
|
|
|
- ->setOffsetX($offset_x)
|
|
|
- ->setOffsetY($offset_y);
|
|
|
+ $y = $offset_y;
|
|
|
+ $rows_per_page = 31;
|
|
|
+
|
|
|
+ $create_table = static function(Slide $slide, int $y) use($column_count, $offset_x): Table {
|
|
|
+ return $slide->createTableShape($column_count)
|
|
|
+ ->setWidth(900)
|
|
|
+ ->setOffsetX($offset_x)
|
|
|
+ ->setOffsetY($y);
|
|
|
+ };
|
|
|
+
|
|
|
+ $table = $create_table($slide, $offset_y);
|
|
|
|
|
|
// Create header row
|
|
|
$row = $table->createRow();
|
|
|
@@ -541,8 +551,16 @@ class Chart {
|
|
|
|
|
|
$suffixes = $this->getPrintSuffixes() ?? $this->getDatalabelSuffixes();
|
|
|
|
|
|
+ $y += 20;
|
|
|
+
|
|
|
// Rows
|
|
|
foreach($rows as $row) {
|
|
|
+ if($y >= 650) {
|
|
|
+ $y = 30;
|
|
|
+ $slide = $presentation->createSlide();
|
|
|
+ $table = $create_table($slide, $y);
|
|
|
+ }
|
|
|
+
|
|
|
$table_row = $table->createRow();
|
|
|
$table_row->setHeight(20);
|
|
|
|
|
|
@@ -559,6 +577,8 @@ class Chart {
|
|
|
->setMarginTop(4);
|
|
|
$cell->createTextRun($text)->getFont()->setBold($bold);
|
|
|
}
|
|
|
+
|
|
|
+ $y += 20;
|
|
|
}
|
|
|
|
|
|
// Footer
|