Workbook Viewer
<!-- GENERATED by build/scripts/gen-viewer-pages.py from viewers/poka-workbook-viewer/plugin.json, viewers/poka-workbook-viewer/src/main.rs, core/proto/preview.proto and FILE_FORMATS.csv. Do not edit by hand: change the source, then run the script. -->poka-workbook-viewer · version 1.0.0 · poka-workbook-viewer.wasm
What it does
From the crate's //! header:
Poka viewer: render a WorkbookAst (protobuf) on stdin as HTML on
stdout. The host wraps the HTML in an HtmlPreview response.
A workbook is several named sheets, each holding one or more tables — the
shape Apple Numbers has and TableAst deliberately does not. Sheets
become a tab bar; the document's own thumbnail, when it ships one, gets a
tab of its own so it stays reachable without pushing the grids down.
The tab bar is plain CSS: a radio input per sheet and a sibling selector, so it works in the desktop webview, the browser and the mobile shell with no script.
A table with a TableLook beside it (a spreadsheet's own formatting) is
drawn as that spreadsheet draws it: white cells on grid lines, row
numbers, the file's fonts, colours, borders, column widths and merged
ranges, and the formula behind a value on hover. Colours and font names
reach a style attribute only in a checked shape.
See preview.proto § "Parser → Viewer composition ABI" for the shape.
Limits
| Memory cap | 32 MB |
| Time cap | 5000 ms |
A module that exceeds either is killed and reported.
What it takes
Stdin is one of these messages, exactly the bytes the parser wrote (core/proto/preview.proto, "Parser → Viewer composition ABI"):
WorkbookAst
A spreadsheet document with more than one sheet: Apple Numbers, and any future format where one file holds several named grids. TableAst stays the single-grid shape that CSV, DBF, parquet and the rest emit; a workbook is its own message so those parsers and viewers are untouched. preview_image carries the document's own rendered thumbnail when it has one (Numbers packages ship a preview.jpg of the first sheet). The viewer shows it beside the sheet tabs; it is not a substitute for the grids. Viewer: poka-workbook-viewer.
| Field | Type | Comment |
|---|---|---|
filename |
string |
Name of the previewed file |
file_size |
uint64 |
Size of the previewed file, in bytes |
source_format |
string |
Free-form, e.g. "Apple Numbers (6 sheets)" |
sheets |
repeated WorkbookSheet |
The workbook's sheets |
preview_image |
bytes |
Optional rendered thumbnail |
preview_image_format |
string |
"jpeg" / "png", empty when no image |
facts |
FileFacts |
Per-format facts for the file-information panel (#182); additive. |
Used by
<!-- USED-BY:BEGIN -->9 format(s) in FILE_FORMATS.csv name this viewer.
| Format | Parser | Extensions |
|---|---|---|
| COBIE | poka-cobie |
.cobie |
| GNUMERIC | poka-gnumeric |
.gnumeric |
| NUMBERS | poka-numbers |
.numbers |
| TAB | poka-tab |
.tab |
| XER | poka-xer |
.xer |
| XLS | poka-xls |
.xls |
| XLSM | poka-xlsm |
.xlsm |
| XLSX | poka-xlsx |
.xlsx |
| XLT | poka-xlt |
.xlt |
This list is read from FILE_FORMATS.csv of a local poka-parsers checkout. It is current only as of the last run of the generator with that checkout.