[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IScenarios

IScenarios Interface

Represents the collection of IScenario objects in the worksheet.

This interface provides access to the worksheet's What-If analysis scenarios. Use Scenarios to obtain the collection, then add, retrieve, and iterate through saved scenarios for the worksheet.

Namespace: GrapeCity.Documents.Excel
Assembly: DS.Documents.Excel.dll
Syntax
public interface IScenarios : IEnumerable
Public Interface IScenarios
    Inherits IEnumerable
Examples
List<object> values = new List<object> { 0.05, 0.10, 0.15 };
IScenarios scenarios = worksheet.Scenarios;
scenarios.Add("Discount Plan", worksheet.Range["B1:B3"], values, "Quarterly discount rates", true, false);
foreach (IScenario scenario in scenarios)
{
    string name = scenario.Name;
}

Properties

Name Description
Count

Returns the number of objects in the collection.

This property returns the number of IScenario objects in the scenario collection for the current worksheet.

this[int]

Gets the scenario using the index.

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

this[string]

Gets the scenario using the name.

Name matching is case-insensitive.

Methods

Name Description
Add(string, IRange, List<object>, string, bool, bool)

Creates a new scenario and adds it to the list of scenarios of the current worksheet.

The values in values correspond to the cells in changingCells one by one. For example, if changingCells is "B2:C3", the values are applied in the order B2, C2, B3, and C3. If values is null, the current values in changingCells are used. If comment is null, Document Solutions for Excel adds the author name and date automatically.