How to resize an excel table


  • I am building an excel 2007 add-in on visual studio professional 2008 with SP1. I want my add-in to add and remove data to a certain excel table.

    Excel.Range rg = ws.get_Range("myExcelTable", System.Type.Missing);
    rg.Value2 = string.Empty;
    rg.Value2 = myArray;


    If the table has less rows than the array, the table doesnt reisze and so the last rows of the array are not copied into excel.
    If the table has more rows than the array, the rows are repeated in the table.

    So, I need to resize the table to fit the array and, after that, copy the array to the table. No missing data and no surplus data.
    How can I do this?

    Thursday, April 02, 2009 12:42 AM


  • I actually created a listobject from my existing excel table with
    and then used the SetDataBinding method.
    • Marked as answer by bouvierr Thursday, April 02, 2009 9:26 PM
    Thursday, April 02, 2009 9:25 PM

All replies