forked from liweijie/education
排课窗口单元格单击双选问题修复
This commit is contained in:
+38
-11
@@ -117,32 +117,59 @@ public class TeachingPlanServiceImpl implements TeachingPlanService {
|
||||
"责任单位", "授课教员", "教学场地", "教学内容", "教学方法",
|
||||
"教员备注", "教务备注", "检查结果", "课程表编号"
|
||||
};
|
||||
String[] example = {
|
||||
"1", "2026", "", "2026-03-02 08:00:00", "", "1", "高等数学", "1班",
|
||||
"基础教研室", "张三", "教学楼A-101", "函数与极限", "讲授",
|
||||
"", "", "", ""
|
||||
String[][] examples = {
|
||||
{"1", "2026", "", "2026-03-02 08:00:00", "", "1", "高等数学(测试)", "1班",
|
||||
"基础教研室", "张三", "教学楼A-101", "函数与极限", "讲授",
|
||||
"导入测试样例1", "", "通过", ""},
|
||||
{"2", "2026", "", "2026-03-02 10:00:00", "", "3", "大学物理(测试)", "2班",
|
||||
"物理教研室", "李四", "实验楼B-203", "牛顿定律", "实验",
|
||||
"导入测试样例2", "", "", ""},
|
||||
{"3", "2026", "", "2026-03-03 14:00:00", "", "5", "军事理论(测试)", "3班",
|
||||
"指挥教研室", "王五", "阶梯教室C-1", "战役概论", "研讨",
|
||||
"导入测试样例3", "联教联训", "", ""}
|
||||
};
|
||||
try (Workbook wb = new XSSFWorkbook(); ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
|
||||
org.apache.poi.ss.usermodel.Font headerFont = wb.createFont();
|
||||
headerFont.setFontName("宋体");
|
||||
headerFont.setBold(true);
|
||||
headerFont.setFontHeightInPoints((short) 11);
|
||||
org.apache.poi.ss.usermodel.CellStyle headerStyle = wb.createCellStyle();
|
||||
headerStyle.setFont(headerFont);
|
||||
org.apache.poi.ss.usermodel.Font dataFont = wb.createFont();
|
||||
dataFont.setFontName("宋体");
|
||||
dataFont.setFontHeightInPoints((short) 11);
|
||||
org.apache.poi.ss.usermodel.CellStyle dataStyle = wb.createCellStyle();
|
||||
dataStyle.setFont(dataFont);
|
||||
|
||||
Sheet sheet = wb.createSheet("教学实施计划");
|
||||
Row header = sheet.createRow(0);
|
||||
for (int i = 0; i < headers.length; i++) {
|
||||
header.createCell(i).setCellValue(headers[i]);
|
||||
sheet.setColumnWidth(i, 14 * 256);
|
||||
org.apache.poi.ss.usermodel.Cell cell = header.createCell(i);
|
||||
cell.setCellValue(headers[i]);
|
||||
cell.setCellStyle(headerStyle);
|
||||
sheet.setColumnWidth(i, 16 * 256);
|
||||
}
|
||||
Row row = sheet.createRow(1);
|
||||
for (int i = 0; i < example.length; i++) {
|
||||
row.createCell(i).setCellValue(example[i]);
|
||||
for (int r = 0; r < examples.length; r++) {
|
||||
Row row = sheet.createRow(r + 1);
|
||||
for (int i = 0; i < examples[r].length; i++) {
|
||||
org.apache.poi.ss.usermodel.Cell cell = row.createCell(i);
|
||||
cell.setCellValue(examples[r][i]);
|
||||
cell.setCellStyle(dataStyle);
|
||||
}
|
||||
}
|
||||
Sheet help = wb.createSheet("填写说明");
|
||||
String[] notes = {
|
||||
"1. 数据从第2行开始填写,第1行表头请勿修改,列顺序固定不可调整。",
|
||||
"2. 「课程名称」必填,课程名称为空的行将被跳过;其余列可留空。",
|
||||
"3. 「序号」「年度」「节次」为整数;「日期」支持 yyyy-MM-dd 或 yyyy-MM-dd HH:mm:ss。",
|
||||
"4. 第2行为示例数据,导入前请删除。",
|
||||
"4. 第2至4行为测试样例,可直接导入验证。",
|
||||
"5. 标识号、登录编号由系统自动生成,无需填写。"
|
||||
};
|
||||
for (int i = 0; i < notes.length; i++) {
|
||||
help.createRow(i).createCell(0).setCellValue(notes[i]);
|
||||
org.apache.poi.ss.usermodel.Row noteRow = help.createRow(i);
|
||||
org.apache.poi.ss.usermodel.Cell noteCell = noteRow.createCell(0);
|
||||
noteCell.setCellValue(notes[i]);
|
||||
noteCell.setCellStyle(dataStyle);
|
||||
}
|
||||
help.setColumnWidth(0, 100 * 256);
|
||||
wb.write(bos);
|
||||
|
||||
Reference in New Issue
Block a user