We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Getting Data from Grid View into Excel and image file into excel

Hi, we have purchsed Aspose Total and trying to implement it. We have a web page which has a standard ASP .NET Grid View. We would like to get the Grid view data into excel using Aspose. Also, we would like to get an image file to excel.

If possible, if you can provide a code sample, it would be very helpful.


Murali Munjeti.

Hi Murali,

Thanks for considering Aspose.

Well, I think you may try to extract the source datatable of a GridView using Cells.ImportDataTable() method. There are some other APIs too e.g.., Cells.ImportFromDataReader(), Cells.ImportDataView(), Cells.ImportDataColumn.

Please check the following doc for your complete reference:


For inserting images into excel worksheets, please check the following doc:


Thank you.

this will not meet our needs as we need to export to Excel the exact format – heading etc that are shown in our GridView and we don’t want to have to reprocess all the data to apply the formatting. Is there any other method which can resolve this?


Well, we do provide Cells.ImportGridView() method for your desired task, but we found an issue with this method recently and we will soon fix it. But, related formattings, this method only extract data and I 'm afraid you have use Aspose.Cells API (formatting related apis) to apply formattings for your need.

Thank you.

what vesion of Aspose does this feature has as we don’t see this feature.


You need to use latest versions of Aspose.Cells for .NET e.g.., 4.4.3, It is to be noted, this method can be used in VS.NET 2005 or greater. Further, you need .Net 2.0 version of Aspose.Cells for .NET component, so in you project, you have to add reference to the version resided in.......... \Program Files\Aspose\Aspose.Cells\Bin\Net2.0.

Thank you.


Sorry for my mistake, the Cells.ImportGridView() mthod just works fine. Please find attached a demo project for your reference.

Thank you.