.ods(@awacloud/odf'sods.read()result) →oconv-ir/v1, tier 2 — one heading + one table per<table:table>.
Module oconvOdsToIr (oconvOdsToIr) | Source packages/front/office/oconv/src/read/ods-to-ir.js | Deps oconvIr, ods | Worker-safe yes
Pure transformation over an already-parsed ods.read(bytes) structure, composing @awacloud/odf's public surface only — same contract and loss vocabulary as oconvXlsxToIr, mirroring the docx/odt sister-pair pattern.
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 ods = runtime.resolve('ods');
const { odsToIr } = runtime.resolve('oconvOdsToIr');
API
| Member | Signature | Returns | Throws |
|---|---|---|---|
odsToIr |
(readResult: object, opts?: object) => {ir, losses} |
ir — an oconv-ir/v1 document; losses — {code, detail}[] |
— |
Examples
Convert an .ods read result to IR
const { ir, losses } = odsToIr(ods.read(bytes));
ir.kind; // 'document'
// measured on the vendored ods-structured.ods fixture:
// [{code:'sheet/formula-as-value', detail:'Data!R3C2'}]
Notes
- One IR
heading{level:1}+ one IRtableper<table:table>, in document order. - Unlike xlsx,
table:table-header-rowsIS a real public signal — the corresponding leading rows of the trimmed grid getrow.header: true. - Cell text uses the typed
office:value-typestring when present, otherwise the cell's raw paragraph children are text-extracted; a<table:covered-table-cell>always contributes''. table:number-rows-repeated/table:number-columns-repeatedare expanded, capped at 1000 (MAX_REPEAT) as a documented safety bound — real content repeats stay far below it, and a trailing "rest of the sheet is empty" repeat is trimmed away regardless by the same grid-normalisation stepoconvXlsxToIruses.- Loss codes this module emits:
sheet/formula-as-value,sheet/format-dropped(once per sheet, first cell carrying astyleName),sheet/merge-dropped(once per sheet, first cell withcolSpan/rowSpan> 1),sheet/chart-dropped(once per sheet, when the table carries atable:shapesextra). - Pivot tables are a matrix-level, permanently out-of-scope drop, same treatment as
oconvXlsxToIr.
See also
- docs/api/README.md — full module index +
exportsboundary note oconvIr— the pivot this reader producesoconvXlsxToIr— the OOXML sister reader, same loss vocabulary- loss matrix