mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-29 21:26:48 -06:00
A macro is plain data in the model (model/src/macros.rs): a name, a description, an optional shortcut, declared inputs (shape, header, column types, non-empty, default reference), steps, an output rule (anchor and what to do on a conflict) and the commands it may run that read or write files. A step runs a command (id and params) or is one of three bounded control steps: Repeat over the rows or columns of a range, If on one cell's value, and Stop with a message. Every step carries enabled, breakpoint and note flags. These are GridCraft macros, not VBA; a VBA project in a file stays preserved and is never run. Workbook::macros holds them. The JSON format keeps the field. In xlsx, io::save_bytes writes each macro as one chunked hidden-name item, _gc_macro_<n>, and io::open_bytes takes the items back out of the names, so the names never linger in the open document. Limits are checked whenever a macro is read from a file or a command: at most 1,000 macros, 10,000 steps each, Repeat and If nested 4 deep, names and notes of bounded length, and at most 4,194,304 characters of JSON, so that saving a workbook never fails because of a macro; nesting is checked before the steps are deserialized. What is over or damaged is dropped with one warning, and clashing names get a suffix. Automate scripts keep their own storage (_sc_scripts) and are neither read nor changed by this.
18 lines
446 B
TOML
18 lines
446 B
TOML
[package]
|
|
name = "gridcraft-model"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
description = "GridCraft document model: workbooks, sheets, cells, styles, tables, charts"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[dependencies]
|
|
gridcraft-core = { workspace = true }
|
|
sha2 = { workspace = true }
|
|
gridcraft-formula = { workspace = true }
|
|
serde = { workspace = true }
|
|
serde_json = { workspace = true }
|
|
thiserror = { workspace = true }
|