Skip to content

word ole

zmworm edited this page Apr 29, 2026 · 17 revisions

Word: OLE Object

Embedded OLE objects (Visio diagrams, Excel charts, equations, Word documents, etc.) stored in the document. Full Add/Get/Set/Query/Remove lifecycle supported.

Path: (inline within paragraphs, detected via w:object elements)

Operations

  • add - Embed an OLE object
  • set - Modify display properties (progId, name, display, width, height)
  • get - Read OLE object properties and optionally extract the embedded binary
  • query - Find OLE objects by selector

set

Property Accepted Values Description
name text Display name
display content, icon Content preview or icon
width unit-qualified Display width (e.g., 6cm, 2in, 160pt)
height unit-qualified Display height

get Attributes

Canonical Format schema (cross-format consistent):

Attribute Type Description
progId string OLE ProgID (e.g., Visio.Drawing.15, Excel.Sheet.12, Word.Document.12, Package, Equation.3)
contentType string MIME type of the embedded content
fileSize number Size of embedded binary (bytes)
width string Display width (cm)
height string Display height (cm)
display string content or icon
name string Display name (from v:shape@alt or custom)
relId string Relationship ID of embedded part
previewImage string Path to extracted preview image (auto-converted EMF/WMF → PNG)
previewContentType string Preview image MIME type

Extract embedded binary

# Extract the embedded file to disk
officecli get report.docx '/body/p[3]/ole[1]' --save extracted.xlsx

Returns savedTo (path) and savedBytes (size) in addition to the standard attributes.

query

# Find all OLE objects (picture selector also includes OLE)
officecli query report.docx "ole"
officecli query report.docx "object"
officecli query report.docx "embed"

# Attribute filters
officecli query report.docx 'ole[progId=Excel.Sheet.12]'
officecli query report.docx 'ole[fileSize>1000]'
officecli query report.docx 'ole[progId~=Word]'

View Output

OLE object count appears in view outline:

File: report.docx | 12 paragraphs | 3 tables | 2 images | 1 OLE object

Notes

  • OLE preview images in .emf or .wmf format are auto-converted to PNG for AI inspection and browser rendering.
  • HTML preview renders web-compatible preview images directly; metafile placeholders are shown with sized boxes.
  • ProgID auto-detected from source file extension when omitted in Add.
  • ProgID validation: ≤39 chars, no leading digit, valid COM characters.
  • Empty or locked source files emit friendly stderr warnings.
  • Resident mode supports add/set/remove/swap/get --save for OLE.

See Also


Based on OfficeCLI v1.0.64

Clone this wiki locally