代码拉取完成,页面将自动刷新
提供一种以更简单的读取复杂excel的方法,开发者只需要提根据要读取的excel文件制作模板excel文件,调用ExcelReader.readExcel方法即可完成对跨行/跨列/动态表格/多行动态表格/嵌入式文本内容的读取,可以将几乎所有复杂格式的excel读取为map的形式返回给开发者. 因这段程序初版是在2010年编写的,所以读取部分依赖jxl只能读取.xls格式的文件,后续将支持xlsx的读取.
假如要读取一个如下图所示的excel:
public static void main(String[] args) throws Exception {
ExcelReader reader = new ExcelReader();
InputStream templateIns = Test.class.getResourceAsStream("test-template.xls");
InputStream dataIns = Test.class.getResourceAsStream("test-data.xls");
Map<String, Object> dataMap = reader.readExcel(templateIns, dataIns);
JSONObject json = JSONObject.fromObject(dataMap);
System.out.println(json.toString());
templateIns.close();
dataIns.close();
}
3.完成读取
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。