Aspose::Cells::IWorksheetCollection Class Referenceabstract

Encapsulates a collection of IWorksheet objects. More...

Inherits CollectionBase.

Public Member Functions

virtual bool IsRefreshAllConnections ()=0
 Indicates whether refresh all connections on opening file in MS Excel. More...
 
virtual void SetRefreshAllConnections (bool value)=0
 Indicates whether refresh all connections on opening file in MS Excel. More...
 
virtual intrusive_ptr< Aspose::Cells::IRangeCreateIRange (intrusive_ptr< Aspose::Cells::Systems::String > address, Aspose::Cells::Systems::Int32 sheetIndex)=0
 Creates a IRange object from an address of the range. More...
 
virtual intrusive_ptr< Aspose::Cells::INameCollectionGetINames ()=0
 Gets the collection of all the Name objects in the spreadsheet. More...
 
virtual intrusive_ptr< Aspose::Cells::IWorksheetGetObjectByIndex (Aspose::Cells::Systems::Int32 index)=0
 Gets the IWorksheet element at the specified index. More...
 
virtual intrusive_ptr< Aspose::Cells::IWorksheetGetObjectByIndex (intrusive_ptr< Aspose::Cells::Systems::String > sheetName)=0
 Gets the IWorksheet element with the specified name. More...
 
virtual intrusive_ptr< Aspose::Cells::IWorksheetGetISheetByCodeName (intrusive_ptr< Aspose::Cells::Systems::String > codeName)=0
 Gets the worksheet by the code name. More...
 
virtual Aspose::Cells::Systems::Int32 GetActiveSheetIndex ()=0
 Represents the index of active worksheet when the spreadsheet is opened. More...
 
virtual void SetActiveSheetIndex (Aspose::Cells::Systems::Int32 value)=0
 Represents the index of active worksheet when the spreadsheet is opened. More...
 
virtual void SortNames ()=0
 Sorts defined names. More...
 
virtual intrusive_ptr< Aspose::Cells::IWorksheetInsertIWorksheet (Aspose::Cells::Systems::Int32 index, Aspose::Cells::SheetType sheetType)=0
 Insert a worksheet. More...
 
virtual intrusive_ptr< Aspose::Cells::IWorksheetInsertIWorksheet (Aspose::Cells::Systems::Int32 index, Aspose::Cells::SheetType sheetType, intrusive_ptr< Aspose::Cells::Systems::String > sheetName)=0
 Insert a worksheet. More...
 
virtual Aspose::Cells::Systems::Int32 Add (Aspose::Cells::SheetType type)=0
 Adds a worksheet to the collection. More...
 
virtual void SwapSheet (Aspose::Cells::Systems::Int32 sheetIndex1, Aspose::Cells::Systems::Int32 sheetIndex2)=0
 Swaps the two sheets. More...
 
virtual Aspose::Cells::Systems::Int32 Add ()=0
 Adds a worksheet to the collection. More...
 
virtual intrusive_ptr< Aspose::Cells::IWorksheetAddIWorksheet (intrusive_ptr< Aspose::Cells::Systems::String > sheetName)=0
 Adds a worksheet to the collection. More...
 
virtual void RemoveAt (intrusive_ptr< Aspose::Cells::Systems::String > name)=0
 Removes the element at a specified name. More...
 
virtual void RemoveAt (Aspose::Cells::Systems::Int32 index)=0
 Removes the element at a specified index. More...
 
virtual void Clear ()=0
 Clear all worksheets. More...
 
virtual Aspose::Cells::Systems::Int32 AddCopy (intrusive_ptr< Aspose::Cells::Systems::String > sheetName)=0
 Adds a worksheet to the collection and copies data from an existed worksheet. More...
 
virtual Aspose::Cells::Systems::Int32 AddCopy (Aspose::Cells::Systems::Int32 sheetIndex)=0
 Adds a worksheet to the collection and copies data from an existed worksheet. More...
 
virtual intrusive_ptr< Aspose::Cells::IRangeGetIRangeByName (intrusive_ptr< Aspose::Cells::Systems::String > rangeName)=0
 Gets Range object by pre-defined name. More...
 
virtual intrusive_ptr< Aspose::Cells::Systems::Array1D< Aspose::Cells::IRange * > > GetNamedIRanges ()=0
 Gets all pre-defined named ranges in the spreadsheet. More...
 
virtual intrusive_ptr< Aspose::Cells::Systems::Array1D< Aspose::Cells::IRange * > > GetNamedIRangesAndTables ()=0
 Gets all pre-defined named ranges in the spreadsheet. More...
 
virtual intrusive_ptr< Aspose::Cells::Properties::IBuiltInDocumentPropertyCollectionGetIBuiltInDocumentProperties ()=0
 Returns an IDocumentProperty collection that represents all the built-in document properties of the spreadsheet. More...
 
virtual intrusive_ptr< Aspose::Cells::Properties::ICustomDocumentPropertyCollectionGetICustomDocumentProperties ()=0
 Returns an ICustomDocumentPropertyCollection that represents all the custom document properties of the spreadsheet. More...
 
virtual intrusive_ptr< Aspose::Cells::Systems::Object > GetOleSize ()=0
 Gets and Sets displayed size when Workbook file is used as an Ole object. More...
 
virtual void SetOleSize (intrusive_ptr< Aspose::Cells::Systems::Object > value)=0
 Gets and Sets displayed size when Workbook file is used as an Ole object. More...
 
virtual void SetOleSize (Aspose::Cells::Systems::Int32 startRow, Aspose::Cells::Systems::Int32 endRow, Aspose::Cells::Systems::Int32 startColumn, Aspose::Cells::Systems::Int32 endColumn)=0
 Sets displayed size when Workbook file is used as an Ole object. More...
 
virtual intrusive_ptr< Aspose::Cells::IExternalLinkCollectionGetIExternalLinks ()=0
 Represents external links in a workbook. More...
 
virtual void ClearPivottables ()=0
 Clears pivot tables from the spreadsheet. More...
 

Detailed Description

Encapsulates a collection of IWorksheet objects.

[C++]
intrusive_ptr<Aspose::Cells::IWorkbook> workbook = Factory::CreateIWorkbook();
intrusive_ptr<Aspose::Cells::IWorksheetCollection> sheets = workbook->GetIWorksheets();
//Add a worksheet
sheets->Add();
//Change the name of a worksheet
sheets->GetObjectByIndex(0)->SetName(new Aspose::Cells::Systems::String("First Sheet"));
//Set the active sheet to the second worksheet
sheets->SetActiveSheetIndex(1);

Member Function Documentation

◆ Add() [1/2]

virtual Aspose::Cells::Systems::Int32 Aspose::Cells::IWorksheetCollection::Add ( Aspose::Cells::SheetType  type)
pure virtual

Adds a worksheet to the collection.

Parameters
typeWorksheet type.
Returns
IWorksheet object index.
[C++]
intrusive_ptr<Aspose::Cells::IWorkbook> workbook = Factory::CreateIWorkbook();
workbook->GetIWorksheets()->Add(Aspose::Cells::SheetType_Chart);
intrusive_ptr<Aspose::Cells::ICells> cells = workbook->GetIWorksheets()->GetObjectByIndex(0)->GetICells();
cells->GetObjectByIndex(new String("c2"))->PutValue(5000);
cells->GetObjectByIndex(new String("c3"))->PutValue(3000);
cells->GetObjectByIndex(new String("c4"))->PutValue(4000);
cells->GetObjectByIndex(new String("c5"))->PutValue(5000);
cells->GetObjectByIndex(new String("c6"))->PutValue(6000);

◆ Add() [2/2]

virtual Aspose::Cells::Systems::Int32 Aspose::Cells::IWorksheetCollection::Add ( )
pure virtual

Adds a worksheet to the collection.

Returns
IWorksheet object index.

◆ AddCopy() [1/2]

virtual Aspose::Cells::Systems::Int32 Aspose::Cells::IWorksheetCollection::AddCopy ( intrusive_ptr< Aspose::Cells::Systems::String >  sheetName)
pure virtual

Adds a worksheet to the collection and copies data from an existed worksheet.

Parameters
sheetNameName of source worksheet.
Returns
IWorksheet object index.
Exceptions
ICellsExceptionSpecifies an invalid worksheet name.

◆ AddCopy() [2/2]

virtual Aspose::Cells::Systems::Int32 Aspose::Cells::IWorksheetCollection::AddCopy ( Aspose::Cells::Systems::Int32  sheetIndex)
pure virtual

Adds a worksheet to the collection and copies data from an existed worksheet.

Parameters
sheetIndexIndex of source worksheet.
Returns
IWorksheet object index.

◆ AddIWorksheet()

virtual intrusive_ptr<Aspose::Cells::IWorksheet> Aspose::Cells::IWorksheetCollection::AddIWorksheet ( intrusive_ptr< Aspose::Cells::Systems::String >  sheetName)
pure virtual

Adds a worksheet to the collection.

Parameters
sheetNameWorksheet name
Returns
IWorksheet object.

◆ Clear()

virtual void Aspose::Cells::IWorksheetCollection::Clear ( )
pure virtual

Clear all worksheets.

A workbook must contains a worksheet.

◆ ClearPivottables()

virtual void Aspose::Cells::IWorksheetCollection::ClearPivottables ( )
pure virtual

Clears pivot tables from the spreadsheet.

◆ CreateIRange()

virtual intrusive_ptr<Aspose::Cells::IRange> Aspose::Cells::IWorksheetCollection::CreateIRange ( intrusive_ptr< Aspose::Cells::Systems::String >  address,
Aspose::Cells::Systems::Int32  sheetIndex 
)
pure virtual

Creates a IRange object from an address of the range.

Parameters
addressThe address of the range.
sheetIndexThe sheet index.
Returns
A IRange object

◆ GetActiveSheetIndex()

virtual Aspose::Cells::Systems::Int32 Aspose::Cells::IWorksheetCollection::GetActiveSheetIndex ( )
pure virtual

Represents the index of active worksheet when the spreadsheet is opened.

Sheet index is zero based.

◆ GetIBuiltInDocumentProperties()

virtual intrusive_ptr<Aspose::Cells::Properties::IBuiltInDocumentPropertyCollection> Aspose::Cells::IWorksheetCollection::GetIBuiltInDocumentProperties ( )
pure virtual

Returns an IDocumentProperty collection that represents all the built-in document properties of the spreadsheet.

A new property cannot be added to built-in document properties list. You can only get a built-in property and change its value. The following is the built-in properties name list:

Title

Subject

Author

Keywords

Comments

Template

Last Author

Revision Number

Application Name

Last Print Date

Creation Date

Last Save Time

Total Editing Time

Number of Pages

Number of Words

Number of Characters

Security

Category

Format

Manager

Company

Number of Bytes

Number of Lines

Number of Paragraphs

Number of Slides

Number of Notes

Number of Hidden Slides

Number of Multimedia Clips

[C++]
intrusive_ptr<Aspose::Cells::IWorkbook> workbook = Factory::CreateIWorkbook();
intrusive_ptr<Aspose::Cells::Properties::IDocumentProperty> doc =
workbook->GetIWorksheets()->GetIBuiltInDocumentProperties()->GetObjectByIndex(new String("Author"));
doc->SetValue(new String("John Smith"));

◆ GetICustomDocumentProperties()

virtual intrusive_ptr<Aspose::Cells::Properties::ICustomDocumentPropertyCollection> Aspose::Cells::IWorksheetCollection::GetICustomDocumentProperties ( )
pure virtual

Returns an ICustomDocumentPropertyCollection that represents all the custom document properties of the spreadsheet.

[C++]
intrusive_ptr<Aspose::Cells::IWorkbook> workbook = Factory::CreateIWorkbook();
intrusive_ptr<Aspose::Cells::Properties::ICustomDocumentPropertyCollection> doc =
workbook->GetIWorksheets()->GetICustomDocumentProperties();
doc->AddLinkToContentProperty(new String("Checked by"), new String("Jane"));

◆ GetIExternalLinks()

virtual intrusive_ptr<Aspose::Cells::IExternalLinkCollection> Aspose::Cells::IWorksheetCollection::GetIExternalLinks ( )
pure virtual

Represents external links in a workbook.

◆ GetINames()

virtual intrusive_ptr<Aspose::Cells::INameCollection> Aspose::Cells::IWorksheetCollection::GetINames ( )
pure virtual

Gets the collection of all the Name objects in the spreadsheet.

◆ GetIRangeByName()

virtual intrusive_ptr<Aspose::Cells::IRange> Aspose::Cells::IWorksheetCollection::GetIRangeByName ( intrusive_ptr< Aspose::Cells::Systems::String >  rangeName)
pure virtual

Gets Range object by pre-defined name.

Parameters
rangeNameName of range.
Returns

Range object.

Returns null if the named range does not exist.

◆ GetISheetByCodeName()

virtual intrusive_ptr<Aspose::Cells::IWorksheet> Aspose::Cells::IWorksheetCollection::GetISheetByCodeName ( intrusive_ptr< Aspose::Cells::Systems::String >  codeName)
pure virtual

Gets the worksheet by the code name.

Parameters
codeNameWorksheet code name.
Returns
The element with the specified code name.

◆ GetNamedIRanges()

virtual intrusive_ptr<Aspose::Cells::Systems::Array1D<Aspose::Cells::IRange*> > Aspose::Cells::IWorksheetCollection::GetNamedIRanges ( )
pure virtual

Gets all pre-defined named ranges in the spreadsheet.

Returns

An array of Range objects.

Returns null if the named range does not exist.

◆ GetNamedIRangesAndTables()

virtual intrusive_ptr<Aspose::Cells::Systems::Array1D<Aspose::Cells::IRange*> > Aspose::Cells::IWorksheetCollection::GetNamedIRangesAndTables ( )
pure virtual

Gets all pre-defined named ranges in the spreadsheet.

Returns

An array of Range objects.

Returns null if the named range does not exist.

◆ GetObjectByIndex() [1/2]

virtual intrusive_ptr<Aspose::Cells::IWorksheet> Aspose::Cells::IWorksheetCollection::GetObjectByIndex ( Aspose::Cells::Systems::Int32  index)
pure virtual

Gets the IWorksheet element at the specified index.

Parameters
indexThe zero based index of the element.
Returns
The element at the specified index.

◆ GetObjectByIndex() [2/2]

virtual intrusive_ptr<Aspose::Cells::IWorksheet> Aspose::Cells::IWorksheetCollection::GetObjectByIndex ( intrusive_ptr< Aspose::Cells::Systems::String >  sheetName)
pure virtual

Gets the IWorksheet element with the specified name.

Parameters
sheetNameWorksheet name
Returns
The element with the specified name.

◆ GetOleSize()

virtual intrusive_ptr<Aspose::Cells::Systems::Object> Aspose::Cells::IWorksheetCollection::GetOleSize ( )
pure virtual

Gets and Sets displayed size when Workbook file is used as an Ole object.

Null means no ole size setting.

◆ InsertIWorksheet() [1/2]

virtual intrusive_ptr<Aspose::Cells::IWorksheet> Aspose::Cells::IWorksheetCollection::InsertIWorksheet ( Aspose::Cells::Systems::Int32  index,
Aspose::Cells::SheetType  sheetType 
)
pure virtual

Insert a worksheet.

Parameters
indexThe sheet index
Parameters
sheetTypeThe sheet type.
Returns
Returns an inserted worksheet.

◆ InsertIWorksheet() [2/2]

virtual intrusive_ptr<Aspose::Cells::IWorksheet> Aspose::Cells::IWorksheetCollection::InsertIWorksheet ( Aspose::Cells::Systems::Int32  index,
Aspose::Cells::SheetType  sheetType,
intrusive_ptr< Aspose::Cells::Systems::String >  sheetName 
)
pure virtual

Insert a worksheet.

Parameters
indexThe sheet index
Parameters
sheetTypeThe sheet type.
Parameters
sheetNameThe sheet name.
Returns
Returns an inserted worksheet.

◆ IsRefreshAllConnections()

virtual bool Aspose::Cells::IWorksheetCollection::IsRefreshAllConnections ( )
pure virtual

Indicates whether refresh all connections on opening file in MS Excel.

◆ RemoveAt() [1/2]

virtual void Aspose::Cells::IWorksheetCollection::RemoveAt ( intrusive_ptr< Aspose::Cells::Systems::String >  name)
pure virtual

Removes the element at a specified name.

Parameters
nameThe name of the element to remove.

◆ RemoveAt() [2/2]

virtual void Aspose::Cells::IWorksheetCollection::RemoveAt ( Aspose::Cells::Systems::Int32  index)
pure virtual

Removes the element at a specified index.

Parameters
indexThe index value of the element to remove.

◆ SetActiveSheetIndex()

virtual void Aspose::Cells::IWorksheetCollection::SetActiveSheetIndex ( Aspose::Cells::Systems::Int32  value)
pure virtual

Represents the index of active worksheet when the spreadsheet is opened.

Sheet index is zero based.

◆ SetOleSize() [1/2]

virtual void Aspose::Cells::IWorksheetCollection::SetOleSize ( intrusive_ptr< Aspose::Cells::Systems::Object >  value)
pure virtual

Gets and Sets displayed size when Workbook file is used as an Ole object.

Null means no ole size setting.

◆ SetOleSize() [2/2]

virtual void Aspose::Cells::IWorksheetCollection::SetOleSize ( Aspose::Cells::Systems::Int32  startRow,
Aspose::Cells::Systems::Int32  endRow,
Aspose::Cells::Systems::Int32  startColumn,
Aspose::Cells::Systems::Int32  endColumn 
)
pure virtual

Sets displayed size when Workbook file is used as an Ole object.

Parameters
startRowStart row index.
Parameters
endRowEnd row index.
Parameters
startColumnStart column index.
Parameters
endColumnEnd column index.

This method is generally used to adjust display size in ppt file or doc file.

◆ SetRefreshAllConnections()

virtual void Aspose::Cells::IWorksheetCollection::SetRefreshAllConnections ( bool  value)
pure virtual

Indicates whether refresh all connections on opening file in MS Excel.

◆ SortNames()

virtual void Aspose::Cells::IWorksheetCollection::SortNames ( )
pure virtual

Sorts defined names.

If you create a large amount of named ranges in the Excel file, please call this method after all named ranges are created and before saving

◆ SwapSheet()

virtual void Aspose::Cells::IWorksheetCollection::SwapSheet ( Aspose::Cells::Systems::Int32  sheetIndex1,
Aspose::Cells::Systems::Int32  sheetIndex2 
)
pure virtual

Swaps the two sheets.

Parameters
sheetIndex1The first worksheet.
Parameters
sheetIndex2The second worksheet.