Skip to main content

tessera_ods 0.2.2 copy "tessera_ods: ^0.2.2" to clipboard
tessera_ods: ^0.2.2 copied to clipboard

OpenDocument (.ods) support for the tessera pivot-table engine: import a sheet as a data source, export a cube or a plain table as a formatted sheet. Pure Dart.

tessera_ods #

OpenDocument Spreadsheet (.ods — LibreOffice Calc, Collabora, …) support for the tessera pivot-table engine:

  • OdsDataSource — a DataSource that streams the rows of one sheet, so a document can be inferred and imported like a CSV file (including in an isolate, via loadFactsInIsolate).
  • OdsCubeExporter — writes a CubeLayout (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 through TesseraStrings, looks from the engine's CubeExportTheme (shared with tessera_xlsx).
  • OdsTableExporter — writes an ExportTable (plain rows, or a whole FactTable through ExportTable.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's TableExportTheme — the counterpart of tessera_xlsx's XlsxTableExporter.

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.

0
likes
160
points
444
downloads

Documentation

API reference

Publisher

verified publishernagylzs.eu

Weekly Downloads

OpenDocument (.ods) support for the tessera pivot-table engine: import a sheet as a data source, export a cube or a plain table as a formatted sheet. Pure Dart.

Repository (GitHub)
View/report issues

Topics

#pivot-table #ods #opendocument #export #import

License

MIT (license)

Dependencies

archive, tessera, xml

More

Packages that depend on tessera_ods