Class ScenarioInputCellCollection

ScenarioInputCellCollection class

Represents the list of the scenario’s input cells.

public class ScenarioInputCellCollection : CollectionBase<ScenarioInputCell>

Properties

NameDescription
Capacity { get; set; }
Count { get; }
Item { get; }Gets ScenarioInputCell by index in the list.
Item { get; set; }

Methods

NameDescription
Add(int, int, string)Adds an input cell.
BinarySearch(ScenarioInputCell)
BinarySearch(ScenarioInputCell, IComparer<ScenarioInputCell>)
BinarySearch(int, int, ScenarioInputCell, IComparer<ScenarioInputCell>)
Clear()
Contains(ScenarioInputCell)
CopyTo(ScenarioInputCell[])
CopyTo(ScenarioInputCell[], int)
CopyTo(int, ScenarioInputCell[], int, int)
Exists(Predicate<ScenarioInputCell>)
Find(Predicate<ScenarioInputCell>)
FindAll(Predicate<ScenarioInputCell>)
FindIndex(Predicate<ScenarioInputCell>)
FindIndex(int, Predicate<ScenarioInputCell>)
FindIndex(int, int, Predicate<ScenarioInputCell>)
FindLast(Predicate<ScenarioInputCell>)
FindLastIndex(Predicate<ScenarioInputCell>)
FindLastIndex(int, Predicate<ScenarioInputCell>)
FindLastIndex(int, int, Predicate<ScenarioInputCell>)
GetEnumerator()
IndexOf(ScenarioInputCell)
IndexOf(ScenarioInputCell, int)
IndexOf(ScenarioInputCell, int, int)
LastIndexOf(ScenarioInputCell)
LastIndexOf(ScenarioInputCell, int)
LastIndexOf(ScenarioInputCell, int, int)
RemoveAt(int)

Examples

[C#]

namespace Demos
{
    using Aspose.Cells;
    using System;

    public class ScenarioInputCellCollectionDemo
    {
        public static void ScenarioInputCellCollectionExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Add a scenario to the worksheet
            int scenarioIndex = worksheet.Scenarios.Add("Scenario1");
            Scenario scenario = worksheet.Scenarios[scenarioIndex];

            // Access the ScenarioInputCellCollection
            ScenarioInputCellCollection inputCells = scenario.InputCells;

            // Add input cells to the scenario
            inputCells.Add(0, 0, "10"); // Adding cell A1 with value 10
            inputCells.Add(1, 1, "20"); // Adding cell B2 with value 20

            // Access and print the properties of the ScenarioInputCellCollection
            Console.WriteLine("Capacity: " + inputCells.Capacity);
            Console.WriteLine("Count: " + inputCells.Count);

            // Access individual ScenarioInputCell by index
            ScenarioInputCell inputCell1 = inputCells[0];
            ScenarioInputCell inputCell2 = inputCells[1];

            // Print details of the input cells
            Console.WriteLine($"Input Cell 1: Row={inputCell1.Row}, Column={inputCell1.Column}, Value={inputCell1.Value}");
            Console.WriteLine($"Input Cell 2: Row={inputCell2.Row}, Column={inputCell2.Column}, Value={inputCell2.Value}");

            // Save the workbook
            workbook.Save("ScenarioInputCellCollectionExample.xlsx");
        }
    }
}

See Also