SmartTagSetting.Item

SmartTagSetting indexer (1 of 3)

Gets a SmartTagCollection object by the index.

public SmartTagCollection this[int index] { get; }
ParameterDescription
indexThe index of the SmartTagCollection object in the list.

Examples

using System;
using Aspose.Cells;
using Aspose.Cells.Markup;

namespace AsposeCellsExamples
{
    public class SmartTagSettingPropertyItemDemo1
    {
        public static void Run()
        {
            Workbook workbook = new Workbook();
            Worksheet sheet = workbook.Worksheets[0];

            sheet.Cells["A1"].PutValue("Aspose");
            sheet.Cells["A2"].PutValue("Cells");

            SmartTagSetting smartTagSetting = sheet.SmartTagSetting;
            int smartTagIndex = smartTagSetting.Add(0, 0);
            
            // Demonstrate Item property usage
            SmartTagCollection smartTags = smartTagSetting[smartTagIndex];
            smartTags.Add("http://docs.aspose.com", "docs");
            
            SmartTag smartTag = smartTags[0];
            smartTag.SetLink("http://www.aspose.com", "AsposeLink");

            SmartTagPropertyCollection properties = smartTag.Properties;
            properties.Add("Author", "Aspose");
            properties.Add("Version", "1.0");

            workbook.Save("SmartTagPropertyDemo.xlsx");
            Console.WriteLine("SmartTagPropertyDemo.xlsx created successfully.");
        }
    }
}

See Also


SmartTagSetting indexer (2 of 3)

Gets the SmartTagCollection object of the cell.

public SmartTagCollection this[int row, int column] { get; }
ParameterDescription
rowThe row index of the cell.
columnThe column index of the cell

Return Value

Returns the SmartTagCollection object of the cell. Returns null if there is no any smart tags on the cell.

Examples

using System;
using Aspose.Cells;
using Aspose.Cells.Markup;

namespace AsposeCellsExamples
{
    public class SmartTagSettingPropertyItemDemo
    {
        public static void Run()
        {
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            SmartTagSetting smartTagSetting = worksheet.SmartTagSetting;
            smartTagSetting.Add(0, 0); // Add smart tag to cell A1

            // Demonstrate Item property usage
            SmartTagCollection smartTagCollection = smartTagSetting[0, 0];
            smartTagCollection.Add("urn:schemas-microsoft-com:office:smarttags", "date");

            Console.WriteLine("Smart tags in cell A1: " + smartTagCollection.Count);
            Console.WriteLine("Namespace URI: " + smartTagCollection[0].Uri);
            Console.WriteLine("Tag name: " + smartTagCollection[0].Name);

            workbook.Save("SmartTagDemo.xlsx");
        }
    }
}

See Also


SmartTagSetting indexer (3 of 3)

Gets the SmartTagCollection object of the cell.

public SmartTagCollection this[string cellName] { get; }
ParameterDescription
cellNameThe name of the cell.

Return Value

Returns the SmartTagCollection object of the cell. Returns null if there is no any smart tags on the cell.

Examples

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

    public class SmartTagSettingPropertyItemDemo2
    {
        public static void Run()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();

            // Get the first worksheet
            Worksheet worksheet = workbook.Worksheets[0];

            try
            {
                // Access the SmartTagSetting for the worksheet
                SmartTagSetting smartTagSetting = worksheet.SmartTagSetting;

                // Add a smart tag to cell A1 (row 0, column 0)
                int smartTagIndex = smartTagSetting.Add(0, 0);

                // Demonstrate the Item property usage (indexer)
                SmartTagCollection smartTagCollection = smartTagSetting[smartTagIndex];

                // Add a smart tag to the collection
                smartTagCollection.Add("urn:schemas-microsoft-com:office:smarttags", "date");

                // Display information about the smart tag
                Console.WriteLine("Number of smart tags in collection: " + smartTagCollection.Count);
                if (smartTagCollection.Count > 0)
                {
                    Console.WriteLine("First smart tag URI: " + smartTagCollection[0].Uri);
                    Console.WriteLine("First smart tag name: " + smartTagCollection[0].Name);
                }

                // Save the workbook
                workbook.Save("SmartTagItemDemo.xlsx");
                Console.WriteLine("SmartTagItemDemo.xlsx created successfully.");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error: {ex.Message}");
            }
        }
    }
}

See Also