修改央视
This commit is contained in:
parent
373be9bd89
commit
a6233fa39c
|
@ -189,7 +189,7 @@ public class BlStuAnswerController extends JeecgController<BlStuAnswer, IBlStuAn
|
|||
WordOperator wo = service.createWordTjfx(id);
|
||||
//保存到本地附件里
|
||||
|
||||
ExportWord.download_by_is();
|
||||
// ExportWord.download_by_is();
|
||||
//update-end-author:taoyan date:20190528 for:批量插入数据
|
||||
return Result.ok("文件导入成功!数据行数:" + list.size());
|
||||
} catch (Exception e) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -76,4 +76,10 @@ public class BlTeacherInfo implements Serializable {
|
|||
@Excel(name = "教师总人数", width = 15)
|
||||
@ApiModelProperty(value = "教师总人数")
|
||||
private java.lang.String teacherSumno;
|
||||
/**最小样本数*/
|
||||
@Excel(name = "最小样有效本数", width = 15)
|
||||
@ApiModelProperty(value = "最小样有效本数")
|
||||
private Integer minNum;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.jeecg.modules.tools.CommonUtil;
|
|||
import org.jeecg.modules.tools.FileUtils;
|
||||
import org.jeecg.modules.tools.Global;
|
||||
import org.jeecg.modules.tools.IdGen;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STMerge;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -905,11 +905,7 @@ public class WordOperator {
|
|||
// 取出这一行对应的数据,数据与单元格角标位置是一致的,一一替换文本
|
||||
List<String> colList = dataList.get(i);
|
||||
for (int j = 0; j < cellList.size(); j++) {
|
||||
// if(StringUtils.contains(colList.get(j),"\n")){
|
||||
// setCellMultiLineText(cellList.get(j), colList, j);
|
||||
// }else{
|
||||
setCellText(cellList.get(j), colList, j);
|
||||
// }
|
||||
setCellText(cellList.get(j), colList, j,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -922,6 +918,40 @@ public class WordOperator {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换单元格文本
|
||||
* @param cell 单元格
|
||||
* @param colList 替换文本的集合(角标越位了,就置空)
|
||||
* @param j 单元格角标,也就是文本集合的角标
|
||||
* @param i 第几行
|
||||
*/
|
||||
private void setCellText(XWPFTableCell cell, List<String> colList, int j,int i) {
|
||||
// 无论一个单元格被切割成多少个run,只需要修改第一个即可,改完就return掉了
|
||||
List<XWPFParagraph> paragraphs = cell.getParagraphs();
|
||||
for (XWPFParagraph p : paragraphs) {
|
||||
List<XWPFRun> runs = p.getRuns();
|
||||
for (XWPFRun r : runs) {
|
||||
try {
|
||||
CTTc ctTc = cell.getCTTc();
|
||||
CTTcPr tcPr = ctTc.isSetTcPr() ? ctTc.getTcPr() : ctTc.addNewTcPr();
|
||||
CTShd ctShd = tcPr.isSetShd() ? tcPr.getShd() : tcPr.addNewShd();
|
||||
if (i % 2 == 0) {
|
||||
ctShd.setFill("c5d5e9"); // 设置背景色
|
||||
}else{
|
||||
ctShd.setFill("f6f8fc"); // 设置背景色
|
||||
}
|
||||
r.setText(colList.get(j), 0);
|
||||
//染上背景色
|
||||
// r.getCTR().addNewRPr().addNewHighlight().setVal(STHighlightColor.YELLOW);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
r.setText("", 0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换单元格文本
|
||||
* @param cell 单元格
|
||||
|
@ -940,6 +970,7 @@ public class WordOperator {
|
|||
//染上背景色
|
||||
// r.getCTR().addNewRPr().addNewHighlight().setVal(STHighlightColor.YELLOW);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
r.setText("", 0);
|
||||
}
|
||||
return;
|
||||
|
|