package com.geese.plugin.excelMapping.test;
import com.geese.plugin.excelMapping.StandardWriter;
import com.geese.plugin.excelMapping.config.Point;
import com.geese.plugin.excelMapping.config.Table;
import com.geese.plugin.excelMapping.filter.CellWriteFilter;
import com.geese.plugin.excelMapping.filter.RowWriteFilter;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.*;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
标准Excel写入接口测试
*
* @author zhangguangyong 1243610991@qq.com
* @date 2016/11/16 21:41
* @sine 0.0.1
*/
public class StandardWriterTest {
private static OutputStream output;
private static InputStream template;
@BeforeClass
public static void beforeClass() throws IOException {
// 输出
URL url = Thread.currentThread().getContextClassLoader().getResource("demo-writer.xlsx");
output = new FileOutputStream(url.getFile());
// 模板
url = Thread.currentThread().getContextClassLoader().getResource("demo-writer-template.xlsx");
template = new FileInputStream(url.getFile());
}
/**
* 实例1:快速上手
*/
@Test
public void test001() {
// 准备表格数据
List tableData = new ArrayList();
Map rowData;
for (int i = 0; i < 50; i++) {
rowData = new HashMap();
rowData.put("name", "隔壁老王" + i);
rowData.put("age", Double.valueOf((Math.random() * 100)).intValue());
rowData.put("idCard", Double.valueOf((Math.random() * 1000000000)).longValue());
rowData.put("qq", Double.valueOf((Math.random() * 100000000)).longValue());
rowData.put("email", Double.valueOf((Math.random() * 1000000)).longValue() + "@qq.com");</