mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-15 04:26:25 +00:00
9fcfa4b7ec
* Xlsx Support Flipping of Image Fix #731. Opened over 5 years ago, probably the second oldest problem I've worked on. Images attached to an Xlsx spreadsheet can be rotated, which is supported by PhpSpreadsheet. They can also be flipped along their horizontal and/or vertical axes, and that has not been supported. This PR adds that support. * Update CHANGELOG.md
39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Reader\Xlsx;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Reader\Xlsx;
|
|
use PhpOffice\PhpSpreadsheetTests\Functional\AbstractFunctional;
|
|
|
|
class Issue731Test extends AbstractFunctional
|
|
{
|
|
private static string $testbook = 'tests/data/Reader/XLSX/issue.731.xlsx';
|
|
|
|
public function testRotateAndFlipImages(): void
|
|
{
|
|
$reader = new Xlsx();
|
|
$spreadsheet = $reader->load(self::$testbook);
|
|
$reloadedSpreadsheet = $this->writeAndReload($spreadsheet, 'Xlsx');
|
|
$spreadsheet->disconnectWorksheets();
|
|
$reloadedSheet = $reloadedSpreadsheet->getActiveSheet();
|
|
$expected = [
|
|
[0, false, false],
|
|
[90, false, false],
|
|
[270, false, false],
|
|
[0, false, true],
|
|
[0, true, false],
|
|
[20, false, false],
|
|
[20, false, true],
|
|
[0, true, true],
|
|
];
|
|
$actual = [];
|
|
foreach ($reloadedSheet->getDrawingCollection() as $drawing) {
|
|
$actual[] = [$drawing->getRotation(), $drawing->getFlipHorizontal(), $drawing->getFlipVertical()];
|
|
}
|
|
self::assertSame($expected, $actual);
|
|
$reloadedSpreadsheet->disconnectWorksheets();
|
|
}
|
|
}
|