[]
        
(Showing Draft Content)

SaveOptionsBase

Class SaveOptionsBase

java.lang.Object
com.grapecity.documents.excel.SaveOptionsBase
Direct Known Subclasses:
CsvSaveOptions, HtmlSaveOptions, PdfSaveOptions, SjsSaveOptions, XlsxSaveOptions

public abstract class SaveOptionsBase extends Object
Base class for save options used by workbook and worksheet save operations.

This abstract class stores the target SaveFileFormat for a save operation and defines the common contract shared by format-specific save option types. Pass a concrete subclass to save APIs such as Workbook.save(String,SaveOptionsBase) or IWorksheet.save(String,SaveOptionsBase) to control how content is written for a particular output format.

Derived classes initialize the file format through setFileFormat(SaveFileFormat) and expose additional settings for their corresponding formats, such as CSV, HTML, PDF, SJS, or XLSX-based output. Use getFileFormat() to inspect the format associated with a concrete save options instance.

  • Constructor Details

    • SaveOptionsBase

      public SaveOptionsBase()
  • Method Details

    • getFileFormat

      public final SaveFileFormat getFileFormat()
      Gets the file format associated with these save options.

      This value identifies the SaveFileFormat used by the current save options instance. Concrete subclasses set this value to the format they support, such as SaveFileFormat.Csv for CsvSaveOptions or SaveFileFormat.Pdf for PdfSaveOptions.

      
       PdfSaveOptions options = new PdfSaveOptions();
       SaveFileFormat fileFormat = options.getFileFormat();
       
      Returns:
      The file format associated with these save options.
    • setFileFormat

      protected final void setFileFormat(SaveFileFormat value)
      Sets the file format associated with these save options.

      This protected method is used by SaveOptionsBase subclasses to define which SaveFileFormat the options instance represents. The assigned value is returned by getFileFormat().

      
       class CustomSaveOptions extends SaveOptionsBase {
           void usePdfFormat() {
               setFileFormat(SaveFileFormat.Pdf);
           }
       }
      
       CustomSaveOptions options = new CustomSaveOptions();
       options.usePdfFormat();
       
      Parameters:
      value - The file format to associate with these save options; may be null.