Free Support Forum - aspose.com

ImportDataGrid equivalent for winforms grid

Within my application i currently have a 3rd party grid(devexpress v6.3.2). i would like to be able to export the data within it to excel, whilst maintaining any formatting that may have been applied. I can see that there is a method called ImportDataGrid which works with webcontrols, is there an equivalent method for winform grids?

Hi,

Thanks for considering Aspose.

Well, I think you may try to fill a datatable from your third party grid and then use Cells.ImportDataTable() to extract the data into the Excel worksheet for your winform project.

Thank you.

Thanks for your prompt response but if i am just export a datable to excel, wont it lose all the formatting?

Hi,

Thanks for considering Aspose.

Yes, my dear and same is the case with ImportDataGrid() method too as Only data is extracted to fill the MS Excel worksheet. Further, when you load a template excel file and want to update and save it / save as it, Aspose.Cells will retain all its formattings, objects, data etc. and save the modified excel file.

Thank you.

Thanks for confirming that my dear. If i understand correctly, i need to have an exisitng excel template, with formatting already set up, then export my datatable into the template? Or are you saying that any changes i make to an excel file will be saved by aspose complete with all formatting?

Yes, a predefined Excel template file with formattings will work for you.