Example.java 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package pub.vie.excel.example;
  2. import pub.vie.excel.example.entity.studentInfo;
  3. import pub.vie.excel.example.entity.studentInfo2;
  4. import pub.vie.excel.read.ExcelReader;
  5. import java.util.List;
  6. /**
  7. * @Descrption :
  8. * @Author: zoujie
  9. * @Date: 2020-4-15
  10. */
  11. public class Example {
  12. public static final String virtualPath = "students.xlsx";
  13. public static void main(String[] args) {
  14. Example example = new Example();
  15. example.testReadWithAnnotation();
  16. }
  17. public void testRead() {
  18. ExcelReader<studentInfo> reader = new ExcelReader<>();
  19. List<studentInfo> read = reader.read(ExcelReader.getStreamOnClassPath(virtualPath),1, studentInfo.class);
  20. if (read != null) {
  21. System.out.println(read.size());
  22. }
  23. }
  24. public void testReadWithAnnotation() {
  25. ExcelReader<studentInfo2> reader = new ExcelReader<>();
  26. List<studentInfo2> read = reader.read(studentInfo2.class);
  27. if (read != null) {
  28. System.out.println(read.size());
  29. }
  30. }
  31. }