internal static XLBorderKey GenerateKey(IXLBorder defaultBorder) { XLBorderKey key; if (defaultBorder == null) { key = XLBorderValue.Default.Key; } else if (defaultBorder is XLBorder) { key = (defaultBorder as XLBorder).Key; } else { key = new XLBorderKey { LeftBorder = defaultBorder.LeftBorder, LeftBorderColor = defaultBorder.LeftBorderColor.Key, RightBorder = defaultBorder.RightBorder, RightBorderColor = defaultBorder.RightBorderColor.Key, TopBorder = defaultBorder.TopBorder, TopBorderColor = defaultBorder.TopBorderColor.Key, BottomBorder = defaultBorder.BottomBorder, BottomBorderColor = defaultBorder.BottomBorderColor.Key, DiagonalBorder = defaultBorder.DiagonalBorder, DiagonalBorderColor = defaultBorder.DiagonalBorderColor.Key, DiagonalUp = defaultBorder.DiagonalUp, DiagonalDown = defaultBorder.DiagonalDown, }; } return(key); }
public bool Equals(IXLBorder other) { var otherB = other as XLBorder; if (otherB == null) { return(false); } return(Key == otherB.Key); }
public void AplicarEstilo(IXLBorder border) { if (Estilo == XLBorderStyleValues.None || Posicion == PosicionBordes.Ninguno) { return; } switch (Posicion) { case PosicionBordes.Todos: border.InsideBorder = Estilo; border.InsideBorderColor = Color; border.RightBorder = Estilo; border.RightBorderColor = Color; border.LeftBorder = Estilo; border.LeftBorderColor = Color; border.BottomBorder = Estilo; border.BottomBorderColor = Color; border.TopBorder = Estilo; border.TopBorderColor = Color; break; case PosicionBordes.Externo: border.RightBorder = Estilo; border.RightBorderColor = Color; border.LeftBorder = Estilo; border.LeftBorderColor = Color; border.BottomBorder = Estilo; border.BottomBorderColor = Color; border.TopBorder = Estilo; border.TopBorderColor = Color; break; case PosicionBordes.Superior: border.TopBorder = Estilo; border.TopBorderColor = Color; break; case PosicionBordes.Inferior: border.BottomBorder = Estilo; border.BottomBorderColor = Color; break; case PosicionBordes.Izquierdo: border.LeftBorder = Estilo; border.LeftBorderColor = Color; break; case PosicionBordes.Derecho: border.RightBorder = Estilo; border.RightBorderColor = Color; break; } }
public bool Equals(IXLBorder other) { var otherB = other as XLBorder; return (_leftBorder == otherB._leftBorder && _leftBorderColor.Equals(otherB._leftBorderColor) && _rightBorder == otherB._rightBorder && _rightBorderColor.Equals(otherB._rightBorderColor) && _topBorder == otherB._topBorder && _topBorderColor.Equals(otherB._topBorderColor) && _bottomBorder == otherB._bottomBorder && _bottomBorderColor.Equals(otherB._bottomBorderColor) && _diagonalBorder == otherB._diagonalBorder && _diagonalBorderColor.Equals(otherB._diagonalBorderColor) && _diagonalUp == otherB._diagonalUp && _diagonalDown == otherB._diagonalDown ); }
public XLBorder(IXLStylized container, IXLBorder defaultBorder, Boolean useDefaultModify = true) { _container = container; if (defaultBorder == null) { return; } _leftBorder = defaultBorder.LeftBorder; _leftBorderColor = new XLColor(defaultBorder.LeftBorderColor); _rightBorder = defaultBorder.RightBorder; _rightBorderColor = new XLColor(defaultBorder.RightBorderColor); _topBorder = defaultBorder.TopBorder; _topBorderColor = new XLColor(defaultBorder.TopBorderColor); _bottomBorder = defaultBorder.BottomBorder; _bottomBorderColor = new XLColor(defaultBorder.BottomBorderColor); _diagonalBorder = defaultBorder.DiagonalBorder; _diagonalBorderColor = new XLColor(defaultBorder.DiagonalBorderColor); _diagonalUp = defaultBorder.DiagonalUp; _diagonalDown = defaultBorder.DiagonalDown; if (useDefaultModify) { var d = defaultBorder as XLBorder; BottomBorderColorModified = d.BottomBorderColorModified; BottomBorderModified = d.BottomBorderModified; DiagonalBorderColorModified = d.DiagonalBorderColorModified; DiagonalBorderModified = d.DiagonalBorderModified; DiagonalDownModified = d.DiagonalDownModified; DiagonalUpModified = d.DiagonalUpModified; LeftBorderColorModified = d.LeftBorderColorModified; LeftBorderModified = d.LeftBorderModified; RightBorderColorModified = d.RightBorderColorModified; RightBorderModified = d.RightBorderModified; TopBorderColorModified = d.TopBorderColorModified; TopBorderModified = d.TopBorderModified; } }
private bool BordersAreEqual(Border b, IXLBorder xlBorder) { var nb = new XLBorder(); if (b.DiagonalUp != null) nb.DiagonalUp = b.DiagonalUp.Value; if (b.DiagonalDown != null) nb.DiagonalDown = b.DiagonalDown.Value; if (b.LeftBorder != null) { if (b.LeftBorder.Style != null) nb.LeftBorder = b.LeftBorder.Style.Value.ToClosedXml(); var bColor = GetColor(b.LeftBorder.Color); if (bColor.HasValue) nb.LeftBorderColor = bColor; } if (b.RightBorder != null) { if (b.RightBorder.Style != null) nb.RightBorder = b.RightBorder.Style.Value.ToClosedXml(); var bColor = GetColor(b.RightBorder.Color); if (bColor.HasValue) nb.RightBorderColor = bColor; } if (b.TopBorder != null) { if (b.TopBorder.Style != null) nb.TopBorder = b.TopBorder.Style.Value.ToClosedXml(); var bColor = GetColor(b.TopBorder.Color); if (bColor.HasValue) nb.TopBorderColor = bColor; } if (b.BottomBorder != null) { if (b.BottomBorder.Style != null) nb.BottomBorder = b.BottomBorder.Style.Value.ToClosedXml(); var bColor = GetColor(b.BottomBorder.Color); if (bColor.HasValue) nb.BottomBorderColor = bColor; } return nb.Equals(xlBorder); }
public XLBorder(IXLStylized container, XLStyle style = null, IXLBorder d = null) : this(container, style, GenerateKey(d)) { }
public bool Equals(IXLBorder other) { var otherB = other as XLBorder; return _leftBorder == otherB._leftBorder && _leftBorderColor.Equals(otherB._leftBorderColor) && _rightBorder == otherB._rightBorder && _rightBorderColor.Equals(otherB._rightBorderColor) && _topBorder == otherB._topBorder && _topBorderColor.Equals(otherB._topBorderColor) && _bottomBorder == otherB._bottomBorder && _bottomBorderColor.Equals(otherB._bottomBorderColor) && _diagonalBorder == otherB._diagonalBorder && _diagonalBorderColor.Equals(otherB._diagonalBorderColor) && _diagonalUp == otherB._diagonalUp && _diagonalDown == otherB._diagonalDown ; }
public XLBorder(IXLStylized container, IXLBorder defaultBorder, Boolean useDefaultModify = true) { _container = container; if (defaultBorder == null) return; _leftBorder = defaultBorder.LeftBorder; _leftBorderColor = defaultBorder.LeftBorderColor; _rightBorder = defaultBorder.RightBorder; _rightBorderColor = defaultBorder.RightBorderColor; _topBorder = defaultBorder.TopBorder; _topBorderColor = defaultBorder.TopBorderColor; _bottomBorder = defaultBorder.BottomBorder; _bottomBorderColor = defaultBorder.BottomBorderColor; _diagonalBorder = defaultBorder.DiagonalBorder; _diagonalBorderColor = defaultBorder.DiagonalBorderColor; _diagonalUp = defaultBorder.DiagonalUp; _diagonalDown = defaultBorder.DiagonalDown; if (useDefaultModify) { var d = defaultBorder as XLBorder; BottomBorderColorModified = d.BottomBorderColorModified; BottomBorderModified = d.BottomBorderModified; DiagonalBorderColorModified = d.DiagonalBorderColorModified; DiagonalBorderModified = d.DiagonalBorderModified; DiagonalDownModified = d.DiagonalDownModified; DiagonalUpModified = d.DiagonalUpModified; LeftBorderColorModified = d.LeftBorderColorModified; LeftBorderModified = d.LeftBorderModified; RightBorderColorModified = d.RightBorderColorModified; RightBorderModified = d.RightBorderModified; TopBorderColorModified = d.TopBorderColorModified; TopBorderModified = d.TopBorderModified; } }