[]
        
(Showing Draft Content)

WorkbookOptions

Class WorkbookOptions

java.lang.Object
com.grapecity.documents.excel.WorkbookOptions

public class WorkbookOptions extends Object
Represents options used when creating a Workbook.

Use this class to configure workbook-level behaviors at construction time, such as whether column widths are measured in pixels instead of character counts. Enabling pixel-based column width can make API behaviors such as auto-fit column, and rendering results such as PDF and image output, closer to SpreadJS.


 WorkbookOptions options = new WorkbookOptions();
 options.setPixelBasedColumnWidth(true);
 Workbook workbook = new Workbook(options);
 IWorksheet worksheet = workbook.getWorksheets().get(0);
 worksheet.getRange("A:A").setColumnWidthInPixel(96);
 double widthInPixels = worksheet.getRange("A:A").getColumnWidthInPixel();
 
  • Constructor Details

    • WorkbookOptions

      public WorkbookOptions()
  • Method Details

    • getPixelBasedColumnWidth

      public boolean getPixelBasedColumnWidth()
      Gets whether the workbook uses pixel-based column width.

      By default, a workbook uses character count based column width. Set this option to true to use pixels as the column width unit so that API behaviors such as auto-fit columns and rendering results such as PDF and image output are closer to SpreadJS.

      
       WorkbookOptions options = new WorkbookOptions();
       options.setPixelBasedColumnWidth(true);
       boolean pixelBased = options.getPixelBasedColumnWidth();
       Workbook workbook = new Workbook(options);
       
      Returns:
      true if the workbook uses pixel-based column width; otherwise, false. The default value is false.
    • setPixelBasedColumnWidth

      public void setPixelBasedColumnWidth(boolean value)
      Sets whether the workbook uses pixel-based column width.

      By default, a workbook uses character count based column width. Set this option to true to use pixels as the column width unit so that API behaviors such as auto-fit columns and rendering results such as PDF and image output are closer to SpreadJS.

      
       WorkbookOptions options = new WorkbookOptions();
       options.setPixelBasedColumnWidth(true);
       Workbook workbook = new Workbook(options);
       IWorksheet worksheet = workbook.getWorksheets().get(0);
       worksheet.getRange("A:A").setColumnWidthInPixel(96);
       
      Parameters:
      value - true if the workbook uses pixel-based column width; otherwise, false. The default value is false.