public final class ExcelWorksheetCollection extends Object implements Iterable<ExcelWorksheet>
ExcelWorksheet
).ExcelWorksheet
Modifier and Type | Method and Description |
---|---|
ExcelWorksheet |
add(SheetType type,
String worksheetName)
Adds an empty worksheet to the end of the collection.
|
ExcelWorksheet |
add(String worksheetName)
Adds an empty worksheet to the end of the collection.
|
ExcelWorksheet |
addCopy(String destinationWorksheetName,
ExcelWorksheet sourceWorksheet)
Adds a copy of an existing worksheet to the end of the collection.
|
boolean |
contains(ExcelWorksheet item)
Determines whether an
ExcelWorksheet element is in the ExcelWorksheetCollection . |
boolean |
contains(String worksheetName)
Determines whether an
ExcelWorksheet element with specified name is in the ExcelWorksheetCollection . |
ExcelWorksheet |
get(int index)
Gets the worksheet with the specified index.
|
ExcelWorksheet |
get(String name)
Gets the worksheet with the specified name.
|
ExcelWorksheet |
getActiveWorksheet()
Gets active worksheet.
|
ExcelWorksheet |
insertCopy(int worksheetIndex,
String worksheetName,
ExcelWorksheet sourceWorksheet)
Inserts a copy of an existing worksheet at the specified index.
|
ExcelWorksheet |
insertEmpty(int worksheetIndex,
SheetType type,
String worksheetName)
Inserts empty worksheet at the specified index.
|
ExcelWorksheet |
insertEmpty(int worksheetIndex,
String worksheetName)
Inserts empty worksheet at the specified index.
|
Iterator<ExcelWorksheet> |
iterator()
Returns an iterator for the
ExcelWorksheetCollection . |
void |
move(int oldIndex,
int newIndex)
Moves the worksheet at the specified index to a new location in the collection.
|
void |
remove(int worksheetIndex)
Removes the worksheet with the specified index.
|
void |
remove(String worksheetName)
Removes the worksheet with the specified name.
|
void |
setActiveWorksheet(ExcelWorksheet value)
Gets active worksheet.
|
int |
size()
Gets the number of elements contained in the
ExcelWorksheetCollection . |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public ExcelWorksheet add(SheetType type, String worksheetName)
If this is the first worksheet added to the collection the
active worksheet
is set to this worksheet.
type
- The sheet type.worksheetName
- Worksheet name.IllegalArgumentException
- Worksheet name is not unique.public ExcelWorksheet add(String worksheetName)
If this is the first worksheet added to the collection the
active worksheet
is set to this worksheet.
worksheetName
- Worksheet name.IllegalArgumentException
- Worksheet name is not unique.public ExcelWorksheet addCopy(String destinationWorksheetName, ExcelWorksheet sourceWorksheet)
If this is the first worksheet added to the collection the
active worksheet
is set to this worksheet.
destinationWorksheetName
- Name of new worksheet.sourceWorksheet
- Source worksheet.IllegalArgumentException
- Worksheet name is not unique.public boolean contains(ExcelWorksheet item)
ExcelWorksheet
element is in the ExcelWorksheetCollection
.item
- The ExcelWorksheet
to locate in the ExcelWorksheetCollection
.ExcelWorksheet
is found in the ExcelWorksheetCollection
; otherwise, false.public boolean contains(String worksheetName)
ExcelWorksheet
element with specified name is in the ExcelWorksheetCollection
.worksheetName
- The name of the ExcelWorksheet
to locate in the ExcelWorksheetCollection
.ExcelWorksheet
with specified name is found in the ExcelWorksheetCollection
; otherwise, false.public ExcelWorksheet get(int index)
index
- The zero-based index of the worksheet.public ExcelWorksheet get(String name)
name
- The name of the worksheet.public ExcelWorksheet getActiveWorksheet()
Active worksheet is the one selected when file is opened with Microsoft Excel. By default active worksheet
is the first one added with ExcelFile.addWorksheet(String)
, add(String)
or add(SheetType, String)
methods.
public ExcelWorksheet insertCopy(int worksheetIndex, String worksheetName, ExcelWorksheet sourceWorksheet)
worksheetIndex
- The zero-based index of the worksheet.worksheetName
- Worksheet name.sourceWorksheet
- Source worksheet to copy.public ExcelWorksheet insertEmpty(int worksheetIndex, SheetType type, String worksheetName)
worksheetIndex
- The zero-based index of the worksheet.type
- The sheet type.worksheetName
- Worksheet name.public ExcelWorksheet insertEmpty(int worksheetIndex, String worksheetName)
worksheetIndex
- The zero-based index of the worksheet.worksheetName
- Worksheet name.public Iterator<ExcelWorksheet> iterator()
ExcelWorksheetCollection
.iterator
in interface Iterable<ExcelWorksheet>
ExcelWorksheetCollection
.public void move(int oldIndex, int newIndex)
oldIndex
- The zero-based index specifying the location of the worksheet to be moved.newIndex
- The zero-based index specifying the new location of the worksheet.public void remove(int worksheetIndex)
worksheetIndex
- The zero-based index of the worksheet.public void remove(String worksheetName)
worksheetName
- Worksheet name.public void setActiveWorksheet(ExcelWorksheet value)
Active worksheet is the one selected when file is opened with Microsoft Excel. By default active worksheet
is the first one added with ExcelFile.addWorksheet(String)
, add(String)
or add(SheetType, String)
methods.
GemBox.Spreadsheet Free allows setting active worksheet to only one of the first 5 worksheets, otherwise active worksheet defaults to the first worksheet.
public int size()
ExcelWorksheetCollection
.© GemBox Ltd. — All rights reserved.