none
How to delete a row in Excel file with Open Xml Sdk RRS feed

  • Question

  • Hi all,

    I currently want to delete a row in excel file(not clear content) with Open Xml Sdk(

    using DocumentFormat.OpenXml;
    using DocumentFormat.OpenXml.Packaging;
    using DocumentFormat.OpenXml.Spreadsheet;

    )

    Any ideas?

    Sunday, December 29, 2013 1:41 PM

Answers

  • Hi,

    It's a complex task to delete a row instead of clearing the content.

    You could take a look at the structure of a spreadsheet by Open XML productivity tool as below.

    We could see that there is RowIndex property to define the information of row and CellReference property to define the information of every cell containing row and column index. But no property is used to specify column index.

    To delete a row “3”, we should clear the whole row where the RowIndex property equal 3 firstly. Then we should not only minus the RowIndex property of the behind rows but only decrease the CellReference property of cells in these rows.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 31, 2013 10:54 AM
    Moderator

All replies

  • Dear Moderators,

    Probably this need to be moved to OPEN XML SDK forum.


    Best Regards,
    Asadulla Javed, Kolkata
    ---------------------------------------------------------------------------------------------
    Please do not forget to click “Vote as Helpful” if any post helps you and "Mark as Answer”if it solves the issue.

    Monday, December 30, 2013 6:29 AM
  • Hi,

    It's a complex task to delete a row instead of clearing the content.

    You could take a look at the structure of a spreadsheet by Open XML productivity tool as below.

    We could see that there is RowIndex property to define the information of row and CellReference property to define the information of every cell containing row and column index. But no property is used to specify column index.

    To delete a row “3”, we should clear the whole row where the RowIndex property equal 3 firstly. Then we should not only minus the RowIndex property of the behind rows but only decrease the CellReference property of cells in these rows.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 31, 2013 10:54 AM
    Moderator