Table of Contents

Method ToJson

Namespace
DocWright.Spreadsheet
Assembly
DocWright.Spreadsheet.dll

ToJson(Stream, XlsxJsonOptions?)

Writes the sheet as JSON, in UTF-8 without a byte order mark.

public void ToJson(Stream stream, XlsxJsonOptions? options = null)

Parameters

stream Stream

Where the bytes go. It is not closed.

options XlsxJsonOptions

How to write, or null for the defaults: an array of objects named by the first row.

Remarks

A number is written as a JSON number with every digit the cell holds, a boolean as true or false, a date (a number its format shows as one) as an ISO 8601 string, an error as its text, and an empty cell as null. A formula cell gives the result the file stores. A sheet that holds nothing is [].

The text is written by this library, not by a JSON package: the output is the same bytes on every runtime, and half of a surrogate pair is written as its \uXXXX escape.

Exceptions

ArgumentNullException

stream is null.

InvalidOperationException

The sheet is not a worksheet.

ResourceLimitExceededException

The range covers more cells than MaxCells.

InvalidDocumentException

The sheet's part is malformed.