Free Support Forum - aspose.com

Exporting dat from excel

Hi,

I have an xls sheet coming up and after that i have changed the values in the sheet and now i want to send them back to database when user clicks the save button on toolbar .Can anyone help me regarding this .There is an exportDatatable i know about.I can get values from indivividual cells and save them.Is there anyway that i wil know when user starts editing the excel sheet i can capture in a event adn then send the changes back.Do i need to use Aspose.editor for this purpose.

Or else there is other option that i have a save button on my front end when we click that i can take values from cells and insert into database.

But,i want to know can i insert them when someone starts editing the doccument or hits save on toolbar.

Thank You,

Bindu.

Hi Bindu,

Well, you may extract data from excel worksheet to fill data into a datatable or array using ExportDataTable and ExportArray methods. For example if you use the first method, you need to creat your own code using ADO.NET components to update your datasource.

e.g..,

Workbook workbook = new Workbook();
workbook.Open(@"d:\test\MyFile.xls");
Worksheet worksheet = workbook.Worksheets[0];
DataTable dataTable = new DataTable();
dataTable = worksheet.Cells.ExportDataTable(0, 0, worksheet.Cells.MaxRow + 1, worksheet.Cells.MaxColumn + 1);
............
//now use your own code here to update the database(datasouce) with dataTable using ADO.NET APIs.
..............

Further to your query about events, Aspose.Cells for .NET does not support events and I am not sure about Aspose.Editor either. Aspose.Cells is a non-gui is a library used to perform all types of spreadsheet managment tasks.

If you do need some GUI control and want the user should perform all types of spreadsheet management tasks in WYSIWYG manner, you may use our other product i.e. Aspose.Grid, which is a control. The control does provide grid matrix an excel like environment used to read and save excel files. The control comes in two flavours, Aspose.Grid.Desktop for winform solutions and Aspose.Grid.Web for asp.net solutions. The control does allow databinding feature so you may directly bind the control (Aspose.Grid.Desktop or Aspose.Grid.Web) with the back end data source and direclty save it to database. The control does provide spreadsheet management features with support for events too.

You may download its evaluation version for free: http://www.aspose.com/community/files/53/visual-components/aspose.grid/entry126616.aspx

And for complete reference, please check the different sections in the documentation: http://www.aspose.com/documentation/visual-components/aspose.grid-for-.net/index.html

You may also check the Aspose.Grid.Web feature demos: http://www.aspose.com/demos/aspose.grid/default.htm

Thank you.