Create, Manipulate or Remove Scenarios from Worksheets

[ ]

Aspose.Cells provides some useful classes, for example ScenarioCollection, Scenario, ScenarioInputCellCollection and ScenarioInputCell. It also provides the Worksheet.Scenarios property. The sample code below opens an XLSX Excel file (that contains some scenarios) and removes an existing scenario from the worksheet. It also adds a new scenario before saving the Excel file. It uses a very simple template file that contains a scenario.

After executing the code, an existing scenario is removed and a new scenario is added to the worksheet.

The output file