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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Dynamically Update Excel from DataGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

60971 May 16,2007 09:50 AM UTC May 28,2007 07:43 AM UTC WinForms 8
loading
Tags: GridControl
SureshKumar
Asked On May 16, 2007 09:50 AM UTC

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



haneefm [Syncfusion]
Replied On 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

SureshKumar
Replied On 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

haneefm [Syncfusion]
Replied On 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

SureshKumar
Replied On 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

haneefm [Syncfusion]
Replied On 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.

SureshKumar
Replied On 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

haneefm [Syncfusion]
Replied On 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

SureshKumar
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;