Classic selected group insertion
Insert a selected group into an existing drawing
The concrete Classic TXLSWorksheet.CopyGroup methods copy a represented group and its descendants into the destination worksheet's existing drawing, either as an outer user group or as the last child of an existing target group
The finite profile uses the axis-aligned nested group model: ordinary rectangle and textbox leaves, embedded picture frames, supported simple image fills, current typed text, explicit fill and line properties and mapped text-run fonts
Source and destination may be different worksheets in one Workbook, different Workbooks or the same drawing; an already inserted group can be selected again, including a parent that contains previously inserted descendants
Existing destination model and wrapper objects retain their identity and content; insertion adds its own independently owned typed subtree and retained structural fragment
CopyGroup overloads
| Concrete worksheet method | Placement |
|---|---|
CopyGroup(ASourceSheet: TXLSWorksheet; ASourceGroup: TXLSShapeGroup; ARow1, ACol1, ARow2, ACol2: Integer): TXLSShapeGroup | Insert an outer group with a worksheet client anchor |
CopyGroup(ASourceSheet: TXLSWorksheet; ASourceGroup, ATargetParent: TXLSShapeGroup; const ALocalBounds: TXLSShapeLocalRect): TXLSShapeGroup | Insert a child group in an existing destination parent's local coordinate domain |
These methods belong to the concrete TXLSWorksheet class; obtain concrete sheets from the TXLSWorkbook class API rather than expecting a worksheet interface member
The supplied source group must belong to ASourceSheet, and ATargetParent must be a non-nil group owned by the destination drawing
Outer placement uses 1-based rows 1..65536 and columns 1..256, with ARow2>ARow1 and ACol2>ACol1; fractional offsets reset to zero
Child placement uses signed 32-bit parent-local bounds with positive width and height; the copied group's own CoordinateBounds and descendant coordinates remain separate and retain their original domains
The returned wrapper is borrowed from the destination Workbook; keep that Workbook alive and do not free the wrapper independently
Destination identities and resources
Insertion allocates unique nonzero unsigned sixteen-bit host object identities and preserves existing destination identities; subsequent ordinary shape creation searches for an available identity, including when the previous identity was 65535
Embedded image references map by actual compatible image identity, reusing matching destination entries and recording each real use; distinct frame and non-frame fill images receive their own required destination entries
Text-run fonts migrate by their represented values rather than numeric source indexes; cross-Workbook indexed font colors require equal resolved colors or explicit refusal, and the reserved BIFF font index remains unavailable
The destination retains its theme and existing formatting; the admitted unchanged Theme package follows its separate persistence contract
The admitted alternate DrawingML shape cache follows the existing bounded copy rule; copied typed objects do not replay stale source text, coordinates or shape identities from that cache
Ownership and later operations
Source ranges and embedded image sources use retained lifetime-managed leases; release the source Workbook after a successful copy and continue editing, saving and normally reopening the destination
The destination's registry binds each inserted owner to its structural fragment, so nested insertion and selected recopy traverse the correct owners and emit each imported shape once
Existing ungrouped outside leaves retain their individual deletion and replacement behavior; arbitrary group deletion, grouped-child deletion and general reparenting remain outside this profile
Sheets.AddCopy explicitly refuses a source drawing that still has live inserted fragments, for both fresh and imported drawings, before creating a destination worksheet; save and normally reopen that source to obtain a single physical tree before using the qualified whole-worksheet copy path
Failure boundaries
Placement, source and parent ownership, unsupported drawing references, object capacity and aggregate structural budgets are checked before publication; a destination read lease refuses mutation through the existing Workbook write guard
The qualified allocation-failure controls preserve existing models, wrappers, parent children, fragment ownership, image catalog membership and use counts, object allocation state and view generation, followed by a healthy retry
Font-pool changes and font reference bookkeeping may remain after a failed operation, including updates to reused font references and newly appended entries; insertion does not provide whole-Workbook or complete font-pool rollback
These are synchronous ownership and publication controls, without a concurrent mutation guarantee or a general transactional copy engine
Finite admission
The combined drawing retains a 65536-node physical metadata budget and a 64-level traversal budget, including its structural overhead; parent walks reject cyclic or overdeep chains
Destination host object identities remain unsigned sixteen-bit, image catalogs retain the existing 4095-entry bound and font admission conservatively checks destination catalog capacity; these limits do not widen the file format or establish a whole-save memory ceiling
Remaining drawing boundaries
General connector and solver references, unknown reference-bearing owner chains, broader workbook defaults, additional shape classes, rotation, flips and arbitrary topology editing remain unsupported
The other original wide typed-metadata, source-copy and narrow compatibility requirements in compound storage remain separate work
Native acceptance covers normal Open, SaveAs and reopen with current typed content, fonts, fills, lines, embedded images and independently predicted nested geometry; it does not establish universal OfficeArt transport or pixel-level rendering parity
Source-effective line visibility
See local use flags, known document defaults and copy closure for the finite visibility profile and retained alternate-cache boundary