hi
this is kavita.
currently I m creating report in .net n the requirement is not to use crystal report.report should be in ms-excel or ms-word
any help?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
PHANI NADIGADDAPosted Jan 2, 2007, 3:42 PM
private
void btnExportExcel_Click(object sender, System.EventArgs e){
DataSet ds = this.getMasters();
Response.AddHeader("Content-Disposition", "attachment; filename=Checking.doc");
string strHTMLBody = null;
string sBgColor;
int iRowCounter = 2;
strHTMLBody += "
strHTMLBody += "
foreach(DataRow dr in ds.Tables[0].Rows)";" + dr["UserID"].ToString() + " ";" + dr["FirstName"].ToString() + " ";" + dr["LastName"].ToString() + " ";" + dr["ManagerID"].ToString() + " ";" + dr["Location"].ToString() + " "; ";
{
if(iRowCounter % 2 == 0)
sBgColor = " bgColor ='#C0C0FF'";
else
sBgColor = " bgcolor='#FFFFFF'";
strHTMLBody += "
strHTMLBody += "
strHTMLBody += "
strHTMLBody += "
strHTMLBody += "
strHTMLBody += "
strHTMLBody += "
iRowCounter++;
}
strHTMLBody += "
Response.Write(strHTMLBody);
Response.End();
}
ALL THE BEST.