use of org.apache.poi.xwpf.usermodel.XWPFTableCell in project poi by apache.
the class XWPFWordExtractor method appendTableText.
private void appendTableText(StringBuffer text, XWPFTable table) {
//this works recursively to pull embedded tables from tables
for (XWPFTableRow row : table.getRows()) {
List<ICell> cells = row.getTableICells();
for (int i = 0; i < cells.size(); i++) {
ICell cell = cells.get(i);
if (cell instanceof XWPFTableCell) {
text.append(((XWPFTableCell) cell).getTextRecursively());
} else if (cell instanceof XWPFSDTCell) {
text.append(((XWPFSDTCell) cell).getContent().getText());
}
if (i < cells.size() - 1) {
text.append("\t");
}
}
text.append('\n');
}
}
use of org.apache.poi.xwpf.usermodel.XWPFTableCell in project Gargoyle by callakrsos.
the class MSWord method mergeCellHorizon.
/**
* 수평셀 병합
*
* @param table
* @param rowNum
* @param colNum
* @param span
*/
public void mergeCellHorizon(XWPFTable table, int rowNum, int colNum, int span) {
XWPFTableRow row = table.getRow(rowNum);
XWPFTableCell cell = row.getCell(colNum);
CTDecimalNumber grdSpan = cell.getCTTc().getTcPr().getGridSpan();
if (grdSpan == null) {
grdSpan = cell.getCTTc().getTcPr().addNewGridSpan();
}
grdSpan.setVal(BigInteger.valueOf((long) span));
}
Aggregations