日期:2014-05-18  浏览次数:20672 次

JXL合并SHEET页!
比如现在有3个XLS, a.xls,b.xls,c.xls 每个XLS里面都只有1个SHEET页,sheeta,sheetb,sheetc

请问如何把这3个sheet页,合并到d.xls中不同的sheet页。结果就是d.xls中有3个sheet页。分别是sheeta,sheetb,sheetc.

高分请教,在线等答案。。。

------解决方案--------------------
a.xls.b.xls.c.xls都是有格式的?什么意思?是不是说每个sheet里的字段都不一样?
那也没问题,用三个的不同的类分别封装三个sheet啊!

至于有没有copy或clone的方法...不太清楚哦!
------解决方案--------------------
看看这两个方法
importSheet
public abstract WritableSheet importSheet(java.lang.String name,
int index,
Sheet s)Imports a sheet from a different workbook. Does a deep copy on all elements within that sheet 

Parameters:
name - the name of the new sheet
index - the position for the new sheet within this workbook
sheet - the sheet (from another workbook) to merge into this one 
Returns:
the new sheet

--------------------------------------------

copySheet
public abstract void copySheet(int s,
java.lang.String name,
int index)Copy sheet within the same workbook. The sheet specified is copied to the new sheet name at the position 

Parameters:
s - the index of the sheet to copy
name - the name of the new sheet
index - the position of the new sheet

--------------------------------------------

copySheet
public abstract void copySheet(java.lang.String s,
java.lang.String name,
int index)Copies the specified sheet and places it at the index specified by the parameter 

Parameters:
s - the name of the sheet to copy
name - the name of the new sheet
index - the position of the new sheet