Free Support Forum - aspose.com

Bug report: DeleteColumn no longer works in 4.8.0.0 but used to in 4.7.x.x

The following code worked in v4.7.x.x but no longer works in v4.8.0.0.

It creates a workbook that fails to load in Excel 2007 and it’s because it’s effectively not changed the column letters within the XML generated within the XLSX.

To re-create the issue create a simple spreadsheet with the top row containing a value in each of the first 5 columns. The code below will then load that spreadsheet, delete one column and resave it.

Dim xls As New Aspose.Cells.Workbook
xls.LoadData("test.original.xlsx)
xls.Worksheets(0).Cells.DeleteColumn(1, True)
xls.Save(“test.updated.xlsx”, Aspose.Cells.FileFormatType.Excel2007Xlsx)

If you prefer C# then replace the first line with
Aspose.Cells.Workbook xls = new Aspose.Cells.Workbook();
and add the semi-colons to the end of each line

I have tried with and without the optional “UpdateReferences” parameter to DeleteColumn and it fails in the same way.

The XML generated looks like this:


0
2
3
4
5
6


and you can see where the C1 cell references is incorrectly included (it should read B1).

This is effectively a regression error introduced in v4.8 that wasn’t there in v4.7

cheers,

Gary

Just a quick edit to say that I’m using .Net 3.5 on Win XP 64bit within both a console app and a web app to prove the above. I can’t imagine the platform is an issue but I guess it’s worth you knowing! It affects both a 32bit and 64bit compile of the app.

Hi,

Please try the attached latest fix v4.8.0.12, it a .net 2.0 compiled version for 64-bit environment. If you want .net1.x compiled version for 32-bit machines, you may ask us and we can provide it for your need.

I have tested with it using the attached template file and it works fine, see the attached output file too.

Sample code:

Workbook xls = new Aspose.Cells.Workbook();
xls.LoadData(“f:\test\test.original.xlsx”);
xls.Worksheets[0].Cells.DeleteColumn(1, true);
xls.Save(“f:\test\test.updated.xlsx”, Aspose.Cells.FileFormatType.Excel2007Xlsx);

If you still find the issue, kindly post your template file with sample code here. We will check it soon.

Thank you.

Yep - that’s fixed it - thanks for the excellent response time,

cheers,

Gary