V4 V5

reogrid-json is V5’s native save format. V4’s RGF (XML) and BinaryFormatter are gone.

It is the same format the web edition uses (reogrid-web / ReoGrid Studio), so files move between them in both directions.

Reading and writing

using unvell.ReoGrid.Core.IO;

string json = ReoGridJsonIO.Write(wb, pretty: true);
File.WriteAllText("book.rgjson", json);

Workbook restored = ReoGridJsonIO.Read(File.ReadAllText("book.rgjson"));

pretty: true formats it for humans. The default is a single compact line.

What is saved

ContentKey
Cell values, formulas, style references, number-format references, rich textcells
The style table (already merged)styles
The number-format tablenumberFormats
Defined namesdefinedNames
Row and column sizes, hidden state and stylesrows / cols
Mergesmerges
Bordersborders
Outlinesoutlines
Cell typescellTypes
Conditional formatsconditionalFormats
Auto-filterfilter

What is not saved

Images are not saved. When images have to survive, use XLSX.

View state is not saved.

  • Scroll position and selection
  • Freeze panes and zoom
  • The undo history

Structure

{
  "format": "reogrid-json",
  "version": 1,
  "styles": [ ... ],
  "numberFormats": [ ... ],
  "definedNames": [ { "name": "...", "scope": null, "address": "Sheet1!A1" } ],
  "workbook": {
    "activeSheet": 0,
    "sheets": [ { "name": "Sheet1", "cells": [ ... ], ... } ]
  }
}

Only cells that exist appear in cells; empty ones are not written.

Styles and number formats are collected into tables, and cells reference them by index (s / nf). Tens of thousands of cells sharing a format add nothing to the file size.

See The reogrid-json Schema.

Interoperating with the web edition

Because the format is the same, workflows like these work.

  • Build it in a desktop app → send it to a server → display it in a browser
  • Edit it on the web → download it → open it on the desktop

Unknown keys are ignored silently. One side adding a feature never makes the file unreadable to an older implementation.

Migrating from V4

RGF cannot be read. The route for bringing V4 files into V5 is:

Save as XLSX in V4 → read it with V5's XlsxReader.Read()
Was this article helpful?