Bug 57231 - clone worksheet throws exception: The class org.apache.poi.hssf.record.ArrayRecord needs to define a clone method
Summary: clone worksheet throws exception: The class org.apache.poi.hssf.record.ArrayR...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.10-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-17 19:48 UTC by Anthony
Modified: 2014-12-22 08:21 UTC (History)
0 users



Attachments
workbook containing hidden MASTER sheet, that I am trying to clone. (354.78 KB, application/zip)
2014-11-17 19:48 UTC, Anthony
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony 2014-11-17 19:48:48 UTC
Created attachment 32210 [details]
workbook containing hidden MASTER sheet, that I am trying to clone.

public void addNewWorksheet4() {
		
	   FileInputStream fileIn   = null;
       FileOutputStream fileOut = null;
       int idx;
       int foundIdx;
       
       try
       {    	   
           fileIn = new FileInputStream(Environment.getExternalStorageDirectory()+File.separator + "uesystems/leakmgr/MixedGasReport.xls");
           POIFSFileSystem fs = new POIFSFileSystem(fileIn);
           HSSFWorkbook wb    = new HSSFWorkbook(fs);
           HSSFSheet sheet    = null;
           
           foundIdx = locateWorkSheetByName(wb, "master");
           
       	   HSSFSheet newSheet = wb.cloneSheet(foundIdx);
		   idx = wb.getSheetIndex(newSheet);
		   wb.setSheetName(idx, "newName");
           
           // Write the output to a file
           fileOut = new FileOutputStream(Environment.getExternalStorageDirectory()+File.separator + "uesystems/leakmgr/MixedGasReport2.xls");
           wb.write(fileOut);
       } 
       catch(FileNotFoundException ex) {
    	   Log.v(TAG, "FileNotFoundException: " + ex.toString());
       }
       catch(IOException ex) {
    	   Log.v(TAG, "IOException: " + ex.toString());
       }
       catch(Exception ex) {
    	   Log.v(TAG, "Exception: " + ex.toString());
       }
       finally {
           if (fileOut != null)  {
        	   try {
                   fileOut.close();
        	   }
        	   catch(Exception ex) {
        		   
        	   }
           }
           if (fileIn != null) {
	    	   try {
	               fileIn.close();
	    	   }
	    	   catch(Exception ex) {
	    		   
	    	   }
           }
       }
       		
	}
Comment 1 Anthony 2014-11-17 19:50:35 UTC
I am not sure how to add a clone method to ArrayRecord object.
Thank you in advance for your help.
Comment 2 Dominik Stadler 2014-12-22 08:21:13 UTC
Fixed via r1647255, should be available in the next nightly build.