FontSettingCollection.Equals

FontSettingCollection.Equals method

public override bool Equals(object obj)
ParameterTypeDescription
objObject

Examples

namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using Aspose.Cells.Drawing.Texts;
    using System;

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

            // Add a text box to the worksheet
            var textBox = worksheet.Shapes.AddTextBox(0, 0, 100, 100, 200, 200);
            var fontSettingCollection = textBox.TextBody;

            // Set some text
            fontSettingCollection.Text = "Sample Text";

            try
            {
                // Create another FontSettingCollection for comparison
                var anotherTextBox = worksheet.Shapes.AddTextBox(0, 0, 100, 100, 200, 200);
                var anotherFontSettingCollection = anotherTextBox.TextBody;
                anotherFontSettingCollection.Text = "Sample Text";

                // Call Equals method to compare the two collections
                bool areEqual = fontSettingCollection.Equals(anotherFontSettingCollection);

                // Display the result
                Console.WriteLine($"Are the FontSettingCollections equal? {areEqual}");

                // Save the workbook
                workbook.Save("FontSettingCollectionEqualsDemo.xlsx");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error calling Equals: {ex.Message}");
            }
        }
    }
}

See Also