private static CT_Border CreateDefaultBorder() { CT_Border ctBorder = new CT_Border(); ctBorder.AddNewLeft(); ctBorder.AddNewRight(); ctBorder.AddNewTop(); ctBorder.AddNewBottom(); ctBorder.AddNewDiagonal(); return(ctBorder); }
public void setLeftBorderColor(CT_Color color) { CT_BorderPr pr = _border.IsSetLeft() ? _border.left : _border.AddNewLeft(); if (color == null) { pr.UnsetColor(); } else { pr.color = (color); } }
private CT_BorderPr GetBorder(BorderSide side, bool ensure) { CT_BorderPr borderPr; switch (side) { case BorderSide.TOP: borderPr = border.top; if (ensure && borderPr == null) { borderPr = border.AddNewTop(); } break; case BorderSide.RIGHT: borderPr = border.right; if (ensure && borderPr == null) { borderPr = border.AddNewRight(); } break; case BorderSide.BOTTOM: borderPr = border.bottom; if (ensure && borderPr == null) { borderPr = border.AddNewBottom(); } break; case BorderSide.LEFT: borderPr = border.left; if (ensure && borderPr == null) { borderPr = border.AddNewLeft(); } break; case BorderSide.DIAGONAL: borderPr = border.diagonal; if (ensure && borderPr == null) { borderPr = border.AddNewDiagonal(); } break; default: throw new ArgumentException("No suitable side specified for the border"); } return(borderPr); }
private CT_Border GetCTBorder() { CT_Border ctBorder; if (this._cellXf.applyBorder) { ctBorder = this._stylesSource.GetBorderAt((int)this._cellXf.borderId).GetCTBorder(); } else { ctBorder = new CT_Border(); ctBorder.AddNewLeft(); ctBorder.AddNewRight(); ctBorder.AddNewTop(); ctBorder.AddNewBottom(); ctBorder.AddNewDiagonal(); } return(ctBorder); }
public void SetLeftBorderColor(XSSFColor color) { CT_Border ctBorder = this.GetCTBorder(); if (color == null && !ctBorder.IsSetLeft()) { return; } CT_BorderPr ctBorderPr = ctBorder.IsSetLeft() ? ctBorder.left : ctBorder.AddNewLeft(); if (color != null) { ctBorderPr.color = color.GetCTColor(); } else { ctBorderPr.UnsetColor(); } this._cellXf.borderId = (uint)this._stylesSource.PutBorder(new XSSFCellBorder(ctBorder, this._theme)); this._cellXf.applyBorder = true; }
/** * Get a <b>copy</b> of the currently used CT_Border, if none is used, return a new instance. */ public CT_Border GetCTBorder() { CT_Border ctBorder; if (_cellXf.applyBorder) { int idx = (int)_cellXf.borderId; XSSFCellBorder cf = _stylesSource.GetBorderAt(idx); ctBorder = (CT_Border)cf.GetCTBorder(); } else { ctBorder = new CT_Border(); ctBorder.AddNewLeft(); ctBorder.AddNewRight(); ctBorder.AddNewTop(); ctBorder.AddNewBottom(); ctBorder.AddNewDiagonal(); } return(ctBorder); }