SmartTagPropertyCollection.Item

SmartTagPropertyCollection indexer (1 of 2)

Gets a SmartTagProperty object.

public SmartTagProperty this[int index] { get; }
ParameterDescription
indexThe index

Return Value

Returns a SmartTagProperty object.

Examples

namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using Aspose.Cells.Markup;
    using System;

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

            // Create a smart tag property collection
            SmartTagPropertyCollection properties = new SmartTagPropertyCollection();

            // Add properties to the collection
            int index1 = properties.Add("Property1", "Value1");
            int index2 = properties.Add("Property2", "Value2");

            // Access properties using Item indexer
            SmartTagProperty property1 = properties[index1];
            SmartTagProperty property2 = properties[index2];

            // Display current property values
            Console.WriteLine("Property1 Name: " + property1.Name);
            Console.WriteLine("Property1 Value: " + property1.Value);
            Console.WriteLine("Property2 Name: " + property2.Name);
            Console.WriteLine("Property2 Value: " + property2.Value);

            // Note: The Item property is read-only, so we can't assign to it directly
            // Instead, we can modify the properties of the returned SmartTagProperty objects
            property1.Value = "UpdatedValue1";
            property2.Value = "UpdatedValue2";

            // Display updated values
            Console.WriteLine("\nAfter modification:");
            Console.WriteLine("Property1 Value: " + properties[index1].Value);
            Console.WriteLine("Property2 Value: " + properties[index2].Value);

            // Save the workbook (though smart tags aren't visibly stored in a simple save)
            workbook.Save("SmartTagPropertyDemo.xlsx");
        }
    }
}

See Also


SmartTagPropertyCollection indexer (2 of 2)

Gets a SmartTagProperty object by the name of the property.

public SmartTagProperty this[string name] { get; }
ParameterDescription
nameThe name of the property.

Return Value

Returns a SmartTagProperty object.

See Also