// Path: src/test/java/t5750/poi/export/TestWriteExcelDemo.java
// public class TestWriteExcelDemo {
// 	public static final String EXCEL_NAME = "testExcelDemo";
// 
// 	public static void main(String[] args) {
// 		// Blank workbook
// 		XSSFWorkbook workbook = new XSSFWorkbook();
// 		// Create a blank sheet
// 		XSSFSheet sheet = workbook.createSheet("Employee Data");
// 		// This data needs to be written (Object[])
// 		Map<String, Object[]> data = new TreeMap<String, Object[]>();
// 		data.put("1", new Object[] { "ID", "NAME", "LASTNAME" });
// 		data.put("2", new Object[] { 1, "Amit", "Shukla" });
// 		data.put("3", new Object[] { 2, "Lokesh", "Gupta" });
// 		data.put("4", new Object[] { 3, "John", "Adwards" });
// 		data.put("5", new Object[] { 4, "Brian", "Schultz" });
// 		// Iterate over data and write to sheet
// 		Set<String> keyset = data.keySet();
// 		int rownum = 0;
// 		for (String key : keyset) {
// 			Row row = sheet.createRow(rownum++);
// 			Object[] objArr = data.get(key);
// 			int cellnum = 0;
// 			for (Object obj : objArr) {
// 				Cell cell = row.createCell(cellnum++);
// 				if (obj instanceof String)
// 					cell.setCellValue((String) obj);
// 				else if (obj instanceof Integer)
// 					cell.setCellValue((Integer) obj);
// 			}
// 		}
// 		try {
// 			// Write the workbook in file system
// 			FileOutputStream out = new FileOutputStream(new File(
// 					TestUtil.DOC_PATH + File.separator + EXCEL_NAME
// 							+ Globals.SUFFIX_XLSX));
// 			workbook.write(out);
// 			out.close();
// 			System.out.println(EXCEL_NAME + Globals.SUFFIX_XLSX
// 					+ TestUtil.SUCCESS);
// 		} catch (Exception e) {
// 			e.printStackTrace();
// 		}
// 	}
// }
// 
// Path: src/main/java/t5750/poi/util/Globals.java
// public class Globals {
// 	public static final String DOC = "doc";
// 	public static final String IMG = "img";
// 	public static final String DOC_PATH = ClassLoaderUtil.getClassPath()
// 			+ File.separator + DOC;
// 	public static final String IMG_PATH = ClassLoaderUtil.getClassPath()
// 			+ File.separator + IMG;
// 	public static final String SUFFIX_XLS = ".xls";
// 	public static final String SUFFIX_XLSX = ".xlsx";
// 	public static final String SUFFIX_PNG = ".png";
// 	public static final String EXPORT_STUDENT = "student"
// 			+ System.currentTimeMillis() + SUFFIX_XLS;
// 	public static final String EXPORT_BOOK = "book"
// 			+ System.currentTimeMillis() + SUFFIX_XLS;
// 	public static final String EXPORT_2007 = "export2007中文_"
// 			+ System.currentTimeMillis() + SUFFIX_XLSX;
// 	public static final String EXPORT_PRODUCT = "product"
// 			+ System.currentTimeMillis() + SUFFIX_XLS;
// 	public static final String SHEETNAME = "测试POI导出EXCEL文档";
// 
// 	public static String getBasePath(HttpServletRequest request) {
// 		String path = request.getContextPath();
// 		String basePath = request.getScheme() + "://" + request.getServerName()
// 				+ ":" + request.getServerPort() + path + "/";
// 		return basePath;
// 	}
// }
// 
// Path: src/test/java/t5750/poi/util/TestUtil.java
// public class TestUtil {
// 	/**
// 	 * poi\target\classes\doc
// 	 */
// 	public static final String DOC_PATH = Globals.DOC_PATH.replace(
// 			"test-classes", "classes");
// 	public static final String IMG_PATH = Globals.IMG_PATH.replace(
// 			"test-classes", "classes");
// 	public static final String SUCCESS = " written successfully...";
// 	public static final String RICH_TEXT_STRING = "o9qAGtxS7K25ItIvnNXd_xBcCe_0";
// 	public static final String REGEX = "_";
// 	public static final String[] RICH_TEXT_STRINGS = RICH_TEXT_STRING
// 			.split(REGEX);
// }


import java.io.File;
import java.io.FileInputStream;
import java.util.Iterator;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import t5750.poi.export.TestWriteExcelDemo;
import t5750.poi.util.Globals;
import t5750.poi.util.TestUtil;
package t5750.poi.read;




public class TestReadExcelDemo {
	public static void main(String[] args) {
		try {
			FileInputStream file = new FileInputStream(new File(
					TestUtil.DOC_PATH + File.separator
							+ TestWriteExcelDemo.EXCEL_NAME
							+ Globals.SUFFIX_XLSX));
			// Create Workbook instance holding reference to .xlsx file
			XSSFWorkbook workbook = new XSSFWorkbook(file);
			// Get first/desired sheet from the workbook
			XSSFSheet sheet = workbook.getSheetAt(0);
			// Iterate through each rows one by one
			Iterator<Row> rowIterator = sheet.iterator();
			while (rowIterator.hasNext()) {
				Row row = rowIterator.next();
				// For each row, iterate through all the columns
// Path: src/test/java/t5750/poi/export/TestWriteExcelDemo.java
// public class TestWriteExcelDemo {
// 	public static final String EXCEL_NAME = "testExcelDemo";
// 
// 	public static void main(String[] args) {
// 		// Blank workbook
// 		XSSFWorkbook workbook = new XSSFWorkbook();
// 		// Create a blank sheet
// 		XSSFSheet sheet = workbook.createSheet("Employee Data");
// 		// This data needs to be written (Object[])
// 		Map<String, Object[]> data = new TreeMap<String, Object[]>();
// 		data.put("1", new Object[] { "ID", "NAME", "LASTNAME" });
// 		data.put("2", new Object[] { 1, "Amit", "Shukla" });
// 		data.put("3", new Object[] { 2, "Lokesh", "Gupta" });
// 		data.put("4", new Object[] { 3, "John", "Adwards" });
// 		data.put("5", new Object[] { 4, "Brian", "Schultz" });
// 		// Iterate over data and write to sheet
// 		Set<String> keyset = data.keySet();
// 		int rownum = 0;
// 		for (String key : keyset) {
// 			Row row = sheet.createRow(rownum++);
// 			Object[] objArr = data.get(key);
// 			int cellnum = 0;
// 			for (Object obj : objArr) {
// 				Cell cell = row.createCell(cellnum++);
// 				if (obj instanceof String)
// 					cell.setCellValue((String) obj);
// 				else if (obj instanceof Integer)
// 					cell.setCellValue((Integer) obj);
// 			}
// 		}
// 		try {
// 			// Write the workbook in file system
// 			FileOutputStream out = new FileOutputStream(new File(
// 					TestUtil.DOC_PATH + File.separator + EXCEL_NAME
// 							+ Globals.SUFFIX_XLSX));
// 			workbook.write(out);
// 			out.close();
// 			System.out.println(EXCEL_NAME + Globals.SUFFIX_XLSX
// 					+ TestUtil.SUCCESS);
// 		} catch (Exception e) {
// 			e.printStackTrace();
// 		}
// 	}
// }
// 
// Path: src/main/java/t5750/poi/util/Globals.java
// public class Globals {
// 	public static final String DOC = "doc";
// 	public static final String IMG = "img";
// 	public static final String DOC_PATH = ClassLoaderUtil.getClassPath()
// 			+ File.separator + DOC;
// 	public static final String IMG_PATH = ClassLoaderUtil.getClassPath()
// 			+ File.separator + IMG;
// 	public static final String SUFFIX_XLS = ".xls";
// 	public static final String SUFFIX_XLSX = ".xlsx";
// 	public static final String SUFFIX_PNG = ".png";
// 	public static final String EXPORT_STUDENT = "student"
// 			+ System.currentTimeMillis() + SUFFIX_XLS;
// 	public static final String EXPORT_BOOK = "book"
// 			+ System.currentTimeMillis() + SUFFIX_XLS;
// 	public static final String EXPORT_2007 = "export2007中文_"
// 			+ System.currentTimeMillis() + SUFFIX_XLSX;
// 	public static final String EXPORT_PRODUCT = "product"
// 			+ System.currentTimeMillis() + SUFFIX_XLS;
// 	public static final String SHEETNAME = "测试POI导出EXCEL文档";
// 
// 	public static String getBasePath(HttpServletRequest request) {
// 		String path = request.getContextPath();
// 		String basePath = request.getScheme() + "://" + request.getServerName()
// 				+ ":" + request.getServerPort() + path + "/";
// 		return basePath;
// 	}
// }
// 
// Path: src/test/java/t5750/poi/util/TestUtil.java
// public class TestUtil {
// 	/**
// 	 * poi\target\classes\doc
// 	 */
// 	public static final String DOC_PATH = Globals.DOC_PATH.replace(
// 			"test-classes", "classes");
// 	public static final String IMG_PATH = Globals.IMG_PATH.replace(
// 			"test-classes", "classes");
// 	public static final String SUCCESS = " written successfully...";
// 	public static final String RICH_TEXT_STRING = "o9qAGtxS7K25ItIvnNXd_xBcCe_0";
// 	public static final String REGEX = "_";
// 	public static final String[] RICH_TEXT_STRINGS = RICH_TEXT_STRING
// 			.split(REGEX);
// }


// Path: src/test/java/t5750/poi/read/TestReadExcelDemo.java
import java.io.File;
import java.io.FileInputStream;
import java.util.Iterator;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import t5750.poi.export.TestWriteExcelDemo;
import t5750.poi.util.Globals;
import t5750.poi.util.TestUtil;

package t5750.poi.read;




public class TestReadExcelDemo {
	public static void main(String[] args) {
		try {
			FileInputStream file = new FileInputStream(new File(
					TestUtil.DOC_PATH + File.separator
							+ TestWriteExcelDemo.EXCEL_NAME
							+ Globals.SUFFIX_XLSX));
			// Create Workbook instance holding reference to .xlsx file
			XSSFWorkbook workbook = new XSSFWorkbook(file);
			// Get first/desired sheet from the workbook
			XSSFSheet sheet = workbook.getSheetAt(0);
			// Iterate through each rows one by one
			Iterator<Row> rowIterator = sheet.iterator();
			while (rowIterator.hasNext()) {
				Row row = rowIterator.next();
				// For each row, iterate through all the columns
				Iterator<Cell> cellIterator = row.cellIterator();