Hi,
Thank you for considering Aspose.
You can use worksheet.Cells.ImportDataGrid(dataGrid,0,0,false); to import the data from a datagrid to work sheet. Please see the sample code which will help you get your desired results
Sample Code:-
sheet.Cells["A1"].PutValue("Import a DataGrid");
sheet.Cells["A1"].Style.Font.IsBold = true;
DataTable dataTable = new DataTable("Products");
dataTable.Columns.Add("Product ID", typeof(Int32));
dataTable.Columns.Add("Product Name", typeof(string));
dataTable.Columns.Add("Units In Stock", typeof(Int32));
DataRow dr = dataTable.NewRow();
dr[0] = 1;
dr[1] = "Aniseed Syrup";
dr[2] = 15;
dataTable.Rows.Add(dr);
dr = dataTable.NewRow();
dr[0] = 2;
dr[1] = "Boston Crab Meat";
dr[2] = 123;
dataTable.Rows.Add(dr);
DataGrid dataGrid = new DataGrid();
dataGrid.DataSource = dataTable;
dataGrid.UseAccessibleHeader = true;
dataGrid.ShowHeader = true;
dataGrid.DataBind();
sheet.Cells.ImportDataGrid(dataGrid,0, 0, true);
sheet.AutoFitColumns();
Please see the following link for more information regarding the data import to a worksheet from a datagrid.
http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/importing-data-to-worksheets.html
Nausherwan Aslam
Support Developer,
Aspose Sialkot Team
Contact Us