Free Support Forum - aspose.com

Unable to move a worksheet

One more for the guys when they get back next week... I can't seem to get a worksheet to move. There are no errors, but the sheets are not moved when I save and reopen the file. I am using version 1.7.3. I do a variety of types of Imports/Exports, so I'm hitting a lot of different part of Cells.

    public static void testMove(  ) {
    // Create the Excel workbook
    Workbook wkb = new Workbook();        

    Worksheet wks = wkb.getWorksheets().getSheet(0);
    Worksheets sheets = wkb.getWorksheets();
    wks.getCells().getCell(0, 0).setValue( "CELL A1" );

    // new sheet
    wks = sheets.addSheet("NEW SHEET");
    wks.getCells().getCell(0, 0).setValue( "new Data" );
    
    <B>// PROBLEM: the sheet does not stay moved
    sheets.moveSheet(0, 1);</B>

    // Save the workbook
    try { 
        wkb.save( "C:/TEST_MOVE.xls" );
    }
    catch(Exception e) {
    }
}

Hi,

Please try the fix in http://www.aspose.com/Community/forums/thread/58064.aspx.