deleting rows in tables

Sep 27, 2010 at 2:19 PM

Hello Tim

is it possible to delete rows into tables (tablewrapper) ?



Sep 27, 2010 at 3:29 PM

Hi Patrice,

The TableWrapper class doesn't have any pubic functionality for individually inserting or deleting rows (although it does automatically insert rows during Fill() operations). Methods like this would be difficult to implement safely, as the affected worksheet rows may contain other data outside of the area covered by the table.

However, if you are sure that no such data exists, you can achieve the same result by deleting worksheet rows within the vertical band covered by the table. This automatically causes the table to resize. Instead of hard-coding your deletion range, you can make your deletion code more robust by using the TableWrapper.FirstRowIndex and LastRowIndex properties to set the deletion coordinates dynamically. This will ensure that the same relative rowspan will be deleted even if the table is moved with the template.

Hope this helps,