https://e7du.github.io/jfinal-ext3/
官方源码调用XlsReadRule,maven包但是没有这个类,是打包失败?我应该怎么使用呢?
void readXls() { XlsReadRule xlsReadRule = new XlsReadRule(); xlsReadRule.setStart(1); xlsReadRule.setEnd(6); xlsReadRule.setClazz(User.class); Column id = Column.create("id"); Column name = Column.create("name"); Column addr = Column.create("addr"); xlsReadRule.alignColumn(id, name, addr); String destFileName = "src/test/resources/users.xls"; List<User> ret = XlsReader.readToModel(User.class, new File(destFileName), xlsReadRule); User u = ret.get(0); String json = JsonKit.toJson(ret); System.out.println(json + "id=" + u.getId() + ";name=" + u.getName() + ";addr=" + u.getAddr()); } void writeXls() { List<User> users = new ArrayList<User>(); for (int i = 0; i < 5; i++) { User u = new User(); u.setId(i); u.setName("name"+i); u.setAddr("addr"+i); users.add(u); } //XlsWriter.data(users).headerRow(1).header("Id","Name", "Addr").column("id","name", "addr").writeToFile("src/test/resources/users.xls"); Column id = Column.header("编号", "id"); Column name = Column.header("姓名", "name"); Column addr = Column.header("地址", "addr"); XlsWriter.data(users).columns(id, name, addr).writeToFile("src/test/resources/users.xls"); }
项目:jfinal-ext3