Exemple #1
0
    public static ICellStyle GetMerged(ICellStyle baseStyle, ICellStyle style)
    {
      if (baseStyle == null) return style ?? new CellStyle();
      if (style == null) return baseStyle;

      var result = new CellStyle(baseStyle);
      if (style.Alignment != ContentAlignment.NotSet) result.Alignment = style.Alignment;
      if (style.BackColor != Color.Empty) result.BackColor = style.BackColor;
      if (style.BorderColor != Color.Empty) result.BorderColor = style.BorderColor;
      if (style.BorderSides != BorderSides.NotSet) result.BorderSides = style.BorderSides;
      if (style.BorderWidth >= 0) result.BorderWidth = style.BorderWidth;
      if (style.Font != null) result.Font = style.Font;
      if (style.ForeColor != Color.Empty) result.ForeColor = style.ForeColor;
      if (!string.IsNullOrEmpty(style.Format)) result.Format = style.Format;
      if (style.Indent >= 0) result.Indent = style.Indent;
      if (style.Padding != Padding.Empty) result.Padding = style.Padding;
      if (style.WrapMode != Conversion.TriState.Indeterminate) result.WrapMode = style.WrapMode;
      return result;
    }
Exemple #2
0
 public bool Equals(CellStyle obj)
 {
   return this.Alignment == obj.Alignment && ColorAreEqual(this.BackColor, obj.BackColor) && ColorAreEqual(this.BorderColor, obj.BorderColor) && this.BorderSides == obj.BorderSides && this.BorderWidth == obj.BorderWidth && this.Font.Equals(obj.Font) && ColorAreEqual(this.ForeColor, obj.ForeColor) && this.Format == obj.Format && this.Indent == obj.Indent && this.Padding == obj.Padding && this.WrapMode == obj.WrapMode;
 }