首页 > 代码库 > java工具类-excel jxl

java工具类-excel jxl

jxl-2.6.9.14.jar
import net.sf.jxls.transformer.XLSTransformer;//jxls-core-1.0.2.jar
import java.io.File;
 public File inputFile;
     Workbook workbook = WorkbookFactory.create(inputFile);
    Sheet sheet0 = workbook.getSheetAt(0);
    
    int rowNum = sheet0.getLastRowNum() + 1;
    for (int i = 1; i < rowNum; i++) {
     Row row = sheet0.getRow(i);
     Cell cell = row.createCell(lastCell);
     cell.setCellValue("");
    }
    File outputFile = new File("");
    FileOutputStream fo = new FileOutputStream(outputFile);
    workbook.write(fo);
    fo.close();
    
    
     XLSTransformer former = new XLSTransformer();
     Map beanParams = new HashMap();
     former.transformXLS(templatePath + exportTemplate, beanParams, outputPath + exportTemplate);