Skip to content

Corrupted Xlsx when Drawing inserted to page with printing settings #1561

@konovalovk

Description

@konovalovk

This is:

  • a bug report

What is the expected behavior?

Xlsx file should be opened with no issue.

What is the current behavior?

Corrupted Xlsx when Drawing inserted to page with printing settings.

What are the steps to reproduce?

Create empty Xlsx file, define printing settings like the screenshot.

The code below behaves different:

  • if there are no printing settings - file is ok, image inserted successfully
  • if there is some printing setting like 1-page-width - MS office opens file with warning

изображение

	$book = PhpOffice\PhpSpreadsheet\IOFactory::load('1.xlsx');
	$image = new PhpOffice\PhpSpreadsheet\Worksheet\Drawing();
	$image->setPath('1.jpg')->setCoordinates('F10')->setHeight(50);
	$image->setWorksheet($book->getActiveSheet());
	$writer = new PhpOffice\PhpSpreadsheet\Writer\Xlsx($book);
	$writer->save('2.xlsx');

Which versions of PhpSpreadsheet and PHP are affected?

1.14, 1.13

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions