当前位置: 首页 > 工具软件 > J-Excel > 使用案例 >

用J_Excel解析EXCEL表格的方法

盖斌
2023-12-01

git的地址:

https://github.com/hyberbin/J-Excel

代码:

	public static void main(String[] args) throws FileNotFoundException, IOException, JSONException {

		Workbook workbook = new HSSFWorkbook(
				new FileInputStream("F:\\coding\\git\\J-Excel\\src\\main\\resources\\xx - 副本.xls"));
		Sheet sheet = workbook.getSheet("aaa");
		ImportTableService tableService = new ImportTableService(sheet);
		tableService.setStartRow(1);
		tableService.doImport();
		List<ZxBusiTemplateVo> read = tableService.read(new String[] { "id", "customerId", "sheetNo", "productCode",
				"city", "marketingCenter", "area", "installedAddr", "cpeDeviceCode", "cpeType", "managerName",
				"managerPhone", "upBandwidth", "downBandwidth", "ipNum", "IP" }, ZxBusiTemplateVo.class);

		Sheet sheet2 = workbook.getSheet("bbb");
		ImportTableService tableService2 = new ImportTableService(sheet2);
		tableService2.setStartRow(1);
		tableService2.doImport();
		List<UserTemplateVO> read2 = tableService2.read(new String[] { "customerName", "customerId", "userId",
				"linkName", "linkPhone", "userIdNo", "account", "userName", "phone", "password" },
				UserTemplateVO.class);

 

 类似资料: