Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2715
ExcelExporter issue
posted

Hi !

What does the excelExport actuqally export ? the datasource of the grid or the content of the displayed grid ?

Why the following code does not work ? - it generates an empty file - 

 

           UltraGrid ugl = new UltraGrid();

            ugl.SetDataBinding(ds, "reportDataset");

            UltraGridExcelExporter exel = new UltraGridExcelExporter();

            exel.Export(ugl,"E:\\excel.xls");

 

            ugl.Dispose();

            exel.Dispose();

 

 

Parents
  • 469350
    Offline posted

    The exported Excel file is created based on the grid, not the data source. It's WYSIWYG - the Excel file will pick up the appearances and layout of the grid, as much as possible. 

    The code you have here probably doesn't work because DataBinding in DotNet requires a BindingContext and since you are creating your grid in code and you never add it to a container of any kind, it has no context.

    I think if you check, you will find that your grid has no rows in it, even if your data source does. To fix this, just set the BindingContext on the grid to a new BindingContext or to the BindingContext of the form (assuming you have a form). Do this before you set the grid's DataSource.

Reply Children