[]
        
(Showing Draft Content)

SerializationOptions

Class SerializationOptions

java.lang.Object
com.grapecity.documents.excel.SerializationOptions

public class SerializationOptions extends Object
Represents options used when serializing a workbook or worksheet to JSON.

Use this class to control which content is included in the generated JSON, such as styles, formulas, sheets, shared formulas, binding sources, and automatically merged cells. These options apply when calling Workbook.toJson(SerializationOptions) or IWorksheet.toJson(SerializationOptions).


 SerializationOptions options = new SerializationOptions();
 options.setIgnoreStyle(true);
 options.setIgnoreFormula(true);
 String jsonText = workbook.toJson(options);
 
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Gets whether shared formulas are exported when serializing a workbook or worksheet to JSON.
    boolean
    Gets whether row and column information outside the used range is ignored when exporting to JSON.
    boolean
    Gets whether formulas are ignored when serializing a workbook or worksheet to JSON.
    boolean
    Gets whether to ignore data outside the RowCount and ColumnCount when exporting to JSON.
    boolean
    Gets whether sheets are ignored when serializing a workbook or worksheet to JSON.
    boolean
    Gets whether styles are ignored when a workbook or worksheet is serialized to JSON.
    boolean
    Gets whether automatically merged cells are included during JSON serialization.
    final boolean
    Gets whether binding sources are included when a workbook or worksheet is serialized to JSON.
    void
    setExportSharedFormula(boolean value)
    Sets whether shared formulas are exported when serializing a workbook or worksheet to JSON.
    void
    Sets whether row and column information outside the used range is ignored when exporting to JSON.
    void
    setIgnoreFormula(boolean value)
    Sets whether formulas are ignored when serializing a workbook or worksheet to JSON.
    void
    Sets whether to ignore data outside the RowCount and ColumnCount when exporting to JSON.
    void
    setIgnoreSheets(boolean value)
    Sets whether sheets are ignored when serializing a workbook or worksheet to JSON.
    void
    setIgnoreStyle(boolean value)
    Sets whether styles are ignored when a workbook or worksheet is serialized to JSON.
    void
    Sets whether automatically merged cells are included during JSON serialization.
    final void
    setIncludeBindingSource(boolean value)
    Sets whether binding sources are included when a workbook or worksheet is serialized to JSON.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SerializationOptions

      public SerializationOptions()
  • Method Details

    • getIgnoreStyle

      public boolean getIgnoreStyle()
      Gets whether styles are ignored when a workbook or worksheet is serialized to JSON.

      If this property is true, style information is excluded from the serialized JSON output. The default value is false.

      
       SerializationOptions options = new SerializationOptions();
       options.setIgnoreStyle(true);
       boolean ignoreStyle = options.getIgnoreStyle();
       
      Returns:
      true if style information is ignored during JSON serialization; otherwise, false.
    • setIgnoreStyle

      public void setIgnoreStyle(boolean value)
      Sets whether styles are ignored when a workbook or worksheet is serialized to JSON.

      If this property is true, style information is excluded from the serialized JSON output. The default value is false.

      
       SerializationOptions options = new SerializationOptions();
       options.setIgnoreStyle(true);
       
      Parameters:
      value - true if style information is ignored during JSON serialization; otherwise, false.
    • getIgnoreFormula

      public boolean getIgnoreFormula()
      Gets whether formulas are ignored when serializing a workbook or worksheet to JSON.

      If this property returns true, formula information is excluded from the serialized JSON output. The default value is false.

      
       SerializationOptions options = new SerializationOptions();
       options.setIgnoreFormula(true);
       boolean ignoreFormula = options.getIgnoreFormula();
       
      Returns:
      true if formulas are ignored during JSON serialization; otherwise, false.
    • setIgnoreFormula

      public void setIgnoreFormula(boolean value)
      Sets whether formulas are ignored when serializing a workbook or worksheet to JSON.

      If this property is true, formula information is excluded from the serialized JSON output. The default value is false.

      
       SerializationOptions options = new SerializationOptions();
       options.setIgnoreFormula(true);
       
      Parameters:
      value - true if formulas are ignored during JSON serialization; otherwise, false.
    • getIgnoreColumnRowInfoOutOfUsedRange

      public boolean getIgnoreColumnRowInfoOutOfUsedRange()
      Gets whether row and column information outside the used range is ignored when exporting to JSON.

      When this option is true, row styles, column styles, row heights, and column widths outside the used range are not exported. The default value is true.

      
       SerializationOptions options = new SerializationOptions();
       options.setIgnoreColumnRowInfoOutOfUsedRange(false);
       boolean ignoreUnusedRowsAndColumns = options.getIgnoreColumnRowInfoOutOfUsedRange();
       
      Returns:
      true if row styles, column styles, row heights, and column widths outside the used range are ignored during JSON export; otherwise, false.
    • setIgnoreColumnRowInfoOutOfUsedRange

      public void setIgnoreColumnRowInfoOutOfUsedRange(boolean value)
      Sets whether row and column information outside the used range is ignored when exporting to JSON.

      When this option is true, row styles, column styles, row heights, and column widths outside the used range are not exported. The default value is true.

      
       SerializationOptions options = new SerializationOptions();
       options.setIgnoreColumnRowInfoOutOfUsedRange(false);
       
      Parameters:
      value - true if row styles, column styles, row heights, and column widths outside the used range are ignored during JSON export; otherwise, false.
    • getIgnoreSheets

      public boolean getIgnoreSheets()
      Gets whether sheets are ignored when serializing a workbook or worksheet to JSON.

      If this property is true, the JSON output excludes worksheet data. The default value is false.

      
       SerializationOptions options = new SerializationOptions();
       options.setIgnoreSheets(true);
       boolean ignoreSheets = options.getIgnoreSheets();
       
      Returns:
      true if sheets are ignored during JSON serialization; otherwise, false.
    • setIgnoreSheets

      public void setIgnoreSheets(boolean value)
      Sets whether sheets are ignored when serializing a workbook or worksheet to JSON.

      If this property is true, the JSON output excludes worksheet data. The default value is false.

      
       SerializationOptions options = new SerializationOptions();
       options.setIgnoreSheets(true);
       
      Parameters:
      value - true if sheets are ignored during JSON serialization; otherwise, false.
    • getIgnoreRangeOutOfRowColumnCount

      public boolean getIgnoreRangeOutOfRowColumnCount()
      Gets whether to ignore data outside the RowCount and ColumnCount when exporting to JSON.

      If this property is true, data outside the row and column count limits is ignored during JSON export. The default value is false.

      
       SerializationOptions options = new SerializationOptions();
       options.setIgnoreRangeOutOfRowColumnCount(true);
       boolean ignoreRangeOutOfBounds = options.getIgnoreRangeOutOfRowColumnCount();
       
      Returns:
      true if data outside the RowCount and ColumnCount is ignored during JSON export; otherwise, false.
    • setIgnoreRangeOutOfRowColumnCount

      public void setIgnoreRangeOutOfRowColumnCount(boolean value)
      Sets whether to ignore data outside the RowCount and ColumnCount when exporting to JSON.

      If this property is true, data outside the row and column count limits is ignored during JSON export. The default value is false.

      
       SerializationOptions options = new SerializationOptions();
       options.setIgnoreRangeOutOfRowColumnCount(true);
       
      Parameters:
      value - true if data outside the RowCount and ColumnCount is ignored during JSON export; otherwise, false.
    • getExportSharedFormula

      public boolean getExportSharedFormula()
      Gets whether shared formulas are exported when serializing a workbook or worksheet to JSON.

      The default value is true. Set this option to false to omit shared formulas from the exported JSON, which can be useful for backward compatibility with earlier DsExcel versions or SpreadJS versions that do not support shared formulas.

      
       SerializationOptions options = new SerializationOptions();
       options.setExportSharedFormula(false);
       boolean exportSharedFormula = options.getExportSharedFormula();
       
      Returns:
      true if shared formulas are exported to JSON; otherwise, false.
    • setExportSharedFormula

      public void setExportSharedFormula(boolean value)
      Sets whether shared formulas are exported when serializing a workbook or worksheet to JSON.

      The default value is true. Set this option to false to omit shared formulas from the exported JSON, which can be useful for backward compatibility with earlier DsExcel versions or SpreadJS versions that do not support shared formulas.

      
       SerializationOptions options = new SerializationOptions();
       options.setExportSharedFormula(false);
       
      Parameters:
      value - true if shared formulas are exported to JSON; otherwise, false.
    • getIncludeBindingSource

      public final boolean getIncludeBindingSource()
      Gets whether binding sources are included when a workbook or worksheet is serialized to JSON.

      If this property is true, bound data sources are included in the serialized JSON output. If this property is false, binding source information is not included. The default value is true.

      
       SerializationOptions options = new SerializationOptions();
       options.setIncludeBindingSource(false);
       boolean includeBindingSource = options.getIncludeBindingSource();
       
      Returns:
      true if binding sources are included during JSON serialization; otherwise, false.
    • setIncludeBindingSource

      public final void setIncludeBindingSource(boolean value)
      Sets whether binding sources are included when a workbook or worksheet is serialized to JSON.

      If this property is true, bound data sources are included in the serialized JSON output. If this property is false, binding source information is not included. The default value is true.

      
       SerializationOptions options = new SerializationOptions();
       options.setIncludeBindingSource(false);
       
      Parameters:
      value - true if binding sources are included during JSON serialization; otherwise, false.
    • getIncludeAutoMergedCells

      public boolean getIncludeAutoMergedCells()
      Gets whether automatically merged cells are included during JSON serialization.

      When this property is true, auto-merge information added to a worksheet can take effect when the workbook or worksheet is serialized to JSON. The default value is false.

      
       SerializationOptions options = new SerializationOptions();
       options.setIncludeAutoMergedCells(true);
       boolean includeAutoMergedCells = options.getIncludeAutoMergedCells();
       
      Returns:
      true if automatically merged cells are included during JSON serialization; otherwise, false.
    • setIncludeAutoMergedCells

      public void setIncludeAutoMergedCells(boolean value)
      Sets whether automatically merged cells are included during JSON serialization.
      
       SerializationOptions options = new SerializationOptions();
       options.setIncludeAutoMergedCells(true);
       
      Parameters:
      value - true if automatically merged cells are included during JSON serialization; otherwise, false.