public static void main(String args[]) throws IOException {
String path="d://pdf//件数一覧表_帳票.xls";
File file = new File(path);
ReadExcelUtil readExcel = new ReadExcelUtil(file);
try {
readExcel.open();
} catch (IOException e) {
e.printStackTrace();
}
readExcel.setSheetNum(2); //再此修改需要读的sheet,从 0 开始的
int count = readExcel.getRowCount();
System.out.println("count>>>>>>"+count);
FileOutputStream fout = new FileOutputStream(path);
List<String> list = new ArrayList<String>();
for (int i = 1; i < count; i++) {
String[] rows = readExcel.readExcelLine(i);
System.out.println("rows de leng>>>"+rows.length);
for (int j = 0; j <rows.length; j++) {
//System.out.println(rows[j]);if((rows[j]).endsWith(".xls")){
//System.out.println(rows[j]);
String str=rows[j].replaceFirst("-", "_");
list.add(str);
System.out.println("str>>>"+str);
System.out.println("list>>>>"+list);
POIFSFileSystem fs = new POIFSFileSystem(
new FileInputStream(path));
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheet("担当機関別件数一覧表印刷");
HSSFRow row = sheet.getRow(i);
@SuppressWarnings("deprecation")
HSSFCell cell = row.getCell((short) j);
System.out.println(">>>"+cell);
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
cell.setCellValue(str);
//System.out.println("set后,writer前/////"+cell);
wb.write(fout);
//System.out.println("write后》》》////"+cell);
}
}
}
fout.close();}