private int GetIdBorder(eStyleClass styleClass, eStyleProperty styleProperty, object value) { ExcelBorderXml border = Border.Copy(); switch (styleClass) { case eStyleClass.BorderBottom: SetBorderItem(border.Bottom, styleProperty, value); break; case eStyleClass.BorderDiagonal: SetBorderItem(border.Diagonal, styleProperty, value); break; case eStyleClass.BorderLeft: SetBorderItem(border.Left, styleProperty, value); break; case eStyleClass.BorderRight: SetBorderItem(border.Right, styleProperty, value); break; case eStyleClass.BorderTop: SetBorderItem(border.Top, styleProperty, value); break; case eStyleClass.Border: if (styleProperty == eStyleProperty.BorderDiagonalUp) { border.DiagonalUp = (bool)value; } else if (styleProperty == eStyleProperty.BorderDiagonalDown) { border.DiagonalDown = (bool)value; } else { throw (new Exception("Invalid property for class Border.")); } break; default: throw (new Exception("Invalid class/property for class Border.")); } int subId; string id = border.Id; subId = _styles.Borders.FindIndexByID(id); if (subId == int.MinValue) { return(_styles.Borders.Add(id, border)); } return(subId); }
internal ExcelBorderXml Copy() { ExcelBorderXml newBorder = new ExcelBorderXml(NameSpaceManager); newBorder.Bottom = _bottom.Copy(); newBorder.Diagonal = _diagonal.Copy(); newBorder.Left = _left.Copy(); newBorder.Right = _right.Copy(); newBorder.Top = _top.Copy(); newBorder.DiagonalUp = _diagonalUp; newBorder.DiagonalDown = _diagonalDown; return(newBorder); }