use of org.apache.poi.xwpf.usermodel.XWPFTableRow in project Gargoyle by callakrsos.
the class MSWord method addTableCell.
private static void addTableCell(DIRECTION dir, XWPFTable table, int currentRow, int span) {
int dirRowIndex = 0;
if (DIRECTION._0 == dir) {
dirRowIndex = currentRow + 1;
} else if (DIRECTION.UP_DOWN == dir) {
dirRowIndex = currentRow - 1;
}
XWPFTableRow belowRow = table.getRow(dirRowIndex);
if (belowRow != null) {
// 병합된 span만큼 셀을 추가한다.
for (int i = 0; i < span - 1; i++) {
belowRow.createCell();
}
}
}
use of org.apache.poi.xwpf.usermodel.XWPFTableRow in project pmph by BCSquad.
the class WordHelper method fillDecNationalPlanData.
private XWPFTable fillDecNationalPlanData(XWPFTable table, List<DecNationalPlan> decNationalPlans) {
if (CollectionUtil.isEmpty(decNationalPlans)) {
return table;
}
if (decNationalPlans.size() > 1) {
int height = table.getRow(1).getHeight();
for (int i = 1; i < decNationalPlans.size(); i++) {
table.createRow().setHeight(height);
}
}
List<XWPFTableRow> rows = table.getRows();
List<XWPFTableCell> cells;
int rowCount = 1;
for (DecNationalPlan decNationalPlan : decNationalPlans) {
cells = rows.get(rowCount).getTableCells();
String value = decNationalPlan.getMaterialName();
if (StringUtil.notEmpty(value)) {
cells.get(0).setText(value);
}
value = decNationalPlan.getIsbn();
if (StringUtil.notEmpty(value)) {
cells.get(1).setText(value);
}
value = decNationalPlan.getRankText();
if (StringUtil.notEmpty(value)) {
cells.get(2).setText(value);
}
value = decNationalPlan.getNote();
if (StringUtil.notEmpty(value)) {
cells.get(3).setText(value);
}
for (XWPFTableCell cell : cells) {
cell.setVerticalAlignment(XWPFVertAlign.CENTER);
}
rowCount++;
}
return table;
}
use of org.apache.poi.xwpf.usermodel.XWPFTableRow in project pmph by BCSquad.
the class WordHelper method fillDecAcadeRewardData.
private XWPFTable fillDecAcadeRewardData(XWPFTable table, List<DecAcadeReward> decAcadeRewards) {
if (CollectionUtil.isEmpty(decAcadeRewards)) {
return table;
}
if (decAcadeRewards.size() > 1) {
int height = table.getRow(1).getHeight();
for (int i = 1; i < decAcadeRewards.size(); i++) {
table.createRow().setHeight(height);
}
}
List<XWPFTableRow> rows = table.getRows();
List<XWPFTableCell> cells;
int rowCount = 1;
for (DecAcadeReward decAcadeReward : decAcadeRewards) {
cells = rows.get(rowCount).getTableCells();
String value = decAcadeReward.getRewardName();
if (StringUtil.notEmpty(value)) {
cells.get(0).setText(value);
}
Date rewardDate = decAcadeReward.getRewardDate();
if (null != rewardDate) {
value = sdf.format(rewardDate);
cells.get(1).setText(value);
}
Integer type = decAcadeReward.getAwardUnit();
if (null != type) {
switch(type) {
case 0:
value = "无";
break;
case 1:
value = "国际";
break;
case 2:
value = "国家";
break;
case 3:
value = "省部";
break;
case 4:
value = "市";
break;
default:
value = "无";
break;
}
cells.get(2).setText(value);
}
value = decAcadeReward.getNote();
if (StringUtil.notEmpty(value)) {
cells.get(3).setText(value);
}
for (XWPFTableCell cell : cells) {
cell.setVerticalAlignment(XWPFVertAlign.CENTER);
}
rowCount++;
}
return table;
}
use of org.apache.poi.xwpf.usermodel.XWPFTableRow in project pmph by BCSquad.
the class WordHelper method fillDecSciData.
private XWPFTable fillDecSciData(XWPFTable table, List<DecSci> decScis) {
if (CollectionUtil.isEmpty(decScis)) {
return table;
}
if (decScis.size() > 1) {
int height = table.getRow(1).getHeight();
for (int i = 1; i < decScis.size(); i++) {
table.createRow().setHeight(height);
}
}
List<XWPFTableRow> rows = table.getRows();
List<XWPFTableCell> cells;
int rowCount = 1;
for (DecSci decSci : decScis) {
cells = rows.get(rowCount).getTableCells();
String value = decSci.getPaperName();
if (StringUtil.notEmpty(value)) {
cells.get(0).setText(value);
}
value = decSci.getJournalName();
if (StringUtil.notEmpty(value)) {
cells.get(1).setText(value);
}
value = decSci.getFactor();
if (StringUtil.notEmpty(value)) {
cells.get(2).setText(value);
}
Date publishDate = decSci.getPublishDate();
if (null != publishDate) {
value = sdf.format(publishDate);
cells.get(3).setText(value);
}
value = decSci.getNote();
if (StringUtil.notEmpty(value)) {
cells.get(4).setText(value);
}
for (XWPFTableCell cell : cells) {
cell.setVerticalAlignment(XWPFVertAlign.CENTER);
}
rowCount++;
}
return table;
}
use of org.apache.poi.xwpf.usermodel.XWPFTableRow in project pmph by BCSquad.
the class WordHelper method fillDecTextbookData.
private XWPFTable fillDecTextbookData(XWPFTable table, List<DecTextbook> decTextbooks) {
if (CollectionUtil.isEmpty(decTextbooks)) {
return table;
}
if (decTextbooks.size() > 1) {
int height = table.getRow(1).getHeight();
for (int i = 1; i < decTextbooks.size(); i++) {
table.createRow().setHeight(height);
}
}
List<XWPFTableRow> rows = table.getRows();
List<XWPFTableCell> cells;
int rowCount = 1;
for (DecTextbook decTextbook : decTextbooks) {
cells = rows.get(rowCount).getTableCells();
String value = decTextbook.getMaterialName();
if (StringUtil.notEmpty(value)) {
cells.get(0).setText(value);
}
/* 0=无/1=国家/2=省部/3=协编/4=校本/5=其他教材 */
Integer rank = decTextbook.getRank();
if (null != rank) {
switch(rank) {
case 0:
value = "无";
break;
case 1:
value = "国家";
break;
case 2:
value = "省部";
break;
case 3:
value = "协编";
break;
case 4:
value = "校本";
break;
case 5:
value = "其他";
break;
default:
value = "无";
break;
}
cells.get(1).setText(value);
}
// 0=无/1=主编/2=副主编/3=编委
Integer position = decTextbook.getPosition();
if (null != position) {
switch(position) {
case 1:
value = "主编";
break;
case 2:
value = "副主编";
break;
case 3:
value = "编委";
break;
default:
value = "无";
break;
}
cells.get(2).setText(value);
}
value = decTextbook.getIsDigitalEditor() ? "是" : "否";
cells.get(3).setText(value);
Date publishDate = decTextbook.getPublishDate();
if (null != publishDate) {
value = sdf.format(publishDate);
cells.get(4).setText(value);
}
value = decTextbook.getPublisher();
if (StringUtil.notEmpty(value)) {
cells.get(5).setText(value);
}
value = decTextbook.getIsbn();
if (StringUtil.notEmpty(value)) {
cells.get(6).setText(value);
}
value = decTextbook.getNote();
if (StringUtil.notEmpty(value)) {
cells.get(7).setText(value);
}
for (XWPFTableCell cell : cells) {
cell.setVerticalAlignment(XWPFVertAlign.CENTER);
}
rowCount++;
}
return table;
}
Aggregations