[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IScenarios.Item

this Property

this[int]

Gets the scenario using the index.

Use this property to retrieve a scenario from the worksheet's scenario collection by its position.

Declaration
IScenario this[int index] { get; }
ReadOnly Default Property Item(index As Integer) As IScenario
Parameters
Type Name Description
int index

The zero-based index of the scenario in the collection.

Property Value
Type Description
IScenario

The scenario at the specified index.

Examples
worksheet.Range["B2"].Value = 0.05;
worksheet.Range["B3"].Value = 0.08;
IRange range = worksheet.Range["B2:B3"];
worksheet.Scenarios.Add("Discount Plan", range);
IScenario scenario = worksheet.Scenarios[0];

this[string]

Gets the scenario using the name.

Name matching is case-insensitive.

Declaration
IScenario this[string name] { get; }
ReadOnly Default Property Item(name As String) As IScenario
Parameters
Type Name Description
string name

The scenario name.

Property Value
Type Description
IScenario

The scenario with the specified name, or null if no matching scenario exists.

Examples
worksheet.Range["B2"].Value = 0.05;
worksheet.Range["B3"].Value = 0.08;
IRange range = worksheet.Range["B2:B3"];
worksheet.Scenarios.Add("Discount Plan", range);
IScenario scenario = worksheet.Scenarios["Discount Plan"];