# Cell format Registry

Cell format registry lets you store formats in a central place and reference each format on the cell via a short ID (`sid`) instead of inlining the full format object. This typically gives \~70% compression on cell data.

```tsx
// Before cellXfs registry
// Cell data A1:

{
  uf: {
    backgroundColor: "green",
    horizontalAlignment: "left"
  },
  ue: {
    sv: "Cell with styleId",
  },
  fv: "Cell with styleId",
  note: "Hello world, this is notes.",
},

// After cellXfs registry — `uf` becomes a StyleReference
{
  uf: {
    sid: "123",
  },
  ue: {
    sv: "Cell with styleId",
  },
  fv: "Cell with styleId",
  note: "Hello world, this is notes.",
},
```

{% hint style="info" %}
Only `uf` is written. The effective format is no longer persisted on `CellData` — the renderer derives it on the fly from `uf` (via the registry lookup), the cell value, and (for formula cells) precedent formats.
{% endhint %}

### Usage

```tsx
const App = () => {
  const [cellXfs, onChangeCellXfs] = useState<CellXfs | null | undefined>(
    new Map()
  );
  
  // With useSpreadsheetstate
  const { getEffectiveFormat } = useSpreadsheetState({
     cellXfs,
     onChangeCellXfs
  })
  
  // With yjs
  const { } = useYSpreadsheetV2({
     onChangeCellXfs
  })
  
  return (
      <CanvasGrid getEffectiveFormat={getEffectiveFormat} />
  )
  
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.rowsncolumns.app/configuration/features/cell-format-registry.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
