Class Scenario
Contents
[
Hide
]Scenario class
Represents an individual scenario.
public class Scenario
Properties
Name | Description |
---|---|
Comment { get; set; } | Gets and sets the comment of scenario. |
InputCells { get; } | Gets the input cells of scenario. |
IsHidden { get; set; } | Indicates whether scenario is hidden. |
IsLocked { get; set; } | Indicates whether scenario is locked for editing when the sheet is protected. |
Name { get; set; } | Gets and sets the name of scenario. |
User { get; } | Gets name of user who last changed the scenario. |
Examples
[C#]
namespace Demos
{
using Aspose.Cells;
using System;
public class ScenarioDemo
{
public static void ScenarioExample()
{
// Create a new workbook and access the first worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
// Access the scenario collection of the worksheet
ScenarioCollection scenarios = worksheet.Scenarios;
// Add a new scenario to the collection
int scenarioIndex = scenarios.Add("MyScenario");
Scenario scenario = scenarios[scenarioIndex];
// Setting properties of the scenario
scenario.Comment = "This is a test scenario.";
scenario.Name = "TestScenario";
scenario.IsHidden = false;
scenario.IsLocked = true;
// Accessing read-only properties
string user = scenario.User;
ScenarioInputCellCollection inputCells = scenario.InputCells;
// Save the workbook
workbook.Save("ScenarioExample.xlsx");
return;
}
}
}
See Also
- namespace Aspose.Cells
- assembly Aspose.Cells