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

Copy grid to clipboard as Excel format

Thread ID:

Created:

Updated:

Platform:

Replies:

63182 Jun 29,2007 03:17 AM UTC Jun 29,2007 09:08 PM UTC WinForms 1
loading
Tags: GridControl
Richard Bysouth
Asked On June 29, 2007 03:17 AM UTC

I'm using code from one of your examples to copy a selected range in my grid to the clipboard in Excel format.
I find that this code works fine for a small selected range (say 2 columns * 5 rows) but for anything over this, the Sheet.Range object throws an out of range exception. It seems that the number of rows and columns in the Sheet is not initialized properly? I though that with xlsIO, all valid cell ranges are available, but the sheet only contains the number of rows and columns it needs?

Is there anything wrong with my code that could be causing this problem?

Many thanks for your excellent support

Richard

CopyToExcel.zip

haneefm [Syncfusion]
Replied On June 29, 2007 09:08 PM UTC

Hi Richard,

Before calling the GridCellToExcel method, Try checking the cell bounds range with WorkSheet by using the below code snippet.

[VB.Net]
If sheet.Columns.Length < iRow or sheet.Rows.Length < iColumn Then
gecc.GridCellToExcel(m_Grid.Model, iRow, iColumn, sheet.Range(iRow, iColumn))
''' continue with next rnage using foreach loop here.
EndIf

Best regards,
Haneef

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

;