ddn.odf.table
Packaged .ods spreadsheet document model and APIs.
This module provides the spreadsheet model with sheets, rows, columns, and cells for reading, writing, and creating OpenDocument Spreadsheet files.
Spreadsheet constructs
Fully typed:
- Sheets (
table:table) with name, style, print ranges - Rows (
table:table-row) with repetition, visibility, height - Columns (
table:table-column) with repetition, width, visibility - Cells (
table:table-cell) with typed values, formulas, styles - Cell value types: string, float, percentage, currency, boolean, date, time, void
- Formulas with namespace, expression, cached value
- Named expressions / named ranges
- Column/row repetition without forced expansion
Preservation-first:
- Filters, validations, database ranges
- Data pilot tables, conditional formatting
- Suite-specific extension elements
Types 8
Cell value type discriminant.
Maps to office:value-type attribute in ODF.
Represents a cell formula with namespace, expression, and cached result.
Formulas are preserved as-is without evaluation. The cached value and type are retained for round-trip fidelity.
Represents a single table cell.
Cells carry a typed value, optional formula, style reference, and repetition count. The columnsRepeated field maps to table:number-columns-repeated and indicates how many logical columns this cell occupies (default 1).
CellValueType valueTypestring valuestring stringValuestring currencystring dateValuestring timeValuestring booleanValueCellFormula formulastring styleNameint columnsRepeatedXmlElement rawElementRepresents a table column declaration.
Columns are separate from rows in ODF. The columnsRepeated field allows declaring multiple identical columns without repeating the element.
int columnIndexint columnsRepeatedstring styleNamestring defaultCellStyleNamebool isVisibleRepresents a table row.
Rows contain cells and may be repeated via number-rows-repeated.
SpreadsheetCell[] cellsint rowsRepeatedstring styleNamebool isVisiblestring defaultCellStyleNameint totalCellCount() @safe pure nothrow constReturns the number of logical cells (summing repetitions).Represents a named expression or named range.
Named ranges map a name to a formula expression (usually a range reference like $Sheet1.$A$1:.$C$10).
string namestring expressionstring baseCellAddressstring namespace_Represents a single sheet within a spreadsheet document.
Sheets contain rows, column declarations, and optional named expressions. Rows and columns are stored sparsely — repeated structures are not expanded.
string namestring styleNamestring printRangesSpreadsheetRow[] rowsSpreadsheetColumn[] columnsNamedExpression[] namedExpressionsOdfSheetChange trackedChangesXmlElement[] unknownElementsRepresents the office:spreadsheet body of an .ods document.
Contains all sheets and provides access to named expressions defined at the document level.
Functions 21
SpreadsheetSheet parseSheet(XmlElement tableElement)Parses a `table:table` XML element into a `SpreadsheetSheet`.OdfSpreadsheetBody parseSpreadsheetBody(XmlElement spreadsheetElement)Parses an `office:spreadsheet` XML element into an `OdfSpreadsheetBody`.OdfSpreadsheetBody emptySpreadsheetBody() @safe pure nothrow @nogcCreates an empty `OdfSpreadsheetBody`.CellFormula parseFormula(string formulaAttr) @safe pure nothrowParses a `table:formula` attribute value into a `CellFormula`.string cellValueTypeString(CellValueType t) @safe pure nothrowConverts a `CellValueType` to its ODF attribute string.CellValueType parseCellValueType(string s) @safe pure nothrowParses an `office:value-type` string into a `CellValueType`.string serializeSpreadsheetBody(const ref OdfSpreadsheetBody body)Serializes an `OdfSpreadsheetBody` to an `office:spreadsheet` XML string.SpreadsheetCell stringCell(string value, string styleName = "") @safe pure nothrowCreates a cell with a string value.SpreadsheetCell floatCell(string value, string styleName = "") @safe pure nothrowCreates a cell with a float value.SpreadsheetCell formulaCell(string formulaNs, string formulaExpr,
string cachedValue = "", CellValueType cachedType = CellValueType.VOID) @safe pure nothrowCreates a cell with a formula.SpreadsheetColumn column(int repeated = 1, string styleName = "") @safe pure nothrowCreates a column declaration.SpreadsheetSheet sheet(string name, SpreadsheetRow[] rows_ = null,
SpreadsheetColumn[] cols = null) @safe pure nothrowCreates a sheet with the given name, rows, and columns.