[]
        
(Showing Draft Content)

XlsxOpenOptions

Class XlsxOpenOptions

java.lang.Object
com.grapecity.documents.excel.OpenOptionsBase
com.grapecity.documents.excel.XlsxOpenOptions
Direct Known Subclasses:
XlsmOpenOptions, XltxOpenOptions

public class XlsxOpenOptions extends OpenOptionsBase
Represents options for opening an XLSX file.

Use this class to configure how a workbook is loaded through Workbook.open(String,OpenOptionsBase) or other open overloads that accept OpenOptionsBase. It supports settings such as the file password, import flags, recalculation behavior after loading, row auto-fit behavior, and digital-signature-only mode.


 XlsxOpenOptions options = new XlsxOpenOptions();
 String password = getWorkbookPassword();
 options.setPassword(password);
 options.setDoNotRecalculateAfterOpened(true);
 workbook.open("path/to/workbook.xlsx", options);
 
  • Constructor Details

    • XlsxOpenOptions

      public XlsxOpenOptions()
      Creates a new options object for opening an XLSX workbook.

      This constructor initializes an XlsxOpenOptions instance for the OpenFileFormat.Xlsx format. Use the returned object to configure settings such as the password, import behavior, recalculation behavior, row auto-fit behavior, or digital-signature-only mode before passing it to Workbook.open(String,OpenOptionsBase) or a related open overload.

      
       XlsxOpenOptions options = new XlsxOpenOptions();
       String password = getWorkbookPassword();
       options.setPassword(password);
       options.setDoNotRecalculateAfterOpened(true);
       workbook.open("path/to/workbook.xlsx", options);
       
  • Method Details

    • getPassword

      public final String getPassword()
      Gets the password for the xlsx file.

      Use this method to retrieve the password configured on this XlsxOpenOptions instance before opening a password-protected xlsx file.

      
       XlsxOpenOptions options = new XlsxOpenOptions();
       String configuredPassword = getWorkbookPassword();
       options.setPassword(configuredPassword);
       String password = options.getPassword();
       workbook.open("path/to/workbook.xlsx", options);
       
      Returns:
      The password for the xlsx file.
    • setPassword

      public final void setPassword(String value)
      Sets the password for the xlsx file.

      Use this method to set the password configured on this XlsxOpenOptions instance before opening a password-protected xlsx file.

      
       XlsxOpenOptions options = new XlsxOpenOptions();
       String password = getWorkbookPassword();
       options.setPassword(password);
       workbook.open("path/to/workbook.xlsx", options);
       
      Parameters:
      value - The password for the xlsx file.
    • getImportFlags

      public final EnumSet<ImportFlags> getImportFlags()
      Gets the import flags that control which parts of an .xlsx workbook are loaded.

      The returned flags are used when opening a workbook with these options. The default value is an empty EnumSet, which is equivalent to the .NET value ImportFlags.NoFlag and imports workbook content without applying a selective import flag.

      
       XlsxOpenOptions options = new XlsxOpenOptions();
       options.setImportFlags(EnumSet.of(ImportFlags.Data, ImportFlags.Formulas));
       EnumSet<ImportFlags> importFlags = options.getImportFlags();
       workbook.open("path/to/workbook.xlsx", options);
       
      Returns:
      An EnumSet that specifies the import flags for loading workbook data.
    • setImportFlags

      public final void setImportFlags(EnumSet<ImportFlags> value)
      Sets the import flags that control which parts of an .xlsx workbook are loaded.

      The returned flags are used when opening a workbook with these options. The default value is an empty EnumSet, which is equivalent to the .NET value ImportFlags.NoFlag and imports workbook content without applying a selective import flag.

      
       XlsxOpenOptions options = new XlsxOpenOptions();
       options.setImportFlags(EnumSet.of(ImportFlags.Data, ImportFlags.Formulas));
       workbook.open("path/to/workbook.xlsx", options);
       
      Parameters:
      value - An EnumSet that specifies the import flags for loading workbook data.
    • getDoNotRecalculateAfterOpened

      public final boolean getDoNotRecalculateAfterOpened()
      Gets whether to skip marking formulas dirty after opening an XLSX file.

      The default value is false.

      When this property is true, formulas with cached results are not marked dirty after opening, so the cached formula results are returned when calculation is triggered. Formulas without cached results are still marked dirty and recalculated when calculation is triggered. When this property is false, formulas are marked dirty after opening, so formula results are recalculated when calculation is triggered. Calculation can be triggered by operations such as getting formula values or calling Workbook.calculate().

      
       XlsxOpenOptions openOptions = new XlsxOpenOptions();
       openOptions.setDoNotRecalculateAfterOpened(true);
       boolean doNotRecalculate = openOptions.getDoNotRecalculateAfterOpened();
       workbook.open("source.xlsx", openOptions);
       
      Returns:
      true if marking formulas dirty is skipped after opening an XLSX file; otherwise, false.
    • setDoNotRecalculateAfterOpened

      public final void setDoNotRecalculateAfterOpened(boolean value)
      Sets whether to skip marking formulas dirty after opening an XLSX file.

      The default value is false.

      When this property is true, formulas with cached results are not marked dirty after opening, so the cached formula results are returned when calculation is triggered. Formulas without cached results are still marked dirty and recalculated when calculation is triggered. When this property is false, formulas are marked dirty after opening, so formula results are recalculated when calculation is triggered. Calculation can be triggered by operations such as getting formula values or calling Workbook.calculate().

      
       XlsxOpenOptions openOptions = new XlsxOpenOptions();
       openOptions.setDoNotRecalculateAfterOpened(true);
       workbook.open("source.xlsx", openOptions);
       
      Parameters:
      value - true if marking formulas dirty is skipped after opening an XLSX file; otherwise, false.
    • getDigitalSignatureOnly

      public final boolean getDigitalSignatureOnly()
      Gets whether to open the workbook in digital signature only mode.

      In digital signature only mode, existing signatures are preserved unless you call ISignature.delete(). In this mode, you can sign existing signature lines, add invisible signatures, remove the digital signature of signed signature lines, or remove invisible signatures. Other changes are discarded.

      After modifying digital signatures, save the workbook to commit the changes.

      
       XlsxOpenOptions options = new XlsxOpenOptions();
       options.setDigitalSignatureOnly(true);
       boolean digitalSignatureOnly = options.getDigitalSignatureOnly();
       workbook.open("path/to/workbook.xlsx", options);
       
      Returns:
      true if the workbook is configured to open in digital signature only mode; otherwise, false. The default value is false.
    • setDigitalSignatureOnly

      public final void setDigitalSignatureOnly(boolean value)
      Sets whether to open the workbook in digital signature only mode.

      In digital signature only mode, existing signatures are preserved unless you call ISignature.delete(). In this mode, you can sign existing signature lines, add invisible signatures, remove the digital signature of signed signature lines, or remove invisible signatures. Other changes are discarded.

      After modifying digital signatures, save the workbook to commit the changes.

      
       XlsxOpenOptions options = new XlsxOpenOptions();
       options.setDigitalSignatureOnly(true);
       workbook.open("path/to/workbook.xlsx", options);
       
      Parameters:
      value - true if the workbook is configured to open in digital signature only mode; otherwise, false. The default value is false.
    • getDoNotAutoFitAfterOpened

      public final boolean getDoNotAutoFitAfterOpened()
      Gets whether automatic row-height fitting after loading the file is disabled.

      When this property returns true, row heights are not auto-fitted after the workbook is opened. The default value is false.

      
       XlsxOpenOptions options = new XlsxOpenOptions();
       options.setDoNotAutoFitAfterOpened(true);
       boolean doNotAutoFit = options.getDoNotAutoFitAfterOpened();
       workbook.open("path/to/workbook.xlsx", options);
       
      Returns:
      true if auto-fitting row height after loading is disabled; otherwise, false.
    • setDoNotAutoFitAfterOpened

      public final void setDoNotAutoFitAfterOpened(boolean value)
      Sets whether automatic row-height fitting after loading the file is disabled.

      When this property Sets true, row heights are not auto-fitted after the workbook is opened. The default value is false.

      
       XlsxOpenOptions options = new XlsxOpenOptions();
       options.setDoNotAutoFitAfterOpened(true);
       workbook.open("path/to/workbook.xlsx", options);
       
      Parameters:
      value - true if auto-fitting row height after loading is disabled; otherwise, false.
    • getInvalidFormulaHandling

      public final InvalidFormulaHandling getInvalidFormulaHandling()
      Gets how invalid formulas are handled when opening a workbook. The default value is InvalidFormulaHandling.Throw.
      
       XlsxOpenOptions options = new XlsxOpenOptions();
       options.setInvalidFormulaHandling(InvalidFormulaHandling.Preserve);
       InvalidFormulaHandling handling = options.getInvalidFormulaHandling();
       
      Returns:
      How invalid formulas are handled when opening a workbook.
    • setInvalidFormulaHandling

      public final void setInvalidFormulaHandling(InvalidFormulaHandling value)
      Sets how invalid formulas are handled when opening a workbook. The default value is InvalidFormulaHandling.Throw.
      
       XlsxOpenOptions options = new XlsxOpenOptions();
       options.setInvalidFormulaHandling(InvalidFormulaHandling.Preserve);
       InvalidFormulaHandling handling = options.getInvalidFormulaHandling();
       
      Parameters:
      value - How invalid formulas are handled when opening a workbook.