Merge pull request #2830 from PHPOffice/ChartSheet

Read ChartSheets with the Xlsx Reader if includeCharts is enabled
This commit is contained in:
Mark Baker 2022-05-17 16:24:51 +02:00 committed by GitHub
commit 4df236a688
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 187 additions and 109 deletions

View File

@ -10,12 +10,15 @@ and this project adheres to [Semantic Versioning](https://semver.org).
### Added ### Added
- Add point size option for scatter charts - Add point size option for scatter charts
- Basic support for Xlsx reading/writing Chart Sheets [PR #2830](https://github.com/PHPOffice/PhpSpreadsheet/pull/2830)
Note that a ChartSheet is still only written as a normal Worksheet containing a single chart, not as an actual ChartSheet.
### Changed ### Changed
- Memory and speed improvements, particularly for the Cell Collection, and the Writers. - Memory and speed improvements, particularly for the Cell Collection, and the Writers.
See [the Discussion](https://github.com/PHPOffice/PhpSpreadsheet/discussions/2821) for details of performance See [the Discussion section on github](https://github.com/PHPOffice/PhpSpreadsheet/discussions/2821) for details of performance across versions
### Deprecated ### Deprecated

View File

@ -1160,76 +1160,6 @@ parameters:
count: 1 count: 1
path: src/PhpSpreadsheet/Chart/Chart.php path: src/PhpSpreadsheet/Chart/Chart.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:getBottomRightXOffset\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Chart/Chart.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:getBottomRightYOffset\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Chart/Chart.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:getTopLeftXOffset\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Chart/Chart.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:getTopLeftYOffset\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Chart/Chart.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightCell\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Chart/Chart.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightCell\\(\\) has parameter \\$cell with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Chart/Chart.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightXOffset\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Chart/Chart.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightXOffset\\(\\) has parameter \\$xOffset with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Chart/Chart.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightYOffset\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Chart/Chart.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setBottomRightYOffset\\(\\) has parameter \\$yOffset with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Chart/Chart.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setTopLeftXOffset\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Chart/Chart.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setTopLeftXOffset\\(\\) has parameter \\$xOffset with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Chart/Chart.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setTopLeftYOffset\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Chart/Chart.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:setTopLeftYOffset\\(\\) has parameter \\$yOffset with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Chart/Chart.php
- -
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$legend \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Legend\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Legend\\|null\\.$#" message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\:\\:\\$legend \\(PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Legend\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Legend\\|null\\.$#"
count: 1 count: 1

View File

@ -124,7 +124,7 @@ class Chart
* *
* @var string * @var string
*/ */
private $bottomRightCellRef = 'A1'; private $bottomRightCellRef = '';
/** /**
* Bottom-Right X-Offset. * Bottom-Right X-Offset.
@ -400,15 +400,15 @@ class Chart
/** /**
* Set the Top Left position for the chart. * Set the Top Left position for the chart.
* *
* @param string $cell * @param string $cellAddress
* @param int $xOffset * @param int $xOffset
* @param int $yOffset * @param int $yOffset
* *
* @return $this * @return $this
*/ */
public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null) public function setTopLeftPosition($cellAddress, $xOffset = null, $yOffset = null)
{ {
$this->topLeftCellRef = $cell; $this->topLeftCellRef = $cellAddress;
if ($xOffset !== null) { if ($xOffset !== null) {
$this->setTopLeftXOffset($xOffset); $this->setTopLeftXOffset($xOffset);
} }
@ -446,13 +446,13 @@ class Chart
/** /**
* Set the Top Left cell position for the chart. * Set the Top Left cell position for the chart.
* *
* @param string $cell * @param string $cellAddress
* *
* @return $this * @return $this
*/ */
public function setTopLeftCell($cell) public function setTopLeftCell($cellAddress)
{ {
$this->topLeftCellRef = $cell; $this->topLeftCellRef = $cellAddress;
return $this; return $this;
} }
@ -491,6 +491,11 @@ class Chart
]; ];
} }
/**
* @param int $xOffset
*
* @return $this
*/
public function setTopLeftXOffset($xOffset) public function setTopLeftXOffset($xOffset)
{ {
$this->topLeftXOffset = $xOffset; $this->topLeftXOffset = $xOffset;
@ -498,11 +503,16 @@ class Chart
return $this; return $this;
} }
public function getTopLeftXOffset() public function getTopLeftXOffset(): int
{ {
return $this->topLeftXOffset; return $this->topLeftXOffset;
} }
/**
* @param int $yOffset
*
* @return $this
*/
public function setTopLeftYOffset($yOffset) public function setTopLeftYOffset($yOffset)
{ {
$this->topLeftYOffset = $yOffset; $this->topLeftYOffset = $yOffset;
@ -510,7 +520,7 @@ class Chart
return $this; return $this;
} }
public function getTopLeftYOffset() public function getTopLeftYOffset(): int
{ {
return $this->topLeftYOffset; return $this->topLeftYOffset;
} }
@ -518,15 +528,15 @@ class Chart
/** /**
* Set the Bottom Right position of the chart. * Set the Bottom Right position of the chart.
* *
* @param string $cell * @param string $cellAddress
* @param int $xOffset * @param int $xOffset
* @param int $yOffset * @param int $yOffset
* *
* @return $this * @return $this
*/ */
public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null) public function setBottomRightPosition($cellAddress = '', $xOffset = null, $yOffset = null)
{ {
$this->bottomRightCellRef = $cell; $this->bottomRightCellRef = $cellAddress;
if ($xOffset !== null) { if ($xOffset !== null) {
$this->setBottomRightXOffset($xOffset); $this->setBottomRightXOffset($xOffset);
} }
@ -551,19 +561,22 @@ class Chart
]; ];
} }
public function setBottomRightCell($cell) /**
* Set the Bottom Right cell for the chart.
*
* @return $this
*/
public function setBottomRightCell(string $cellAddress = '')
{ {
$this->bottomRightCellRef = $cell; $this->bottomRightCellRef = $cellAddress;
return $this; return $this;
} }
/** /**
* Get the cell address where the bottom right of the chart is fixed. * Get the cell address where the bottom right of the chart is fixed.
*
* @return string
*/ */
public function getBottomRightCell() public function getBottomRightCell(): string
{ {
return $this->bottomRightCellRef; return $this->bottomRightCellRef;
} }
@ -602,6 +615,11 @@ class Chart
]; ];
} }
/**
* @param int $xOffset
*
* @return $this
*/
public function setBottomRightXOffset($xOffset) public function setBottomRightXOffset($xOffset)
{ {
$this->bottomRightXOffset = $xOffset; $this->bottomRightXOffset = $xOffset;
@ -609,11 +627,16 @@ class Chart
return $this; return $this;
} }
public function getBottomRightXOffset() public function getBottomRightXOffset(): int
{ {
return $this->bottomRightXOffset; return $this->bottomRightXOffset;
} }
/**
* @param int $yOffset
*
* @return $this
*/
public function setBottomRightYOffset($yOffset) public function setBottomRightYOffset($yOffset)
{ {
$this->bottomRightYOffset = $yOffset; $this->bottomRightYOffset = $yOffset;
@ -621,7 +644,7 @@ class Chart
return $this; return $this;
} }
public function getBottomRightYOffset() public function getBottomRightYOffset(): int
{ {
return $this->bottomRightYOffset; return $this->bottomRightYOffset;
} }

View File

@ -226,7 +226,10 @@ class Xlsx extends BaseReader
$worksheets = []; $worksheets = [];
foreach ($relsWorkbook->Relationship as $elex) { foreach ($relsWorkbook->Relationship as $elex) {
$ele = self::getAttributes($elex); $ele = self::getAttributes($elex);
if ((string) $ele['Type'] === "$namespace/worksheet") { if (
((string) $ele['Type'] === "$namespace/worksheet") ||
((string) $ele['Type'] === "$namespace/chartsheet")
) {
$worksheets[(string) $ele['Id']] = $ele['Target']; $worksheets[(string) $ele['Id']] = $ele['Target'];
} }
} }
@ -512,6 +515,12 @@ class Xlsx extends BaseReader
case Namespaces::PURL_WORKSHEET: case Namespaces::PURL_WORKSHEET:
$worksheets[(string) $ele['Id']] = $ele['Target']; $worksheets[(string) $ele['Id']] = $ele['Target'];
break;
case Namespaces::CHARTSHEET:
if ($this->includeCharts === true) {
$worksheets[(string) $ele['Id']] = $ele['Target'];
}
break; break;
// a vbaProject ? (: some macros) // a vbaProject ? (: some macros)
case Namespaces::VBA: case Namespaces::VBA:
@ -690,6 +699,13 @@ class Xlsx extends BaseReader
continue; continue;
} }
$sheetReferenceId = (string) self::getArrayItem(self::getAttributes($eleSheet, $xmlNamespaceBase), 'id');
if (isset($worksheets[$sheetReferenceId]) === false) {
++$countSkippedSheets;
$mapSheetId[$oldSheetId] = null;
continue;
}
// Map old sheet id in original workbook to new sheet id. // Map old sheet id in original workbook to new sheet id.
// They will differ if loadSheetsOnly() is being used // They will differ if loadSheetsOnly() is being used
$mapSheetId[$oldSheetId] = $oldSheetId - $countSkippedSheets; $mapSheetId[$oldSheetId] = $oldSheetId - $countSkippedSheets;
@ -701,7 +717,8 @@ class Xlsx extends BaseReader
// and we're simply bringing the worksheet name in line with the formula, not the // and we're simply bringing the worksheet name in line with the formula, not the
// reverse // reverse
$docSheet->setTitle((string) $eleSheetAttr['name'], false, false); $docSheet->setTitle((string) $eleSheetAttr['name'], false, false);
$fileWorksheet = (string) $worksheets[(string) self::getArrayItem(self::getAttributes($eleSheet, $xmlNamespaceBase), 'id')];
$fileWorksheet = (string) $worksheets[$sheetReferenceId];
$xmlSheet = $this->loadZipNoNamespace("$dir/$fileWorksheet", $mainNS); $xmlSheet = $this->loadZipNoNamespace("$dir/$fileWorksheet", $mainNS);
$xmlSheetNS = $this->loadZip("$dir/$fileWorksheet", $mainNS); $xmlSheetNS = $this->loadZip("$dir/$fileWorksheet", $mainNS);
@ -1195,6 +1212,7 @@ class Xlsx extends BaseReader
$drawings[(string) $ele['Id']] = self::dirAdd("$dir/$fileWorksheet", $ele['Target']); $drawings[(string) $ele['Id']] = self::dirAdd("$dir/$fileWorksheet", $ele['Target']);
} }
} }
if ($xmlSheet->drawing && !$this->readDataOnly) { if ($xmlSheet->drawing && !$this->readDataOnly) {
$unparsedDrawings = []; $unparsedDrawings = [];
$fileDrawing = null; $fileDrawing = null;
@ -1203,6 +1221,7 @@ class Xlsx extends BaseReader
$fileDrawing = $drawings[$drawingRelId]; $fileDrawing = $drawings[$drawingRelId];
$drawingFilename = dirname($fileDrawing) . '/_rels/' . basename($fileDrawing) . '.rels'; $drawingFilename = dirname($fileDrawing) . '/_rels/' . basename($fileDrawing) . '.rels';
$relsDrawing = $this->loadZipNoNamespace($drawingFilename, $xmlNamespaceBase); $relsDrawing = $this->loadZipNoNamespace($drawingFilename, $xmlNamespaceBase);
$images = []; $images = [];
$hyperlinks = []; $hyperlinks = [];
if ($relsDrawing && $relsDrawing->Relationship) { if ($relsDrawing && $relsDrawing->Relationship) {
@ -1223,6 +1242,7 @@ class Xlsx extends BaseReader
} }
} }
} }
$xmlDrawing = $this->loadZipNoNamespace($fileDrawing, ''); $xmlDrawing = $this->loadZipNoNamespace($fileDrawing, '');
$xmlDrawingChildren = $xmlDrawing->children(Namespaces::SPREADSHEET_DRAWING); $xmlDrawingChildren = $xmlDrawing->children(Namespaces::SPREADSHEET_DRAWING);
@ -1401,6 +1421,27 @@ class Xlsx extends BaseReader
} }
} }
} }
if ($xmlDrawingChildren->absoluteAnchor) {
foreach ($xmlDrawingChildren->absoluteAnchor as $absoluteAnchor) {
if (($this->includeCharts) && ($absoluteAnchor->graphicFrame)) {
$graphic = $absoluteAnchor->graphicFrame->children(Namespaces::DRAWINGML)->graphic;
/** @var SimpleXMLElement $chartRef */
$chartRef = $graphic->graphicData->children(Namespaces::CHART)->chart;
$thisChart = (string) self::getAttributes($chartRef, $xmlNamespaceBase);
$width = Drawing::EMUToPixels((int) self::getArrayItem(self::getAttributes($absoluteAnchor->ext), 'cx')[0]);
$height = Drawing::EMUToPixels((int) self::getArrayItem(self::getAttributes($absoluteAnchor->ext), 'cy')[0]);
$chartDetails[$docSheet->getTitle() . '!' . $thisChart] = [
'fromCoordinate' => 'A1',
'fromOffsetX' => 0,
'fromOffsetY' => 0,
'width' => $width,
'height' => $height,
'worksheetTitle' => $docSheet->getTitle(),
];
}
}
}
if (empty($relsDrawing) && $xmlDrawing->count() == 0) { if (empty($relsDrawing) && $xmlDrawing->count() == 0) {
// Save Drawing without rels and children as unparsed // Save Drawing without rels and children as unparsed
$unparsedDrawings[$drawingRelId] = $xmlDrawing->asXML(); $unparsedDrawings[$drawingRelId] = $xmlDrawing->asXML();
@ -1600,16 +1641,21 @@ class Xlsx extends BaseReader
$chartEntryRef = ltrim((string) $contentType['PartName'], '/'); $chartEntryRef = ltrim((string) $contentType['PartName'], '/');
$chartElements = $this->loadZip($chartEntryRef); $chartElements = $this->loadZip($chartEntryRef);
$objChart = Chart::readChart($chartElements, basename($chartEntryRef, '.xml')); $objChart = Chart::readChart($chartElements, basename($chartEntryRef, '.xml'));
if (isset($charts[$chartEntryRef])) { if (isset($charts[$chartEntryRef])) {
$chartPositionRef = $charts[$chartEntryRef]['sheet'] . '!' . $charts[$chartEntryRef]['id']; $chartPositionRef = $charts[$chartEntryRef]['sheet'] . '!' . $charts[$chartEntryRef]['id'];
if (isset($chartDetails[$chartPositionRef])) { if (isset($chartDetails[$chartPositionRef])) {
$excel->getSheetByName($charts[$chartEntryRef]['sheet'])->addChart($objChart); $excel->getSheetByName($charts[$chartEntryRef]['sheet'])->addChart($objChart);
$objChart->setWorksheet($excel->getSheetByName($charts[$chartEntryRef]['sheet'])); $objChart->setWorksheet($excel->getSheetByName($charts[$chartEntryRef]['sheet']));
$objChart->setTopLeftPosition($chartDetails[$chartPositionRef]['fromCoordinate'], $chartDetails[$chartPositionRef]['fromOffsetX'], $chartDetails[$chartPositionRef]['fromOffsetY']); // For oneCellAnchor or absoluteAnchor positioned charts,
// toCoordinate is not in the data. Does it need to be calculated?
if (array_key_exists('toCoordinate', $chartDetails[$chartPositionRef])) { if (array_key_exists('toCoordinate', $chartDetails[$chartPositionRef])) {
// For oneCellAnchor positioned charts, toCoordinate is not in the data. Does it need to be calculated? // twoCellAnchor
$objChart->setTopLeftPosition($chartDetails[$chartPositionRef]['fromCoordinate'], $chartDetails[$chartPositionRef]['fromOffsetX'], $chartDetails[$chartPositionRef]['fromOffsetY']);
$objChart->setBottomRightPosition($chartDetails[$chartPositionRef]['toCoordinate'], $chartDetails[$chartPositionRef]['toOffsetX'], $chartDetails[$chartPositionRef]['toOffsetY']); $objChart->setBottomRightPosition($chartDetails[$chartPositionRef]['toCoordinate'], $chartDetails[$chartPositionRef]['toOffsetX'], $chartDetails[$chartPositionRef]['toOffsetY']);
} else {
// oneCellAnchor or absoluteAnchor (e.g. Chart sheet)
$objChart->setTopLeftPosition($chartDetails[$chartPositionRef]['fromCoordinate'], $chartDetails[$chartPositionRef]['fromOffsetX'], $chartDetails[$chartPositionRef]['fromOffsetY']);
$objChart->setBottomRightPosition('', $chartDetails[$chartPositionRef]['width'], $chartDetails[$chartPositionRef]['height']);
} }
} }
} }

View File

@ -50,6 +50,8 @@ class Namespaces
const WORKSHEET = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet'; const WORKSHEET = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet';
const CHARTSHEET = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartsheet';
const SCHEMA_MICROSOFT = 'http://schemas.microsoft.com/office/2006/relationships'; const SCHEMA_MICROSOFT = 'http://schemas.microsoft.com/office/2006/relationships';
const EXTENSIBILITY = 'http://schemas.microsoft.com/office/2006/relationships/ui/extensibility'; const EXTENSIBILITY = 'http://schemas.microsoft.com/office/2006/relationships/ui/extensibility';

View File

@ -89,6 +89,9 @@ class Drawing extends WriterPart
$tl = $chart->getTopLeftPosition(); $tl = $chart->getTopLeftPosition();
$tlColRow = Coordinate::indexesFromString($tl['cell']); $tlColRow = Coordinate::indexesFromString($tl['cell']);
$br = $chart->getBottomRightPosition(); $br = $chart->getBottomRightPosition();
$isTwoCellAnchor = $br['cell'] !== '';
if ($isTwoCellAnchor) {
$brColRow = Coordinate::indexesFromString($br['cell']); $brColRow = Coordinate::indexesFromString($br['cell']);
$objWriter->startElement('xdr:twoCellAnchor'); $objWriter->startElement('xdr:twoCellAnchor');
@ -105,6 +108,17 @@ class Drawing extends WriterPart
$objWriter->writeElement('xdr:row', (string) ($brColRow[1] - 1)); $objWriter->writeElement('xdr:row', (string) ($brColRow[1] - 1));
$objWriter->writeElement('xdr:rowOff', self::stringEmu($br['yOffset'])); $objWriter->writeElement('xdr:rowOff', self::stringEmu($br['yOffset']));
$objWriter->endElement(); $objWriter->endElement();
} else {
$objWriter->startElement('xdr:absoluteAnchor');
$objWriter->startElement('xdr:pos');
$objWriter->writeAttribute('x', '0');
$objWriter->writeAttribute('y', '0');
$objWriter->endElement();
$objWriter->startElement('xdr:ext');
$objWriter->writeAttribute('cx', self::stringEmu($br['xOffset']));
$objWriter->writeAttribute('cy', self::stringEmu($br['yOffset']));
$objWriter->endElement();
}
$objWriter->startElement('xdr:graphicFrame'); $objWriter->startElement('xdr:graphicFrame');
$objWriter->writeAttribute('macro', ''); $objWriter->writeAttribute('macro', '');

View File

@ -0,0 +1,35 @@
<?php
namespace PhpOffice\PhpSpreadsheetTests\Reader\Xlsx;
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
use PHPUnit\Framework\TestCase;
class ChartSheetTest extends TestCase
{
public function testLoadChartSheetWithCharts(): void
{
$filename = 'tests/data/Reader/XLSX/ChartSheet.xlsx';
$reader = new Xlsx();
$reader->setIncludeCharts(true);
$spreadsheet = $reader->load($filename);
self::assertCount(2, $spreadsheet->getAllSheets());
$chartSheet = $spreadsheet->getSheetByName('Chart1');
self::assertInstanceOf(Worksheet::class, $chartSheet);
self::assertSame(1, $chartSheet->getChartCount());
}
public function testLoadChartSheetWithoutCharts(): void
{
$filename = 'tests/data/Reader/XLSX/ChartSheet.xlsx';
$reader = new Xlsx();
$reader->setIncludeCharts(false);
$spreadsheet = $reader->load($filename);
self::assertCount(1, $spreadsheet->getAllSheets());
$chartSheet = $spreadsheet->getSheetByName('Chart1');
self::assertNull($chartSheet);
}
}

View File

@ -77,4 +77,29 @@ class WorksheetInfoNamesTest extends TestCase
self::assertEquals($expected, $actual); self::assertEquals($expected, $actual);
} }
public function testListWorksheetNamesChartSheet(): void
{
$filename = 'tests/data/Reader/XLSX/ChartSheet.xlsx';
$reader = new Xlsx();
$actual = $reader->listWorksheetNames($filename);
$expected = ['Sheet1', 'Chart1'];
self::assertEquals($expected, $actual);
}
public function testListWorksheetInfoChartSheet(): void
{
$filename = 'tests/data/Reader/XLSX/ChartSheet.xlsx';
$reader = new Xlsx();
$actual = $reader->listWorksheetInfo($filename);
$chartSheetInfo = $actual[1];
self::assertSame('Chart1', $chartSheetInfo['worksheetName']);
self::assertSame(-1, $chartSheetInfo['lastColumnIndex']);
self::assertSame(0, $chartSheetInfo['totalRows']);
self::assertSame(0, $chartSheetInfo['totalColumns']);
}
} }

Binary file not shown.