[]
        
(Showing Draft Content)

ICustomViews

Interface ICustomViews

All Superinterfaces:
Iterable<ICustomView>

public interface ICustomViews extends Iterable<ICustomView>
A collection of custom workbook views.

This interface represents the collection returned by Workbook.getCustomViews(). Each item in the collection is an ICustomView that stores a workbook custom view and can be retrieved by name, added to the workbook, or iterated in sequence.


 worksheet.getPageSetup().setPrintArea("$A$1:$C$10");
 ICustomViews customViews = workbook.getCustomViews();
 customViews.add("PrintView", true, false);
 ICustomView customView = customViews.get("PrintView");
 customView.show();
 
  • Method Summary

    Modifier and Type
    Method
    Description
    add(String viewName, boolean printSettings, boolean rowColSettings)
    Creates a custom view from the current workbook view state.
    get(String viewName)
    Gets the ICustomView object with the specified name.
    int
    Gets the number of custom views in the collection.

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator
  • Method Details

    • getCount

      int getCount()
      Gets the number of custom views in the collection.

      This method returns the current number of ICustomView objects available from Workbook.getCustomViews().

      
       worksheet.getPageSetup().setPrintArea("$A$1:$C$10");
       workbook.getCustomViews().add("PrintView", true, false);
       workbook.getCustomViews().add("HiddenRows", false, true);
       int count = workbook.getCustomViews().getCount();
       
      Returns:
      The number of custom views in the collection.
    • get

      ICustomView get(String viewName)
      Gets the ICustomView object with the specified name.

      Use this method to retrieve a custom workbook view that was previously added to this collection, and then apply it by calling ICustomView.show().

      
       workbook.getCustomViews().add("PrintSetting", true, false);
       ICustomView customView = workbook.getCustomViews().get("PrintSetting");
       customView.show();
       
      Parameters:
      viewName - The name of the custom view in the collection.
      Returns:
      The ICustomView object with the specified name.
    • add

      ICustomView add(String viewName, boolean printSettings, boolean rowColSettings)
      Creates a custom view from the current workbook view state.

      The custom view captures the current view state of all worksheets in the workbook. If a custom view with the same name already exists, the existing custom view is replaced. A custom view cannot be added while the workbook contains a table or a pivot table.

      
       worksheet.getPageSetup().setPrintArea("$A$1:$C$10");
       ICustomView customView = workbook.getCustomViews().add("PrintView", true, false);
       customView.show();
       
      Parameters:
      viewName - The name of the custom view. Must not be null, empty, or blank.
      printSettings - true to include print settings in the custom view; otherwise, false.
      rowColSettings - true to include hidden row and column settings, including filter information, in the custom view; otherwise, false.
      Returns:
      The newly created ICustomView.
      Throws:
      IllegalArgumentException - if viewName is null, empty, or blank, or if the workbook contains a table or a pivot table.