示例#1
0
        /// <summary>
        /// Returns true if this = other
        /// </summary>
        /// <param name="other"></param>
        /// <returns></returns>
        public bool Equals(ExcelCellStyleInfo other)
        {
            if (other == null && !this.HasCellInfo)
            {
                return(true);
            }
            if (other == null)
            {
                return(false);
            }

            if (!Nullable <Color> .Equals(this.FillColour, other.FillColour))
            {
                return(false);
            }
            if (!string.Equals(this.NumberFormat, other.NumberFormat))
            {
                return(false);
            }
            if (!ExcelCellFontInfo.Equals(this.FontInfo, other.FontInfo))
            {
                return(false);
            }
            if (!ExcelCellBorderInfo.Equals(this.BorderInfo, other.BorderInfo))
            {
                return(false);
            }
            if (!ExcelCellAlignmentInfo.Equals(this.AlignmentInfo, other.AlignmentInfo))
            {
                return(false);
            }

            return(true);
        }
示例#2
0
        /// <summary>
        /// Creates a copy of original.
        /// </summary>
        /// <param name="source"></param>
        private ExcelCellStyleInfo(ExcelCellStyleInfo source)
        {
            this.fillColour   = source.FillColour;
            this.numberFormat = source.NumberFormat;
            this.hasCellInfo  = source.HasCellInfo;

            this.fontInfo      = source.FontInfo == null ? null : (ExcelCellFontInfo)source.FontInfo.Clone();
            this.borderInfo    = source.BorderInfo == null ? null : (ExcelCellBorderInfo)source.BorderInfo.Clone();
            this.alignmentInfo = source.AlignmentInfo == null ? null : (ExcelCellAlignmentInfo)source.AlignmentInfo.Clone();
        }
示例#3
0
        /// <summary>
        /// Compares and updates font information for the cell.
        /// </summary>
        /// <param name="font"></param>
        private void UpdateFontInfo(StyleBase mapStyle)
        {
            // Only applies to CellMapStyles
            CellStyle typedMapStyle = mapStyle as CellStyle;

            if (typedMapStyle != null && HasAnyFontInfo(typedMapStyle))
            {
                if (this.fontInfo == null)
                {
                    this.fontInfo = new ExcelCellFontInfo();
                }

                // Update any font-related properties that are non-null/empty
                if (!string.IsNullOrEmpty(typedMapStyle.FontFamily))
                {
                    this.fontInfo.FontFamily = typedMapStyle.FontFamily;
                }

                if (typedMapStyle.FontSize.HasValue)
                {
                    this.fontInfo.FontSize = typedMapStyle.FontSize.Value;
                }
                if (typedMapStyle.FontWeight.HasValue)
                {
                    this.fontInfo.FontWeight = typedMapStyle.FontWeight.Value;
                }
                if (typedMapStyle.FontUnderlined.HasValue)
                {
                    this.fontInfo.FontUnderlined = typedMapStyle.FontUnderlined.Value;
                }

                if (typedMapStyle.InternalFontColour.HasValue)
                {
                    this.fontInfo.FontColour = typedMapStyle.InternalFontColour.Value;
                }

                this.hasCellInfo = true;
            }
        }