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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

CSV Export from a virtual grid

Thread ID:





35579 Oct 4,2005 03:47 PM UTC Jan 27,2006 06:20 AM UTC WinForms 5
Tags: GridControl
Jose Lacson
Asked On October 4, 2005 03:47 PM UTC

How do you export to a CSV file a virtual grid, I tries CopyTextToClipboard, but I get a divide by zero error. Thanks.

Administrator [Syncfusion]
Replied On October 4, 2005 03:58 PM UTC

Try using this.gridControl1.TextDataExchange.CopyTextToBuffer.

Jose Lacson
Replied On October 4, 2005 04:23 PM UTC

Sorry. That''s actually what i was using. Here''s my code: Private Sub Export() Me.m_oVGrid.Model.TextDataExchange.ExportTabDelim = "," Dim oRangeList As New Syncfusion.Windows.Forms.Grid.GridRangeInfoList Dim oRange As Syncfusion.Windows.Forms.Grid.GridRangeInfo oRange = Me.m_oVGrid.GridCellsRange.Rows(1, 5) oRangeList.Add(oRange) Dim sBuffer As String Dim nRows, nCols As Long Dim bReturn as Boolean bReturn = Me.m_oVGrid.TextDataExchange.CopyTextToBuffer(sBuffer, oRangeList, nRows, nCols) End Sub bReturn returns false sBuffer is blank, but length is > 0, Why is that? Thanks. >Try using this.gridControl1.TextDataExchange.CopyTextToBuffer.

Administrator [Syncfusion]
Replied On October 4, 2005 04:35 PM UTC

The range has to be a cell range an dnot a row range. Try code like: oRange = gridControl1.GridCellsRange.Rows(1, 5) oRange = oRange.ExpandRange(1, 1, Me.gridControl1.RowCount, Me.gridControl1.ColCount) oRangeList.Add(oRange)

Replied On January 25, 2006 11:42 PM UTC

I''ve followed the code to convert GridGroupingControl to CSV, but it missed the last row. Can you try? I think that might be a bug if the code below is correct. Here is the code I used. this.gridGroupingControl1.TableModel.TextDataExchange.ExportTabDelim = ","; string buffer; int coldone; int rowdone; Syncfusion.Windows.Forms.Grid.GridRangeInfoList rangeInfoList = new Syncfusion.Windows.Forms.Grid.GridRangeInfoList(); Syncfusion.Windows.Forms.Grid.GridRangeInfo gridRangeInfo = new Syncfusion.Windows.Forms.Grid.GridRangeInfo(); gridRangeInfo = this.gridGroupingControl1.TableModel.GridCellsRange; gridRangeInfo = gridRangeInfo.ExpandRange(0, 0, 1, 1); rangeInfoList.Add(gridRangeInfo); this.gridGroupingControl1.TableModel.TextDataExchange.CopyTextToBuffer( out buffer, rangeInfoList, out rowdone, out coldone); Console.WriteLine(rowdone); Console.WriteLine(coldone); Console.WriteLine(buffer);

stanleyj [Syncfusion]
Replied On January 27, 2006 06:20 AM UTC

Hi Ken, This code works without leaving the last row, I tried in 4.1. What version of grid are you using? In 4.1, there is also a new support to convert grid contents to excel using XlsIO libraries. Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl converter = new Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl(); converter.GroupingGridToExcel(this.gridGroupingControl1,"Test.xls", Syncfusion.GridExcelConverter.ConverterOptions.Default); Best regards, Stanley


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