Hi,
Thanks for your posting and using Aspose.Cells for .NET.
Please download and use the latest version:
Aspose.Cells
for .NET v7.2.0.7
Please use the following code, it will copy the entire contents of your worksheet from source workbook into your destination workbook and column widths will not be affected too.
So, you do not now need to worry about column widths after modifying your code according to the code given below.
I have attached both the source and output file generated by this code for your reference. Please also see the screenshot below.
C#
string filePath = @“F:\Shak-Data-RW\Downloads\source.xlsx”;
Workbook sourceWorkbook = new Workbook(filePath);
Workbook destWorkbook = new Workbook();
destWorkbook.Worksheets.Clear();
foreach (Worksheet sourceSheet in sourceWorkbook.Worksheets)
{
destWorkbook.Worksheets.Add();
destWorkbook.Worksheets[destWorkbook.Worksheets.Count - 1].Copy(sourceSheet);
}
destWorkbook.Save(filePath + “.out.xlsx”, SaveFormat.Xlsx);
Screenshot:
Thank you for the reply. I attempted to download and use the newer ddl and was faced with a daunting task of updating deprecated style properties. unfortunately, once I updated all of my code I ran into an issue with the license. I am using an older version of Aspose. Is there a limit to the version level that you can update to?
Hi,