Porting data from dataset to MS Word
You can dump the contents of a data set to word/Excel sheet and dispaly it in the browser.1. Create a new web form and add a DataGrid control onto the form.Righ
June 20, 2004
You can dump the contents of a data set to word/Excel sheet and dispaly it in the browser.
1. Create a new web form and add a DataGrid control onto the form.Right-click on the grid and choose Auto Format from the context menu.
2. In the code behind just add this code in Page Render or Page Load event
Dim dataTbl As DataTable = _
CType(Application.Item("MyGridSet"), DataTable)
Response.ContentType = "application/ms-word"
Response.AddHeader("Content-Disposition", _
"inline;filename=Porttest.doc")
DataGrid1.DataSource = dt
DataGrid1.DataBind()
DataGrid1.RenderControl(writer)
On the current page provide a button to navigate to the new page and pass the dataset/datatable to that page.
About the Author
You May Also Like