User-325797852 posted
Hello,
I am working on an excel based report using asp.net with C#. I have moved my datatable to an excel sheet using the interop library. My datatable is dt.
Microsoft.Office.Interop.Excel.Worksheet Sheet1;
Microsoft.Office.Interop.Excel.Workbook WB1;
Sheet1 = (Microsoft.Office.Interop.Excel.Worksheet)WB1.ActiveSheet; //binding the sheet to the workbook
int rowCount = 1;
foreach (DataRow dr in dt.Rows)
{
rowCount += 1;
for (int i = 1; i < dt.Columns.Count + 1; i++)
{
Sheet1.Cells[rowCount+1, i] = dr[i - 1].ToString(); //writing the datarows
}
}
After this, I have written some code for formatting on the Sheet1. While this code runs, an excel sheet appears with gradual data population and formatting. I can save the file when the sheet gets completed.
Now this is when I am running the website at my local PC, when I would deploy the solution at the server I would certainly need to give a dialog box to the user so that he can save that sheet to his client PC.
Can anyone help me in developing a solution for that dialog box thing.