本文整理了Java中org.apache.poi.xwpf.usermodel.XWPFDocument.createTable()
方法的一些代码示例,展示了XWPFDocument.createTable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XWPFDocument.createTable()
方法的具体详情如下:
包路径:org.apache.poi.xwpf.usermodel.XWPFDocument
类名称:XWPFDocument
方法名:createTable
[英]Create an empty table with one row and one column as default.
[中]创建一个默认为一行一列的空表。
代码示例来源:origin: youseries/ureport
for(Page page:pages){
List<Row> rows=page.getRows();
XWPFTable table = document.createTable(rows.size(), totalColumn);
table.getCTTbl().getTblPr().unsetTblBorders();
table.getCTTbl().addNewTblPr().addNewTblW().setW(BigInteger.valueOf(DxaUtils.points2dxa(tableWidth)));
代码示例来源:origin: stackoverflow.com
XWPFDocument doc = new XWPFDocument();
XWPFTable table = doc.createTable(1,2);
table.getCTTbl().addNewTblGrid().addNewGridCol().setW(BigInteger.valueOf(6000));
table.getCTTbl().getTblGrid().addNewGridCol().setW(BigInteger.valueOf(2000));
table.getRow(0).getCell(0).setText("1A");
table.getRow(0).getCell(1).setText("1B");
XWPFTableRow newrow = table.createRow();
newrow.getCell(0).setText("2A");
newrow.getCell(1).setText("2B");
代码示例来源:origin: stackoverflow.com
public static void main(String[] args) throws IOException {
XWPFDocument document = new XWPFDocument();
XWPFTable tableOne = document.createTable();
XWPFTableRow tableOneRowOne = tableOne.getRow(0);
tableOneRowOne.getCell(0).setText("Header1");
tableOneRowOne.addNewTableCell().setText("header2");
XWPFTableRow tableOneRowTwo = tableOne.createRow();
tableOneRowTwo.getCell(0).setText("Data1");
tableOneRowTwo.getCell(1).setText("Data2");
FileOutputStream outStream = new FileOutputStream("test.doc");
document.write(outStream);
outStream.close();
}
代码示例来源:origin: stackoverflow.com
XWPFTable table = document.createTable();
代码示例来源:origin: stackoverflow.com
XWPFTable table = document.createTable(rows, cols);
代码示例来源:origin: stackoverflow.com
XWPFTable table = document.createTable();
代码示例来源:origin: stackoverflow.com
destDoc.createTable();
代码示例来源:origin: stackoverflow.com
XWPFTable table = document.createTable();
代码示例来源:origin: stackoverflow.com
run.setText("The table:");
XWPFTable ltable = document.createTable(1,1);
代码示例来源:origin: stackoverflow.com
XWPFTable table = document.createTable(3,5);
代码示例来源:origin: stackoverflow.com
XWPFTable table = document.createTable();
代码示例来源:origin: stackoverflow.com
XWPFTable table = document.createTable();
代码示例来源:origin: org.apache.poi/poi-examples
public static void createSimpleTable() throws Exception {
try (XWPFDocument doc = new XWPFDocument()) {
XWPFTable table = doc.createTable(3, 3);
table.getRow(1).getCell(1).setText("EXAMPLE OF TABLE");
// table cells have a list of paragraphs; there is an initial
// paragraph created when the cell is created. If you create a
// paragraph in the document to put in the cell, it will also
// appear in the document following the table, which is probably
// not the desired result.
XWPFParagraph p1 = table.getRow(0).getCell(0).getParagraphs().get(0);
XWPFRun r1 = p1.createRun();
r1.setBold(true);
r1.setText("The quick brown fox");
r1.setItalic(true);
r1.setFontFamily("Courier");
r1.setUnderline(UnderlinePatterns.DOT_DOT_DASH);
r1.setTextPosition(100);
table.getRow(2).getCell(2).setText("only text");
try (OutputStream out = new FileOutputStream("simpleTable.docx")) {
doc.write(out);
}
}
}
代码示例来源:origin: stackoverflow.com
XWPFTable table = document.createTable(4, 3);
代码示例来源:origin: com.bstek.ureport/ureport2-core
for(Page page:pages){
List<Row> rows=page.getRows();
XWPFTable table = document.createTable(rows.size(), totalColumn);
table.getCTTbl().getTblPr().unsetTblBorders();
table.getCTTbl().addNewTblPr().addNewTblW().setW(BigInteger.valueOf(DxaUtils.points2dxa(tableWidth)));
代码示例来源:origin: org.apache.poi/poi-examples
XWPFTable table = doc.createTable(nRows, nCols);
代码示例来源:origin: stackoverflow.com
run.addBreak();
table = document.createTable(rw, cl);
table.getCTTbl().getTblPr().unsetTblBorders();
内容来源于网络,如有侵权,请联系作者删除!