I thought to use the grid to export dataset to excel from a proccess, and not from a form .
I mean I want to create a windows service, that binds data to a grid and exports it
to excel, without opening a form.
Is this possible?
The following code, created an empty excel file:
grid.DataSource = ds;grid.Show(); grid.Refresh(); string exportFileName = "c:\\X.xls";
ultraGridExcelExporter1.Export(grid, exportFileName);
Hi,
If the grid is not parented to any form, then it will have no BindingContext and it will therefore be unable to get any data.
Try setting grid.BindingContext to a new BindingContext immediately after you call the grid's Constructor.
What you suggest did work better in a console application without opening a form.
But it didnt work in a windows service.
Still excel is empty.
Hm, that's odd. I can't see why that would make any difference.
My only guess is that perhaps that DataSource itself is not getting any data. Check the count on the rows and columns of the DataSource.
Oops...
You are right.
That works also on winservice.
That's great. Thanks!
I need to export data with hirarchy, and its to complicated to do on my own.
The grid does a good job...