package org.onetwo.ext.poi.excel.reader;
/**
 * @author weishao zeng
 * <br/>
 */

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.junit.Test;

import com.monitorjbl.xlsx.StreamingReader;

public class StreamingReaderTest {
	
	@Test
	public void test() throws Exception {
		InputStream is = new FileInputStream(new File("F:\\资料\\广州烟商\\2月度销售统计表导入模版.xlsx"));
		Workbook workbook = StreamingReader.builder()
		        .rowCacheSize(100)    // number of rows to keep in memory (defaults to 10)
		        .bufferSize(4096)     // buffer size to use when reading InputStream to file (defaults to 1024)
		        .open(is); 
		for (Sheet sheet : workbook){
			System.out.println(sheet.getSheetName());
			for (Row r : sheet) {
				for (Cell c : r) {
					System.out.println(c.getStringCellValue());
			    }
			}
		}
	}

}

@@ -348,16 +348,60 @@
 it.Test;
+%0Aimport org.onetwo.ext.poi.utils.ExcelUtils;
 %0A%0Aimport
@@ -500,16 +500,22 @@
 oid test
+Stream
 () throw
@@ -581,39 +581,665 @@
 le(%22
-F:%5C%5C%E8%B5%84%E6%96%99%5C%5C%E5%B9%BF%E5%B7%9E%E7%83%9F%E5%95%86%5C%5C2%E6%9C%88%E5%BA%A6%E9%94%80%E5%94%AE%E7%BB%9F%E8%AE%A1%E8%A1%A8%E5%AF%BC%E5%85%A5%E6%A8%A1%E7%89%88.xlsx
+/Users/way/mydev/java/cloud-micro/odysseus/bff-tobacco/doc/%E9%9C%80%E6%B1%82%E6%96%87%E6%A1%A3/%E6%99%BA%E8%83%BD%E6%B4%BE%E5%8D%95/%E7%95%AA%E7%A6%BA-%E5%B7%A5%E4%BD%9C%E6%97%A5%E5%8E%8620201230(1).xls%22));%0A%09%09WorkbookReaderFactory.streamReader().readSheet(0).to(1)%0A%09%09%09%09.row(1).toEnd().onData((dataModel, row, index) -%3E %7B%0A%09%09%09%09%09Cell cell = row.getCell(0);%0A%09%09%09%09%09ExcelUtils.setCellTypeAsString(cell);%0A%09%09%09%09%09short dfs = cell.getCellStyle().getDataFormat();%0A%09%09%09%09%09System.out.println(%22rwo%5B%22+index+%22%5D: %22 + dfs + %22, %22+cell.getStringCellValue());%0A%09%09%09%09%7D)%0A%09%09%09.endSheet()%0A%09%09%09.from(is, null);%0A%09%7D%0A%09%0A%09@Test%0A%09public void test() throws Exception %7B%0A%09%09InputStream is = new FileInputStream(new File(%22/Users/way/mydev/java/cloud-micro/odysseus/bff-tobacco/doc/%E9%9C%80%E6%B1%82%E6%96%87%E6%A1%A3/%E6%99%BA%E8%83%BD%E6%B4%BE%E5%8D%95/%E7%95%AA%E7%A6%BA-%E5%B7%A5%E4%BD%9C%E6%97%A5%E5%8E%8620201230(1).xls
 %22));

fix test