| | |
| | | import org.openxmlformats.schemas.drawingml.x2006.chart.*; |
| | | import org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObject; |
| | | import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTAnchor; |
| | | import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDrawing; |
| | | import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTPPr; |
| | | import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR; |
| | | import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.w3c.dom.Node; |
| | |
| | | if (table.getRows().size() > 0) { |
| | | log.info("表行数:{}",table.getRows().size()); |
| | | log.info("表格数据:" + table.getText()); |
| | | |
| | | addOrDelTableRow(table,i,textMap); |
| | | //增加表格或者減少表格 |
| | | if (Objects.equals(textMap.get("sendEmailFileName"), ReportTypeEnum.JAQ.getCode())) { |
| | | addOrDelTableRow(table,i,textMap); |
| | | } |
| | | if (checkText(table.getText())) { |
| | | List<XWPFTableRow> rows = table.getRows(); |
| | | |
| | |
| | | TableEnum tableEnum = TableEnum.codeOf(index); |
| | | Integer tableNum = Integer.valueOf(textMap.get(tableEnum.getName()).toString()); |
| | | Integer rows = table.getRows().size(); |
| | | Integer contentRows = table.getRows().size() - 1; |
| | | |
| | | //表1-表3 需剔除表头 |
| | | Integer contentRows = rows - 1; |
| | | //表4 需剔除表头跟尾部预留行数 |
| | | if(tableEnum == TableEnum.table4){ |
| | | contentRows -= 5; |
| | | rows -= 5; |
| | | |
| | | |
| | | //表4 行为表现举例处理 |
| | | Integer table4ChildrenNum = Integer.valueOf(textMap.get(TableEnum.table4Children.getName()).toString()); |
| | | if(table4ChildrenNum != null && table4ChildrenNum != 3){ |
| | | if(table4ChildrenNum > 3){ |
| | | //追加 |
| | | for (int i = 1; i < rows; i++) { |
| | | XWPFTableRow row = table.getRows().get(i); |
| | | List<XWPFTableCell> cells = row.getTableCells(); |
| | | XWPFTableCell cell = cells.get(1); |
| | | XWPFParagraph paragraph = cell.getParagraphs().get(0); |
| | | for (int j = 3; j < cell.getParagraphs().size(); j++) { |
| | | //log.info(cell.getParagraphs().get(j).getText()+""); |
| | | //设置样式 |
| | | cell.getParagraphs().get(j).getCTP().setPPr(cell.getParagraphs().get(0).getCTP().getPPr()); |
| | | if (paragraph.getRuns() != null |
| | | && paragraph.getRuns().size() > 0) { |
| | | XWPFRun cellR = cell.getParagraphs().get(j).createRun(); |
| | | cellR.setBold(paragraph.getRuns().get(0).isBold()); |
| | | cellR.getCTR().setRPr(paragraph.getRuns().get(0).getCTR().getRPr()); |
| | | } |
| | | //替换文字 |
| | | changeText(cell.getParagraphs().get(j),"%T4com"+i+"item"+(j+1)+"%"); |
| | | } |
| | | } |
| | | }else{ |
| | | //减少 |
| | | for (int i = 1; i < rows; i++) { |
| | | XWPFTableRow row = table.getRows().get(i); |
| | | List<XWPFTableCell> cells = row.getTableCells(); |
| | | XWPFTableCell cell = cells.get(1); |
| | | //XWPFParagraph paragraph = cell.getParagraphs().get(0); |
| | | for (int j = 3; j > table4ChildrenNum; j--) { |
| | | //cell.removeParagraph(j-1); |
| | | changeText(cell.getParagraphs().get(j),""); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | //表4 胜任力预留位置序号处理 |
| | | if(tableNum != null && tableNum != 8){ |
| | | for (int i = tableNum; i < tableNum+4; i++) { |
| | | XWPFTableRow row = table.getRows().get(i); |
| | | List<XWPFTableCell> cells = row.getTableCells(); |
| | | changeText(cells.get(0).getParagraphs().get(0),"#"+(i+1)+"."); |
| | | } |
| | | } |
| | | } |
| | | |
| | | //限制行数不为空 和 限制行数跟报告现有不一致需进行处理 |
| | | if(tableNum != null && !tableNum.equals(contentRows)){ |
| | | |
| | | if(tableNum > contentRows){ |
| | | //增加行数 |
| | | Integer addRow = tableNum - contentRows; |
| | | log.info("{}增加{}行数",tableEnum.getName(),addRow); |
| | | log.info("{}增加{}行",tableEnum.getName(),addRow); |
| | | for (int i = rows; i < rows+addRow; i++) { |
| | | log.info("增加{}行",i); |
| | | addJAQTable(table,tableEnum,i); |
| | | addJAQTable(table,tableEnum,i,textMap); |
| | | } |
| | | |
| | | }else{ |
| | | //减少行数 |
| | | Integer delRow = tableNum - rows; |
| | | log.info("{}减少{}行数",TableEnum.codeOf(index).getName(),delRow); |
| | | Integer delRow = rows - tableNum; |
| | | for (int i = contentRows; i > rows-delRow; i--) { |
| | | delJAQTable(table,i); |
| | | } |
| | | log.info("{}减少{}行数",TableEnum.codeOf(index).getName(),delRow-1); |
| | | } |
| | | |
| | | } |
| | | |
| | | }catch (Exception e){ |
| | |
| | | } |
| | | |
| | | /** |
| | | * 替换段落里面的变量 |
| | | * @param para |
| | | * @param text |
| | | */ |
| | | private static void replaceInPara(XWPFParagraph para, String text) { |
| | | List<XWPFRun> runs; |
| | | runs = para.getRuns(); |
| | | XWPFRun run = runs.get(0); |
| | | // 直接调用XWPFRun的setText()方法设置文本时,在底层会重新创建一个XWPFRun,把文本附加在当前文本后面, |
| | | // 所以我们不能直接设值,需要先删除当前run,然后再自己手动插入一个新的run。 |
| | | para.removeRun(0); |
| | | para.insertNewRun(0).setText(text); |
| | | } |
| | | |
| | | public static void changeText(XWPFParagraph p, String newText) { |
| | | List<XWPFRun> runs = p.getRuns(); |
| | | if(runs.isEmpty()){ |
| | | p.createRun(); |
| | | } |
| | | for(int i = runs.size() - 1; i > 0; i--) { |
| | | p.removeRun(i); |
| | | } |
| | | XWPFRun run = runs.get(0); |
| | | run.setText(newText, 0); |
| | | } |
| | | |
| | | /** |
| | | * 删除JAQ表格 |
| | | * @param table |
| | | * @param index |
| | | */ |
| | | private static void delJAQTable(XWPFTable table,Integer index){ |
| | | table.removeRow(index); |
| | | } |
| | | |
| | | /** |
| | | * 添加JAQ表格 |
| | | * @param tableEnum |
| | | * @param index |
| | | */ |
| | | private static void addJAQTable(XWPFTable table,TableEnum tableEnum,Integer index){ |
| | | private static void addJAQTable(XWPFTable table,TableEnum tableEnum,Integer index,Map<String, Object> textMap){ |
| | | |
| | | // 在表格中指定的位置新增一行 |
| | | insertRow(table,1,index); |
| | | |
| | | XWPFTableRow row = table.getRows().get(index); |
| | | List<XWPFTableCell> cells = row.getTableCells(); |
| | | switch (tableEnum){ |
| | | case table1: |
| | | cells.get(0).getParagraphs().get(0).getRuns().get(0).setText(textMap.get("T1rank"+index)+""); |
| | | cells.get(1).getParagraphs().get(0).getRuns().get(0).setText(textMap.get("T1com"+index)+""); |
| | | cells.get(2).getParagraphs().get(0).getRuns().get(0).setText(textMap.get("T1com"+index+"IF_M")+""); |
| | | cells.get(3).getParagraphs().get(0).getRuns().get(0).setText(textMap.get("T1com"+index+"IF_L")+"-"+textMap.get("T1com"+index+"IF_H")); |
| | | break; |
| | | case table2: |
| | | cells.get(0).getParagraphs().get(0).getRuns().get(0).setText(textMap.get("T2rank"+index)+""); |
| | | cells.get(1).getParagraphs().get(0).getRuns().get(0).setText(textMap.get("T2com"+index)+""); |
| | | cells.get(2).getParagraphs().get(0).getRuns().get(0).setText(textMap.get("T2Com"+index+"I_M")+""); |
| | | cells.get(3).getParagraphs().get(0).getRuns().get(0).setText(textMap.get("T2com"+index+"I_L")+"-"+textMap.get("T2com"+index+"I_H")); |
| | | break; |
| | | case table3: |
| | | cells.get(0).getParagraphs().get(0).getRuns().get(0).setText(textMap.get("T3rank"+index)+""); |
| | | cells.get(1).getParagraphs().get(0).getRuns().get(0).setText(textMap.get("T3item"+index)+""); |
| | | cells.get(2).getParagraphs().get(0).getRuns().get(0).setText(textMap.get("T3item"+index+"IF_M")+""); |
| | | cells.get(3).getParagraphs().get(0).getRuns().get(0).setText(textMap.get("T3com"+index)+""); |
| | | break; |
| | | case table4: |
| | | cells.get(0).getParagraphs().get(0).getRuns().get(0).setText("#"+textMap.get("T4rank"+index)+". "+textMap.get("T4com"+index)); |
| | | |
| | | //子集合长度 |
| | | Integer table4ChildrenNum = Integer.valueOf(textMap.get(TableEnum.table4Children.getName()).toString()); |
| | | List<String> items = new ArrayList<>(); |
| | | for (int j = 1; j <= table4ChildrenNum; j++) { |
| | | items.add(textMap.get("T4com"+index+"item"+j)+""); |
| | | } |
| | | |
| | | //设置值 |
| | | XWPFTableCell cell = cells.get(1); |
| | | XWPFParagraph paragraph = cell.getParagraphs().get(0); |
| | | for (int i = 0; i < items.size(); i++) { |
| | | String item = items.get(i); |
| | | if(i == 0){ |
| | | paragraph.getRuns().get(0).setText(item); |
| | | }else{ |
| | | //新增段落 |
| | | cell.addParagraph(); |
| | | cell.getParagraphs().get(i).getCTP().setPPr(paragraph.getCTP().getPPr()); |
| | | if (paragraph.getRuns() != null |
| | | && paragraph.getRuns().size() > 0) { |
| | | XWPFRun cellR = cell.getParagraphs().get(i).createRun(); |
| | | cellR.setBold(paragraph.getRuns().get(0).isBold()); |
| | | /*cellR.setFontSize(paragraph.getRuns().get(0).getFontSize()); |
| | | cellR.setFontFamily(paragraph.getRuns().get(0).getFontFamily());*/ |
| | | cellR.getCTR().setRPr(paragraph.getRuns().get(0).getCTR().getRPr()); |
| | | } |
| | | cell.getParagraphs().get(i).getRuns().get(0).setText(item); |
| | | } |
| | | } |
| | | |
| | | //小于6个胜任力 补齐 |
| | | Integer repair = 6 - table4ChildrenNum; |
| | | if(repair > 0){ |
| | | for (int i = 0; i < repair; i++) { |
| | | //新增段落 |
| | | cell.addParagraph(); |
| | | cell.getParagraphs().get(cell.getParagraphs().size()-1).getCTP().setPPr(paragraph.getCTP().getPPr()); |
| | | if (paragraph.getRuns() != null |
| | | && paragraph.getRuns().size() > 0) { |
| | | XWPFRun cellR = cell.getParagraphs().get(cell.getParagraphs().size()-1).createRun(); |
| | | cellR.setBold(paragraph.getRuns().get(0).isBold()); |
| | | /*cellR.setFontSize(paragraph.getRuns().get(0).getFontSize()); |
| | | cellR.setFontFamily(paragraph.getRuns().get(0).getFontFamily());*/ |
| | | cellR.getCTR().setRPr(paragraph.getRuns().get(0).getCTR().getRPr()); |
| | | } |
| | | cell.getParagraphs().get(cell.getParagraphs().size()-1).getRuns().get(0).setText(null); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * insertRow 在word表格中指定位置插入一行,并将某一行的样式复制到新增行 |
| | | * @param copyrowIndex 需要复制的行位置 |
| | | * @param newrowIndex 需要新增一行的位置 |
| | | * */ |
| | | public static void insertRow(XWPFTable table, int copyrowIndex, int newrowIndex) { |
| | | // 在表格中指定的位置新增一行 |
| | | XWPFTableRow targetRow = table.insertNewTableRow(newrowIndex); |
| | | // 获取需要复制行对象 |
| | | XWPFTableRow copyRow = table.getRow(copyrowIndex); |
| | | //复制行对象 |
| | | targetRow.getCtRow().setTrPr(copyRow.getCtRow().getTrPr()); |
| | | //或许需要复制的行的列 |
| | | List<XWPFTableCell> copyCells = copyRow.getTableCells(); |
| | | //复制列对象 |
| | | XWPFTableCell targetCell = null; |
| | | for (int i = 0; i < copyCells.size(); i++) { |
| | | XWPFTableCell copyCell = copyCells.get(i); |
| | | targetCell = targetRow.addNewTableCell(); |
| | | targetCell.getCTTc().setTcPr(copyCell.getCTTc().getTcPr()); |
| | | if (copyCell.getParagraphs() != null && copyCell.getParagraphs().size() > 0) { |
| | | targetCell.getParagraphs().get(0).getCTP().setPPr(copyCell.getParagraphs().get(0).getCTP().getPPr()); |
| | | if (copyCell.getParagraphs().get(0).getRuns() != null |
| | | && copyCell.getParagraphs().get(0).getRuns().size() > 0) { |
| | | XWPFRun cellR = targetCell.getParagraphs().get(0).createRun(); |
| | | cellR.setBold(copyCell.getParagraphs().get(0).getRuns().get(0).isBold()); |
| | | cellR.getCTR().setRPr(copyCell.getParagraphs().get(0).getRuns().get(0).getCTR().getRPr()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 复制模板行的属性 |
| | | * @param tmpCell |
| | | * @param cell |
| | | * @param text |
| | | * @throws Exception |
| | | */ |
| | | private static void setCellText(XWPFTableCell tmpCell, XWPFTableCell cell,String text){ |
| | | try { |
| | | CTTc cttc2 = tmpCell.getCTTc(); |
| | | CTTcPr ctPr2 = cttc2.getTcPr(); |
| | | CTTc cttc = cell.getCTTc(); |
| | | CTTcPr ctPr = cttc.addNewTcPr(); |
| | | if (ctPr2.getTcW() != null) { |
| | | ctPr.addNewTcW().setW(ctPr2.getTcW().getW()); |
| | | } |
| | | if (ctPr2.getVAlign() != null) { |
| | | ctPr.addNewVAlign().setVal(ctPr2.getVAlign().getVal()); |
| | | } |
| | | if (cttc2.getPList().size() > 0) { |
| | | CTP ctp = cttc2.getPList().get(0); |
| | | if (ctp.getPPr() != null) { |
| | | if (ctp.getPPr().getJc() != null) { |
| | | cttc.getPList().get(0).addNewPPr().addNewJc() |
| | | .setVal(ctp.getPPr().getJc().getVal()); |
| | | } |
| | | } |
| | | } |
| | | if (ctPr2.getTcBorders() != null) { |
| | | ctPr.setTcBorders(ctPr2.getTcBorders()); |
| | | } |
| | | XWPFParagraph tmpP = tmpCell.getParagraphs().get(0); |
| | | XWPFParagraph cellP = cell.getParagraphs().get(0); |
| | | XWPFRun tmpR = null; |
| | | if (tmpP.getRuns() != null && tmpP.getRuns().size() > 0) { |
| | | tmpR = tmpP.getRuns().get(0); |
| | | } |
| | | XWPFRun cellR = cellP.createRun(); |
| | | cellR.setText(text); |
| | | // 复制字体信息 |
| | | if (tmpR != null) { |
| | | if(!cellR.isBold()){ |
| | | cellR.setBold(tmpR.isBold()); |
| | | } |
| | | cellR.setItalic(tmpR.isItalic()); |
| | | cellR.setUnderline(tmpR.getUnderline()); |
| | | cellR.setColor(tmpR.getColor()); |
| | | cellR.setTextPosition(tmpR.getTextPosition()); |
| | | if (tmpR.getFontSize() != -1) { |
| | | cellR.setFontSize(tmpR.getFontSize()); |
| | | } |
| | | if (tmpR.getFontFamily() != null) { |
| | | cellR.setFontFamily(tmpR.getFontFamily()); |
| | | } |
| | | if (tmpR.getCTR() != null) { |
| | | if (tmpR.getCTR().isSetRPr()) { |
| | | CTRPr tmpRPr = tmpR.getCTR().getRPr(); |
| | | if (tmpRPr.isSetRFonts()) { |
| | | CTFonts tmpFonts = tmpRPr.getRFonts(); |
| | | CTRPr cellRPr = cellR.getCTR().isSetRPr() ? cellR |
| | | .getCTR().getRPr() : cellR.getCTR().addNewRPr(); |
| | | CTFonts cellFonts = cellRPr.isSetRFonts() ? cellRPr |
| | | .getRFonts() : cellRPr.addNewRFonts(); |
| | | cellFonts.setAscii(tmpFonts.getAscii()); |
| | | cellFonts.setAsciiTheme(tmpFonts.getAsciiTheme()); |
| | | cellFonts.setCs(tmpFonts.getCs()); |
| | | cellFonts.setCstheme(tmpFonts.getCstheme()); |
| | | cellFonts.setEastAsia(tmpFonts.getEastAsia()); |
| | | cellFonts.setEastAsiaTheme(tmpFonts.getEastAsiaTheme()); |
| | | cellFonts.setHAnsi(tmpFonts.getHAnsi()); |
| | | cellFonts.setHAnsiTheme(tmpFonts.getHAnsiTheme()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // 复制段落信息 |
| | | cellP.setAlignment(tmpP.getAlignment()); |
| | | cellP.setVerticalAlignment(tmpP.getVerticalAlignment()); |
| | | cellP.setBorderBetween(tmpP.getBorderBetween()); |
| | | cellP.setBorderBottom(tmpP.getBorderBottom()); |
| | | cellP.setBorderLeft(tmpP.getBorderLeft()); |
| | | cellP.setBorderRight(tmpP.getBorderRight()); |
| | | cellP.setBorderTop(tmpP.getBorderTop()); |
| | | cellP.setPageBreak(tmpP.isPageBreak()); |
| | | if (tmpP.getCTP() != null) { |
| | | if (tmpP.getCTP().getPPr() != null) { |
| | | CTPPr tmpPPr = tmpP.getCTP().getPPr(); |
| | | CTPPr cellPPr = cellP.getCTP().getPPr() != null ? cellP |
| | | .getCTP().getPPr() : cellP.getCTP().addNewPPr(); |
| | | // 复制段落间距信息 |
| | | CTSpacing tmpSpacing = tmpPPr.getSpacing(); |
| | | if (tmpSpacing != null) { |
| | | CTSpacing cellSpacing = cellPPr.getSpacing() != null ? cellPPr |
| | | .getSpacing() : cellPPr.addNewSpacing(); |
| | | if (tmpSpacing.getAfter() != null) { |
| | | cellSpacing.setAfter(tmpSpacing.getAfter()); |
| | | } |
| | | if (tmpSpacing.getAfterAutospacing() != null) { |
| | | cellSpacing.setAfterAutospacing(tmpSpacing |
| | | .getAfterAutospacing()); |
| | | } |
| | | if (tmpSpacing.getAfterLines() != null) { |
| | | cellSpacing.setAfterLines(tmpSpacing.getAfterLines()); |
| | | } |
| | | if (tmpSpacing.getBefore() != null) { |
| | | cellSpacing.setBefore(tmpSpacing.getBefore()); |
| | | } |
| | | if (tmpSpacing.getBeforeAutospacing() != null) { |
| | | cellSpacing.setBeforeAutospacing(tmpSpacing |
| | | .getBeforeAutospacing()); |
| | | } |
| | | if (tmpSpacing.getBeforeLines() != null) { |
| | | cellSpacing.setBeforeLines(tmpSpacing.getBeforeLines()); |
| | | } |
| | | if (tmpSpacing.getLine() != null) { |
| | | cellSpacing.setLine(tmpSpacing.getLine()); |
| | | } |
| | | if (tmpSpacing.getLineRule() != null) { |
| | | cellSpacing.setLineRule(tmpSpacing.getLineRule()); |
| | | } |
| | | } |
| | | // 复制段落缩进信息 |
| | | CTInd tmpInd = tmpPPr.getInd(); |
| | | if (tmpInd != null) { |
| | | CTInd cellInd = cellPPr.getInd() != null ? cellPPr.getInd() |
| | | : cellPPr.addNewInd(); |
| | | if (tmpInd.getFirstLine() != null) { |
| | | cellInd.setFirstLine(tmpInd.getFirstLine()); |
| | | } |
| | | if (tmpInd.getFirstLineChars() != null) { |
| | | cellInd.setFirstLineChars(tmpInd.getFirstLineChars()); |
| | | } |
| | | if (tmpInd.getHanging() != null) { |
| | | cellInd.setHanging(tmpInd.getHanging()); |
| | | } |
| | | if (tmpInd.getHangingChars() != null) { |
| | | cellInd.setHangingChars(tmpInd.getHangingChars()); |
| | | } |
| | | if (tmpInd.getLeft() != null) { |
| | | cellInd.setLeft(tmpInd.getLeft()); |
| | | } |
| | | if (tmpInd.getLeftChars() != null) { |
| | | cellInd.setLeftChars(tmpInd.getLeftChars()); |
| | | } |
| | | if (tmpInd.getRight() != null) { |
| | | cellInd.setRight(tmpInd.getRight()); |
| | | } |
| | | if (tmpInd.getRightChars() != null) { |
| | | cellInd.setRightChars(tmpInd.getRightChars()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | private static void addTableValue(XWPFDocument document, Map<Integer, Map<Integer, List<String[]>>> autoTableMap) { |
| | | if (Objects.isNull(autoTableMap)) { |
| | | return; |
| | |
| | | try { |
| | | run.setText(changeValue(run.toString(), textMap, run, paragraph, document, runPosition), 0); |
| | | } catch (Exception e) { |
| | | |
| | | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | |
| | | } else { |
| | | String keyTemp = textSet.getKey(); |
| | | String keyValue = Objects.isNull(textSet.getValue()) ? "" : textSet.getValue().toString(); |
| | | if (StringUtils.contains(keyValue, "%line-feed%")) { |
| | | |
| | | |
| | | //表格里的换行 特殊处理 因为没有段落 |
| | | if(StringUtils.contains(keyValue, "%table-line-feed%")){ |
| | | String[] keyValues = keyValue.split("%table-line-feed%"); |
| | | runValue = delDynList(keyTemp, Arrays.asList(keyValues), paragraph, document,1); |
| | | }else{ |
| | | String[] keyValues = keyValue.split("%line-feed%"); |
| | | runValue = delDynList(keyTemp, Arrays.asList(keyValues), paragraph, document); |
| | | runValue = delDynList(keyTemp, Arrays.asList(keyValues), paragraph, document,0); |
| | | } |
| | | |
| | | log.info("ChangeValue的key值:" + key + " ChangeValue的value值:" + keyValue); |
| | | runValue = runValue.replaceAll(key, keyValue); |
| | | } |
| | |
| | | |
| | | ctpPr.addNewSectPr(); |
| | | } |
| | | private static String delDynList(String placeholder, List obj, XWPFParagraph oldParagraph, XWPFDocument templateDoc) { |
| | | |
| | | private static String delDynList(String placeholder, List obj, XWPFParagraph oldParagraph, XWPFDocument templateDoc,Integer flag) { |
| | | String placeholderValue = placeholder; |
| | | List dataList = obj; |
| | | Collections.reverse(dataList); |
| | | //普通换行降序处理 表格换行无需降序 |
| | | if(flag == 0){ |
| | | Collections.reverse(dataList); |
| | | } |
| | | XWPFRun oldRun = oldParagraph.getRuns().size() > 0 ? oldParagraph.getRuns().get(0) : null; |
| | | Boolean isBold = Objects.nonNull(oldRun) ? oldRun.isBold() : false; |
| | | for (int i = 0, size = dataList.size(); i < size; i++) { |
| | |
| | | if (i == 0) { |
| | | placeholderValue = String.valueOf(text); |
| | | } else { |
| | | XWPFParagraph paragraph = createParagraph(oldParagraph, templateDoc, oldRun, isBold, String.valueOf(text)); |
| | | XWPFParagraph paragraph = null; |
| | | if(flag == 0){ |
| | | paragraph = createParagraph(oldParagraph, templateDoc, oldRun, isBold, String.valueOf(text)); |
| | | }else if(flag == 1){ |
| | | paragraph = createTableRun(oldParagraph, oldRun, isBold, String.valueOf(text)); |
| | | } |
| | | |
| | | if (paragraph != null) { |
| | | oldParagraph = paragraph; |
| | | } |
| | |
| | | copyParagraph(oldParagraph, newPar, oldRun, isBold, texts); |
| | | return newPar; |
| | | } |
| | | |
| | | /** |
| | | * 创建table表格换行 段落run |
| | | * @param oldParagraph |
| | | * @param oldRun |
| | | * @param isBold |
| | | * @param texts |
| | | * @return |
| | | */ |
| | | public static XWPFParagraph createTableRun(XWPFParagraph oldParagraph,XWPFRun oldRun, boolean isBold, String... texts) { |
| | | |
| | | XWPFRun run = oldParagraph.createRun(); |
| | | run.addBreak(); |
| | | run.setText(texts[0]); |
| | | run.setFontFamily(oldRun.getFontFamily()); |
| | | int fontSize = oldRun.getFontSize(); |
| | | run.setFontSize((fontSize == -1) ? DEFAULT_FONT_SIZE : fontSize); |
| | | run.setBold(isBold); |
| | | run.setItalic(oldRun.isItalic()); |
| | | run.setColor(oldRun.getColor()); |
| | | |
| | | return null; |
| | | } |
| | | |
| | | ; |
| | | |
| | | private static void copyParagraph(XWPFParagraph sourcePar, XWPFParagraph targetPar, XWPFRun oldRun, boolean isBold, String... texts) { |
| | | targetPar.setAlignment(sourcePar.getAlignment()); |
| | | targetPar.setVerticalAlignment(sourcePar.getVerticalAlignment()); |
| | |
| | | }*/ |
| | | |
| | | try { |
| | | InputStream is = new FileInputStream("C:\\Users\\datou\\Desktop\\JAQ中文版.docx"); |
| | | InputStream is = new FileInputStream("C:\\Users\\大头\\Desktop\\JAQ中文版.docx"); |
| | | XWPFDocument document = new XWPFDocument(is); |
| | | |
| | | String result = "{\"T3Line21C\":\"1\",\"T4com8item1\":\"JAQ0127\",\"T1com8IF_H\":\"12.92\",\"T4com8item3\":\"JAQ0046\",\"T4com8item2\":\"JAQ0108\",\"T1com8IF_L\":\"12.16\",\"T1com8IF_M\":\"12.54\",\"T3item2\":\"JAQ0092\",\"T2com1I_L\":\"3.80\",\"T3item3\":\"JAQ0019\",\"T3item4\":\"JAQ0027\",\"T3item5\":\"JAQ0021\",\"T3item6\":\"JAQ0044\",\"T3item7\":\"JAQ0045\",\"T2Com13I_M\":\"3.40\",\"T3item8\":\"JAQ0105\",\"T3item9\":\"JAQ0002\",\"T2com1I_H\":\"4.20\",\"T3item3IF_M\":\"18.00\",\"T3Line10C\":\"0\",\"T3Line22C\":\"0\",\"T1com15IF_H\":\"15.20\",\"T1com15IF_L\":\"7.28\",\"T3Line9C\":\"0\",\"T1com1IF_M\":\"15.62\",\"T1com15IF_M\":\"11.24\",\"T1com1IF_L\":\"14.44\",\"T2com6I_L\":\"3.60\",\"T1com1IF_H\":\"16.80\",\"T1com4IF_M\":\"14.78\",\"T1com4IF_L\":\"14.44\",\"T3Line11C\":\"0\",\"T2com6I_H\":\"4.00\",\"T1com4IF_H\":\"15.12\",\"T3item16IF_M\":\"16.00\",\"T3com18\":\"23. 激励他人\",\"T4com6item1\":\"JAQ0049\",\"T3com17\":\"11. 客户导向(内部和外部)\",\"T4com6item3\":\"JAQ0135\",\"T3com19\":\"14. 判断和决策\",\"T4com6item2\":\"JAQ0025\",\"T3Line8C\":\"0\",\"T3com10\":\"20. 授权\",\"T3item13IF_M\":\"16.00\",\"T3com12\":\"19. 人员配置与人才培养\",\"T3com11\":\"1. 适应性和变革管理\",\"T3com14\":\"15. 计划和组织\",\"T3Line23C\":\"0\",\"T3com13\":\"20. 授权\",\"T3com16\":\"23. 激励他人\",\"T3com15\":\"18. 管理他人\",\"T1com11IF_L\":\"10.88\",\"T1com11IF_M\":\"11.90\",\"T1com11IF_H\":\"12.92\",\"T2com14I_H\":\"3.40\",\"T2com1\":\"1. 适应性和变革管理\",\"T2com2\":\"20. 授权\",\"T3Line6C\":\"0\",\"T2com9\":\"6. 压力忍受-情绪韧性\",\"T2com7\":\"15. 计划和组织\",\"T2com8\":\"19. 人员配置与人才培养\",\"T2com5\":\"5. 缜密性\",\"T3item7IF_M\":\"18.00\",\"T3Line7C\":\"0\",\"T2com6\":\"9. 同理心\",\"T2Com14I_M\":\"3.40\",\"T3item24IF_M\":\"16.00\",\"T2com3\":\"23. 激励他人\",\"T2Com5I_M\":\"3.80\",\"T2com4\":\"11. 客户导向(内部和外部)\",\"T2com14I_L\":\"3.40\",\"T3Line12C\":\"0\",\"T3Line24C\":\"1\",\"T2com15I_H\":\"3.80\",\"T2com15I_L\":\"2.60\",\"T1com4\":\"1. 适应性和变革管理\",\"T4com2item2\":\"JAQ0089\",\"T1com5\":\"9. 同理心\",\"T4com2item3\":\"JAQ0129\",\"T1com6\":\"5. 缜密性\",\"T1com7\":\"8. 团队协作\",\"T4com2item1\":\"JAQ0105\",\"T1com8\":\"19. 人员配置与人才培养\",\"T1com9\":\"6. 压力忍受-情绪韧性\",\"T2Com6I_M\":\"3.80\",\"T1com1\":\"23. 激励他人\",\"T1com2\":\"20. 授权\",\"T1com3\":\"11. 客户导向(内部和外部)\",\"T2Line9C\":\"0\",\"T1com7IF_H\":\"17.60\",\"T2com5I_H\":\"4.00\",\"T1com7IF_M\":\"12.70\",\"T3Line13C\":\"0\",\"T1com7IF_L\":\"7.80\",\"T3Line25C\":\"0\",\"T2com5I_L\":\"3.60\",\"T1com2IF_M\":\"15.56\",\"T1com2IF_L\":\"14.40\",\"T1com2IF_H\":\"16.72\",\"表4子集合\":\"3\",\"T2rank1\":\"1\",\"T3item4IF_M\":\"18.00\",\"T3item27IF_M\":\"16.00\",\"T2rank3\":\"3\",\"T3com21\":\"12. 分析和批判性思维\",\"T2rank2\":\"2\",\"T3com20\":\"5. 缜密性\",\"T2rank5\":\"5\",\"T3com23\":\"6. 压力忍受-情绪韧性\",\"T2rank4\":\"4\",\"T3com22\":\"3. 主动性\",\"T2rank7\":\"7\",\"T3com25\":\"11. 客户导向(内部和外部)\",\"T2rank6\":\"6\",\"T3com24\":\"2. 学习敏锐度\",\"T2rank9\":\"9\",\"T3Line14C\":\"0\",\"T3com27\":\"20. 授权\",\"T2rank8\":\"8\",\"T3com26\":\"1. 适应性和变革管理\",\"T3Line26C\":\"0\",\"T3item23IF_M\":\"16.00\",\"T3item27\":\"JAQ0076\",\"T3item26\":\"JAQ0113\",\"T3item25\":\"JAQ0107\",\"T3item24\":\"JAQ0065\",\"T3item23\":\"JAQ0064\",\"T1rank9\":\"9\",\"T3item22\":\"JAQ0068\",\"T3item21\":\"JAQ0052\",\"T3item20\":\"JAQ0049\",\"T1rank6\":\"6\",\"T1com3IF_M\":\"14.88\",\"T1rank5\":\"5\",\"T1com3IF_L\":\"12.96\",\"T1rank8\":\"8\",\"T1rank7\":\"7\",\"T1rank2\":\"2\",\"T1rank1\":\"1\",\"T2Com15I_M\":\"3.20\",\"T1rank4\":\"4\",\"T1rank3\":\"3\",\"T3Line27C\":\"0\",\"表1\":\"15\",\"表2\":\"15\",\"表3\":\"27\",\"表4\":\"10\",\"T1com3IF_H\":\"16.80\",\"T3Line15C\":\"1\",\"T4com1item3\":\"JAQ0023\",\"T3item8IF_M\":\"18.00\",\"T3item17IF_M\":\"16.00\",\"T4com7item3\":\"JAQ0003\",\"T3item19\":\"JAQ0033\",\"T3item18\":\"JAQ0023\",\"T4com7item1\":\"JAQ0001\",\"T3item12IF_M\":\"16.00\",\"T3item17\":\"JAQ0020\",\"T4com7item2\":\"JAQ0042\",\"T3item16\":\"JAQ0133\",\"T3item15\":\"JAQ0012\",\"T1com12IF_M\":\"11.58\",\"T3item14\":\"JAQ0131\",\"T3item13\":\"JAQ0129\",\"T3item12\":\"JAQ0127\",\"T3item11\":\"JAQ0006\",\"T3item10\":\"JAQ0089\",\"T4com10\":\"24. 组织敏锐度\",\"T3item1\":\"JAQ0128\",\"T1com12IF_H\":\"12.96\",\"T1com12IF_L\":\"10.20\",\"T2Com10I_M\":\"3.50\",\"T2com10I_H\":\"4.40\",\"T3Line16C\":\"0\",\"T2Com1I_M\":\"4.00\",\"T2com4I_H\":\"4.20\",\"T2com10I_L\":\"2.60\",\"T4com1item2\":\"JAQ0133\",\"T2com4I_L\":\"3.60\",\"T4com1item1\":\"JAQ0019\",\"T1com13IF_H\":\"12.92\",\"T2Line4C\":\"0\",\"T3item5IF_M\":\"18.00\",\"T2com11I_H\":\"3.60\",\"T3Line1C\":\"0\",\"T4com9item3\":\"JAQ0114\",\"T4rank10\":\"10\",\"T1com13IF_L\":\"10.20\",\"T1com13IF_M\":\"11.56\",\"T3Line17C\":\"0\",\"T2Com2I_M\":\"4.00\",\"T2com11I_L\":\"3.40\",\"T2com9I_L\":\"3.00\",\"T4com9item1\":\"JAQ0064\",\"T4com9item2\":\"JAQ0050\",\"T2com9I_H\":\"4.00\",\"T2Line5C\":\"0\",\"T3item26IF_M\":\"16.00\",\"T4com10item3\":\"JAQ0079\",\"T2Com7I_M\":\"3.60\",\"T2Line6C\":\"0\",\"T3Line18C\":\"0\",\"T2com12\":\"24. 组织敏锐度\",\"T2com13\":\"16. 创造性\",\"T2com14\":\"25. 商业与战略敏锐度\",\"T2Line11C\":\"0\",\"T2com15\":\"3. 主动性\",\"T3rank27\":\"27\",\"T2com10\":\"8. 团队协作\",\"T2com11\":\"14. 判断和决策\",\"T4com5item3\":\"JAQ0097\",\"T4com5item1\":\"JAQ0044\",\"T4com5item2\":\"JAQ0004\",\"T4com3\":\"11. 客户导向(内部和外部)\",\"T4com4\":\"1. 适应性和变革管理\",\"T4com1\":\"23. 激励他人\",\"T3item9IF_M\":\"18.00\",\"T3item22IF_M\":\"16.00\",\"T4com2\":\"20. 授权\",\"T4com7\":\"8. 团队协作\",\"T3item2IF_M\":\"18.00\",\"T4com8\":\"19. 人员配置与人才培养\",\"T4com5\":\"9. 同理心\",\"T2Com8I_M\":\"3.60\",\"T2Com11I_M\":\"3.50\",\"T4com6\":\"5. 缜密性\",\"T2com3I_H\":\"4.20\",\"T3rank22\":\"22\",\"T3rank21\":\"21\",\"T3rank20\":\"20\",\"T4com9\":\"6. 压力忍受-情绪韧性\",\"T2Line7C\":\"0\",\"T3Line19C\":\"0\",\"T2com3I_L\":\"3.80\",\"T3rank26\":\"26\",\"T3rank25\":\"25\",\"T3rank24\":\"24\",\"T3rank23\":\"23\",\"T2Line10C\":\"0\",\"T1com6IF_M\":\"13.00\",\"T1com6IF_L\":\"10.80\",\"T3item18IF_M\":\"16.00\",\"T1com6IF_H\":\"15.20\",\"T3item11IF_M\":\"16.00\",\"T2Line8C\":\"0\",\"T2com8I_L\":\"3.40\",\"T1com9IF_M\":\"12.10\",\"T3rank1\":\"1\",\"T2com8I_H\":\"3.80\",\"T3rank2\":\"2\",\"T3item10IF_M\":\"18.00\",\"T1com14IF_M\":\"11.40\",\"T1com14IF_L\":\"8.40\",\"T3rank9\":\"9\",\"T3Line5C\":\"0\",\"T3rank7\":\"7\",\"T3rank8\":\"8\",\"T3rank5\":\"5\",\"T3rank6\":\"6\",\"T3rank3\":\"3\",\"T3rank4\":\"4\",\"T4rank7\":\"7\",\"T4rank6\":\"6\",\"T4rank5\":\"5\",\"T4rank4\":\"4\",\"T4com3item3\":\"JAQ0107\",\"T4com3item2\":\"JAQ0020\",\"T4rank9\":\"9\",\"T4com3item1\":\"JAQ0045\",\"T4rank8\":\"8\",\"T3item6IF_M\":\"18.00\",\"T1com14IF_H\":\"14.40\",\"T4rank3\":\"3\",\"T2Line13C\":\"0\",\"T4rank2\":\"2\",\"T4rank1\":\"1\",\"T3rank19\":\"19\",\"T2Line1C\":\"0\",\"T3rank18\":\"18\",\"T2Line12C\":\"0\",\"T3rank17\":\"17\",\"T3rank16\":\"16\",\"T2com12I_H\":\"4.00\",\"T3Line4C\":\"0\",\"T3item20IF_M\":\"16.00\",\"T2Com12I_M\":\"3.50\",\"T2Com3I_M\":\"4.00\",\"T3item14IF_M\":\"16.00\",\"T3rank11\":\"11\",\"T3rank10\":\"10\",\"T2com2I_H\":\"4.40\",\"T1com9IF_H\":\"15.20\",\"T2com12I_L\":\"3.00\",\"T3rank15\":\"15\",\"T3rank14\":\"14\",\"T2com2I_L\":\"3.60\",\"T3rank13\":\"13\",\"T1com9IF_L\":\"9.00\",\"T3rank12\":\"12\",\"T2rank14\":\"14\",\"T2rank13\":\"13\",\"T2rank15\":\"15\",\"T2rank10\":\"10\",\"T2com13I_H\":\"4.00\",\"T3item15IF_M\":\"16.00\",\"T2Line2C\":\"0\",\"T2rank12\":\"12\",\"T2rank11\":\"11\",\"T3Line3C\":\"0\",\"T1com10IF_M\":\"12.10\",\"T1com10IF_L\":\"9.00\",\"T2Com4I_M\":\"3.90\",\"T4com10item2\":\"JAQ0014\",\"T1com10IF_H\":\"15.20\",\"T4com10item1\":\"JAQ0027\",\"T2com13I_L\":\"2.80\",\"T3item25IF_M\":\"16.00\",\"T3item1IF_M\":\"18.00\",\"T3item21IF_M\":\"16.00\",\"T2com7I_L\":\"3.40\",\"T2Line15C\":\"1\",\"T3com6\":\"9. 同理心\",\"T3com7\":\"11. 客户导向(内部和外部)\",\"T3Line20C\":\"0\",\"T2com7I_H\":\"3.80\",\"T3com8\":\"20. 授权\",\"T3com9\":\"15. 计划和组织\",\"T3com2\":\"16. 创造性\",\"T3com3\":\"23. 激励他人\",\"T3com4\":\"24. 组织敏锐度\",\"T2Line3C\":\"0\",\"T3com5\":\"1. 适应性和变革管理\",\"T1rank15\":\"15\",\"T1rank14\":\"14\",\"T1rank13\":\"13\",\"T1rank12\":\"12\",\"T1rank11\":\"11\",\"T1rank10\":\"10\",\"T3Line2C\":\"0\",\"T1com5IF_H\":\"15.20\",\"T1com10\":\"24. 组织敏锐度\",\"T1com11\":\"25. 商业与战略敏锐度\",\"T2Com9I_M\":\"3.50\",\"T1com12\":\"14. 判断和决策\",\"T1com13\":\"15. 计划和组织\",\"T1com14\":\"16. 创造性\",\"T1com15\":\"26. 正直、信任和公信力\",\"T3item19IF_M\":\"16.00\",\"T1com5IF_M\":\"13.72\",\"T3com1\":\"1. 适应性和变革管理\",\"T4com4item1\":\"JAQ0128\",\"T1com5IF_L\":\"12.24\",\"T2Line14C\":\"0\",\"T4com4item2\":\"JAQ0021\",\"T4com4item3\":\"JAQ0006\"}"; |
| | | String result = "{\"T3Line21C\":\"0\",\"T4com8item1\":\"JAQ0027\",\"T1com8IF_H\":\"15.20\",\"T4com8item3\":\"JAQ0070\",\"T4com8item2\":\"JAQ0014\",\"T1com8IF_L\":\"15.20\",\"T1com8IF_M\":\"15.20\",\"T3item2\":\"JAQ0092\",\"T2com1I_L\":\"4.40\",\"T3item3\":\"JAQ0019\",\"T3item4\":\"JAQ0027\",\"T3item5\":\"JAQ0048\",\"T3item6\":\"JAQ0044\",\"T3item7\":\"JAQ0045\",\"T3item8\":\"JAQ0057\",\"T3item9\":\"JAQ0053\",\"T2com1I_H\":\"4.40\",\"T3item3IF_M\":\"20.00\",\"T3Line10C\":\"0\",\"T3Line22C\":\"0\",\"T3Line9C\":\"0\",\"T1com1IF_M\":\"17.60\",\"T1com1IF_L\":\"17.60\",\"T2com6I_L\":\"4.00\",\"T1com1IF_H\":\"17.60\",\"T1com4IF_M\":\"16.72\",\"T1com4IF_L\":\"16.72\",\"T3Line11C\":\"0\",\"T2com6I_H\":\"4.00\",\"T1com4IF_H\":\"16.72\",\"T3item16IF_M\":\"20.00\",\"T3com18\":\"1. 适应性和变革管理\",\"T4com6item1\":\"JAQ0114\",\"T3com17\":\"20. 授权\",\"T4com6item3\":\"JAQ0050\",\"T3com19\":\"1. 适应性和变革管理\",\"T4com6item2\":\"JAQ0016\",\"T3Line8C\":\"0\",\"T3com10\":\"4. 沟通\",\"T3item13IF_M\":\"20.00\",\"T3com12\":\"6. 压力忍受-情绪韧性\",\"T3com11\":\"20. 授权\",\"T3com14\":\"15. 计划和组织\",\"T3Line23C\":\"0\",\"T3com13\":\"20. 授权\",\"T3com16\":\"8. 团队协作\",\"T3com15\":\"4. 沟通\",\"T1com11IF_L\":\"14.44\",\"T1com11IF_M\":\"14.44\",\"T1com11IF_H\":\"14.44\",\"T2com1\":\"8. 团队协作\",\"T2com2\":\"20. 授权\",\"T3Line6C\":\"0\",\"T2com9\":\"24. 组织敏锐度\",\"T2com7\":\"9. 同理心\",\"T2com8\":\"16. 创造性\",\"T2com5\":\"4. 沟通\",\"T3item7IF_M\":\"20.00\",\"T3Line7C\":\"0\",\"T2com6\":\"6. 压力忍受-情绪韧性\",\"T3item24IF_M\":\"16.00\",\"T2com3\":\"11. 客户导向(内部和外部)\",\"T2Com5I_M\":\"4.00\",\"T2com4\":\"23. 激励他人\",\"T3Line12C\":\"0\",\"T3Line24C\":\"0\",\"T1com4\":\"20. 授权\",\"T4com2item2\":\"JAQ0057\",\"T1com5\":\"4. 沟通\",\"T4com2item3\":\"JAQ0020\",\"T1com6\":\"6. 压力忍受-情绪韧性\",\"T1com7\":\"9. 同理心\",\"T4com2item1\":\"JAQ0045\",\"T1com8\":\"24. 组织敏锐度\",\"T1com9\":\"26. 正直、信任和公信力\",\"T2Com6I_M\":\"4.00\",\"T1com1\":\"8. 团队协作\",\"T1com2\":\"11. 客户导向(内部和外部)\",\"T1com3\":\"23. 激励他人\",\"T2Line9C\":\"0\",\"T1com7IF_H\":\"15.20\",\"T2com5I_H\":\"4.00\",\"T1com7IF_M\":\"15.20\",\"T3Line13C\":\"0\",\"T1com7IF_L\":\"15.20\",\"T3Line25C\":\"0\",\"T2com5I_L\":\"4.00\",\"T1com2IF_M\":\"16.80\",\"T1com2IF_L\":\"16.80\",\"T1com2IF_H\":\"16.80\",\"表4子集合\":\"3\",\"T2rank1\":\"1\",\"T3item4IF_M\":\"20.00\",\"T2rank3\":\"3\",\"T3com21\":\"26. 正直、信任和公信力\",\"T2rank2\":\"2\",\"T3com20\":\"20. 授权\",\"T2rank5\":\"5\",\"T3com23\":\"24. 组织敏锐度\",\"T2rank4\":\"4\",\"T3com22\":\"26. 正直、信任和公信力\",\"T2rank7\":\"7\",\"T3com25\":\"6. 压力忍受-情绪韧性\",\"T2rank6\":\"6\",\"T3com24\":\"23. 激励他人\",\"T2rank9\":\"9\",\"T3Line14C\":\"0\",\"T2rank8\":\"8\",\"T3item23IF_M\":\"16.00\",\"T3item25\":\"JAQ0016\",\"T3item24\":\"JAQ0015\",\"T3item23\":\"JAQ0014\",\"T1rank9\":\"9\",\"T3item22\":\"JAQ0090\",\"T3item21\":\"JAQ0095\",\"T3item20\":\"JAQ0129\",\"T1rank6\":\"6\",\"T1com3IF_M\":\"16.80\",\"T1rank5\":\"5\",\"T1com3IF_L\":\"16.80\",\"T1rank8\":\"8\",\"T1rank7\":\"7\",\"T1rank2\":\"2\",\"T1rank1\":\"1\",\"T1rank4\":\"4\",\"T1rank3\":\"3\",\"表1\":\"12\",\"表2\":\"12\",\"表3\":\"25\",\"表4\":\"8\",\"T1com3IF_H\":\"16.80\",\"T3Line15C\":\"0\",\"T4com1item3\":\"JAQ0042\",\"T3item8IF_M\":\"20.00\",\"T3item17IF_M\":\"20.00\",\"T4com7item3\":\"JAQ0100\",\"T3item19\":\"JAQ0128\",\"T3item18\":\"JAQ0006\",\"T4com7item1\":\"JAQ0044\",\"T3item12IF_M\":\"20.00\",\"T3item17\":\"JAQ0089\",\"T4com7item2\":\"JAQ0097\",\"T3item16\":\"JAQ0001\",\"T3item15\":\"JAQ0120\",\"T1com12IF_M\":\"14.40\",\"T3item14\":\"JAQ0002\",\"T3item13\":\"JAQ0076\",\"T3item12\":\"JAQ0114\",\"T3item11\":\"JAQ0105\",\"T3item10\":\"JAQ0102\",\"T3item1\":\"JAQ0008\",\"T1com12IF_H\":\"14.40\",\"T1com12IF_L\":\"14.40\",\"T2Com10I_M\":\"3.80\",\"T2com10I_H\":\"3.80\",\"T3Line16C\":\"0\",\"T2Com1I_M\":\"4.40\",\"T2com4I_H\":\"4.20\",\"T2com10I_L\":\"3.80\",\"T4com1item2\":\"JAQ0001\",\"T2com4I_L\":\"4.20\",\"T4com1item1\":\"JAQ0048\",\"T2Line4C\":\"0\",\"T3item5IF_M\":\"20.00\",\"T2com11I_H\":\"3.80\",\"T3Line1C\":\"1\",\"T3Line17C\":\"0\",\"T2Com2I_M\":\"4.40\",\"T2com11I_L\":\"3.80\",\"T2com9I_L\":\"4.00\",\"T2com9I_H\":\"4.00\",\"T2Line5C\":\"0\",\"T2Com7I_M\":\"4.00\",\"T2Line6C\":\"0\",\"T3Line18C\":\"0\",\"T2com12\":\"15. 计划和组织\",\"T2Line11C\":\"1\",\"T2com10\":\"1. 适应性和变革管理\",\"T2com11\":\"3. 主动性\",\"T4com5item3\":\"JAQ0034\",\"T4com5item1\":\"JAQ0102\",\"T4com5item2\":\"JAQ0120\",\"T4com3\":\"23. 激励他人\",\"T4com4\":\"20. 授权\",\"T4com1\":\"8. 团队协作\",\"T3item9IF_M\":\"20.00\",\"T3item22IF_M\":\"16.00\",\"T4com2\":\"11. 客户导向(内部和外部)\",\"T4com7\":\"9. 同理心\",\"T3item2IF_M\":\"20.00\",\"T4com8\":\"24. 组织敏锐度\",\"T4com5\":\"4. 沟通\",\"T2Com8I_M\":\"4.00\",\"T2Com11I_M\":\"3.80\",\"T4com6\":\"6. 压力忍受-情绪韧性\",\"T2com3I_H\":\"4.20\",\"T3rank22\":\"22\",\"T3rank21\":\"21\",\"T3rank20\":\"20\",\"T2Line7C\":\"0\",\"T3Line19C\":\"0\",\"T2com3I_L\":\"4.20\",\"T3rank25\":\"25\",\"T3rank24\":\"24\",\"T3rank23\":\"23\",\"T2Line10C\":\"0\",\"T1com6IF_M\":\"15.20\",\"T1com6IF_L\":\"15.20\",\"T3item18IF_M\":\"16.00\",\"T1com6IF_H\":\"15.20\",\"T3item11IF_M\":\"20.00\",\"T2Line8C\":\"0\",\"T2com8I_L\":\"4.00\",\"T1com9IF_M\":\"15.20\",\"T3rank1\":\"1\",\"T2com8I_H\":\"4.00\",\"T3rank2\":\"2\",\"T3item10IF_M\":\"20.00\",\"T3rank9\":\"9\",\"T3Line5C\":\"0\",\"T3rank7\":\"7\",\"T3rank8\":\"8\",\"T3rank5\":\"5\",\"T3rank6\":\"6\",\"T3rank3\":\"3\",\"T3rank4\":\"4\",\"T4rank7\":\"7\",\"T4rank6\":\"6\",\"T4rank5\":\"5\",\"T4rank4\":\"4\",\"T4com3item3\":\"JAQ0133\",\"T4com3item2\":\"JAQ0015\",\"T4com3item1\":\"JAQ0019\",\"T4rank8\":\"8\",\"T3item6IF_M\":\"20.00\",\"T4rank3\":\"3\",\"T4rank2\":\"2\",\"T4rank1\":\"1\",\"T3rank19\":\"19\",\"T2Line1C\":\"0\",\"T3rank18\":\"18\",\"T2Line12C\":\"1\",\"T3rank17\":\"17\",\"T3rank16\":\"16\",\"T2com12I_H\":\"3.80\",\"T3Line4C\":\"0\",\"T3item20IF_M\":\"16.00\",\"T2Com12I_M\":\"3.80\",\"T2Com3I_M\":\"4.20\",\"T3item14IF_M\":\"20.00\",\"T3rank11\":\"11\",\"T3rank10\":\"10\",\"T2com2I_H\":\"4.40\",\"T1com9IF_H\":\"15.20\",\"T2com12I_L\":\"3.80\",\"T3rank15\":\"15\",\"T3rank14\":\"14\",\"T2com2I_L\":\"4.40\",\"T3rank13\":\"13\",\"T1com9IF_L\":\"15.20\",\"T3rank12\":\"12\",\"T2rank10\":\"10\",\"T3item15IF_M\":\"20.00\",\"T2Line2C\":\"0\",\"T2rank12\":\"12\",\"T2rank11\":\"11\",\"T3Line3C\":\"0\",\"T1com10IF_M\":\"14.44\",\"T1com10IF_L\":\"14.44\",\"T2Com4I_M\":\"4.20\",\"T1com10IF_H\":\"14.44\",\"T3item25IF_M\":\"16.00\",\"T3item1IF_M\":\"20.00\",\"T3item21IF_M\":\"16.00\",\"T2com7I_L\":\"4.00\",\"T3com6\":\"9. 同理心\",\"T3com7\":\"11. 客户导向(内部和外部)\",\"T3Line20C\":\"0\",\"T2com7I_H\":\"4.00\",\"T3com8\":\"11. 客户导向(内部和外部)\",\"T3com9\":\"3. 主动性\",\"T3com2\":\"16. 创造性\",\"T3com3\":\"23. 激励他人\",\"T3com4\":\"24. 组织敏锐度\",\"T2Line3C\":\"0\",\"T3com5\":\"8. 团队协作\",\"T1rank12\":\"12\",\"T1rank11\":\"11\",\"T1rank10\":\"10\",\"T3Line2C\":\"0\",\"T1com5IF_H\":\"15.20\",\"T1com10\":\"1. 适应性和变革管理\",\"T1com11\":\"27. 行动果敢\",\"T2Com9I_M\":\"4.00\",\"T1com12\":\"16. 创造性\",\"T3item19IF_M\":\"16.00\",\"T1com5IF_M\":\"15.20\",\"T3com1\":\"13. 应用所习得的专业知识\",\"T4com4item1\":\"JAQ0105\",\"T1com5IF_L\":\"15.20\",\"T4com4item2\":\"JAQ0076\",\"T4com4item3\":\"JAQ0089\"}"; |
| | | |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | //json对象转Map |
| | |
| | | changeTable(document, textMap); |
| | | |
| | | //建立文件对象 |
| | | File file = new File("C:\\Users\\datou\\Desktop\\JAQ中文版1.docx"); |
| | | File file = new File("C:\\Users\\大头\\Desktop\\JAQ中文版1.docx"); |
| | | FileOutputStream out = new FileOutputStream(file); |
| | | document.write(out); |
| | | out.flush(); |