#!/bin/bash # sparklines.sh — exercise the full xlsx `sparkline` element (in-cell mini charts) # (schemas/help/xlsx/sparkline.json) using the officecli CLI. # # One dashboard sheet: a label column + 12 months of trend data per row, with a # sparkline placed in the cell adjacent to each data row so the result reads like # a real KPI dashboard. Demonstrates all three sparkline kinds (line / column / # winLoss) plus every point-highlight, marker, colour and line-weight prop the # element declares. # # CLI twin of sparklines.py (officecli SDK); both produce an equivalent # sparklines.xlsx. # # Each sparkline is one `add` against the sheet: type= picks the kind, # dataRange= is the source values, location= is the target cell. The group is # stored under the x14 extension list and renders a tiny inline chart. # NOTE: intentionally NO `set -e`. Like the SDK twin's doc.batch, this script # tolerates forward-compat 'UNSUPPORTED props' warnings (officecli exit 2) and # keeps building so the full document is produced. FILE="$(dirname "$0")/sparklines.xlsx" echo "Building $FILE ..." rm -f "$FILE" officecli create "$FILE" officecli open "$FILE" # helper: write a data row — label in A, 12 monthly values across B..M row() { # row