用J_Excel解析EXCEL表格的方法

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);

猜你喜欢

转载自blog.csdn.net/alyone_23/article/details/81209388