1金币
本帖最后由 Lynn.Dou 于 2024-1-24 17:46 编辑
产品:GcExcel
版本:v6.2.1
问题编号:DOCXLS-8901
LastReview:2023/12/12
该问题已经在V6.2.5版本修复。
public static void main(String[] args) {
String path1 = "L:\\test\\test.xlsx";
String path2 = "L:\\test\\货币资金.xlsx";
FileOutputStream fos = null;
try {
Workbook wk = new Workbook();
wk.open(path1);
IWorksheets iWorksheets = wk.getWorksheets();
int count = iWorksheets.getCount();
Workbook wk1 = new Workbook();
wk1.open(path2);
IWorksheets iWorksheets1 = wk1.getWorksheets();
IWorksheet copySheet = iWorksheets1.get(0).copyAfter(iWorksheets.get(count - 1));
copySheet.setName("copyName");
fos = new FileOutputStream(path1);
wk.save(fos);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (null != fos) {
try {
fos.close();
} catch (Exception var2) {
}
}
}
}
将文件【货币资金.xlsx】中的sheet复制到【test.xlsx】中,打开【test.xlsx】异常,怎么做才能不会出现这个异常
|
|