TRY IT ! 在已存在的A中创建A1
最小的代价修复这段代码?
还能调优这段代码嘛?
把你的答案发布在留言里
public class TRY_IT{
public static void main(String[] args) {
String readPath = "C:\\Users\\nixian\\Desktop\\A.xlsx";
try (FileOutputStream os = new FileOutputStream(readPath);Workbook workBook = new XSSFWorkbook(readPath);){
Sheet topPic = workBook.getSheet("A1");
if(null==topPic) {
topPic = workBook.createSheet("A1");
}
workBook.write(os);
} catch (Exception e) {
}
}
}