cycyexcel
中文0.2.0

ARCHITECTURE

Data structures

cyexcel uses a sparse WorkbookSnapshot. External object arrays are import sources, not live bindings.

Top-level structure

ts
{
  version: 1,
  sheetOrder: ["sheet-1"],
  sheets: {
    "sheet-1": {
      id: "sheet-1",
      name: "Sheet1",
      blankRows: 1000,
      blankColumns: 26,
      cellData: { /* row -> column -> CellRecord */ },
      rowData: { /* row -> RowMeta */ },
      columnData: { /* column -> ColumnMeta */ },
      mergeData: [],
      dataValidations: [ /* Validation rules; omitted means empty */ ]
    }
  },
  styles: { /* styleId -> CellStyle */ },
  resources: []
}

Cells

ts
// Store only nonempty cell records.
"0,0": { v: "CY-100001" }
"0,1": { v: "Industrial temperature sensor" }
"0,2": { v: 128 }
NameTypeDescription
vstring | number | booleanCell value.
tstringOptional semantic type, such as text, number, or date.
sstringStyle ID referencing the workbook's top-level styles table.
fstringOptional formula text.

Coordinate space

ts
rowCount    = maxOccupiedRow    + 1 + blankRows
columnCount = maxOccupiedColumn + 1 + blankColumns
NameTypeDescription
getUsedRowCount()numberThe occupied row extent, excluding trailing blank rows.
getRowCount()numberThe coordinate-space row count, including trailing blank rows.
getColumnCount()numberThe coordinate-space column count, including trailing blank columns.

Validation rules

ts
dataValidations: [
  {
    id: "dv-1",
    // Range list (sqref): disjoint rectangles within and across rules
    ranges: [{ startRow: 1, startColumn: 1, endRow: 99, endColumn: 1 }],
    criteria: { type: "whole", operator: "between", value1: 1, value2: 100 },
    errorStyle: "stop",
    errorMessage: "Quantity must be an integer from 1 to 100"
  }
]
NameTypeDescription
rangesCellRange[]Rule coverage is stored in dataValidations and updated when row or column structure changes.
criteriaobjectCriteria type: whole / decimal / textLength / date / time / list / custom. Dates and times use serial numbers. Custom rules store only name and params; validator functions are not serialized.
allowBlankbooleanDefaults to true.
errorStyle"stop" | "warning" | "information"Defaults to stop. stop rejects invalid editor submissions; warning and information allow submission and show invalid markers.
renderMode / showDropDownList onlytext / arrow / custom (default: arrow) and dropdown visibility. list.colors maps options to hexadecimal colors.