How I Delete Rows of an Excel Spreadsheet Using Open XML in VB.Net

rspiet 1 Reputation point

I have an Excel Spreadsheet that I am using as a template file. I want to start by deleting all but the first row of the first worksheet. I tried the following code. It should work, but it immediately exits the For loop right after the Row.Remove() statement is executed. This seems like a bug. How do I accomplish this?

The For Loop

For Each Row As Row In SheetData.Elements(Of Row)
    If Int(Row.RowIndex) > 1 Then
    End If

The full code block.

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,658 questions
0 comments No comments
{count} votes