Click here to Skip to main content
15,919,028 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: How to generate Report in MS Word Pin
praveenanand31-Jan-07 20:21
praveenanand31-Jan-07 20:21 
AnswerRe: How to generate Report in MS Word Pin
praveenanand31-Jan-07 20:28
praveenanand31-Jan-07 20:28 
QuestionRe: How to generate Report in MS Word Pin
Jay_se31-Jan-07 22:32
Jay_se31-Jan-07 22:32 
AnswerRe: How to generate Report in MS Word Pin
praveenanand31-Jan-07 23:27
praveenanand31-Jan-07 23:27 
GeneralRe: How to generate Report in MS Word Pin
Jay_se31-Jan-07 23:54
Jay_se31-Jan-07 23:54 
GeneralRe: How to generate Report in MS Word Pin
praveenanand1-Feb-07 0:32
praveenanand1-Feb-07 0:32 
GeneralRe: How to generate Report in MS Word Pin
Jay_se1-Feb-07 1:02
Jay_se1-Feb-07 1:02 
GeneralRe: How to generate Report in MS Word Pin
praveenanand1-Feb-07 2:04
praveenanand1-Feb-07 2:04 
as an example take a sample grid and populate with data from database and then press button
here text and id of button is word


protected void word_Click(object sender, EventArgs e)
{

//string attachment = "attachment; filename=f.xls";
SqlDataAdapter da = new SqlDataAdapter("select * from empdata", cn);
DataSet dsExport = new DataSet();
da.Fill(dsExport);

System.IO.StringWriter tw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw =
new System.Web.UI.HtmlTextWriter(tw);
//DataGrid dgGrid = new DataGrid();
//dgGrid.DataSource = dsExport;

DataGrid1.DataSource = dsExport;


// //Report Header
hw.WriteLine("" +
"Report for the Employee Information: " +
"
");
//hw.WriteLine("
");
//// Response.AddHeader("emp info", attachment);

// // Get the HTML for the control.
//dgGrid.HeaderStyle.Font.Bold = true;
//dgGrid.DataBind();
//dgGrid.RenderControl(hw);

DataGrid1.HeaderStyle.Font.Bold = true;
DataGrid1.DataBind();
DataGrid1.RenderControl(hw);

// // Write the HTML back to the browser.
Response.ContentType = "application/msword";
this.EnableViewState = false;
Response.Write(tw.ToString());
Response.End();


}
GeneralRe: How to generate Report in MS Word Pin
praveenanand1-Feb-07 2:05
praveenanand1-Feb-07 2:05 
GeneralRe: How to generate Report in MS Word Pin
Jay_se1-Feb-07 2:08
Jay_se1-Feb-07 2:08 
AnswerRe: How to generate Report in MS Word Pin
Jay_se1-Feb-07 17:26
Jay_se1-Feb-07 17:26 
QuestionDatagrid Pin
kirthikirthi31-Jan-07 19:31
kirthikirthi31-Jan-07 19:31 
AnswerRe: Datagrid Pin
Sylvester george31-Jan-07 19:47
Sylvester george31-Jan-07 19:47 
GeneralRe: Datagrid Pin
kirthikirthi31-Jan-07 20:10
kirthikirthi31-Jan-07 20:10 
QuestionEnhanced Dropdownlist Pin
Vsree31-Jan-07 19:00
Vsree31-Jan-07 19:00 
AnswerRe: Enhanced Dropdownlist Pin
Vasudevan Deepak Kumar31-Jan-07 19:29
Vasudevan Deepak Kumar31-Jan-07 19:29 
GeneralRe: Enhanced Dropdownlist Pin
Vsree31-Jan-07 19:39
Vsree31-Jan-07 19:39 
AnswerRe: Enhanced Dropdownlist Pin
Vsree31-Jan-07 20:16
Vsree31-Jan-07 20:16 
QuestionAdd elements from one ListBox to another ListBox Using JavaScript Pin
varshavmane31-Jan-07 18:10
varshavmane31-Jan-07 18:10 
AnswerRe: Add elements from one ListBox to another ListBox Using JavaScript Pin
Venkatesh Mookkan31-Jan-07 18:23
Venkatesh Mookkan31-Jan-07 18:23 
GeneralRe: Add elements from one ListBox to another ListBox Using JavaScript Pin
varshavmane31-Jan-07 18:56
varshavmane31-Jan-07 18:56 
GeneralRe: Add elements from one ListBox to another ListBox Using JavaScript Pin
Venkatesh Mookkan1-Feb-07 0:15
Venkatesh Mookkan1-Feb-07 0:15 
Questiontext highlight in pdf files Pin
amrtita31-Jan-07 18:05
amrtita31-Jan-07 18:05 
QuestionWriting the contents of response object into an ExcelSheet Pin
crazy_mads31-Jan-07 16:39
crazy_mads31-Jan-07 16:39 
Questionlogin form Pin
saravanan0531-Jan-07 12:27
saravanan0531-Jan-07 12:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.