[]
XlsmOpenOptions, XltxOpenOptionsUse 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);
final booleanfinal booleanfinal booleanfinal EnumSet<ImportFlags>final InvalidFormulaHandlingfinal Stringfinal voidsetDigitalSignatureOnly(boolean value) final voidsetDoNotAutoFitAfterOpened(boolean value) final voidsetDoNotRecalculateAfterOpened(boolean value) final voidsetImportFlags(EnumSet<ImportFlags> value) final voidfinal voidsetPassword(String value) getFileFormat, setFileFormatThis 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);
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);
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);
value - The password for the xlsx file.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);
EnumSet that specifies the import flags for loading workbook data.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);
value - An EnumSet that specifies the import flags for loading workbook data.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);
true if marking formulas dirty is skipped after opening an XLSX file; otherwise, false.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);
value - true if marking formulas dirty is skipped after opening an XLSX file; otherwise, false.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);
true if the workbook is configured to open in digital signature only mode; otherwise, false. The default value is false.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);
value - true if the workbook is configured to open in digital signature only mode; otherwise, false. The default value is false.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);
true if auto-fitting row height after loading is disabled; otherwise, false.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);
value - true if auto-fitting row height after loading is disabled; otherwise, false.InvalidFormulaHandling.Throw.
XlsxOpenOptions options = new XlsxOpenOptions();
options.setInvalidFormulaHandling(InvalidFormulaHandling.Preserve);
InvalidFormulaHandling handling = options.getInvalidFormulaHandling();
InvalidFormulaHandling.Throw.
XlsxOpenOptions options = new XlsxOpenOptions();
options.setInvalidFormulaHandling(InvalidFormulaHandling.Preserve);
InvalidFormulaHandling handling = options.getInvalidFormulaHandling();
value - How invalid formulas are handled when opening a workbook.