[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.Workbook.ToSjsJson

ToSjsJson Method

ToSjsJson(Stream)

Writes a JSON string that combines all JSON parts of the SpreadJS .sjs content for this workbook to the specified stream.

Use this method to export the workbook as a single SJS JSON payload through a Stream.

Declaration
public void ToSjsJson(Stream stream)
Public Sub ToSjsJson(stream As Stream)
Parameters
Type Name Description
Stream stream

The output stream that receives the generated SJS JSON content. Must not be null.

Implements
Examples
worksheet.Range["A1:B2"].Value = new object[,] {
    { "Name", "Value" },
    { "Test", 100 }
};
using (MemoryStream stream = new MemoryStream())
{
    workbook.ToSjsJson(stream);
    string sjsJson = System.Text.Encoding.UTF8.GetString(stream.ToArray());
}

ToSjsJson(Stream, SjsSaveOptions)

Integrates all JSON files in the SpreadJS .sjs format into a single string and writes it to the specified stream.

Use SjsSaveOptions to control how workbook content is included when generating the SJS JSON output.

Declaration
public void ToSjsJson(Stream stream, SjsSaveOptions options)
Public Sub ToSjsJson(stream As Stream, options As SjsSaveOptions)
Parameters
Type Name Description
Stream stream

The output stream that receives the integrated JSON string.

SjsSaveOptions options

The save options used when generating the SpreadJS .sjs JSON output.

Implements
Examples
worksheet.Range["A1:B2"].Value = new object[,] {
    { "Name", "Value" },
    { "Test", 100 }
};
SjsSaveOptions options = new SjsSaveOptions();
options.IncludeFormulas = true;
using (MemoryStream stream = new MemoryStream())
{
    workbook.ToSjsJson(stream, options);
    string sjsJson = System.Text.Encoding.UTF8.GetString(stream.ToArray());
}

ToSjsJson()

Generates a single JSON payload that represents the workbook in SpreadJS .sjs format.

Declaration
public string ToSjsJson()
Public Function ToSjsJson() As String
Returns
Type Description
string

A JSON string that contains the workbook content in SpreadJS .sjs format.

Implements
Examples
worksheet.Range["A1:B2"].Value = new object[,] {
    { "Name", "Value" },
    { "Test", 100 }
};
string sjsJson = workbook.ToSjsJson();

ToSjsJson(SjsSaveOptions)

Generates a single JSON payload that represents the workbook in SpreadJS .sjs format, using the specified save options.

Declaration
public string ToSjsJson(SjsSaveOptions options)
Public Function ToSjsJson(options As SjsSaveOptions) As String
Parameters
Type Name Description
SjsSaveOptions options

The save options used to generate the SJS JSON content.

Returns
Type Description
string

A JSON string that contains the workbook content in SpreadJS .sjs format.

Implements
Examples
worksheet.Range["A1:B2"].Value = new object[,] {
    { "Name", "Value" },
    { "Test", 100 }
};
SjsSaveOptions options = new SjsSaveOptions();
options.IncludeEmptyRegionCells = false;
string sjsJson = workbook.ToSjsJson(options);