Copy method

Does Aspose.Cells.Workbook.Copy(Workbook) does a deep copy or shallow copy ??

Hi Ashish,


Thank you for considering Aspose APIs.

The Aspose.Cells.Workbook.Copy method makes a deep copy of the Workbook object by copying the structure as well as the data and formatting from the source object to the destination object. You can confirm this using the following code snippet. When you load the resultant spreadsheet in Excel application, you will notice that it has everything (worksheets, data, formulas, style etc) as of the original source spreadsheet.

C#

var book = new Workbook(source);
var newbook = new Workbook();
newbook.Copy(book);
Console.WriteLine(“Worksheet Count:” + newbook.Worksheets.Count);
Console.WriteLine(“Cell Count:” + newbook.Worksheets[0].Cells.Count);
Console.WriteLine(“Max Data Columns:” + newbook.Worksheets[0].Cells.MaxDataColumn);
Console.WriteLine(“Max Data Rows:” + newbook.Worksheets[0].Cells.MaxDataRow);
newbook.Save(destination);

Please feel free to contact us back in case you have further questions for us.