objstrbuild.Append(@"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">"); objstrbuild.Append("<head>"); objstrbuild.Append("<style type='text/css'>.divBlockcss{height:30px;padding:5px;width:150px;background-color: #67da67;}</style>"); objstrbuild.Append("</head>"); objstrbuild.Append("<body>"); if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { objstrbuild.Append("<table border='1'>"); objstrbuild.Append("<tr>"); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { objstrbuild.Append("<td style='border='1'>"); if (ds.Tables[0].Rows[i]["PositionCode"].ToString() != "*") { for (int j = Convert.ToInt16(ds.Tables[0].Rows[i]["PositionLevel"]); j>0 ; j--) { objstrbuild.Append("<div>"); objstrbuild.Append("<div style='height:30px;padding:5px;width:150px;background-color: #67da67;'>"); for (int k = 0; k < ds.Tables[1].Rows.Count; k++) { if (ds.Tables[0].Rows[i]["PositionID"].ToString() == ds.Tables[1].Rows[k]["PositionID"].ToString() && (j) == Convert.ToInt32(ds.Tables[1].Rows[k]["Level"]) && ds.Tables[0].Rows[i]["BlockNumber"].ToString() == ds.Tables[1].Rows[k]["Block"].ToString()) { objstrbuild.Append(ds.Tables[1].Rows[k]["ContainerCode"].ToString()); break; } } objstrbuild.Append("</div>"); objstrbuild.Append("<div style='font-weight:bold;'>"); objstrbuild.Append(ds.Tables[0].Rows[i]["PositionCode"].ToString() + "(Level-" + j.ToString() + ")"); objstrbuild.Append("</div>"); objstrbuild.Append("</div>"); } } else { objstrbuild.Append("<div>"); objstrbuild.Append("</div>"); } objstrbuild.Append("</td>"); } objstrbuild.Append("</tr>"); objstrbuild.Append("</table>"); } objstrbuild.Append("</body>"); objstrbuild.Append("</html>"); Response.Clear(); Response.AddHeader("Content-Disposition", "attachment;filename=" + "filename" + ".xls"); Response.ContentType = "application/ms-excel"; Response.ContentEncoding = System.Text.Encoding.Unicode; Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble()); Response.Cache.SetCacheability(HttpCacheability.NoCache); // not necessarily required Response.Charset = ""; Response.Output.Write(objstrbuild.ToString()); Response.End();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)