We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Grouped Worksheets After Copying

I am having an issue where worksheets in a workbook are being grouped by default. Here is some sample code:

//Open a Workbook.

Workbook yearly = new Workbook();

yearly.Open(@"C:\Aspose\A.xls");

//Open another Workbook.

Workbook monthly = new Workbook();

monthly.Open(@"C:\Aspose\B.xls");

//Open another Workbook merge the two.

Workbook main = new Workbook();

//Merging

main.Worksheets.Add("Data from A");

main.Worksheets[1].Copy(yearly.Worksheets[0]);

main.Worksheets.Add("Data from B");

main.Worksheets[2].Copy(monthly.Worksheets[0]);

//Save the file.

main.Worksheets.ActiveSheetIndex = 0;

main.Save(@"C:\Aspose\C.xls", FileFormatType.Default);

I've attached the related spreadsheets. If you run the above code, the resulting spreadsheet will show the worksheets as being highlighted and grouped. The user must right click one and select 'Ungroup' or click on any other worksheet to break the grouping.

Hi,

Please download the latest version:
Aspose.Cells
for .NET v6.0.1.4


It works fine. Below is my sample code. I have attached the output xls file.

C#


//Open a Workbook.


Workbook yearly = new Workbook(@“F:\Shak-Data-RW\Downloads\A.xls”);


//Open another Workbook.


Workbook monthly = new Workbook(@“F:\Shak-Data-RW\Downloads\B.xls”);






//Open another Workbook merge the two.


Workbook main = new Workbook();


//Merging


main.Worksheets.Add(“Data from A”);


main.Worksheets[1].Copy(yearly.Worksheets[0]);


main.Worksheets.Add(“Data from B”);


main.Worksheets[2].Copy(monthly.Worksheets[0]);


//Save the file.


main.Worksheets.ActiveSheetIndex = 0;


main.Save(@“F:\Shak-Data-RW\Downloads\B2.xls”, SaveFormat.Excel97To2003);