[]
        
(Showing Draft Content)

IWorksheetView

Interface IWorksheetView


public interface IWorksheetView
Represents worksheet view options.

Provides access to the display settings of a worksheet, such as formula visibility, gridline visibility, reading direction, scroll position, zoom, and view type. Use IWorksheet.getSheetView() to retrieve the view settings for a worksheet.


 IWorksheetView sheetView = worksheet.getSheetView();
 sheetView.setDisplayFormulas(true);
 sheetView.setDisplayRightToLeft(true);
 sheetView.setZoom(150);
 
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Gets whether the worksheet displays formulas.
    boolean
    Gets whether gridlines are displayed in the worksheet view.
    boolean
    Gets whether row and column headings are displayed.
    boolean
    Gets whether horizontal gridlines are displayed.
    boolean
    Gets whether outline symbols are displayed.
    boolean
    Gets whether the worksheet is displayed from right to left instead of from left to right.
    boolean
    Gets whether a ruler is displayed for the specified worksheet.
    boolean
    Gets whether vertical gridlines are displayed.
    boolean
    Gets whether whitespace is displayed.
    boolean
    Gets whether zero values are displayed in the worksheet view.
    boolean
    Gets whether the zoom is set to fit the selection.
    Gets the Color object that represents the gridline color of the worksheet.
    int
    Gets the number of the leftmost column in the pane or worksheet.
    int
    Gets the number of the row that appears at the top of the pane or worksheet.
    Gets the current worksheet view type.
    int
    Gets the display size of the worksheet as a percentage.
    void
    setDisplayFormulas(boolean value)
    Sets whether the worksheet displays formulas.
    void
    setDisplayGridlines(boolean value)
    Sets whether gridlines are displayed in the worksheet view.
    void
    setDisplayHeadings(boolean value)
    Sets whether row and column headings are displayed.
    void
    Sets whether horizontal gridlines are displayed.
    void
    setDisplayOutline(boolean value)
    Sets whether outline symbols are displayed.
    void
    setDisplayRightToLeft(boolean value)
    Sets whether the worksheet is displayed from right to left instead of from left to right.
    void
    setDisplayRuler(boolean value)
    Sets whether a ruler is displayed for the specified worksheet.
    void
    Sets whether vertical gridlines are displayed.
    void
    setDisplayWhitespace(boolean value)
    Sets whether whitespace is displayed.
    void
    setDisplayZeros(boolean value)
    Sets whether zero values are displayed in the worksheet view.
    void
    setFitSelection(boolean value)
    Sets whether the zoom is set to fit the selection.
    void
    Sets the Color object that represents the gridline color of the worksheet.
    void
    setScrollColumn(int value)
    Sets the number of the leftmost column in the pane or worksheet.
    void
    setScrollRow(int value)
    Sets the number of the row that appears at the top of the pane or worksheet.
    void
    Sets the view type.
    void
    setZoom(int value)
    Sets the display size of the worksheet as a percentage.
  • Method Details

    • getDisplayRightToLeft

      boolean getDisplayRightToLeft()
      Gets whether the worksheet is displayed from right to left instead of from left to right.

      Returns whether the worksheet view uses right-to-left display.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayRightToLeft(true);
       boolean displayRightToLeft = sheetView.getDisplayRightToLeft();
       
      Returns:
      true if the worksheet is displayed from right to left instead of from left to right; otherwise, false.
    • setDisplayRightToLeft

      void setDisplayRightToLeft(boolean value)
      Sets whether the worksheet is displayed from right to left instead of from left to right.

      Sets whether the worksheet view uses right-to-left display.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayRightToLeft(true);
       
      Parameters:
      value - Whether the worksheet is displayed from right to left instead of from left to right.
    • getDisplayFormulas

      boolean getDisplayFormulas()
      Gets whether the worksheet displays formulas.

      Returns true if formulas are displayed instead of calculated values, or false if the worksheet displays values.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayFormulas(true);
       boolean displayFormulas = sheetView.getDisplayFormulas();
       
      Returns:
      true if the worksheet displays formulas; otherwise, false.
    • setDisplayFormulas

      void setDisplayFormulas(boolean value)
      Sets whether the worksheet displays formulas.

      Sets true if formulas are displayed instead of calculated values, or false if the worksheet displays values.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayFormulas(true);
       
      Parameters:
      value - Whether the worksheet displays formulas.
    • getDisplayGridlines

      boolean getDisplayGridlines()
      Gets whether gridlines are displayed in the worksheet view.

      This property indicates whether cell gridlines are currently shown for the worksheet.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayGridlines(false);
       boolean displayGridlines = sheetView.getDisplayGridlines();
       
      Returns:
      true if gridlines are displayed in the worksheet view; otherwise, false.
    • setDisplayGridlines

      void setDisplayGridlines(boolean value)
      Sets whether gridlines are displayed in the worksheet view.

      This property indicates whether cell gridlines are currently shown for the worksheet.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayGridlines(false);
       
      Parameters:
      value - Whether gridlines are displayed in the worksheet view.
    • getDisplayVerticalGridlines

      boolean getDisplayVerticalGridlines()
      Gets whether vertical gridlines are displayed.

      Returns whether vertical gridlines are visible in the worksheet view.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayVerticalGridlines(false);
       boolean displayVerticalGridlines = sheetView.getDisplayVerticalGridlines();
       
      Returns:
      true if vertical gridlines are displayed; otherwise, false.
    • setDisplayVerticalGridlines

      void setDisplayVerticalGridlines(boolean value)
      Sets whether vertical gridlines are displayed.

      Sets whether vertical gridlines are visible in the worksheet view.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayVerticalGridlines(false);
       
      Parameters:
      value - Whether vertical gridlines are displayed.
    • getDisplayHorizontalGridlines

      boolean getDisplayHorizontalGridlines()
      Gets whether horizontal gridlines are displayed.

      Returns whether horizontal gridlines are visible in the worksheet view.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayHorizontalGridlines(true);
       boolean displayHorizontalGridlines = sheetView.getDisplayHorizontalGridlines();
       
      Returns:
      true if horizontal gridlines are displayed; otherwise, false.
    • setDisplayHorizontalGridlines

      void setDisplayHorizontalGridlines(boolean value)
      Sets whether horizontal gridlines are displayed.

      Sets whether horizontal gridlines are visible in the worksheet view.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayHorizontalGridlines(true);
       
      Parameters:
      value - Whether horizontal gridlines are displayed.
    • getDisplayHeadings

      boolean getDisplayHeadings()
      Gets whether row and column headings are displayed.

      Returns whether both row and column headings are visible in the worksheet view.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayHeadings(false);
       boolean displayHeadings = sheetView.getDisplayHeadings();
       
      Returns:
      true if row and column headings are displayed; otherwise, false.
    • setDisplayHeadings

      void setDisplayHeadings(boolean value)
      Sets whether row and column headings are displayed.

      Sets whether both row and column headings are visible in the worksheet view.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayHeadings(false);
       
      Parameters:
      value - Whether row and column headings are displayed.
    • getDisplayOutline

      boolean getDisplayOutline()
      Gets whether outline symbols are displayed.

      This property indicates whether the worksheet view currently shows outline symbols for grouped rows and columns.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayOutline(false);
       boolean displayOutline = sheetView.getDisplayOutline();
       
      Returns:
      true if outline symbols are displayed; otherwise, false.
    • setDisplayOutline

      void setDisplayOutline(boolean value)
      Sets whether outline symbols are displayed.

      This property indicates whether the worksheet view currently shows outline symbols for grouped rows and columns.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayOutline(false);
       
      Parameters:
      value - Whether outline symbols are displayed.
    • getDisplayRuler

      boolean getDisplayRuler()
      Gets whether a ruler is displayed for the specified worksheet.

      This property indicates whether the current worksheet view shows the ruler.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayRuler(false);
       boolean displayRuler = sheetView.getDisplayRuler();
       
      Returns:
      true if a ruler is displayed for the specified worksheet; otherwise, false.
    • setDisplayRuler

      void setDisplayRuler(boolean value)
      Sets whether a ruler is displayed for the specified worksheet.

      This property indicates whether the current worksheet view shows the ruler.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayRuler(false);
       
      Parameters:
      value - Whether a ruler is displayed for the specified worksheet.
    • getDisplayWhitespace

      boolean getDisplayWhitespace()
      Gets whether whitespace is displayed.

      This property indicates whether the current worksheet view shows whitespace.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayWhitespace(true);
       boolean displayWhitespace = sheetView.getDisplayWhitespace();
       
      Returns:
      true if whitespace is displayed; otherwise, false.
    • setDisplayWhitespace

      void setDisplayWhitespace(boolean value)
      Sets whether whitespace is displayed.

      This property indicates whether the current worksheet view shows whitespace.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayWhitespace(true);
       
      Parameters:
      value - Whether whitespace is displayed.
    • getDisplayZeros

      boolean getDisplayZeros()
      Gets whether zero values are displayed in the worksheet view.

      When this property is false, cells whose displayed value is zero are hidden in the current worksheet view.

      
       worksheet.getRange("A1").setValue(0);
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayZeros(false);
       boolean displayZeros = sheetView.getDisplayZeros();
       
      Returns:
      true if zero values are displayed in the worksheet view; otherwise, false.
    • setDisplayZeros

      void setDisplayZeros(boolean value)
      Sets whether zero values are displayed in the worksheet view.

      When this property is false, cells whose displayed value is zero are hidden in the current worksheet view.

      
       worksheet.getRange("A1").setValue(0);
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setDisplayZeros(true);
       
      Parameters:
      value - Whether zero values are displayed in the worksheet view.
    • getZoom

      int getZoom()
      Gets the display size of the worksheet as a percentage.

      A value of 100 represents the normal display size, 200 represents double size, and other values scale the worksheet view accordingly.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setZoom(120);
       int zoom = sheetView.getZoom();
       
      Returns:
      The display size of the worksheet as a percentage. A value of 100 represents the normal display size, 200 represents double size, and other values scale the worksheet view accordingly.
    • setZoom

      void setZoom(int value)
      Sets the display size of the worksheet as a percentage.

      A value of 100 represents the normal display size, 200 represents double size, and other values scale the worksheet view accordingly.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setZoom(120);
       
      Parameters:
      value - The display size of the worksheet as a percentage.
    • getViewType

      ViewType getViewType()
      Gets the current worksheet view type.

      The view type indicates how the worksheet is displayed, such as ViewType.NormalView, ViewType.PageBreakPreview, and ViewType.PageLayoutView.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setViewType(ViewType.PageLayoutView);
       ViewType viewType = sheetView.getViewType();
       
      Returns:
      The current worksheet view type.
    • setViewType

      void setViewType(ViewType value)
      Sets the view type.

      Use this method to switch the worksheet between different display modes, such as ViewType.NormalView, ViewType.PageBreakPreview, and ViewType.PageLayoutView.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setViewType(ViewType.PageLayoutView);
       
      Parameters:
      value - The view type to apply to the worksheet.
    • getGridlineColor

      Color getGridlineColor()
      Gets the Color object that represents the gridline color of the worksheet.
      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setGridlineColor(Color.GetBlue());
       Color gridlineColor = sheetView.getGridlineColor();
       
      Returns:
      The Color object that represents the gridline color of the worksheet.
    • setGridlineColor

      void setGridlineColor(Color value)
      Sets the Color object that represents the gridline color of the worksheet.
      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setGridlineColor(Color.GetBlue());
       
      Parameters:
      value - The Color object that represents the gridline color of the worksheet.
    • getScrollColumn

      int getScrollColumn()
      Gets the number of the leftmost column in the pane or worksheet.

      This value indicates which column is currently displayed at the left edge of the active worksheet view.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setScrollColumn(3);
       int scrollColumn = sheetView.getScrollColumn();
       
      Returns:
      The number of the leftmost column in the pane or worksheet.
    • setScrollColumn

      void setScrollColumn(int value)
      Sets the number of the leftmost column in the pane or worksheet.

      This value indicates which column is currently displayed at the left edge of the active worksheet view.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setScrollColumn(3);
       
      Parameters:
      value - The number of the leftmost column in the pane or worksheet.
    • getScrollRow

      int getScrollRow()
      Gets the number of the row that appears at the top of the pane or worksheet.

      Use this property to determine which row is currently shown at the top edge of the worksheet view.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setScrollRow(5);
       int scrollRow = sheetView.getScrollRow();
       
      Returns:
      The number of the row that appears at the top of the pane or worksheet.
    • setScrollRow

      void setScrollRow(int value)
      Sets the number of the row that appears at the top of the pane or worksheet.

      Use this property to specify which row is currently shown at the top edge of the worksheet view.

      
       IWorksheetView sheetView = worksheet.getSheetView();
       sheetView.setScrollRow(5);
       
      Parameters:
      value - The number of the row that appears at the top of the pane or worksheet.
    • getFitSelection

      boolean getFitSelection()
      Gets whether the zoom is set to fit the selection.

      This option is only supported for SheetType.Chart.

      
       IWorksheet chartSheet = workbook.getWorksheets().add(SheetType.Chart);
       chartSheet.getShapes().addChart(ChartType.Area, 0, 0, 100, 100);
       IWorksheetView sheetView = chartSheet.getSheetView();
       sheetView.setFitSelection(true);
       boolean fitSelection = sheetView.getFitSelection();
       
      Returns:
      true if the zoom is set to fit the selection; otherwise, false.
      Throws:
      UnsupportedOperationException - if called with unsupported sheet types.
    • setFitSelection

      void setFitSelection(boolean value)
      Sets whether the zoom is set to fit the selection.

      This option is only supported for SheetType.Chart.

      
       IWorksheet chartSheet = workbook.getWorksheets().add(SheetType.Chart);
       chartSheet.getShapes().addChart(com.grapecity.documents.excel.drawing.ChartType.Area, 0, 0, 100, 100);
       IWorksheetView sheetView = chartSheet.getSheetView();
       sheetView.setFitSelection(true);
       
      Parameters:
      value - Whether to fit the selection. Unlike Microsoft Excel, this option does not change the return value of getZoom(). This feature is supported only for worksheets of type SheetType.Chart.
      Throws:
      UnsupportedOperationException - if called with unsupported sheet types.