Skip to content

ppt ole

zmworm edited this page Apr 29, 2026 · 16 revisions

PowerPoint: OLE Object

Embedded OLE objects (Word documents, Excel workbooks, PDFs, Visio diagrams, etc.) placed on a slide inside a p:graphicFrame wrapper. PowerPoint can render them either as an inline preview (display=content) or a clickable icon (display=icon, default). Full Add/Set/Get/Query/Remove lifecycle supported.

Path: /slide[N]/ole[M] (1-based, per slide)

Aliases accepted in selectors and --type: ole, oleobject, object, embed, embeddedobject.

Operations

  • add - Embed an OLE object on a slide
  • set - Replace source, toggle display, reposition, or rename
  • get - Read OLE object properties and optionally extract the embedded binary
  • query - Find OLE objects by selector
  • remove - Delete the graphic frame + backing embedded part + icon image (no orphans)

set

Path: /slide[N]/ole[M]

Property Accepted Values Description
src / path file path Replace the embedded payload. ProgID is auto-refreshed from the new extension unless progId is also set in the same call. Old part is deleted.
progId valid ProgID Override the OLE ProgID (e.g. Word.Document.12, Excel.Sheet.12, Package).
name text Display name surfaced on the graphic frame (stored in p:oleObj@name and the frame's non-visual drawing properties).
display icon, content Toggle p:oleObj/@showAsIcon. icon renders the icon preview; content renders the live embedded payload.
x, y EMU or unit-qualified (2cm, 1in, 72pt) Top-left position on the slide (may be negative for off-slide anchors).
width, height EMU or unit-qualified Display size. Must be non-negative (ST_PositiveCoordinate).

Examples

# Swap the embedded file (progId auto-refreshes from extension)
officecli set deck.pptx /slide[1]/ole[1] --prop src=updated-memo.docx

# Toggle to inline content preview
officecli set deck.pptx /slide[1]/ole[1] --prop display=content

# Reposition and resize
officecli set deck.pptx /slide[1]/ole[1] --prop x=3cm --prop y=5cm --prop width=10cm --prop height=6cm

# Rename the object (shown by accessibility tools and hover tooltip)
officecli set deck.pptx /slide[1]/ole[1] --prop name="Q4 Revenue Model"

get Attributes

Canonical Format schema (shared with Word/Excel OLE where applicable):

Attribute Type Description
objectType string Always ole
progId string OLE ProgID (e.g. Excel.Sheet.12, Word.Document.12, Package)
name string Display name (p:oleObj@name)
display string icon (ShowAsIcon=true) or content (ShowAsIcon=false)
width string Display width (unit-qualified, e.g. 6cm) — sourced from the frame's xfrm/ext
height string Display height (unit-qualified)
contentType string MIME type of the embedded payload
fileSize number Size of embedded binary (bytes)
relId string Relationship ID of the embedded part
previewImage string Path to extracted preview image when available (auto-converted EMF/WMF → PNG)
previewContentType string Preview image MIME type

Extract embedded binary

# Read properties
officecli get deck.pptx /slide[1]/ole[1]

# Extract the embedded payload to disk
officecli get deck.pptx /slide[1]/ole[1] --save extracted.xlsx

--save adds savedTo (path) and savedBytes (size) to the standard attributes.

query

# Find all OLE objects across every slide
officecli query deck.pptx "ole"
officecli query deck.pptx "object"
officecli query deck.pptx "embed"

# Scope to one slide (either separator form)
officecli query deck.pptx "slide[2]>ole"
officecli query deck.pptx "/slide[2]/ole"

# Filter by ProgID
officecli query deck.pptx 'ole[progId=Excel.Sheet.12]'
officecli query deck.pptx 'ole[progId~=Word]'

# Filter by size
officecli query deck.pptx 'ole[fileSize>50000]'

remove

officecli remove deck.pptx /slide[2]/ole[1]

Removes the hosting p:graphicFrame, the backing embedded payload part, and the inner icon image part so no orphan parts remain.

view Output

OLE object count appears in view outline per slide. Preview images are surfaced via the previewImage attribute in get and rendered directly in HTML watch previews (metafile placeholders get sized boxes).

Notes

  • Default display mode is icon (matching PowerPoint's own default for embedded OLE) — set display=content on Add to show an inline live preview instead.
  • Icon preview uses a placeholder PNG when icon= is not supplied on Add. p:embed@followColorScheme="full" lets PowerPoint tint the icon with the current theme accent.
  • Shape ID is auto-generated to avoid clashing with other shapes on the slide.
  • Orphan parts are not indexed — embedded parts without a matching p:oleObj element are hidden from ole[M] so get/set/remove stay in lockstep. Use validate or raw package inspection to audit them.
  • ProgID auto-detection from the source file extension (.docxWord.Document.12, .xlsxExcel.Sheet.12, .pdf/unknown → Package).
  • ProgID validation: ≤39 chars, no leading digit, valid COM characters — see OleHelper.ValidateProgId.
  • Resident mode (officecli open) supports add/set/remove/swap/get --save for OLE.

See Also


Based on OfficeCLI v1.0.64

Clone this wiki locally