Fill.Equals

Fill.Equals method

/

public override bool Equals(object obj)
ParameterTypeDescription
objObject

Examples

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

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

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

            try
            {
                // Add a rectangle shape to the worksheet
                Shape rectangle = worksheet.Shapes.AddRectangle(1, 0, 0, 0, 100, 150);

                // Get the FillFormat object from the shape
                FillFormat fillFormat1 = rectangle.Fill;

                // Create another shape to get a second FillFormat object
                Shape oval = worksheet.Shapes.AddOval(3, 0, 0, 0, 100, 150);
                FillFormat fillFormat2 = oval.Fill;

                // Call the Equals method to compare the two FillFormat objects
                bool areEqual = fillFormat1.Equals(fillFormat2);

                // Display the result of the comparison
                Console.WriteLine($"FillFormat objects are equal: {areEqual}");

                // Also demonstrate comparing with null
                bool isNullEqual = fillFormat1.Equals(null);
                Console.WriteLine($"FillFormat object equals null: {isNullEqual}");

                // Save the workbook
                workbook.Save("FillEqualsDemo.xlsx");
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error in FillFormat Equals demonstration: {ex.Message}");
            }
        }
    }
}

See Also