We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Deleting a range of rows

Thread ID:

Created:

Updated:

Platform:

Replies:

51876 Nov 15,2006 03:27 PM Nov 16,2006 10:53 AM ASP.NET Web Forms (Classic) 3
loading
Tags: XlsIO
Chuck
Asked On November 15, 2006 03:27 PM

I'm trying to write a line of code that will accomplish doing a select on Rows 45 through 55, then Delete the rows and let the rows below shift up. I want to delete the entire Row, not just selected columns.

I tried this:
sht.Range["45:55"].Clear(ExcelMoveDirection.MoveUp);

but it took "System.ArgumentException was unhandled by user code"
Message="Wrong range name format - alpha part "

Any ideas? TIA

Chella Pandian B [Syncfusion]
Replied On November 15, 2006 04:42 PM

Hi Chuck

I think this must help you.

// Where 45 is the first row. 1 is the column of 45 row. 55 is the last row and 10 is the last column in 55th row. It mean I have 10 columns in my excel sheet.

sheet.Range[45,1,55,10].Clear(ExcelMoveDirection.MoveUp);

Let me know if you have any other queries.

With regards,
Chella.

Chuck
Replied On November 16, 2006 09:22 AM

Thank you for assistance. That method does give me a way to select and clear a range of cells.

Unfortunately deleting a range of cells is not the same a deleting a range of rows. For one thing, it leaves the spreadsheet with the same last used row as before the clear operation, where deleting rows changes the last used row.

Is there a way of deleting either 1 or many entire rows? That is, without specifying columns too?

TIA again.

Chella Pandian B [Syncfusion]
Replied On November 16, 2006 10:53 AM

Hi Chuck

I have found you another solution.


// This will delete 10 rows from 45th row
for(int i=1;i<=10;i++)
{
sheet.DeleteRow(45);
}

I have even attached a sample too.

Sample:

DeleteRows.zip

With Regards,
Chella.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;