parent
							
								
									6e9dfc5544
								
							
						
					
					
						commit
						97fe299236
					
				@ -0,0 +1,49 @@
 | 
				
			||||
package com.platform.test;
 | 
				
			||||
 | 
				
			||||
import java.io.File;
 | 
				
			||||
import java.io.FileNotFoundException;
 | 
				
			||||
import java.io.FileOutputStream;
 | 
				
			||||
import java.io.IOException;
 | 
				
			||||
import java.util.ArrayList;
 | 
				
			||||
import java.util.List;
 | 
				
			||||
 | 
				
			||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 | 
				
			||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 | 
				
			||||
import org.junit.Test;
 | 
				
			||||
 | 
				
			||||
import com.base.Constant;
 | 
				
			||||
import com.platform.entities.PreDataInfo;
 | 
				
			||||
import com.platform.utils.excelUtils.ExcelOperation;
 | 
				
			||||
 | 
				
			||||
public class ExcelTest {
 | 
				
			||||
	
 | 
				
			||||
	@Test
 | 
				
			||||
	public void writeData() {
 | 
				
			||||
		PreDataInfo info = new PreDataInfo();
 | 
				
			||||
		info.setAnalysisOfFinancialEconomicProsperity("否");
 | 
				
			||||
		info.setAreaCode("321167");
 | 
				
			||||
		info.setBeginUseTime("201107");
 | 
				
			||||
		List<PreDataInfo> list = new ArrayList<PreDataInfo>();
 | 
				
			||||
		list.add(info);
 | 
				
			||||
		XSSFWorkbook result = null;
 | 
				
			||||
		try {
 | 
				
			||||
			result = ExcelOperation.readExcelTemplate(Constant.SYSTEM_INFO_EXCEL_TEMPLATE_FIEL_PATH, list);
 | 
				
			||||
		} catch (IllegalArgumentException
 | 
				
			||||
				| IllegalAccessException | IOException e) {
 | 
				
			||||
			// TODO Auto-generated catch block
 | 
				
			||||
			e.printStackTrace();
 | 
				
			||||
		}
 | 
				
			||||
		System.out.println("----"+result);
 | 
				
			||||
		
 | 
				
			||||
		try {
 | 
				
			||||
			FileOutputStream fileOut =new FileOutputStream(new File("D:/test/3.xlsx"));
 | 
				
			||||
			result.write(fileOut);
 | 
				
			||||
	        fileOut.close();
 | 
				
			||||
		} catch (IOException e) {
 | 
				
			||||
			// TODO Auto-generated catch block
 | 
				
			||||
			e.printStackTrace();
 | 
				
			||||
		}
 | 
				
			||||
		
 | 
				
			||||
	}
 | 
				
			||||
 | 
				
			||||
}
 | 
				
			||||
					Loading…
					
					
				
		Reference in new issue