tessera_ods 0.1.0
tessera_ods: ^0.1.0 copied to clipboard
OpenDocument (.ods) support for the tessera pivot-table engine: import a sheet as a data source, export a cube as a formatted sheet. Pure Dart.
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).
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);
export returns the document as a Uint8List, ready to write to a file
or hand to a download.
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.