Bug 57770 - cloneSheet(...) takes forever
Summary: cloneSheet(...) takes forever
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.12-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2015-03-27 17:51 UTC by Michael
Modified: 2015-03-31 14:08 UTC (History)
0 users

Java code (1.44 KB, text/plain)
2015-03-27 17:51 UTC, Michael
Test Excel file (9.52 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2015-03-31 13:53 UTC, Michael

Note You need to log in before you can comment on or make changes to this bug.
Description Michael 2015-03-27 17:51:09 UTC
Created attachment 32617 [details]
Java code

The method cloneSheet(...) of the class XSSFWorkbook takes forever...
Comment 1 Nick Burch 2015-03-30 14:40:27 UTC
Is this for all sheets, or just certain ones? And if it's just certain ones, what kinds of things on the sheet make it slow?

Additionally, can you try using a profiler to see where the time is going?
Comment 2 Michael 2015-03-31 13:53:39 UTC
Created attachment 32626 [details]
Test Excel file
Comment 3 Michael 2015-03-31 13:57:35 UTC
I attached the file I was trying to copy. It has just one small sheet with different styling.

When I run my program (trying to copy sheet from one workbook to another), I shut down java process after about 20 minutes of visible inactivity. Few minutes later I had to cold restart my computer because the entire RAM (16Gb) was in use and computer was just "frosen".

Hope this will help.
Comment 4 Nick Burch 2015-03-31 14:01:13 UTC
Your attached code will never work. Your problem is you keep cloning a sheet onto the end of a workbook, then keep looping until you have seen all sheets which you neever will as you keep adding new ones

Additionally, you cannot clone a sheet onto another workbook, which is what I think you're trying to do.
Comment 5 Michael 2015-03-31 14:04:17 UTC
Is any convenient way to copy a sheet from one workbook to another? Or I have to do it manually, row-by-row, ...?
Comment 6 Nick Burch 2015-03-31 14:08:40 UTC
Please ask use questions on the user list - http://poi.apache.org/mailinglists.html