Unable to manually delete row in table in Excel after ImportData

ExcelTableTest.zip (5.4 MB)
I’ve attached a solution that I’ve made, where I use ImportData to populate a table in an Excel template.

Importing the data works fine but if I open the Excel file afterwards in Excel, I’m unable to delete any rows in the table.

If I, however, insert an extra blank row in the table in the template file that I use and them use ImportData to populate the table, I can delete rows afterwards manually.

Button1 is an example where I’m unable to delete rows afterwards and Button2 is an example where I use the workaround with an extra row in the template and therefore is able to delete rows.

Is this a bug or am I using the ImportData function wrong?

I’m also curious as to why I end up with an extra blank row in the table just above the total row. If I import data using Excel, the table doesn’t contain a blank row between the data and the total row but it seems that if do the same with ImportData, the blank line, that’s always there in an empty table, ends up at the bottom of the table in the end.

With regards,
Martin Moustgaard

I just found out that if I delete blank row that always is there after an ImportData (using the following code to delete it: myCells.DeleteRow(tableList.EndRow - 1)) and then save the file, then I can delete rows in the table afterwards by opening it in Excel.

So it seems that this employ row in the table is the cause of the problem.

@mm.jsworldmedia,
We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46902 – Manually delete row option is disabed in table after populating the Excel file using ImportData

@mm.jsworldmedia,

Please check the template file, the delete row option is disabled too, so it should be behavior of MS Excel and not an issue with Aspose.Cells APIs.

Yes in a empty table you cannot delete the empty row below the header, since the table always have to have 1 row besides the header.

However if you populate the table with data directly in Excel, you’ll be able to delete the row - that’s not the case if you populate the table with data using Cells.net - here the row remains undeletable, so somehow the ImportData method doesn’t generate a table exactly the same way as Excel does.

It’s easy to reproduce - simply use Excel to create a table with the column headers Id and Name. Now you cannot delete the blank row. Fill our the first row with test data and press TAB when you’re in the last column of the first row and a second row is created, that’s now deletable.

If you instead import data to the table from an external source, using Excel, the blank row at the bottom of the table isn’t even there - Excel removes it automatically.

So I think the problem is that somehow Cells.Net inserts the data in between the header and the blank row on the cell, resulting in a blank row at the end of the table after ImportData. However this blank row behaves as if it’s the only row in the table, making it impossible to delete it, using Excel.

With regards,
Martin Moustgaard

@mm.jsworldmedia,

Thanks for your feedback and details.

I have logged it against your issue into our database. We will evaluate it thoroughly and will get back to you soon.

@mm.jsworldmedia,

Upon further investigations, we found the issue and we will start working over it to fix it.

Once we have an update on it, we will let you know.

@mm.jsworldmedia,

This is to inform you that we have fixed your issue now. We will provide you the fixed version after performing QA and incorporating other enhancements and fixes.

Keep in touch.

The issues you have found earlier (filed as CELLSNET-46902) have been fixed in Aspose.Cells for .NET v19.10. This message was posted using Bugs notification tool by Amjad_Sahi