Package excel.copyandmove

Source Code of excel.copyandmove.AsposeMoveSheetWithinWorkbook

package excel.copyandmove;

import com.aspose.cells.Workbook;
import com.aspose.cells.Worksheet;
import com.aspose.cells.WorksheetCollection;

public class AsposeMoveSheetWithinWorkbook
{
  public static void main(String[] args) throws Exception
  {
    //Create a new Workbook.
    Workbook workbook = new Workbook();

    WorksheetCollection worksheets = workbook.getWorksheets();
        Worksheet worksheet1 = worksheets.get(0);
        Worksheet worksheet2 = worksheets.add("Sheet2");
        Worksheet worksheet3 = worksheets.add("Sheet3");
       
    //Move Sheets with in Workbook.
        worksheet2.moveTo(0);
        worksheet1.moveTo(1);
        worksheet3.moveTo(2);

    //Save the excel file.
        workbook.save("data/AsposeMoveSheet.xls");
   
    System.out.println("Sheet moved successfully."); // Print Message
  }
}
TOP

Related Classes of excel.copyandmove.AsposeMoveSheetWithinWorkbook

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.