Hi,
Well, there are quite a few approaches that can be used for your scenario. For example:
1) Use Aspose.Cells.GridWeb control to load the excel files into the grid for display. You may use the API i.e…,
GridWeb.WebWorksheets.ImportExcelFile(fileName) to load the file into the grid. Users can edit the file visually, apply formatting or other things. Now for saving the excel file from the gridweb to the disk or streams, you may use the code like:GridWeb.WebWorksheets.SaveToExcelFile(filename)
2) For saving the data (in the generated file) to SQL Server Database, you may try some approaches and select any one if it fits your scenario. For example, you may use your own code to fill a datatable based on the the excel file and then use ADO.NET API to fill the SQL Server Database table(s). You may import that data into the gridweb too, for example, you can use your own code using ADO.NET API to fill a datatable from your back end database tables using SQL query, now you may import the data to the gridweb using the view of that table, see the code:
GridWeb.WebWorksheets.ImportDataView(dataTable1.DefaultView, null, null)
Another way is to use data-binding feature of the GridWeb, the control provides this feature. For reference, please see the doc for reference: http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net/binding-worksheet-to-a-dataset-at-run-time-using-gridweb.html
You may use different GridWeb for databinding task.
Alternatively, you may use Aspose.Cells library for the task. For example, you may use the following line of code once the edited file is saved to disk/stream by Aspose.Cells.GridWeb control:
//******You can open the saved file using Aspose.Cells.Workbook.Open() method, now export / fill a datatable based on the sheet data in the cells, finally use ADO.NET API to fill the SQL Server Database table(s) for your need.//
Sample code:
Workbook wb = new Workbook();
wb.Open(“f:\test\MyExcelFile.xls”);
Worksheet ws = wb.Worksheets[0];
int trows = ws.Cells.MaxDataRow;
int tcols = ws.Cells.MaxDataColumn;
DataTable dt = ws.Cells.ExportDataTable(0, 0,trows, tcols, true);
Hope, this helps you.
Thank you.