Hi, with POI 2.5 final the following exception occurs: java.lang.RuntimeException: The class org.apache.poi.hssf.record.DrawingRecord needs to define a clone method at org.apache.poi.hssf.record.Record.clone(Record.java:194) at org.apache.poi.hssf.model.Sheet.cloneSheet(Sheet.java:301) at org.apache.poi.hssf.usermodel.HSSFSheet.cloneSheet (HSSFSheet.java:114) at org.apache.poi.hssf.usermodel.HSSFWorkbook.cloneSheet (HSSFWorkbook.java:339)
I had same error,when the cell has comment.
It seems that the problem arise only if the sheet has comments. See also Massimiliano
i get the same when the selected cell isn't A1 but another one (doesn't happen for all cells) to reproduce use my uploaded file in http://issues.apache.org/bugzilla/show_bug.cgi?id=27571
ah, i'm using 2.5.1-final
i checked out the cvs version and implemented clone in DrawingRecord: public Object clone() { DrawingRecord drawingRecord = new DrawingRecord(); drawingRecord.recordData = (byte[]) recordData.clone(); return drawingRecord; } I don't really know, what a DrawingRecord is, my excel file doesn't contain drawings (but i think it did once). but this works for me, and if i write it to a new file, this doesn't make things worse.
Created attachment 18892 [details] Fix as patch Here's the fix suggested in comment 5, as a patch against 3.0 alpha2.
Pivot Tables clone just fine until you add a cell to the Page area. Even after deleting the item from the Pivot Table, trying to clone the sheet fails with the same error.
*** This bug has been marked as a duplicate of 31795 ***