public void TestSetGetHBorders() { // instantiate the following classes so they'll Get picked up by // the XmlBean process and Added to the jar file. they are required // for the following XWPFTable methods. CT_TblBorders cttb = new CT_TblBorders(); Assert.IsNotNull(cttb); ST_Border stb = new ST_Border(); Assert.IsNotNull(stb); // create a table XWPFDocument doc = new XWPFDocument(); CT_Tbl ctTable = new CT_Tbl(); XWPFTable table = new XWPFTable(ctTable, doc); // Set inside horizontal border table.SetInsideHBorder(NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType.SINGLE, 4, 0, "FF0000"); // Get inside horizontal border components int s = table.GetInsideHBorderSize(); Assert.AreEqual(4, s); int sp = table.GetInsideHBorderSpace(); Assert.AreEqual(0, sp); String clr = table.GetInsideHBorderColor(); Assert.AreEqual("FF0000", clr); NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType bt = table.GetInsideHBorderType(); Assert.AreEqual(NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType.SINGLE, bt); }
private void CreateEmptyTable(CT_Tbl table) { // MINIMUM ELEMENTS FOR A TABLE table.AddNewTr().AddNewTc().AddNewP(); CT_TblPr tblpro = table.AddNewTblPr(); if (!tblpro.IsSetTblW()) { tblpro.AddNewTblW().w = "0"; } tblpro.tblW.type = (ST_TblWidth.auto); // layout tblpro.AddNewTblLayout().type = ST_TblLayoutType.autofit; // borders CT_TblBorders borders = tblpro.AddNewTblBorders(); borders.AddNewBottom().val = ST_Border.single; borders.AddNewInsideH().val = ST_Border.single; borders.AddNewInsideV().val = ST_Border.single; borders.AddNewLeft().val = ST_Border.single; borders.AddNewRight().val = ST_Border.single; borders.AddNewTop().val = ST_Border.single; CT_TblGrid tblgrid = table.AddNewTblGrid(); tblgrid.AddNewGridCol().w = (ulong)2000; }
private void CreateEmptyTable(CT_Tbl table) { // MINIMUM ELEMENTS FOR A TABLE table.AddNewTr().AddNewTc().AddNewP(); CT_TblPr tblpro = table.AddNewTblPr(); if (!tblpro.IsSetTblW()) { tblpro.AddNewTblW().w = "0"; } tblpro.tblW.type = (ST_TblWidth.auto); // layout // tblpro.AddNewTblLayout().Type=(STTblLayoutType.AUTOFIT); // borders CT_TblBorders borders = tblpro.AddNewTblBorders(); borders.AddNewBottom().val = (ST_Border.single); borders.AddNewInsideH().val = (ST_Border.single); borders.AddNewInsideV().val = (ST_Border.single); borders.AddNewLeft().val = (ST_Border.single); borders.AddNewRight().val = (ST_Border.single); borders.AddNewTop().val = (ST_Border.single); /* * CTTblGrid tblgrid=table.AddNewTblGrid(); * tblgrid.AddNewGridCol().W=(new Bigint("2000")); */ GetRows(); }
public void SetInsideVBorder(XWPFBorderType type, int size, int space, String rgbColor) { CT_TblPr tblPr = GetTrPr(); CT_TblBorders ctb = tblPr.IsSetTblBorders() ? tblPr.tblBorders : tblPr.AddNewTblBorders(); CT_Border b = ctb.IsSetInsideV() ? ctb.insideV : ctb.AddNewInsideV(); b.val = (xwpfBorderTypeMap[type]); b.sz = (ulong)size; b.space = (ulong)space; b.color = (rgbColor); }
public void SetInsideVBorder(XWPFTable.XWPFBorderType type, int size, int space, string rgbColor) { CT_TblPr trPr = this.GetTrPr(); CT_TblBorders ctTblBorders = trPr.IsSetTblBorders() ? trPr.tblBorders : trPr.AddNewTblBorders(); CT_Border ctBorder = ctTblBorders.IsSetInsideV() ? ctTblBorders.insideV : ctTblBorders.AddNewInsideV(); ctBorder.val = XWPFTable.xwpfBorderTypeMap[type]; ctBorder.sz = (ulong)size; ctBorder.space = (ulong)space; ctBorder.color = rgbColor; }
public void SetRightBorder(XWPFBorderType type, int size, int space, String rgbColor) { CT_TblPr tblPr = GetTrPr(); CT_TblBorders ctb = tblPr.IsSetTblBorders() ? tblPr.tblBorders : tblPr.AddNewTblBorders(); CT_Border b = ctb.right != null ? ctb.right : ctb.AddNewRight(); b.val = xwpfBorderTypeMap[type]; b.sz = (ulong)size; b.space = (ulong)space; b.color = (rgbColor); }
public string GetInsideVBorderColor() { string str = (string)null; CT_TblPr trPr = this.GetTrPr(); if (trPr.IsSetTblBorders()) { CT_TblBorders tblBorders = trPr.tblBorders; if (tblBorders.IsSetInsideV()) { str = tblBorders.insideV.color; } } return(str); }
public int GetInsideVBorderSpace() { int num = -1; CT_TblPr trPr = this.GetTrPr(); if (trPr.IsSetTblBorders()) { CT_TblBorders tblBorders = trPr.tblBorders; if (tblBorders.IsSetInsideV()) { num = (int)tblBorders.insideV.space; } } return(num); }
public int GetInsideHBorderSize() { int num = -1; CT_TblPr trPr = this.GetTrPr(); if (trPr.IsSetTblBorders()) { CT_TblBorders tblBorders = trPr.tblBorders; if (tblBorders.IsSetInsideH()) { num = (int)tblBorders.insideH.sz; } } return(num); }
public XWPFTable.XWPFBorderType GetInsideVBorderType() { XWPFTable.XWPFBorderType xwpfBorderType = XWPFTable.XWPFBorderType.NONE; CT_TblPr trPr = this.GetTrPr(); if (trPr.IsSetTblBorders()) { CT_TblBorders tblBorders = trPr.tblBorders; if (tblBorders.IsSetInsideV()) { CT_Border insideV = tblBorders.insideV; xwpfBorderType = XWPFTable.stBorderTypeMap[insideV.val]; } } return(xwpfBorderType); }
public String GetInsideVBorderColor() { String color = null; CT_TblPr tblPr = GetTrPr(); if (tblPr.IsSetTblBorders()) { CT_TblBorders ctb = tblPr.tblBorders; if (ctb.IsSetInsideV()) { CT_Border border = ctb.insideV; color = border.color; } } return(color); }
public int GetInsideVBorderSpace() { int space = -1; CT_TblPr tblPr = GetTrPr(); if (tblPr.IsSetTblBorders()) { CT_TblBorders ctb = tblPr.tblBorders; if (ctb.IsSetInsideV()) { CT_Border border = ctb.insideV; space = (int)border.space; } } return(space); }
public XWPFBorderType GetInsideVBorderType() { XWPFBorderType bt = XWPFBorderType.NONE; CT_TblPr tblPr = GetTrPr(); if (tblPr.IsSetTblBorders()) { CT_TblBorders ctb = tblPr.tblBorders; if (ctb.IsSetInsideV()) { CT_Border border = ctb.insideV; bt = stBorderTypeMap[border.val]; } } return(bt); }
public int GetInsideHBorderSize() { int size = -1; CT_TblPr tblPr = GetTrPr(); if (tblPr.IsSetTblBorders()) { CT_TblBorders ctb = tblPr.tblBorders; if (ctb.IsSetInsideH()) { CT_Border border = ctb.insideH; size = (int)border.sz; } } return(size); }
private void CreateEmptyTable(CT_Tbl table) { table.AddNewTr().AddNewTc().AddNewP(); CT_TblPr ctTblPr = table.AddNewTblPr(); if (!ctTblPr.IsSetTblW()) { ctTblPr.AddNewTblW().w = "0"; } ctTblPr.tblW.type = ST_TblWidth.auto; CT_TblBorders ctTblBorders = ctTblPr.AddNewTblBorders(); ctTblBorders.AddNewBottom().val = ST_Border.single; ctTblBorders.AddNewInsideH().val = ST_Border.single; ctTblBorders.AddNewInsideV().val = ST_Border.single; ctTblBorders.AddNewLeft().val = ST_Border.single; ctTblBorders.AddNewRight().val = ST_Border.single; ctTblBorders.AddNewTop().val = ST_Border.single; this.GetRows(); }
public void TestSetGetHBorders() { // instantiate the following classes so they'll Get picked up by // the XmlBean process and Added to the jar file. they are required // for the following XWPFTable methods. CT_TblBorders cttb = new CT_TblBorders(); Assert.IsNotNull(cttb); ST_Border stb = new ST_Border(); Assert.IsNotNull(stb); // create a table XWPFDocument doc = new XWPFDocument(); CT_Tbl ctTable = new CT_Tbl(); XWPFTable table = new XWPFTable(ctTable, doc); // Set inside horizontal border table.SetInsideHBorder(NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType.SINGLE, 4, 0, "FF0000"); // Get inside horizontal border components int s = table.InsideHBorderSize; Assert.AreEqual(4, s); int sp = table.InsideHBorderSpace; Assert.AreEqual(0, sp); String clr = table.InsideHBorderColor; Assert.AreEqual("FF0000", clr); NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType bt = table.InsideHBorderType; Assert.AreEqual(NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType.SINGLE, bt); }