mirror of
https://github.com/storytold/gridcraft.git
synced 2026-11-07 19:12:40 +00:00
Buttons, scroll bars (sliders) and spin buttons are written the three ways the published formats describe: a control properties part (xl/ctrlProps/ctrlPropN.xml, formControlPr with objectType, fmlaLink, min, max, inc, page, val and horiz), a <control> in the sheet's <controls> inside mc:AlternateContent with its anchor, print and locked flags and a button's macro="[0]!Name", and a VML shape with x:ClientData. Notes and controls share one VML drawing per sheet; shape ids come from 1024-id blocks listed in the drawing's idmap (after the blocks kept header and footer drawings use), notes first, so each control's shapeId names its VML shape. Reading prefers the properties part, takes the caption from the VML text box and falls back to the VML alone for files that only have it. Values are clamped to whole numbers 0..30000 and repaired to pass the model's rules. Form controls of other kinds (check boxes, list boxes, drop-downs) stay with pass-through: the reader returns the shape numbers it modelled, and pass-through keeps the rest of the <controls> element and VML drawing without them. On save, modelled controls join the kept <controls> element and take a fresh shape block in the kept drawing, so a sheet with both round-trips without duplicates. Properties part names are reserved so kept parts of other sheets don't collide with them. Button actions xlsx has no place for (commands, fixed inputs, output cells) travel in a chunked hidden name keyed by sheet and position, and are taken back out on open. The streaming sheet parser now splits only shallow <row> elements, so an anchor's <xdr:row> inside <controls> stays in the tree.