Ordering of sheets

When I do an AddCopy of a sheet, it puts the sheet as the last sheet in the workbook. I was wondering if it was possible to renumber/reorder the sheets to be in a different order.

Thanks!

Pam

Hi Pam,

Thanks for your suggestion.

It’s really a useful feature. I have thought of this feature but postpone it because of the complexity if worksheets containg drawing objects.

Now I will make a deep investigation for this feature and put it in my work plan.

It has been a while, but I was wondering if this issue had ever been addressed. We are getting ramped up to produce our yearly reports, and this feature is key, as we generate a lot of cloned pages, and since the pages are appended to the end, someone is forced to go into each workbook and reorder the pages.

Thanks for any input.
Pam

Hi Pam,

Have you tried Worksheet.Move method?

@pamvcl,
Aspose.Cells has replaced Aspose.Excel that is discontinued and no more development is done for it. This new product supports all the latest features available in different versions of MS Excel. It supports the management of worksheets within a workbook such that you can copy and move worksheets with minimal code. The following example can be used to re-order worksheets in a workbook.

//Create a new Workbook.
Workbook workbook = new Workbook();
WorksheetCollection worksheets = workbook.Worksheets;
Worksheet worksheet1 = worksheets[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("AsposeMoveSheet.xls");

Here is the output of the above program.

For more information on working with the worksheets, follow the below link:
Reorder Worksheets
Worksheets

Get the latest free trial version here to test different features of Aspose.Cells.
Aspose.Cells for .NET (Latest Version)

Download here the latest solution containing all the sample codes to test multiple features of this new product.