public static CT_Border Parse(XmlNode node, XmlNamespaceManager namespaceManager) { if (node == null) return null; CT_Border ctObj = new CT_Border(); ctObj.diagonalUp = XmlHelper.ReadBool(node.Attributes["diagonalUp"]); ctObj.diagonalDown = XmlHelper.ReadBool(node.Attributes["diagonalDown"]); ctObj.outline = XmlHelper.ReadBool(node.Attributes["outline"]); foreach (XmlNode childNode in node.ChildNodes) { if (childNode.LocalName == "left") ctObj.left = CT_BorderPr.Parse(childNode, namespaceManager); else if (childNode.LocalName == "right") ctObj.right = CT_BorderPr.Parse(childNode, namespaceManager); else if (childNode.LocalName == "top") ctObj.top = CT_BorderPr.Parse(childNode, namespaceManager); else if (childNode.LocalName == "bottom") ctObj.bottom = CT_BorderPr.Parse(childNode, namespaceManager); else if (childNode.LocalName == "diagonal") ctObj.diagonal = CT_BorderPr.Parse(childNode, namespaceManager); else if (childNode.LocalName == "vertical") ctObj.vertical = CT_BorderPr.Parse(childNode, namespaceManager); else if (childNode.LocalName == "horizontal") ctObj.horizontal = CT_BorderPr.Parse(childNode, namespaceManager); } return ctObj; }
public CT_Border AddNewBorder() { if (this.borderField == null) this.borderField = new List<CT_Border>(); CT_Border border = new CT_Border(); this.borderField.Add(border); return border; }
public CT_Border Copy() { CT_Border obj = new CT_Border(); obj.bottomField = this.bottomField; obj.topField = this.topField; obj.rightField = this.rightField; obj.leftField = this.leftField; obj.horizontalField = this.horizontalField; obj.verticalField = this.verticalField; obj.outlineField = this.outlineField; return obj; }
public void SetUp() { stylesTable = new StylesTable(); ctStylesheet = stylesTable.GetCTStylesheet(); ctBorderA = new CT_Border(); XSSFCellBorder borderA = new XSSFCellBorder(ctBorderA); long borderId = stylesTable.PutBorder(borderA); Assert.AreEqual(1, borderId); XSSFCellBorder borderB = new XSSFCellBorder(); Assert.AreEqual(1, stylesTable.PutBorder(borderB)); ctFill = new CT_Fill(); XSSFCellFill fill = new XSSFCellFill(ctFill); long fillId = stylesTable.PutFill(fill); Assert.AreEqual(2, fillId); ctFont = new CT_Font(); XSSFFont font = new XSSFFont(ctFont); long fontId = stylesTable.PutFont(font); Assert.AreEqual(1, fontId); cellStyleXf = ctStylesheet.AddNewCellStyleXfs().AddNewXf(); cellStyleXf.borderId = 1; cellStyleXf.fillId = 1; cellStyleXf.fontId = 1; cellXfs = ctStylesheet.AddNewCellXfs(); cellXf = cellXfs.AddNewXf(); cellXf.xfId = (1); cellXf.borderId = (1); cellXf.fillId = (1); cellXf.fontId = (1); stylesTable.PutCellStyleXf(cellStyleXf); stylesTable.PutCellXf(cellXf); cellStyle = new XSSFCellStyle(1, 1, stylesTable, null); Assert.IsNotNull(stylesTable.GetFillAt(1).GetCTFill().patternFill); Assert.AreEqual(ST_PatternType.darkGray, stylesTable.GetFillAt(1).GetCTFill().patternFill.patternType); }
/** * Get a <b>copy</b> of the currently used CT_Border, if none is used, return a new instance. */ private 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; }
/*package*/ internal XSSFBorderFormatting(CT_Border border) { _border = border; }
public CT_Border AddNewBorder() { CT_Border border = new CT_Border(); this.borderField = border; return border; }
private static CT_Border CreateDefaultBorder() { CT_Border ctBorder = new CT_Border(); ctBorder.AddNewLeft(); ctBorder.AddNewRight(); ctBorder.AddNewTop(); ctBorder.AddNewBottom(); ctBorder.AddNewDiagonal(); return ctBorder; }
public CT_Border Copy() { CT_Border obj = new CT_Border(); obj.bottomField = this.bottomField == null ? null : this.bottomField.Copy(); obj.topField = this.topField == null ? null : this.topField.Copy(); obj.rightField = this.rightField == null ? null : this.rightField.Copy(); obj.leftField = this.leftField == null ? null : this.leftField.Copy(); obj.diagonalField = this.diagonalField == null ? null : this.diagonalField.Copy(); obj.verticalField = this.verticalField == null ? null : this.verticalField.Copy(); obj.horizontalField = this.horizontalField == null ? null : this.horizontalField.Copy(); obj.diagonalUpField = this.diagonalUpField; obj.diagonalUpFieldSpecified = this.diagonalUpFieldSpecified; obj.diagonalDownField = this.diagonalDownField; obj.diagonalDownFieldSpecified = this.diagonalDownFieldSpecified; obj.outlineField = this.outlineField; return obj; }
/** * Creates a new, empty Cell Border. * You need to attach this to the Styles Table */ public XSSFCellBorder() { border = new CT_Border(); }
/** * Creates a Cell Border from the supplied XML defInition */ public XSSFCellBorder(CT_Border border) { this.border = border; }
/** * Creates a Cell Border from the supplied XML defInition */ public XSSFCellBorder(CT_Border border, ThemesTable theme) : this(border) { this._theme = theme; }
/** * 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().Copy(); } else { ctBorder = new CT_Border(); } return ctBorder; }
public CT_Border Copy() { CT_Border obj = new CT_Border(); if (bottomField != null) { obj.bottomField = bottomField.Copy(); } if (topField != null) { obj.topField = topField.Copy(); } if (rightField != null) { obj.rightField = rightField.Copy(); } if (leftField != null) { obj.leftField = leftField.Copy(); } if (horizontalField != null) { obj.horizontalField = horizontalField.Copy(); } if (verticalField != null) { obj.verticalField = verticalField.Copy(); } if (diagonalField != null) { obj.diagonalField = diagonalField.Copy(); } obj.diagonalUpField = diagonalUpField; obj.diagonalUpSpecified = diagonalUpSpecified; obj.diagonalDown = diagonalDown; obj.diagonalDownSpecified = diagonalDownSpecified; obj.outline = this.outline; return obj; }