tessera_ods
OpenDocument Spreadsheet (.ods — LibreOffice Calc, Collabora, …)
support for the tessera pivot-table engine:
OdsDataSource— aDataSourcethat streams the rows of one sheet, so a document can be inferred and imported like a CSV file (including in an isolate, vialoadFactsInIsolate).OdsCubeExporter— writes aCubeLayout(the expanded rows and columns exactly as shown) as a formatted sheet: merged group headers in the "rotated L" shape, level shading, bold summaries, frozen headers, localized labels throughTesseraStrings, looks from the engine'sCubeExportTheme(shared withtessera_xlsx).OdsTableExporter— writes anExportTable(plain rows, or a wholeFactTablethroughExportTable.ofFacts) as a filterable data table rather than a pivot: filter buttons on the header row, the header frozen and repeated on printed pages, real numbers, booleans and dates, number formats per column, the engine'sTableExportTheme— the counterpart oftessera_xlsx'sXlsxTableExporter.
Pure Dart, no Flutter dependency — works in Flutter apps, on servers and in command-line tools alike.
import 'package:tessera_ods/tessera_ods.dart';
final source = OdsDataSource.fromData(bytes, name: 'sales.ods');
final result = await loadFacts(source);
final ods = OdsCubeExporter(
strings: TesseraStrings.forLanguage('hu')!,
theme: CubeExportTheme.brand(primary: 0xFF00695C),
).export(cube.layout);
final table = const OdsTableExporter().export(
ExportTable.ofFacts(result.facts, filter: cube.spec.filter),
);
export returns the document as a Uint8List, ready to write to a file
or hand to a download.
User guide: github.com/nagylzs/tessera/docs — data sources, schema, cubes, aggregates, filters, the expression language, widgets, theming, export, localization, saving, large data.
Example
example/main.dart does the whole round trip from
the command line — read example/sales.ods, infer and import, build a
region/country × year/quarter cube with every region expanded, write it
as sales_pivot.ods:
dart run example/main.dart [input.ods] [output.ods]
License
MIT — see LICENSE. Author: László Zsolt Nagy.
Libraries
- tessera_ods
- OpenDocument Spreadsheet (
.ods) support for thetesserapivot-table engine.