poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 57231] New: clone worksheet throws exception: The class org.apache.poi.hssf.record.ArrayRecord needs to define a clone method
Date Mon, 17 Nov 2014 19:48:48 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=57231

            Bug ID: 57231
           Summary: clone worksheet throws exception: The class
                    org.apache.poi.hssf.record.ArrayRecord needs to define
                    a clone method
           Product: POI
           Version: 3.10-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
          Assignee: dev@poi.apache.org
          Reporter: anthony.ap@gmail.com

Created attachment 32210
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32210&action=edit
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) {

               }
           }
       }

    }

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message