We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Dynamically Update Excel from DataGrid

Hi,

We have a requirement in order to dynamically export the Grid date to Excel.

i.e. Based on the data being changed in the DataGrid, the data has to dynamicaly reflect in the excel.

we are using the Syncfusion DataGrid, pls advice.
How to acheive this.

Thanks In Avance,
Suresh



8 Replies

HA haneefm Syncfusion Team May 16, 2007 05:51 PM UTC

Hi Suresh,

There is no built-in support for this. If you want to export the grid dynamically when the current cell is changed, you can derive the GridExcelConverterControl class and implement the CurrentCellExport method. Please refer to the attached sample for implementation and let me know if this helps.

[c#]
public void CurrentCellExport(GridModel model,string FileName,GridCurrentCell CurrentCell, bool IsCreateNew )
{
ExcelEngine engine = CreateEngine();
IWorkbook book = (!IsCreateNew)? engine.Excel.Workbooks.Open(FileName):engine.Excel.Workbooks.Create();
IWorksheet sheet = book.Worksheets[ 0 ];
GridRangeInfoList list = model.SelectedRanges;
ExportCurrentCell(CurrentCell,model,sheet);
book.SaveAs(FileName);
book.Close();
}

public void ExportCurrentCell(GridCurrentCell CurrentCell, GridModel model, IWorksheet sheet)
{
this.CopyStyle( model[CurrentCell.RowIndex, CurrentCell.ColIndex],sheet[CurrentCell.RowIndex + 1, CurrentCell.ColIndex]);
sheet[CurrentCell.RowIndex + 1 , CurrentCell.ColIndex].Text = model[CurrentCell.RowIndex, CurrentCell.ColIndex].FormattedText;
}

Sample : DynamicGDBGExport.zip

Best regards,
Haneef


SU SureshKumar May 17, 2007 08:14 AM UTC

Hello Haneef,
Unfortunately the solution does not solve the purpose,

pls let me know

(1) Does GridToExcel Method provide a overload, which can take handle of open excel file or something similar, instead of always saving into a new file.

(2) The requirement here is Update instead of Create

Thanks In Advance,
Suresh


HA haneefm Syncfusion Team May 17, 2007 06:41 PM UTC

Hi Suresh,

Please try the attached sample and let me know if this helps.

Sample : ModifiedDynamicGDBGExport.zip

Best regards,
Haneef


SU SureshKumar May 21, 2007 10:02 AM UTC

Hi Haneef,

The sample raises exceptions, pls provide a sample that can update the excel on a timer.

Thanks,
Suresh


HA haneefm Syncfusion Team May 21, 2007 10:01 PM UTC

Hi Suresh,

We were not able to reproduce the issue here. Is it possible for you to upload us a sample or modify the attached sample to reproduce the issue here? This will help us to analyse the issue further.

Sample : TimerforExcelExport.zip

Best regards,
Haneef

Note : The attached sample implements the timer for exporting the grid data to excel in a grid.


SU SureshKumar May 25, 2007 09:39 AM UTC

Hi Haneef,

The problem is still not solved, the requirement is to
simultaneously display the changing data in the grid in the Excel.

Meaning in the UI of the application the DataGrid is updated with the dynamic data, and the same has to reflect in the Excel file, even if it is open.

Pls provide a sample for this.

Thanks,
Suresh


HA haneefm Syncfusion Team May 25, 2007 11:25 PM UTC

Hi Suresh,

We apologies for the inconvenience, your requested event is currently not supported in our grid. Thank you for your patience.

With kindest regards,
Haneef


SU SureshKumar May 28, 2007 07:43 AM UTC

Very dis-appointing

Thanks.

>Hi Suresh,

We apologies for the inconvenience, your requested event is currently not supported in our grid. Thank you for your patience.

With kindest regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon