[]
        
(Showing Draft Content)

SjsSaveOptions

Class SjsSaveOptions

java.lang.Object
com.grapecity.documents.excel.SaveOptionsBase
com.grapecity.documents.excel.SjsSaveOptions

public class SjsSaveOptions extends SaveOptionsBase
Options for saving a workbook as a SpreadJS `.sjs` file.

Use this class to control which workbook content is included when exporting to `.sjs`, such as styles, formulas, unused names, empty cells outside the used range, binding sources, automatically merged cells, and data outside the defined row and column counts. By default, styles, formulas, unused names, empty region cells, and binding sources are included, while automatically merged cells are not included and data outside RowCount and ColumnCount is not ignored.

This class can be used with Workbook.save(String,SaveOptionsBase) to write an`.sjs` file, or with Workbook.toSjsJson(SjsSaveOptions) to generate a single JSON string from the `.sjs` content.


 worksheet.getRange("A1").setValue("Name");
 SjsSaveOptions options = new SjsSaveOptions();
 options.setIncludeStyles(false);
 String json = workbook.toSjsJson(options);
 workbook.save("path/to/output.sjs", options);
 
  • Constructor Details

    • SjsSaveOptions

      public SjsSaveOptions()
      Creates an options instance for saving SpreadJS .sjs content.

      This constructor configures the file format to SaveFileFormat.Sjs.

      
       SjsSaveOptions options = new SjsSaveOptions();
       workbook.save("path/to/output.sjs", options);
       
  • Method Details

    • getIncludeStyles

      public final boolean getIncludeStyles()
      Gets whether styles are included when saving files.

      This option controls whether style information is written when exporting to the SpreadJS .sjs format. By default, the value is true.

      
       SjsSaveOptions options = new SjsSaveOptions();
       options.setIncludeStyles(false);
      
       boolean includeStyles = options.getIncludeStyles();
       workbook.save("path/to/output.sjs", options);
       
      Returns:
      true if styles are included when saving files; otherwise, false.
    • setIncludeStyles

      public final void setIncludeStyles(boolean value)
      Sets whether styles are included when saving files.

      This option controls whether style information is written when exporting to the SpreadJS .sjs format. By default, the value is true.

      
       SjsSaveOptions options = new SjsSaveOptions();
       options.setIncludeStyles(false);
      
       workbook.save("path/to/output.sjs", options);
       
      Parameters:
      value - true if styles are included when saving files; otherwise, false.
    • getIncludeFormulas

      public final boolean getIncludeFormulas()
      Gets whether formulas can be included when saving the file.

      The default value is true.

      
       SjsSaveOptions options = new SjsSaveOptions();
       options.setIncludeFormulas(false);
      
       boolean includeFormulas = options.getIncludeFormulas();
       workbook.save("path/to/output.sjs", options);
       
      Returns:
      true if formulas are included when saving the file; otherwise, false.
    • setIncludeFormulas

      public final void setIncludeFormulas(boolean value)
      Sets whether formulas can be included when saving the file.

      The default value is true.

      
       SjsSaveOptions options = new SjsSaveOptions();
       options.setIncludeFormulas(false);
      
       workbook.save("path/to/output.sjs", options);
       
      Parameters:
      value - true if formulas are included when saving the file; otherwise, false.
    • getIncludeUnusedNames

      public final boolean getIncludeUnusedNames()
      Gets whether unused custom names are included when saving the file.

      This property applies to SjsSaveOptions when exporting to the SpreadJS.sjs format. If this property is true, unused custom names are included in the saved file. By default, the value is true.

      
       SjsSaveOptions options = new SjsSaveOptions();
       options.setIncludeUnusedNames(false);
      
       boolean includeUnusedNames = options.getIncludeUnusedNames();
       workbook.save("path/to/output.sjs", options);
       
      Returns:
      true if unused custom names are included when saving the file; otherwise, false.
    • setIncludeUnusedNames

      public final void setIncludeUnusedNames(boolean value)
      Sets whether unused custom names are included when saving the file.

      This property applies to SjsSaveOptions when exporting to the SpreadJS.sjs format. If this property is true, unused custom names are included in the saved file. By default, the value is true.

      
       SjsSaveOptions options = new SjsSaveOptions();
       options.setIncludeUnusedNames(false);
      
       workbook.save("path/to/output.sjs", options);
       
      Parameters:
      value - true if unused custom names are included when saving the file; otherwise, false.
    • getIncludeEmptyRegionCells

      public final boolean getIncludeEmptyRegionCells()
      Gets whether empty cells outside the used data range are included when saving to an SJS file.

      The default value is true.

      
       SjsSaveOptions options = new SjsSaveOptions();
       options.setIncludeEmptyRegionCells(false);
      
       boolean includeEmptyRegionCells = options.getIncludeEmptyRegionCells();
       workbook.save("path/to/output.sjs", options);
       
      Returns:
      true if empty cells outside the used data range are included during SJS export; otherwise, false.
    • setIncludeEmptyRegionCells

      public final void setIncludeEmptyRegionCells(boolean value)
      Sets whether empty cells outside the used data range are included when saving to an SJS file.

      The default value is true.

      
       SjsSaveOptions options = new SjsSaveOptions();
       options.setIncludeEmptyRegionCells(false);
      
       workbook.save("path/to/output.sjs", options);
       
      Parameters:
      value - true if empty cells outside the used data range are included during SJS export; otherwise, false.
    • getIgnoreRangeOutOfRowColumnCount

      public boolean getIgnoreRangeOutOfRowColumnCount()
      Gets whether data outside the worksheet RowCount and ColumnCount is ignored when exporting to an .sjs file.

      The default value is false. When this property is false, data outside the specified row and column count is still exported to the .sjs file.

      
       SjsSaveOptions options = new SjsSaveOptions();
       options.setIgnoreRangeOutOfRowColumnCount(true);
      
       boolean ignore = options.getIgnoreRangeOutOfRowColumnCount();
       workbook.save("path/to/output.sjs", options);
       
      Returns:
      true if data outside the worksheet row and column count is ignored during .sjs export; otherwise, false.
    • setIgnoreRangeOutOfRowColumnCount

      public void setIgnoreRangeOutOfRowColumnCount(boolean value)
      Sets whether data outside the worksheet RowCount and ColumnCount is ignored when exporting to an .sjs file.

      The default value is false. When this property is false, data outside the specified row and column count is still exported to the .sjs file.

      
       SjsSaveOptions options = new SjsSaveOptions();
       options.setIgnoreRangeOutOfRowColumnCount(true);
      
       workbook.save("path/to/output.sjs", options);
       
      Parameters:
      value - true if data outside the worksheet row and column count is ignored during .sjs export; otherwise, false.
    • getIncludeBindingSource

      public final boolean getIncludeBindingSource()
      Gets whether to include the binding source when saving the file.

      This option controls whether bound data is exported when the workbook is saved to SpreadJS .sjs format. The default value is true.

      
       SjsSaveOptions options = new SjsSaveOptions();
       options.setIncludeBindingSource(false);
      
       boolean includeBindingSource = options.getIncludeBindingSource();
       workbook.save("path/to/output.sjs", options);
       
      Returns:
      true if the binding source is included when saving the file; otherwise, false.
    • setIncludeBindingSource

      public final void setIncludeBindingSource(boolean value)
      Sets whether to include the binding source when saving the file.

      This option controls whether bound data is exported when the workbook is saved to SpreadJS .sjs format. The default value is true.

      
       SjsSaveOptions options = new SjsSaveOptions();
       options.setIncludeBindingSource(false);
      
       workbook.save("path/to/output.sjs", options);
       
      Parameters:
      value - true if the binding source is included when saving the file; otherwise, false.
    • getIncludeAutoMergedCells

      public boolean getIncludeAutoMergedCells()
      Gets whether to include automatically merged cells when saving a file.

      The default value is false.

      
       SjsSaveOptions options = new SjsSaveOptions();
       options.setIncludeAutoMergedCells(true);
      
       boolean includeAutoMergedCells = options.getIncludeAutoMergedCells();
       workbook.save("path/to/output.sjs", options);
       
      Returns:
      true if automatically merged cells are included; otherwise, false.
    • setIncludeAutoMergedCells

      public void setIncludeAutoMergedCells(boolean value)
      Sets whether to include automatically merged cells when saving a file.

      The default value is false.

      
       SjsSaveOptions options = new SjsSaveOptions();
       options.setIncludeAutoMergedCells(true);
      
       workbook.save("path/to/output.sjs", options);
       
      Parameters:
      value - true if automatically merged cells are included; otherwise, false.