use of org.apache.poi.xwpf.usermodel.XWPFTableRow in project pmph by BCSquad.
the class WordHelper method fillDecLastPositionData.
private XWPFTable fillDecLastPositionData(XWPFTable table, List<DecLastPosition> decLastPositions) {
if (CollectionUtil.isEmpty(decLastPositions)) {
return table;
}
if (decLastPositions.size() > 1) {
int height = table.getRow(1).getHeight();
for (int i = 1; i < decLastPositions.size(); i++) {
table.createRow().setHeight(height);
}
}
List<XWPFTableRow> rows = table.getRows();
List<XWPFTableCell> cells;
int rowCount = 1;
for (DecLastPosition decLastPosition : decLastPositions) {
cells = rows.get(rowCount).getTableCells();
String value = decLastPosition.getMaterialName();
if (StringUtil.notEmpty(value)) {
cells.get(0).setText(value);
}
// 0=无/1=主编/2=副主编/3=编委
Integer position = decLastPosition.getPosition();
if (null != position) {
switch(position) {
case 1:
value = "主编";
break;
case 2:
value = "副主编";
break;
case 3:
value = "编委";
break;
default:
value = "无";
break;
}
cells.get(1).setText(value);
}
value = decLastPosition.getIsDigitalEditor() ? "是" : "否";
cells.get(2).setText(value);
value = decLastPosition.getPublisher();
if (StringUtil.notEmpty(value)) {
cells.get(3).setText(value);
}
Date publishDate = decLastPosition.getPublishDate();
if (null != publishDate) {
value = sdf.format(publishDate);
cells.get(4).setText(value);
}
value = decLastPosition.getNote();
if (!StringUtil.isEmpty(value)) {
cells.get(5).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 fillDecPublishRewardData.
private XWPFTable fillDecPublishRewardData(XWPFTable table, List<DecPublishReward> decPublishRewards) {
if (CollectionUtil.isEmpty(decPublishRewards)) {
return table;
}
if (decPublishRewards.size() > 1) {
int height = table.getRow(1).getHeight();
for (int i = 1; i < decPublishRewards.size(); i++) {
table.createRow().setHeight(height);
}
}
List<XWPFTableRow> rows = table.getRows();
List<XWPFTableCell> cells;
int rowCount = 1;
for (DecPublishReward decPublishReward : decPublishRewards) {
cells = rows.get(rowCount).getTableCells();
String value = decPublishReward.getRewardName();
if (StringUtil.notEmpty(value)) {
cells.get(0).setText(value);
}
Date rewardDate = decPublishReward.getRewardDate();
if (null != rewardDate) {
value = sdf.format(rewardDate);
cells.get(1).setText(value);
}
value = decPublishReward.getAwardUnit();
if (StringUtil.notEmpty(value)) {
cells.get(2).setText(value);
}
value = decPublishReward.getNote();
if (StringUtil.notEmpty(value)) {
cells.get(3).setText(value);
}
for (XWPFTableCell cell : cells) {
cell.setVerticalAlignment(XWPFVertAlign.CENTER);
}
rowCount++;
}
return table;
}
Aggregations