public override bool Equals(Object o) { if (!(o is XSSFCellBorder)) { return(false); } //TODO: change the compare logic XSSFCellBorder cf = (XSSFCellBorder)o; return(border.ToString().Equals(cf.GetCTBorder().ToString())); }
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); }
public void TestGetBorderStyle() { CT_Stylesheet stylesheet = new CT_Stylesheet(); CT_Border border = stylesheet.AddNewBorders().AddNewBorder(); CT_BorderPr top = border.AddNewTop(); CT_BorderPr right = border.AddNewRight(); CT_BorderPr bottom = border.AddNewBottom(); top.style = (ST_BorderStyle.dashDot); right.style = (ST_BorderStyle.none); bottom.style = (ST_BorderStyle.thin); XSSFCellBorder cellBorderStyle = new XSSFCellBorder(border); Assert.AreEqual("DashDot", cellBorderStyle.GetBorderStyle(BorderSide.TOP).ToString()); Assert.AreEqual("None", cellBorderStyle.GetBorderStyle(BorderSide.RIGHT).ToString()); Assert.AreEqual(BorderStyle.None, cellBorderStyle.GetBorderStyle(BorderSide.RIGHT)); Assert.AreEqual("Thin", cellBorderStyle.GetBorderStyle(BorderSide.BOTTOM).ToString()); Assert.AreEqual(BorderStyle.Thin, cellBorderStyle.GetBorderStyle(BorderSide.BOTTOM)); }
public void TestGetBorderStyle() { CT_Stylesheet stylesheet = new CT_Stylesheet(); CT_Border border = stylesheet.AddNewBorders().AddNewBorder(); CT_BorderPr top = border.AddNewTop(); CT_BorderPr right = border.AddNewRight(); CT_BorderPr bottom = border.AddNewBottom(); top.style = (ST_BorderStyle.dashDot); right.style = (ST_BorderStyle.none); bottom.style = (ST_BorderStyle.thin); XSSFCellBorder cellBorderStyle = new XSSFCellBorder(border); Assert.AreEqual("DASH_DOT", cellBorderStyle.GetBorderStyle(BorderSide.TOP).ToString()); Assert.AreEqual("NONE", cellBorderStyle.GetBorderStyle(BorderSide.RIGHT).ToString()); Assert.AreEqual(BorderStyle.NONE, cellBorderStyle.GetBorderStyle(BorderSide.RIGHT)); Assert.AreEqual("THIN", cellBorderStyle.GetBorderStyle(BorderSide.BOTTOM).ToString()); Assert.AreEqual(BorderStyle.THIN, cellBorderStyle.GetBorderStyle(BorderSide.BOTTOM)); }
public int PutBorder(XSSFCellBorder border) { int idx = borders.IndexOf(border); if (idx != -1) { return idx; } borders.Add(border); border.SetThemesTable(theme); return borders.Count - 1; }