Excel处理工具类
需要poi.jar包的支持package com.mypack.core.utils;import org.apache.poi.hssf.usermodel.HSSFCell;import org.apache.poi.hssf.usermodel.HSSFRichTextString;import org.apache.poi.hssf.usermodel.HSSFRow;import org.apache.poi.hssf.usermodel.HSSFSheet;import org.apache.poi.hssf.usermodel.HSSFWorkbook;public class ExcelUtils {public static HSSFWorkbook workbook;public static HSSFSheet sheet;/** * * <li>创建Excel工作薄</li> * * @param sheetName * @return */public static HSSFSheet createSheet(String sheetName) {workbook = new HSSFWorkbook();sheet = workbook.createSheet(sheetName);return sheet;}/** * * <li>填充表单内容</li> * * @param titles * @param sheetName * @param rowIndex */public static void fillSheetContent(String[] titles, int rowIndex) {HSSFRow row = sheet.createRow((short) rowIndex);if (titles != null) {for (int i = 0; i < titles.length; i++) {HSSFCell cell = row.createCell((short) i);cell.setCellValue(new HSSFRichTextString(titles[i]));}}}}