Class ExportOptions
Defaults reproduce the historical full-fidelity export exactly, so an
export with ExportOptions.DEFAULT (or a freshly constructed instance)
is byte-identical to the no-options export. Every setter returns this
for fluent configuration:
ExportOptions opts = new ExportOptions()
.formulaPolicy(ExportOptions.FormulaPolicy.BLANK)
.skipComments(true);
Exporters.getExporter("xlsx").export(book, out, opts);
Performance. formulaPolicy, skipComments and
skipHyperlinks cost nothing per cell on the Java side — they ship a
tiny payload and the engine applies them during its single-pass write. A
cellTransform hook, in contrast, walks
the populated cells once in Java to collect per-cell decisions; use it only
when the declarative options cannot express the rule.
Currently honored by the XLSX/XLSM exporter only. Other exporters reject a
non-default ExportOptions with UnsupportedOperationException
rather than silently ignore it.
- Since:
- 7.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA per-cell export decision computed by the app.static enumHow a formula cell is written on export. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ExportOptionsShared immutable-by-convention default (full fidelity). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncellTransform(ExportOptions.CellTransform transform) Sets a per-cell transform for arbitrary, app-defined export rules that the declarative options cannot express (e.g.Sets the global policy for every formula cell.booleanbooleanbooleanskipComments(boolean skip) Whentrue, cell comments (notes) are not exported.skipHyperlinks(boolean skip) Whentrue, cell hyperlinks are not exported.
-
Field Details
-
DEFAULT
Shared immutable-by-convention default (full fidelity). Do not mutate.
-
-
Constructor Details
-
ExportOptions
public ExportOptions()
-
-
Method Details
-
formulaPolicy
Sets the global policy for every formula cell.nullresets toExportOptions.FormulaPolicy.KEEP. -
getFormulaPolicy
-
skipComments
Whentrue, cell comments (notes) are not exported. -
isSkipComments
public boolean isSkipComments() -
skipHyperlinks
Whentrue, cell hyperlinks are not exported. -
isSkipHyperlinks
public boolean isSkipHyperlinks() -
cellTransform
Sets a per-cell transform for arbitrary, app-defined export rules that the declarative options cannot express (e.g. "blank only formulas that call a custom add-in function").nullclears it.The hook is invoked once per populated cell during export; its returned action overrides
formulaPolicyfor that cell. -
getCellTransform
-
isDefault
public boolean isDefault()- Returns:
truewhen every option is at its default — the exporter can then take the historical full-fidelity path.
-