| | |
| | | DataValidationConstraint dvConstraintStatus = dvHelper.createFormulaListConstraint("状态详细信息!$A$1:$A$" + statuses.length); |
| | | DataValidationConstraint dvConstraintStatus1 = dvHelper.createFormulaListConstraint("优先度详细信息!$A$1:$A$" + priorities.length); |
| | | CellRangeAddressList addressListUser = new CellRangeAddressList(1, 100, 4, 4); // 所属员工列 |
| | | CellRangeAddressList addressListStatus = new CellRangeAddressList(1, 100, 6, 6); // 任务状态列 |
| | | CellRangeAddressList addressListStatus1 = new CellRangeAddressList(1, 100, 8, 8); // 优先度状态列 |
| | | CellRangeAddressList addressListStatus = new CellRangeAddressList(1, 100, 5, 5); // 任务状态列 |
| | | CellRangeAddressList addressListStatus1 = new CellRangeAddressList(1, 100, 6, 6); // 优先度状态列 |
| | | DataValidation validationUser = dvHelper.createValidation(dvConstraintUser, addressListUser); |
| | | DataValidation validationStatus = dvHelper.createValidation(dvConstraintStatus, addressListStatus); |
| | | DataValidation validationStatus1 = dvHelper.createValidation(dvConstraintStatus1, addressListStatus1); |
| | |
| | | headerRow1.createCell(2).setCellValue("任务结束时间"); |
| | | headerRow1.createCell(3).setCellValue("任务工时"); |
| | | headerRow1.createCell(4).setCellValue("所属员工"); |
| | | headerRow1.createCell(5).setCellValue("所属员工ID"); |
| | | headerRow1.createCell(6).setCellValue("任务状态"); |
| | | headerRow1.createCell(7).setCellValue("任务状态ID"); |
| | | // headerRow1.createCell(8).setCellValue("消耗工时"); |
| | | headerRow1.createCell(8).setCellValue("优先度"); |
| | | headerRow1.createCell(9).setCellValue("优先度ID"); |
| | | // headerRow1.createCell(5).setCellValue("所属员工ID"); |
| | | headerRow1.createCell(5).setCellValue("任务状态"); |
| | | // headerRow1.createCell(7).setCellValue("任务状态ID"); |
| | | headerRow1.createCell(6).setCellValue("优先度"); |
| | | // headerRow1.createCell(9).setCellValue("优先度ID"); |
| | | headerRow1.createCell(7).setCellValue("隔绝列1"); |
| | | headerRow1.createCell(8).setCellValue("隔绝列2"); |
| | | headerRow1.createCell(9).setCellValue("隔绝列3"); |
| | | headerRow1.createCell(10).setCellValue("隔绝列4"); |
| | | headerRow1.createCell(11).setCellValue("隔绝列5"); |
| | | headerRow1.createCell(12).setCellValue("隔绝列6"); |
| | | headerRow1.createCell(13).setCellValue("隔绝列7"); |
| | | headerRow1.createCell(14).setCellValue("隔绝列8"); |
| | | headerRow1.createCell(15).setCellValue("所属员工ID"); |
| | | headerRow1.createCell(16).setCellValue("任务状态ID"); |
| | | headerRow1.createCell(17).setCellValue("优先度ID"); |
| | | |
| | | |
| | | // 使用VLOOKUP函数来显示对应的ID |
| | | for (int i = 1; i <= 100; i++) { |
| | | Row row = mainSheet.createRow(i); |
| | | Cell cellUser = row.createCell(5); |
| | | Cell cellUser = row.createCell(15); |
| | | cellUser.setCellFormula("VLOOKUP(E" + (i + 1) + ", '员工详细信息'!$A$1:$B$" + userList.size() + ", 2, FALSE)"); |
| | | Cell cellStatus = row.createCell(7); |
| | | cellStatus.setCellFormula("VLOOKUP(G" + (i + 1) + ", '状态详细信息'!$A$1:$B$" + statuses.length + ", 2, FALSE)"); |
| | | Cell cellYstatus = row.createCell(9); |
| | | cellYstatus.setCellFormula("VLOOKUP(I" + (i + 1) + ", '优先度详细信息'!$A$1:$B$" + priorities.length + ", 2, FALSE)"); |
| | | Cell cellStatus = row.createCell(16); |
| | | cellStatus.setCellFormula("VLOOKUP(F" + (i + 1) + ", '状态详细信息'!$A$1:$B$" + statuses.length + ", 2, FALSE)"); |
| | | Cell cellYstatus = row.createCell(17); |
| | | cellYstatus.setCellFormula("VLOOKUP(G" + (i + 1) + ", '优先度详细信息'!$A$1:$B$" + priorities.length + ", 2, FALSE)"); |
| | | } |
| | | |
| | | mainSheet.setColumnWidth(5, 0); |
| | | mainSheet.setColumnWidth(7, 0); |
| | | mainSheet.setColumnWidth(8, 0); |
| | | mainSheet.setColumnWidth(9, 0); |
| | | mainSheet.setColumnWidth(10, 0); |
| | | mainSheet.setColumnWidth(11, 0); |
| | | mainSheet.setColumnWidth(12, 0); |
| | | mainSheet.setColumnWidth(13, 0); |
| | | mainSheet.setColumnWidth(14, 0); |
| | | mainSheet.setColumnWidth(15, 0); |
| | | mainSheet.setColumnWidth(16, 0); |
| | | mainSheet.setColumnWidth(17, 0); |
| | | |
| | | // response.setHeader("Content-Disposition", "attachment;filename=测试.xlsx"); |
| | | // response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.mainSheet;charset=utf-8"); |