Deleting rows and columns


#1

Hi!

It seems to be a bug in DeleteColumn() and DeleteRow() methods. When some range is shifted up or left, some formatting (cell merging and rows height) is lost. To reproduce the bug, try the following code:

---------------
// apply some formatting
Range range = excel.Worksheets[0].Cells.CreateRange(4, 4, 1, 1);
range.RowHeight = 40;

range = excel.Worksheets[0].Cells.CreateRange(3, 3, 3, 3);
range.Merge();

for (int i = 2; i < 7; i++)
for (byte j = 2; j < 7; j++)
excel.Worksheets[0].Cells[i, j].PutValue(i + "/" + j);

excel.Save("sample1.xls", FileFormatType.Default);

// delete the first column
excel.Open("sample1.xls");
excel.Worksheets[0].Cells.DeleteColumn(0);
excel.Save("sample2.xls", FileFormatType.Default);

// delete the first row
excel.Open("sample1.xls");
excel.Worksheets[0].Cells.DeleteRow(0);
excel.Save("sample3.xls", FileFormatType.Default);
---------------

Then load sample1.xls, sample2.xls and sample3.xls into MS Excel and compare. This is definitely not the expected behavior (at least, when I delete row/column in Excel, is gives another results).

P.S. I use Aspose.Excel version is 2.4.0.0 (trial demo version). Maybe, this is just a demo-version limitation?

Thanks for your reply


#2

Hi Antoine,

Thanks for your report.
The merged cell and row setting doesn’t shift while the row or column is deleted. I will fix it to make it same as MS Excel.


#3

Please download the latest hotfix and have a try.


#4

Nice, thank you!