本文介绍了如何格式化在Apache的POI的XWPFTable文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在使用Apache POI,现在表是用在column.Now文本正确来临了我要在表中的文本大小为沿格式字创建XWPFTable,字体etc.How我能做到什么?我看到,每一个技巧与option.But我想是TableRow.See是我迄今所做的运行有关。
I have created a XWPFTable in word using Apache POI,Now the table is coming properly with text in the column.Now i want to format the text in the table along with size ,font etc.How i can do that ?what i am seeing that every tricks is associated with the run option.But i want is in TableRow.See what i have done so far.
XWPFTable tableTwo = document.createTable();
XWPFTableRow tableTwoRowOne = tableTwo.getRow(0);
tableTwo.getCTTbl().getTblPr().unsetTblBorders();
tableTwoRowOne.getCell(0).setText("No Match – Location: ");
tableTwoRowOne.addNewTableCell().setText("Prospect has expressed unwillingness to relocate or is based out of area where commute is not feasible");
XWPFTableRow tableTwoRowTwo = tableTwo.createRow();
tableTwoRowTwo.getCell(0).setText("No Match – Scalability: ");
tableTwoRowTwo.getCell(1).setText("Prospect’s recent organizational size, structure, and complexity is not scalable to client’s environment");
我要表tableTwo和tableTwoRowTwo,我怎么能做到这一点的文本的格式??
I want to format the text of the table tableTwo and tableTwoRowTwo ,how i can achieve that??
推荐答案
在单元格添加段落。
XWPFTableRow rowOne = table.getRow(0);
XWPFParagraph paragraph = rowOne.getCell(0).addParagraph();
setRun(paragraphRefTitle.createRun() , "Calibre LIght" , 10, "2b5079" , "Some string" , false, false);
private static void setRun (XWPFRun run , String fontFamily , int fontSize , String colorRGB , String text , boolean bold , boolean addBreak) {
run.setFontFamily(fontFamily);
run.setFontSize(fontSize);
run.setColor(colorRGB);
run.setText(text);
run.setBold(bold);
if (addBreak) run.addBreak();
}
这篇关于如何格式化在Apache的POI的XWPFTable文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!