How to customize a cell's borders
Posted: Thu Apr 18, 2013 1:03 pm
i have a table that should have a singel cell with a border so i tried using the TcBorders, CTBorder, and STBorder to set a TcPr (table cell property) to a cell. so i made a table and made a cell and set a border on it. but it didnt work. what might be the problem? and how do you properly set a border or set a border to none in case you put a border to a table? here's a sample code for the cell that is supposed to have a border.
i have set a table and other cells normally. the overall code runs well but the borders of this cell doesnt show.
- Code: Select all
Tc tcTAF = factory.createTc();
TcPr sample = new TcPr();
TcBorders tcb = factory.createTcPrInnerTcBorders();
CTBorder ctb = factory.createCTBorder();
STBorder stb = STBorder.SINGLE;
ctb.setVal(stb);
tcb.setBottom(ctb);
tcb.setRight(ctb);
tcb.setLeft(ctb);
tcb.setTop(ctb);
sample.setTcBorders(tcb);
tcTAF.setTcPr(sample);
setGrid(tcTAF, 3, factory);
tcTAF.getContent().add(
wordMLPackage.getMainDocumentPart().createParagraphOfText("sample cell with a border "));
i have set a table and other cells normally. the overall code runs well but the borders of this cell doesnt show.