[]
        
(Showing Draft Content)

OpenOptionsBase

Class OpenOptionsBase

java.lang.Object
com.grapecity.documents.excel.OpenOptionsBase
Direct Known Subclasses:
CsvOpenOptions, SjsOpenOptions, XlsxOpenOptions

public abstract class OpenOptionsBase extends Object
Base class for workbook open options.

This abstract class defines the common contract for option objects passed to workbook open APIs. Concrete subclasses represent format-specific settings for opening different workbook sources, such as CSV, XLSX, XLSM, XLTX, or SpreadJS .sjs content.

Each subclass assigns its associated OpenFileFormat through setFileFormat(OpenFileFormat) and can expose additional settings for its target format. Use getFileFormat() to inspect the format associated with a concrete options instance.

  • Constructor Details

    • OpenOptionsBase

      public OpenOptionsBase()
  • Method Details

    • getFileFormat

      public final OpenFileFormat getFileFormat()
      Gets the file format setting for these open options.

      This value identifies the workbook format associated with the current options instance, such as OpenFileFormat.Csv for CsvOpenOptions or OpenFileFormat.Sjs for SjsOpenOptions.

      
       CsvOpenOptions options = new CsvOpenOptions();
       OpenFileFormat fileFormat = options.getFileFormat();
       workbook.open("path/to/data.csv", options);
       
      Returns:
      The file format associated with these open options.
    • setFileFormat

      protected final void setFileFormat(OpenFileFormat value)
      Sets the file format used by these open options.

      This method updates the OpenFileFormat value returned by getFileFormat(). It is intended for use by derived option classes that need to identify the workbook format to open, such as CSV, XLSX, XLSM, XLTX, or SJS.

      
       class CustomOpenOptions extends OpenOptionsBase {
           CustomOpenOptions() {
               setFileFormat(OpenFileFormat.Sjs);
           }
       }
       CustomOpenOptions options = new CustomOpenOptions();
       
      Parameters:
      value - The file format to use for these open options. Must not be null.