@@ -108,6 +108,13 @@ class Worksheet
108108 */
109109 private ArrayObject $ drawingCollection ;
110110
111+ /**
112+ * Collection of drawings.
113+ *
114+ * @var ArrayObject<int, BaseDrawing>
115+ */
116+ private ArrayObject $ inCellDrawingCollection ;
117+
111118 /**
112119 * Collection of Chart objects.
113120 *
@@ -334,6 +341,8 @@ public function __construct(?Spreadsheet $parent = null, string $title = 'Worksh
334341 $ this ->sheetView = new SheetView ();
335342 // Drawing collection
336343 $ this ->drawingCollection = new ArrayObject ();
344+ // In Cell Drawing collection
345+ $ this ->inCellDrawingCollection = new ArrayObject ();
337346 // Chart collection
338347 $ this ->chartCollection = new ArrayObject ();
339348 // Protection
@@ -371,7 +380,7 @@ public function __destruct()
371380 ?->clearCalculationCacheForWorksheet($ this ->title );
372381
373382 $ this ->disconnectCells ();
374- unset($ this ->rowDimensions , $ this ->columnDimensions , $ this ->tableCollection , $ this ->drawingCollection , $ this ->chartCollection , $ this ->autoFilter );
383+ unset($ this ->rowDimensions , $ this ->columnDimensions , $ this ->tableCollection , $ this ->drawingCollection , $ this ->inCellDrawingCollection , $ this -> chartCollection , $ this ->autoFilter );
375384 }
376385
377386 /**
@@ -519,6 +528,16 @@ public function getDrawingCollection(): ArrayObject
519528 return $ this ->drawingCollection ;
520529 }
521530
531+ /**
532+ * Get collection of drawings.
533+ *
534+ * @return ArrayObject<int, BaseDrawing>
535+ */
536+ public function getInCellDrawingCollection (): ArrayObject
537+ {
538+ return $ this ->inCellDrawingCollection ;
539+ }
540+
522541 /**
523542 * Get collection of charts.
524543 *
@@ -3730,6 +3749,13 @@ public function __clone()
37303749 $ newDrawing = clone $ item ;
37313750 $ newDrawing ->setWorksheet ($ this );
37323751 }
3752+ } elseif ($ key === 'inCellDrawingCollection ' ) {
3753+ $ currentCollection = $ this ->inCellDrawingCollection ;
3754+ $ this ->inCellDrawingCollection = new ArrayObject ();
3755+ foreach ($ currentCollection as $ item ) {
3756+ $ newDrawing = clone $ item ;
3757+ $ newDrawing ->setWorksheet ($ this );
3758+ }
37333759 } elseif ($ key === 'tableCollection ' ) {
37343760 $ currentCollection = $ this ->tableCollection ;
37353761 $ this ->tableCollection = new ArrayObject ();
0 commit comments