Using the Copy
method for either the Worksheet or Workbook classes does not preserve sorting from the source.
using Aspose.Cells;
License license = new();
license.SetLicense("Aspose.Total.NET.lic");
// Open a workbook which has one sheet with a table which has a basic descending sort on one column
Workbook wb = new("test.xlsx");
var source = wb.Worksheets[0];
// Make a copy of the first sheet
var copy = wb.Worksheets.Add("copy");
copy.Copy(source);
wb.Save("test_with_copy_sheet.xlsx"); // no sort on the new sheet
// Now let's try with a copied workbook
Workbook sourceWb = new("test.xlsx");
Workbook destWb = new();
destWb.Copy(sourceWb);
destWb.Save("test_new_workbook_copy.xlsx", SaveFormat.Xlsx); // no sort again