C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » Tools »

Function to export datagrid to Word in ASP.NET and C#


Posted Date: 29 Aug 2009    Resource Type: Code Snippets    Category: Tools
Author: dotnetguru78Member Level: Bronze    
Rating: 1 out of 5Points: 4



Description :


The following function will export a datagrid into a word document
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

private void MyWordReport()
{
//exporting to ms word

Response.Clear();

Response.Buffer= true;

Response.ContentType = "application/msword";

Response.Charset = "";

this.EnableViewState = false;

System.IO.StringWriter oStringWriter = new System.IO.StringWriter();

System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);

//rendering the html content to textwriter

DataGrid1.RenderControl(oHtmlTextWriter);

Response.Write(oStringWriter.ToString());

Response.End();
}



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Export  .  Datagrid to Word  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Enter TFS Bug using TFS API
Return to Discussion Resource Index
Post New Resource
Category: Tools


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use