本文整理汇总了Java中org.apache.poi.xwpf.usermodel.XWPFTableCell.setText方法的典型用法代码示例。如果您正苦于以下问题:Java XWPFTableCell.setText方法的具体用法?Java XWPFTableCell.setText怎么用?Java XWPFTableCell.setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.poi.xwpf.usermodel.XWPFTableCell
的用法示例。
在下文中一共展示了XWPFTableCell.setText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createHeader
import org.apache.poi.xwpf.usermodel.XWPFTableCell; //导入方法依赖的package包/类
private void createHeader(XWPFTable table, List<RenderData> headers) {
if (null == headers || headers.isEmpty()) return;
int i = 0;
for (RenderData head : headers) {
TextRenderData textHead = (TextRenderData) head;
Style style = textHead.getStyle();
String color = null == style ? null : style.getColor();
XWPFTableCell cell = table.getRow(0).getCell(i);
String[] fragment = textHead.getText().split(TextRenderPolicy.REGEX_LINE_CHARACTOR);
if (null != fragment) {
cell.setText(fragment[0]);
for (int j = 1; j < fragment.length; j++) {
XWPFParagraph addParagraph = cell.addParagraph();
addParagraph.createRun().setText(fragment[j]);
}
}
if (null != color) table.getRow(0).getCell(i).setColor(color);
i++;
}
}
示例2: render
import org.apache.poi.xwpf.usermodel.XWPFTableCell; //导入方法依赖的package包/类
@Override
public void render(XWPFTable table, Object data) {
TableRenderData tableData = (TableRenderData) data;
List<Object> datas = tableData.getDatas();
if (null == datas || datas.isEmpty()) {
table.getRow(1).getCell(0).removeParagraph(0);
table.getRow(1).getCell(0).setText(tableData.getNoDatadesc());
} else {
// XWPFTableRow row = table.getRow(1);
table.removeRow(1);
for (Object obj : datas) {
XWPFTableRow row = table.insertNewTableRow(1);
String str = obj.toString();
String[] split = str.split(";");
XWPFTableCell cell0 = row.createCell();
cell0.setText(split[0]);
XWPFTableCell cell1 = row.createCell();
cell1.setText(split[1]);
XWPFTableCell cell2 = row.createCell();
cell2.setText(split[2]);
}
}
}
示例3: setCellText
import org.apache.poi.xwpf.usermodel.XWPFTableCell; //导入方法依赖的package包/类
private static void setCellText(XWPFDocument xDocument, XWPFTableCell cell, String text, String bgcolor, int width) {
CTTcPr cellPr = cell.getCTTc().addNewTcPr();
cellPr.addNewTcW().setW(BigInteger.valueOf(width));
cell.setColor(bgcolor);
cell.setVerticalAlignment(XWPFVertAlign.CENTER);
cell.setText(text);
}
示例4: setTextAndHeaderShading
import org.apache.poi.xwpf.usermodel.XWPFTableCell; //导入方法依赖的package包/类
private static void setTextAndHeaderShading(XWPFTableCell cell, String text) {
cell.setText(text);
cell.setColor("AAAAFF");
// CTShd ctshd = cell.getCTTc().addNewTcPr().addNewShd();
// ctshd.setColor("FFFFFF");
// ctshd.setVal(STShd.CLEAR);
// ctshd.setFill("6666BB");
}