public override bool Equals(object obj)
    {
        CellStyleFormat cfs = obj as CellStyleFormat;

        if (cfs == null)
        {
            return(false);
        }
        return(this.WrapText == cfs.wrapText && this.LineStyle == cfs.lineStyle && this.HorizontalAlignment == cfs.horizontalAlignment && this.VerticalAlignment == cfs.verticalAlignment && this.Treead == cfs.treead && this.fontIndex == cfs.fontIndex && this.rgbHtmlCode == cfs.rgbHtmlCode);
    }
        private static int SetCellFormat(
            bool wrapText,
            int lineStyle,
            int horizontalAlignment,
            int verticalAlignment,
            bool treead,
            int fontIndex,
            string rgbHtmlCode)
        {
            CellStyleFormat currentCell = new CellStyleFormat(wrapText, lineStyle, horizontalAlignment, verticalAlignment, treead, fontIndex, rgbHtmlCode);
            int             counter     = 1;

            foreach (CellStyleFormat d in cellStyleFormatList)
            {
                if (currentCell.Equals(d))
                {
                    return(counter);
                }
                counter++;
            }
            cellStyleFormatList.Add(currentCell);
            return(cellStyleFormatList.Count);
        }