填充模板代码
//设置下拉框模型String[] spinnerData1 = new String[]{"string", "number", "integer", "object", "array", "boolean"};String[] spinnerData2 = new String[]{"string", "number", "integer", "object", "array", "boolean"};SpinnerModel spinnerModel1 = new SpinnerModel();spinnerModel1.setSpinnerData(spinnerData1);spinnerModel1.setStartRowIndex(35);spinnerModel1.setEndRowIndex(35 + inputParameterList.size()-1);spinnerModel1.setStartColumnIndex(3);spinnerModel1.setEndColumnIndex(3);SpinnerModel spinnerModel2 = new SpinnerModel();spinnerModel2.setSpinnerData(spinnerData2);spinnerModel2.setStartRowIndex(35 + inputParameterList.size() + 1);spinnerModel2.setEndRowIndex(35 + inputParameterList.size() + 1 + outputParameterList.size()-1);spinnerModel2.setStartColumnIndex(3);spinnerModel2.setEndColumnIndex(3);List spinnerList = new ArrayList<>();spinnerList.add(spinnerModel1);spinnerList.add(spinnerModel2);//写入模板excelWriter = EasyExcel.write(newPath).excelType(ExcelTypeEnum.XLS).withTemplate(templatePath).registerWriteHandler(new CustomSpinnerHandler(spinnerList)).build();WriteSheet writeSheet = EasyExcel.writerSheet().build();//每写一行自动添加一行新空行FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();//写列表excelWriter.fill(new FillWrapper("a", inputParameterList), fillConfig, writeSheet);excelWriter.fill(new FillWrapper("b", outputParameterList), fillConfig, writeSheet);//写其他信息excelWriter.fill(baseServiceData, fillConfig, writeSheet);excelWriter.close();
需要注意的是如果模板中存在多个列表,需要加前缀区分
如果新模板中有下拉选项填充,则需要去掉告警的勾选
以上仅作为个人工作学习记录,如有不妥敬请指正 。
- neo4j 常用功能和语句整理
- 图片的预加载和懒加载
- 秋分的风俗活动和寓意 秋分节气传统习俗有哪些
- chatgpt赋能python:Python绝对值求和:如何用Python求一个
- Object js对象常用方法(Api)
- 傻瓜式教程--基于FPGA的CYUSB3014双向通信
- Keras学习:06.LSTM和双向LSTM讲解及实践
- 如何优雅的拟合非线性曲线
- 前鼻音和后鼻音有哪些
- 全额事业单位和差额有什么区别