Exporting infragistics grid to excel- pdf and CSV

Hi,

In the process of evaluating Aspose I came across a functionality to export infragistics grid to excel, PDF and CSV.

I am using evaluation version of Aspose. Runtime Version “v2.0.50727”, Version 8.1.0.0.

I am not able to see the “ImportGridView” function.

I am trying to use the below lines
worksheet.Cells.ImportGridView (dataGrid, 0, 0, false);

Please suggest.


Hi,


Well, Aspose.Cells does support to import data from Asp.NET native GridView control but not Infragistics grid control, see the document on Importing data options which Aspose.Cells provides:
http://www.aspose.com/docs/display/cellsnet/Importing+Data+to+Worksheets

Thank you.

The link explains the use of below code for the export operation (WPF application)
worksheet.Cells.ImportGridView (dataGrid, 0, 0, false);

However, I am not able to find the function named “ImportGridView” in “Aspose.Cells.dll” version 8.1.0.0 and release version
v2.0.50727

I get below compile error
’Aspose.Cells.Cells’ does not contain a definition for ‘ImportGridView’ and no extension method ‘ImportGridView’ accepting a first argument of type ‘Aspose.Cells.Cells’ could be found (are you missing a using directive or an assembly reference?)

Please suggest.


Hi,


I think you cannot have Asp.NET GridView control in WPF, please check it out. Anyways, if you could have or access the GridView control in a WPF application, kindly create a sample application with Aspose.Cells APIs, zip it and post it here, we will check it why you are getting this error message.

Thank you.

Hi,

Below is the sample WPF code

Aspose.xaml

<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:igDP="http://infragistics.com/DataPresenter" x:Class=“AsposeImplementation.MainWindow”
Title=“Aspose” Height=“350” Width=“525”>


<igDP:XamDataGrid Name=“shareClassBasicInfoGrid” HorizontalAlignment=“Left” Margin=“107,189,0,0” VerticalAlignment=“Top”/>





Aspose.xaml.cs

private void PopulateGrid()
{
//Logic to get data from DB and populate the grid.
}

private void csvGridExtract_Click(object sender, RoutedEventArgs e)
{
var book = new Workbook();
var worksheet = book.Worksheets[0];
///book.Save(“GridOutput.csv”, SaveFormat.CSV);
// book.Save(“GridOutput.csv”, SaveFormat.CSV);
// worksheet.Cells.ImportGridView (dataGrid, 0, 0, false);
}

Hi,


As I said earlier, I am afraid Aspose.Cells only supports to import data from native .NET DataGrid or GridView control and does not support Infragistics grid control that you are talking about. By the way, if you could import data from Infragistics grid control to some datatable or arrays by yourself, then you may use Aspose.Cells APIs to import data from datatable/arrays to fill the worksheet in the Workbook.

Thanks for your understanding!

Hi Amjad,

Thanks for replying to the post and helping me solve the issues encountered.

There seems to be a bit of confusion here.

The problem that I am trying to solve here is that I am not able to find the function named “ImportGridView” in the “Aspose.Cells.dll” downloaded. Version details – version 8.1.0.0 and release version
v2.0.50727

I get a compile error stating

‘Aspose.Cells.Cells’
does not contain a definition for ‘ImportGridView’ and no extension
method ‘ImportGridView’ accepting a first argument of type
‘Aspose.Cells.Cells’ could be found (are you missing a using directive
or an assembly reference?)"

Incase I get this function in the dll I will be able to import WPF grid to excel or PDF.
However, I am not able to find the function in the dll downloaded.
Aspose.Cells.zip


Request you to please suggest.

Hi,


I have tested your scenario/ case a bit. I created a simple Asp.NET web project and added a GridView control to the web form, I created a datatable and filled some data to it and bind it. I have added reference to Aspose.Cells for .NET v8.1.0 component to the project. Now I created a new Workbook via Aspose.Cells APIs and import GridView Data to the first worksheet cells, I saved the PDF file to export it. Everything is working fine here, I do not get any error what so ever. I have attached the sample project for your reference here.

Thank you.