Class ExportOptions

java.lang.Object
io.keikai.range.ExportOptions

public final class ExportOptions extends Object
Options controlling how a book is exported to Excel (XLSX/XLSM).

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
  • Field Details

    • DEFAULT

      public static final ExportOptions DEFAULT
      Shared immutable-by-convention default (full fidelity). Do not mutate.
  • Constructor Details

    • ExportOptions

      public ExportOptions()
  • Method Details

    • formulaPolicy

      public ExportOptions formulaPolicy(ExportOptions.FormulaPolicy policy)
      Sets the global policy for every formula cell. null resets to ExportOptions.FormulaPolicy.KEEP.
    • getFormulaPolicy

      public ExportOptions.FormulaPolicy getFormulaPolicy()
    • skipComments

      public ExportOptions skipComments(boolean skip)
      When true, cell comments (notes) are not exported.
    • isSkipComments

      public boolean isSkipComments()
    • skipHyperlinks

      public ExportOptions skipHyperlinks(boolean skip)
      When true, cell hyperlinks are not exported.
    • isSkipHyperlinks

      public boolean isSkipHyperlinks()
    • cellTransform

      public ExportOptions cellTransform(ExportOptions.CellTransform transform)
      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"). null clears it.

      The hook is invoked once per populated cell during export; its returned action overrides formulaPolicy for that cell.

    • getCellTransform

      public ExportOptions.CellTransform getCellTransform()
    • isDefault

      public boolean isDefault()
      Returns:
      true when every option is at its default — the exporter can then take the historical full-fidelity path.