Skip to content

Commit bafbad2

Browse files
committed
Add tests
1 parent f34facf commit bafbad2

File tree

3 files changed

+316
-42
lines changed

3 files changed

+316
-42
lines changed

src/PhpSpreadsheet/Writer/Xlsx/Drawing.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -599,15 +599,13 @@ private static function writeAttributeIf(XMLWriter $objWriter, ?bool $condition,
599599
}
600600

601601
/**
602-
* Get pass-through drawing XML if available and no drawings have been modified.
602+
* Get pass-through drawing XML if available.
603+
*
604+
* Returns the original drawing XML stored during load (when Reader pass-through was enabled).
605+
* This preserves unsupported drawing elements (shapes, textboxes) that PhpSpreadsheet cannot parse.
603606
*/
604607
private function getPassThroughDrawingXml(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $worksheet): ?string
605608
{
606-
// Only use pass-through if no drawings have been added/modified programmatically
607-
if (count($worksheet->getDrawingCollection()) !== 0) {
608-
return null;
609-
}
610-
611609
$unparsedLoadedData = $worksheet->getParentOrThrow()->getUnparsedLoadedData();
612610
if (!isset($unparsedLoadedData['sheets']) || !is_array($unparsedLoadedData['sheets'])) {
613611
return null;

0 commit comments

Comments
 (0)