.pptx(@awacloud/ooxml'spptx.read()result) →oconv-ir/v2, tier 1 — one heading + N paragraphs per slide.
Module oconvPptxToIr (oconvPptxToIr) | Source packages/front/office/oconv/src/read/pptx-to-ir.js | Deps oconvIr, pptx | Worker-safe yes
Pure transformation over an already-parsed pptx.read(bytes) structure. There is no "section" node in the frozen IR vocabulary, so each slide contributes a flat run of top-level blocks in slide order.
Resolve
import { ModuleRuntime } from '@awacloud/fw/core/runtime.js';
import { fw_require, modules } from '@awacloud/oconv';
const runtime = new ModuleRuntime();
runtime.registerAll(fw_require);
runtime.registerAll(modules);
const pptx = runtime.resolve('pptx');
const { pptxToIr } = runtime.resolve('oconvPptxToIr');
API
| Member | Signature | Returns | Throws |
|---|---|---|---|
pptxToIr |
(readResult: object, opts?: {includeNotes?: boolean}) => {ir, losses} |
ir — an oconv-ir/v2 document; losses — {code, detail}[] |
— |
Examples
Convert a .pptx read result to IR
const { ir, losses } = pptxToIr(pptx.read(bytes), { includeNotes: false });
ir.kind; // 'document'
Notes
- Title — the first shape whose
placeholder.typeis'title'or'ctrTitle'; a title shape present but carrying no non-empty text counts as "no title" (lossslides/untitled). - Body — every other shape carrying a
txBody, in shape order, one IRparagraphper non-empty text paragraph. - Pictures — a
pictureshape is a block IRimageamong the body paragraphs, at its place in shape order:altitsdescription(else''),nameimage<k>.<ext>(kcounting the deck's distinct pictures, by their bytes, from 1 in reading order;extfrom the media type:png,jpg,gif,wmf,emf, elsebin), its bytes inescapes.pptx = { bytes, contentType }. One picture used on several slides is one name (one asset intoMd); a picture without bytes (a linked one) keeps its shape name, has no escapes and recordsimage/bytes-unavailable. A group shape — typed whenpptx.read()is giventypedGroups, whichoconv.toMdasks for — is walked in place, depth first: its text, pictures and media are read as the slide's. Read without that option, a group stays in the slide's raw_extrasand nothing inside one reaches this reader. includeNotesis a documented no-op for pptx:pptx.read()'s public return shape never surfaces speaker notes (nonotesfield on a slide, no relationship resolution tonotesSlide<n>.xml), so this reader never emits a notes blockquote and never recordsslides/notes-omittedfor pptx — the option is accepted only for frozen shape parity withoconvOdpToIr, whose underlying format does expose notes.- Loss codes this module emits:
slides/untitled,image/bytes-unavailable(a picture without bytes — a linked one; detail = its shape name),slides/media-dropped(atable/chart/graphicFrameshape, detail = itstype),slides/notes-omitted(never actually reachable for pptx — see above). - Layout and animations (
layoutRef, transitions) are permanently out of scope and never reach a per-node loss —pptx.read()'s public result does not even model them.
See also
- docs/api/README.md — full module index +
exportsboundary note oconvIr— the pivot this reader producesoconvOdpToIr— the ODF sister reader (notes ARE reachable there)- loss matrix