Class JsonSaveOptions

JsonSaveOptions class

Represents the options of saving the workbook as a json file.

public class JsonSaveOptions : SaveOptions

Constructors

NameDescription
JsonSaveOptions()Creates options for saving json file.

Properties

NameDescription
AlwaysExportAsJsonObject { get; set; }Indicates whether always exporting excel to json as object, even there is only a worksheet in the file.
CachedFileFolder { get; set; }The cached file folder is used to store some large data.(Inherited from SaveOptions.)
ClearData { get; set; }Make the workbook empty after saving the file.(Inherited from SaveOptions.)
CreateDirectory { get; set; }If true and the directory does not exist, the directory will be automatically created before saving the file.(Inherited from SaveOptions.)
EncryptDocumentProperties { get; set; }Indicates whether encrypt document properties when saving as .xls file. The default value is true.(Inherited from SaveOptions.)
ExportArea { get; set; }Gets or sets the exporting range.
ExportAsString { get; set; }Exports the string value of the cells to json.
ExportEmptyCells { get; set; }Indicates whether exporting empty cells as null.
ExportHyperlinkType { get; set; }Represents the type of exporting hyperlink to json.
ExportNestedStructure { get; set; }Exported as parent-child hierarchy Json structure.
HasHeaderRow { get; set; }Indicates whether the range contains header row.
Indent { get; set; }Indicates the indent.
MergeAreas { get; set; }Indicates whether merge the areas of conditional formatting and validation before saving the file.(Inherited from SaveOptions.)
RefreshChartCache { get; set; }Indicates whether refreshing chart cache data(Inherited from SaveOptions.)
SaveFormat { get; }Gets the save file format.(Inherited from SaveOptions.)
Schemas { get; set; }The original json schema of each worksheet.
SheetIndexes { get; set; }Represents the indexes of exported sheets.
SkipEmptyRows { get; set; }Indicates whether skipping emtpy rows.
SortExternalNames { get; set; }Indicates whether sorting external defined names before saving file.(Inherited from SaveOptions.)
SortNames { get; set; }Indicates whether sorting defined names before saving file.(Inherited from SaveOptions.)
ToExcelStruct { get; set; }Indicates whether converting to json struct of the Excel file.
UpdateSmartArt { get; set; }Indicates whether updating smart art setting. The default value is false.(Inherited from SaveOptions.)
ValidateMergedAreas { get; set; }Indicates whether validate merged cells before saving the file.(Inherited from SaveOptions.)
WarningCallback { get; set; }Gets or sets warning callback.(Inherited from SaveOptions.)

Examples

[C#]

namespace Demos
{
    using Aspose.Cells;
    using Aspose.Cells.Json;
    using System;

    public class JsonSaveOptionsDemo
    {
        public static void JsonSaveOptionsExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Fill some data into the worksheet
            worksheet.Cells["A1"].PutValue("Name");
            worksheet.Cells["B1"].PutValue("Age");
            worksheet.Cells["A2"].PutValue("John");
            worksheet.Cells["B2"].PutValue(30);
            worksheet.Cells["A3"].PutValue("Jane");
            worksheet.Cells["B3"].PutValue(25);

            // Create an instance of JsonSaveOptions
            JsonSaveOptions saveOptions = new JsonSaveOptions
            {
                ExportHyperlinkType = JsonExportHyperlinkType.DisplayString,
                SkipEmptyRows = true,
                ExportArea = new CellArea { StartRow = 0, EndRow = 2, StartColumn = 0, EndColumn = 1 },
                HasHeaderRow = true,
                ExportAsString = true,
                Indent = "  ",
                ExportNestedStructure = false,
                ExportEmptyCells = false,
                AlwaysExportAsJsonObject = false,
                ToExcelStruct = false,
                ClearData = false,
                CachedFileFolder = "C:\\Temp",
                ValidateMergedAreas = true,
                MergeAreas = false,
                SortNames = false,
                SortExternalNames = false,
                RefreshChartCache = false,
                UpdateSmartArt = false
            };

            // Save the workbook as a JSON file
            workbook.Save("JsonSaveOptionsExample.json", saveOptions);

            return;
        }
    }
}

See Also