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

Free Support Forum - aspose.com

ImportGridView not working

hello,

I need to get the contents of a gridview that I have saved into a worksheet in my workbook.

I am trying to use ImportGridView and it doesn't seem to be working? I tried calling it right after the data was bound to the grid and still could not get it to update the workbook. Am I using this incorrectly?

Aspose.Cells.Workbook myBook = new Aspose.Cells.Workbook();

Aspose.Cells.Worksheet mySheet = myBook.Worksheets[0];

mySheet.Cells.ImportGridView(GridView2, 0, 0, true, true, true);

Hi,

We found the issue with Cells.ImportGridView() method, we will fix it soon.

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

Please check the following doc for your complete reference:

http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/importing-data-to-worksheets.html

Thank you.

Hi,

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

Thank you.

Hello thanks for the demo project, but the code in that project does not export correctly for me? it gives a blank excel file when there is clearly data in the GridView? Any Ideas?

Thanks for your help

Hi,

Well, how do you bind data to GridView? Did you check and run the demo probject I attached, To run it, I think you can also add the Northwind.mdb database and add Default.aspx webform with .cs file to your project and have a test run if it works fine. Attached is the resultant file when I run the demo project on my pc.

Thank you.