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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Copying table to excel via code

Thread ID:





6411 Aug 12,2003 06:20 AM UTC Aug 12,2003 08:07 AM UTC WinForms 1
Tags: GridControl
Stephen Rose
Asked On August 12, 2003 06:20 AM UTC

I am trying to write an option to export my grid to excel. It is quite a complex grid with covered cells and borders etc. If i do Grid.CutPaste.CopyRange(GridRangeInfo.Table) I get a divide by zero. Grid.CutPaste.CopyRange(GridRangeInfo.Row(3)) Excel gives an error in its paste function Grid.CutPaste.CopyRange(GridRangeInfo.Cell(1,1)) Works. Is there a way for me to dump the grid colours, layout and all into excel? Cheers Steve

Administrator [Syncfusion]
Replied On August 12, 2003 08:07 AM UTC

Currently Essential Grid only supports 2 clipboard formats, an internal GridData format, and a DataFormats.Text format (tab separated text with newlines for rows). So, currently the only format that Excel can use is the text format. This only supports the text copying, and not cell colors, etc. We are working on supporting BIFF formats, so in the future you would be able to copy more than text. Biff support will not be in the upcoming 2.0 release, but should be available shortly thereafter. You can call range.ExpandRange on a range object to make sure it is a cell range so the Copy has a fixed set cesll to work with.
private void button1_Click(object sender, System.EventArgs e)
	GridRangeInfo range = GridRangeInfo.Col(1);
	range = range.ExpandRange(1, 1, this.gridDataBoundGrid1.Model.RowCount-1, this.gridDataBoundGrid1.Model.ColCount);


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon