wordpress hit counter
Re: Copy Row, Insert Row, Paste Row - SpreadsheetML - Formats - OpenXML Developer

Re: Copy Row, Insert Row, Paste Row

Formats

Discussions about working with different Open XML Formats

Copy Row, Insert Row, Paste Row

  • rated by 0 users
  • This post has 2 Replies |
  • 2 Followers
  • I have a table in a spreadsheet template with 3 columns with headers. The first row in the table is populated, and the first cell in this row contains a formula, the second and third cells contain data validations.  On the row just below the table is a button that runs a macro. I need to insert new rows with cells of data into the table following the first row and above the row containing the button, and use the same formula and data validations being used by the cells in the first row.

    Is it possible to insert a new row with new cells in the table below the first row and above any remaining rows in the spreadsheet, and apply the formulas and data validations used by the cells in first row to the cells in new row?    Can someone provide an example of how to do this?

    Thanks!

  • Hi,

        This thread would help you to add a row to the table. To add a row above/below, modify the existing code, i.e. get the row Id/Index where the button is, and create a Row object, append Cell objects to it and then call

    sheetData.InsertAt(newrRow,the position);
    OR
    sheetData.InsertAfter(newChild, refChild);

    Let me know if you need any help on this. 

  • Hi pramodhegde,

    Thank you very much, your example helped me get past the problem I had run into.

    If I run into any trouble with some other tabs in the spreadsheet where I need to move stuff around I will ask for help.

    Thanks!

Page 1 of 1 (3 items)