Class ScenarioCollection
Contents
[
Hide
]ScenarioCollection class
Represents the list of scenarios.
public class ScenarioCollection : CollectionBase<Scenario>
Properties
Name | Description |
---|---|
ActiveIndex { get; set; } | Gets and sets which scenario is selected. |
Capacity { get; set; } | |
Count { get; } | |
Item { get; } | Gets the Scenario object by the index. |
Item { get; set; } | |
LastSelected { get; set; } | Indicates which scenario was last selected by the user to be run/shown. |
Methods
Name | Description |
---|---|
Add(string) | Adds a scenario. |
BinarySearch(Scenario) | |
BinarySearch(Scenario, IComparer<Scenario>) | |
BinarySearch(int, int, Scenario, IComparer<Scenario>) | |
Clear() | |
Contains(Scenario) | |
CopyTo(Scenario[]) | |
CopyTo(Scenario[], int) | |
CopyTo(int, Scenario[], int, int) | |
Exists(Predicate<Scenario>) | |
Find(Predicate<Scenario>) | |
FindAll(Predicate<Scenario>) | |
FindIndex(Predicate<Scenario>) | |
FindIndex(int, Predicate<Scenario>) | |
FindIndex(int, int, Predicate<Scenario>) | |
FindLast(Predicate<Scenario>) | |
FindLastIndex(Predicate<Scenario>) | |
FindLastIndex(int, Predicate<Scenario>) | |
FindLastIndex(int, int, Predicate<Scenario>) | |
GetEnumerator() | |
IndexOf(Scenario) | |
IndexOf(Scenario, int) | |
IndexOf(Scenario, int, int) | |
LastIndexOf(Scenario) | |
LastIndexOf(Scenario, int) | |
LastIndexOf(Scenario, int, int) | |
RemoveAt(int) |
Examples
[C#]
namespace Demos
{
using Aspose.Cells;
using System;
public class ScenarioCollectionDemo
{
public static void ScenarioCollectionExample()
{
// Create a new workbook
Workbook workbook = new Workbook();
// Access the first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Access the ScenarioCollection of the worksheet
ScenarioCollection scenarios = worksheet.Scenarios;
// Add a new scenario to the collection
int scenarioIndex = scenarios.Add("Scenario1");
// Access the newly added scenario
Scenario scenario = scenarios[scenarioIndex];
// Set some properties for the scenario
scenario.Comment = "This is a test scenario.";
scenario.IsHidden = false;
// Set the active scenario index
scenarios.ActiveIndex = scenarioIndex;
// Set the last selected scenario index
scenarios.LastSelected = scenarioIndex;
// Save the workbook
workbook.Save("ScenarioCollectionExample.xlsx");
return;
}
}
}
See Also
- class CollectionBase<T>
- class Scenario
- namespace Aspose.Cells
- assembly Aspose.Cells