package base;

import com.github.ExcelUtils;
import moudles.Student1;
import moudles.Student2;
import org.junit.Test;

import java.util.List;

public class Excel2Module {

    @Test
    public void excel2Object() throws Exception {
    	
        String path = "/Users/cloume/Excel4J/src/test/resource/students_01.xlsx";

        System.out.println("读取全部：");
        List<Student1> students = ExcelUtils.getInstance().readExcel2Objects(path, Student1.class);
        for (Student1 stu : students) {
            System.out.println(stu);
        }

        System.out.println("读取指定行数：");
        students = ExcelUtils.getInstance().readExcel2Objects(path, Student1.class, 0, 3, 0);
        for (Student1 stu : students) {
            System.out.println(stu);
        }
    }

    @Test
    public void excel2Object2() throws Exception {
        
        String path = "/Users/cloume/Excel4J/src/test/resource/students_02.xlsx";

        // 不基于注解,将Excel内容读至List<List<String>>对象内
        List<List<String>> lists = ExcelUtils.getInstance().readExcel2List(path, 1, 3, 0);
        System.out.println("读取Excel至String数组：");
        for (List<String> list : lists) {
            System.out.println(list);
        }
        // 基于注解,将Excel内容读至List<Student2>对象内
        List<Student2> students = ExcelUtils.getInstance().readExcel2Objects(path, Student2.class, 0);
        System.out.println("读取Excel至对象数组(支持类型转换)：");
        for (Student2 st : students) {
            System.out.println(st);
        }
    }
}

@@ -38,16 +38,59 @@
 lUtils;%0A
+import com.github.utils.IStringConverter;%0A%0A
 import m
@@ -1532,10 +1532,895 @@
 %7D%0A    %7D%0A
+    %0A    public class StringConverter implements IStringConverter %7B%0A%0A%09%09@Override%0A%09%09public Object convert(String field, String value) %7B%0A%09%09%09System.out.println(field + %22: %22 + value);%0A%09%09%09return %22test%22;%0A%09%09%7D%0A    %09%0A    %7D%0A    %0A    @Test%0A    public void excel2Object3() throws Exception %7B%0A    %09%0A        String path = %22/Users/cloume/Excel4J/src/test/resource/students_01.xlsx%22;%0A%0A        System.out.println(%22%E8%AF%BB%E5%8F%96%E5%85%A8%E9%83%A8%EF%BC%9A%22);%0A        List%3CStudent1%3E students = ExcelUtils.getInstance().readExcel2Objects(path, Student1.class);%0A        for (Student1 stu : students) %7B%0A            System.out.println(stu);%0A        %7D%0A%0A        System.out.println(%22%E8%AF%BB%E5%8F%96%E6%8C%87%E5%AE%9A%E8%A1%8C%E6%95%B0%EF%BC%9A%22);%0A        //%E4%BD%BF%E7%94%A8IStringConverter%E6%8E%A5%E5%8F%A3%E5%AE%9E%E7%8E%B0%E8%87%AA%E5%AE%9A%E4%B9%89%E6%95%B0%E6%8D%AE%E7%B1%BB%E5%9E%8B%E8%BD%AC%E6%8D%A2%0A        students = ExcelUtils.getInstance().readExcel2Objects(path, Student1.class, 0, 3, 0, new StringConverter());%0A        for (Student1 stu : students) %7B%0A            System.out.println(stu);%0A        %7D%0A    %7D%0A
 %7D%0A

add test case for IStringConverter.