Package io.keikai.axyra.sheets.io
Class SaveOptions
java.lang.Object
io.keikai.axyra.sheets.io.SaveOptions
Export options for
Workbook.save(path, options). Every field defaults
to full-fidelity export. Saved formula results are current, since writes
recalculate their dependents; only a workbook in CalcMode.MANUAL
needs Workbook.recalculate() before saving.
Only the XLSX family (.xlsx, .xlsm, .xltx,
.xltm) honors these options. Other formats are written as
Workbook.save(Path) writes them and ignore the options. One check
applies to other formats: an explicit FormulaPolicy.KEEP is refused
for output that cannot keep formulas (see formulaPolicy(FormulaPolicy)).
workbook.save(Path.of("values.xlsx"),
SaveOptions.create().formulaPolicy(FormulaPolicy.VALUES_ONLY).skipComments(true));
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SaveOptionscreate()Options with every field at its full-fidelity default: formulas kept, comments and hyperlinks written.The formula policy;FormulaPolicy.KEEPby default.formulaPolicy(FormulaPolicy policy) Sets how formulas are written.booleanWhetherformulaPolicy(FormulaPolicy)was called, rather than left at the default.booleanWhether comments are left out of the saved file.skipComments(boolean skip) Leaves cell comments (notes) out of the saved XLSX file (true).booleanWhether hyperlinks are left out of the saved file.skipHyperlinks(boolean skip) Leaves hyperlinks out of the saved XLSX file (true).
-
Constructor Details
-
SaveOptions
public SaveOptions()
-
-
Method Details
-
create
Options with every field at its full-fidelity default: formulas kept, comments and hyperlinks written.- Returns:
- new options
-
formulaPolicy
Sets how formulas are written. Asking forFormulaPolicy.KEEPexplicitly is a promise that the file keeps its formulas. SoWorkbook.savethrowsIllegalArgumentExceptioninstead of writing values when the target cannot keep them: always for.csv,.tsvand.txt, and for.odswhen a formula has no OpenFormula translation. Leaving the policy at its default KEEP does not trigger this check.- Parameters:
policy- the policy- Returns:
- these options
- Throws:
NullPointerException- ifpolicyisnull
-
skipComments
Leaves cell comments (notes) out of the saved XLSX file (true). The workbook in memory keeps them. Defaultfalse.- Parameters:
skip-trueto leave comments out- Returns:
- these options
-
skipHyperlinks
Leaves hyperlinks out of the saved XLSX file (true). The cell text stays, and the workbook in memory keeps the links. Defaultfalse.- Parameters:
skip-trueto leave hyperlinks out- Returns:
- these options
-
formulaPolicy
The formula policy;FormulaPolicy.KEEPby default. -
formulaPolicyExplicit
public boolean formulaPolicyExplicit()WhetherformulaPolicy(FormulaPolicy)was called, rather than left at the default. -
skipComments
public boolean skipComments()Whether comments are left out of the saved file. -
skipHyperlinks
public boolean skipHyperlinks()Whether hyperlinks are left out of the saved file.
-