How about deleting all the other worksheets in the workbook and then saving the file under a different name? (Disclaimer: my experience with NPOI now totals 1 hour)
This still doesn't solve the problem if you want to put the sheet into an existing workbook.
I just spent a few minutes time digging through the source code, and it seems like this could be implemented.
Clearly, the logic is all there to clone a sheet, and in the HSSFWorkbook
class there is a private ArrayList
that holds all the HSSFSheet
s. Could it be so simple as to add this method to the HSSFWorkbook
class?
public void AddSheet(HSSFSheet sheet)
{
_sheets.Add(sheet);
}
There must be something huge I'm missing, because otherwise I would expect this to have been implemented long ago.
I might try this out next week and see what can be done. If anyone else has time to try it in the interim, by all means do.
There is a recent question (2 wks ago -- 2010.01.15) about the ability to do this on the NPOI discussions page, but there has been no response as of yet.