[]
        
(Showing Draft Content)

DeserializationOptions

Class DeserializationOptions

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

public class DeserializationOptions extends Object
Represents options that control how workbook or worksheet content is deserialized from JSON.

Use this class to configure JSON loading behavior for APIs such as Workbook.fromJson(String,DeserializationOptions) and Workbook.open(String,DeserializationOptions). You can use these options to ignore styles, ignore formulas, or prevent recalculation after the JSON data is loaded.


 DeserializationOptions options = new DeserializationOptions();
 options.setIgnoreStyle(true);
 options.setIgnoreFormula(true);
 workbook.fromJson(jsonText, options);
 
  • Constructor Details

    • DeserializationOptions

      public DeserializationOptions()
  • Method Details

    • getIgnoreStyle

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

      If this property is true, style information in the JSON data is ignored during deserialization. The default value is false.

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

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

      If this property is true, style information in the JSON data is ignored during deserialization. The default value is false.

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

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

      If this property is true, formula information in the JSON data is ignored during deserialization. The default value is false.

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

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

      If this property is true, formula information in the JSON data is ignored during deserialization. The default value is false.

      
       DeserializationOptions options = new DeserializationOptions();
       options.setIgnoreFormula(true);
       
      Parameters:
      value - true if formulas are ignored during JSON deserialization; otherwise, false.
    • getDoNotRecalculateAfterLoad

      public boolean getDoNotRecalculateAfterLoad()
      Gets whether to skip marking formulas dirty after loading JSON data.

      This option is used by JSON deserialization APIs such as Workbook.fromJson(String,DeserializationOptions) and Workbook.open(String,DeserializationOptions). The default value is false.

      When this property is true, formulas are not marked dirty after loading, so the formula results loaded from JSON are returned when calculation is triggered. When this property is false, formulas are marked dirty after loading, so formula results are recalculated when calculation is triggered. Calculation can be triggered by operations such as getting formula values or calling Workbook.calculate().

      
       DeserializationOptions openOptions = new DeserializationOptions();
       openOptions.setDoNotRecalculateAfterLoad(true);
       boolean doNotRecalculate = openOptions.getDoNotRecalculateAfterLoad();
       workbook.open("source.json", openOptions);
       
      Returns:
      true if marking formulas dirty is skipped after loading JSON data; otherwise, false.
    • setDoNotRecalculateAfterLoad

      public void setDoNotRecalculateAfterLoad(boolean value)
      Sets whether to skip marking formulas dirty after loading JSON data.

      This option is used by JSON deserialization APIs such as Workbook.fromJson(String,DeserializationOptions) and Workbook.open(String,DeserializationOptions). The default value is false.

      When this property is true, formulas are not marked dirty after loading, so the formula results loaded from JSON are returned when calculation is triggered. When this property is false, formulas are marked dirty after loading, so formula results are recalculated when calculation is triggered. Calculation can be triggered by operations such as getting formula values or calling Workbook.calculate().

      
       DeserializationOptions openOptions = new DeserializationOptions();
       openOptions.setDoNotRecalculateAfterLoad(true);
       workbook.open("source.json", openOptions);
       
      Parameters:
      value - true if marking formulas dirty is skipped after loading JSON data; otherwise, false.
    • getInvalidFormulaHandling

      public InvalidFormulaHandling getInvalidFormulaHandling()
      Gets how invalid formulas are handled when deserializing JSON data. The default value is null.
      
       DeserializationOptions options = new DeserializationOptions();
       options.setInvalidFormulaHandling(InvalidFormulaHandling.Preserve);
       InvalidFormulaHandling invalidFormulaHandling = options.getInvalidFormulaHandling();
       
      Returns:
      How invalid formulas are handled when deserializing JSON data.
    • setInvalidFormulaHandling

      public void setInvalidFormulaHandling(InvalidFormulaHandling value)
      Sets how invalid formulas are handled when deserializing JSON data. The default value is null.
      
       DeserializationOptions options = new DeserializationOptions();
       options.setInvalidFormulaHandling(InvalidFormulaHandling.Preserve);
       
      Parameters:
      value - How invalid formulas are handled when deserializing JSON data.