Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;
 
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        StringBuilder sbDocBody = new StringBuilder();
 
        sbDocBody.Append("<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:w='urn:schemas-microsoft-com:office:word' xmlns=> ");
        sbDocBody.Append("<!--[if gte mso 9]><xml> <w:worddocument xmlns:w="#unknown">  <w:view>Print</w:view>  <w:zoom>90</w:zoom></w:worddocument></xml><![endif]-->");
        sbDocBody.Append("<style>p.MsoFooter, li.MsoFooter, div.MsoFooter{margin:0in;margin-bottom:.0001pt;mso-pagination:widow-orphan;tab-stops:center 3.0in right 6.0in;font-size:12.0pt;}");
        sbDocBody.Append("<style>@page Section1{size:8.5in 11.0in; margin:1.0in 1.0in 1.0in 1.0in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-title-page:yes; mso-header: h1; border:solid black 2pt; padding:24.0pt 24.0pt 24.0pt 24.0pt;mso-footer: f1;mso-first-header: fh1;mso-first-footer: ff1;mso-paper-source:0;}div.Section1{page:Section1;}");
        sbDocBody.Append("table#hrdftrtbl{margin:0in 0in 0in 900in;width:1px;height:1px;overflow:hidden;}</style>");
        sbDocBody.Append("<body lang=EN-US style='tab-interval:.5in'>");
        sbDocBody.Append("<div class="Section1"><table id="hrdftrtbl" border="0" cellspacing="0" cellpadding="0">");
        sbDocBody.Append("<tr><td>");
        sbDocBody.Append("<div style="mso-element:header" id="h1">");
        sbDocBody.Append("<div class="MsoHeader">");
        sbDocBody.Append("<table width="100%">");
 
        sbDocBody.Append("<tr><td align="left">Faculty of engineering <span style="mso-field-code: "><span style="mso-no-proof:yes"></span></span></td>");
        sbDocBody.Append("<td align="right"><span>Program</span></td></tr>");
        sbDocBody.Append("<tr><td colspan="2"><hr /></td></tr>");
        sbDocBody.Append("</table>");
        sbDocBody.Append("</div>");
        sbDocBody.Append("</div>");
 
        sbDocBody.Append("<div style="mso-element:footer" id="f1">");
        sbDocBody.Append("<p class="MsoFooter">");
        sbDocBody.Append(" <span style="mso-tab-count:2'"></span>");
        sbDocBody.Append("<table width="100%">");
        sbDocBody.Append("<tr><td colspan="2"><hr /></td></tr>");
        sbDocBody.Append("<tr><td align="center">Page <span style="mso-field-code: PAGE "><span style="mso-no-proof:yes"></span></span> of <span style="mso-field-code: NUMPAGES "></span></td>");
        //sbDocBody.Append("<td align="right">Downloaded on: <span> " + DateTime.Now.ToString("dd MMM yyyy h:MM tt") + "</span></td></tr>");
        sbDocBody.Append("</table></p></div>");
        sbDocBody.Append("<div style="mso-element:header" id="fh1">");
        sbDocBody.Append("<div class="MsoHeader">");
        sbDocBody.Append("<table width="100%">");
        sbDocBody.Append("<tr><td align="left">Faculty of engineering <span style="mso-field-code: "><span style="mso-no-proof:yes"></span></span></td>");
        sbDocBody.Append("<td align="right">Program <span></span></td></tr>");
        sbDocBody.Append("<tr><td colspan="2"><hr /><br /></td></tr>");
        sbDocBody.Append("</table>");
        sbDocBody.Append("</div></div>");
        sbDocBody.Append("<div style="mso-element:footer" id="ff1">");
        sbDocBody.Append("<p class="MsoFooter"><span lang="EN-US" style="mso-ansi-language:EN-US">");
        sbDocBody.Append(" <table width="100%">");
        sbDocBody.Append("<tr><td colspan="2"><hr /></td></tr>");
        sbDocBody.Append("<tr><td align="center">Page <span style="mso-field-code: PAGE "><span style="mso-no-proof:yes"></span></span> of <span style="mso-field-code: NUMPAGES "></span></td>");
        // sbDocBody.Append("<td align="right">Downloaded on: <span>" + DateTime.Now.ToString("dd MMM yyyy h:MM tt") + "</span></td></tr>");
        sbDocBody.Append("</table>");
        sbDocBody.Append("<o:p xmlns:o="#unknown"></o:p></span></p>");
        sbDocBody.Append("</div>");
        sbDocBody.Append("</td></tr>");
        sbDocBody.Append("</table>");
        instructor(sbDocBody);
        qualification(sbDocBody);
        service(sbDocBody);
        course_taught(sbDocBody);
        Thesis_Supervised(sbDocBody);
        experience(sbDocBody);
        research_patent(sbDocBody);
        Licene_certification(sbDocBody);
        HttpContext.Current.Response.Clear();
        HttpContext.Current.Response.Buffer = true;
        HttpContext.Current.Response.AppendHeader("Content-Type", "application/msword");
        HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=CV1.doc");
        Response.Charset = "";
        HttpContext.Current.Response.Write(sbDocBody.ToString());
        HttpContext.Current.Response.End();
    }
 
    public void general(StringBuilder sbDocBody)
    {
        DataTable dtTemp = new DataTable("MyDataTable");
        sbDocBody.Append("<br><br>");
        dtTemp.Columns.Add("DR ALI M AL BAHI");
        dtTemp.Rows.Add("Professor, Aeronautical Engineering Dept.,King Abdul Aziz university. ");
        sbDocBody.Append("<style>");
        sbDocBody.Append(".Header{background-color:#B0C4DE; color:black; font-weight:bold;font-family:Verdana; font-size:15px;text-align:left}");
        sbDocBody.Append(".SectionHeader { background-color:#8080aa; color:#ffffff; font-family:Verdana; font-size:10px;font-weight:;text-align:center}");
        sbDocBody.Append(".Content { background-color:#FFFFFF; color:black; font-family:Verdana; font-size:15px;text-align:left}");
        sbDocBody.Append(".Label { background-color:#ccccee; color:#000000; font-family:Verdana; font-size:10px;text-align:center}");
        sbDocBody.Append("<table align="\" cellpadding="1" cellspacing="0" style="\">");
        sbDocBody.Append("<tr><td width="\">");
        sbDocBody.Append("<table width="\" cellpadding="1" cellspacing="1" style="\">");
 
        if (dtTemp.Rows.Count > 0)
        {
            sbDocBody.Append("<tr><td>");
            sbDocBody.Append("<table width="\" cellpadding="\" cellspacing="\"><tr><td>");
            //
            // Add Column Headers
            sbDocBody.Append("<tr><td width="\"> </td></tr>");
            sbDocBody.Append("<tr><td height="\"> </td></tr>");
            sbDocBody.Append("<tr>");
            sbDocBody.Append("<td></td>");
            for (int i = 0; i < dtTemp.Columns.Count; i++)
            {
                sbDocBody.Append("<td class="\" width="\">" + dtTemp.Columns[i].ToString().Replace(".", "<br>") + "</br></td>");
            }
            sbDocBody.Append("</tr>");
            //
            // Add Data Rows
            for (int i = 0; i < dtTemp.Rows.Count; i++)
            {
                sbDocBody.Append("<tr>");
                sbDocBody.Append("<td> </td>");
 
                for (int j = 0; j < dtTemp.Columns.Count; j++)
                {
                    sbDocBody.Append("<td class="\">" + dtTemp.Rows[i][j].ToString() + "</td>");
                }
                sbDocBody.Append("</tr>");
            }
            sbDocBody.Append("</td></tr></table><br>");
            sbDocBody.Append("</br></td></tr></table>");
            sbDocBody.Append("</td></tr></table>");
        }
    }
 
    public void instructor(StringBuilder sbDocBody)
    {
        DataTable dtTemp = new DataTable("MyDataTable");
        sbDocBody.Append("<br><br>");
 
        dtTemp.Columns.Add("Name");
        dtTemp.Columns.Add("Code");
        dtTemp.Columns.Add("department");
        dtTemp.Columns.Add("designation");
        dtTemp.Columns.Add("email");
        dtTemp.Columns.Add("mobile");
        dtTemp.Columns.Add("location");
        dtTemp.Columns.Add("address");
        dtTemp.Columns.Add("postbox");
        dtTemp.Columns.Add("phone");
        dtTemp.Columns.Add("address type");
        dtTemp.Rows.Add("vin", "01", "dept", "desg", "email", "9496184698", "calicut", "  calicut", "673503", "3246798", "address");
        dtTemp.Rows.Add("vinu", "02", "dept1", "desg1", "email1", "9496184698", "calicut1", " calicut1", "673503", "3246798", "address1");
        //StringBuilder sbDocBody = new StringBuilder(); 
 
        // Declare Styles
        sbDocBody.Append("<left>Instructor Details<br></br></left>");
        sbDocBody.Append("<style>");
        sbDocBody.Append(".Header{background-color:#B0C4DE; color:black; font-weight:bold;font-family:Verdana; font-size:10px;text-align:center}");
        sbDocBody.Append(".SectionHeader { background-color:#8080aa; color:#ffffff; font-family:Verdana; font-size:10px;font-weight:;text-align:center}");
        sbDocBody.Append(".Content { background-color:#FFFFFF; color:black; font-family:Verdana; font-size:10px;text-align:center}");
        sbDocBody.Append(".Label { background-color:#ccccee; color:#000000; font-family:Verdana; font-size:10px;text-align:center}");
 
        sbDocBody.Append("</style>");
        // StringBuilder sbContent = new StringBuilder(); ;
 
        sbDocBody.Append("<table align="\" cellpadding="1" cellspacing="0" style="\">");
        sbDocBody.Append("<tr><td width="\">");
        sbDocBody.Append("<table width="\" cellpadding="1" cellspacing="1" style="\">");
        //
        if (dtTemp.Rows.Count > 0)
        {
            sbDocBody.Append("<tr><td>");
            sbDocBody.Append("<table width="\" cellpadding="\" cellspacing="\"><tr><td>");
            //
            // Add Column Headers
            sbDocBody.Append("<tr><td width="\"> </td></tr>");
            sbDocBody.Append("<tr>");
            sbDocBody.Append("<td> </td>");
            for (int i = 0; i < dtTemp.Columns.Count; i++)
            {
                sbDocBody.Append("<td class="\" width="\">" + dtTemp.Columns[i].ToString().Replace(".", "<br>") + "</br></td>");
            }
            sbDocBody.Append("</tr>");
            //
            // Add Data Rows
            for (int i = 0; i < dtTemp.Rows.Count; i++)
            {
                sbDocBody.Append("<tr>");
                sbDocBody.Append("<td> </td>");
 
                for (int j = 0; j < dtTemp.Columns.Count; j++)
                {
                    sbDocBody.Append("<td class="\">" + dtTemp.Rows[i][j].ToString() + "</td>");
                }
                sbDocBody.Append("</tr>");
            }
            sbDocBody.Append("</td></tr></table><br>");
            sbDocBody.Append("</br></td></tr></table>");
            sbDocBody.Append("</td></tr></table>");
        }
    }
 
    public void qualification(StringBuilder sbDocBody)
    {
        DataTable dt = new DataTable();
 
        sbDocBody.Append("<br><br>");
        dt.Columns.Add("Degree");
        dt.Columns.Add("Field");
        dt.Columns.Add("Year");
        dt.Columns.Add("Year of passing");
        dt.Rows.Add("phD", "Aeronautical Engineering", "ENSAE,Toulouse,France", "1983");
        dt.Rows.Add("MS", "Aeronautical Engineering", "ENSAE,Toulouse,France", "1980");
        dt.Rows.Add("BS", "Aeronautical Engineering", "Cairo University,Egypth", "1975");
        //StringBuilder sbDocBody = new StringBuilder(); ;
 
        // Declare Styles
        sbDocBody.Append("<left>Qualification Details</left><br>");
        sbDocBody.Append("<style>");
        sbDocBody.Append(".Header {  background-color:#B0C4DE; color:black; font-weight:bold;font-family:Verdana; font-size:10px;text-align:center}");
        sbDocBody.Append(".SectionHeader { background-color:#8080aa; color:#ffffff; font-family:Verdana; font-size:10px;font-weight:;text-align:center}");
        sbDocBody.Append(".Content { background-color:#FFFFFF; color:black; font-family:Verdana; font-size:10px;text-align:center}");
        sbDocBody.Append(".Label { background-color:#ccccee; color:#000000; font-family:Verdana; font-size:10px; text-align:center;}");
        sbDocBody.Append("</style>");
 
        StringBuilder sbContent = new StringBuilder(); ;
        sbDocBody.Append("<br><table align="\" cellpadding="1" cellspacing="0" style="\">");
        sbDocBody.Append("<tr><td width="\">");
        sbDocBody.Append("<table width="\" cellpadding="1" cellspacing="1" style="\">");
        //
        if (dt.Rows.Count > 0)
        {
            sbDocBody.Append("<tr><td>");
            sbDocBody.Append("<table width="\" cellpadding="\" cellspacing="\"><tr><td>");
            //
            // Add Column Headers
            sbDocBody.Append("<tr><td width="\"> </td></tr>");
            sbDocBody.Append("<tr>");
            sbDocBody.Append("<td> </td>");
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                sbDocBody.Append("<td class="\" width="\">" + dt.Columns[i].ToString().Replace(".", "<br>") + "</br></td>");
            }
            sbDocBody.Append("</tr>");
            //
            // Add Data Rows
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                sbDocBody.Append("<tr>");
                sbDocBody.Append("<td> </td>");
                for (int j = 0; j < dt.Columns.Count; j++)
                {
                    sbDocBody.Append("<td class="\">" + dt.Rows[i][j].ToString() + "</td>");
                }
                sbDocBody.Append("</tr>");
            }
            sbDocBody.Append("</td></tr></table>");
            sbDocBody.Append("</td></tr></table>");
            sbDocBody.Append("</td></tr></table>");
        }
        //
        //HttpContext.Current.Response.Clear();
        //HttpContext.Current.Response.Buffer = true;
        ////
        //HttpContext.Current.Response.AppendHeader("Content-Type", "application/msword");
        //HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=Employee.doc");
        //HttpContext.Current.Response.Write(sbDocBody.ToString());
        //HttpContext.Current.Response.End();
 
    }
    public void service(StringBuilder sbDocBody)
    {
        DataTable dt = new DataTable();
        sbDocBody.Append("<br><br>");
 
        dt.Columns.Add("Appointment date");
        dt.Columns.Add("From date");
        dt.Columns.Add("To date");
        dt.Columns.Add("Accadamic rank");
        dt.Columns.Add("Department");
        dt.Rows.Add("1987", "1978", "1993", "Assistent professor", "Aeronautical engineering");
        dt.Rows.Add("1990", "1993", "1999", "Assistent professor", "Aeronautical engineering");
        dt.Rows.Add("1999", "2000", "2001", "professor", "Aeronautical engineering");
        //StringBuilder sbDocBody = new StringBuilder(); ;
 
        // Declare Styles
        sbDocBody.Append("<left>Services in KAU</left><br>");
        sbDocBody.Append("<style>");
 
        sbDocBody.Append(".Header {  background-color:#B0C4DE; color:black; font-weight:bold;font-family:Verdana; font-size:10px;text-align:center}");
        sbDocBody.Append(".SectionHeader { background-color:#8080aa; color:#ffffff; font-family:Verdana; font-size:10px;font-weight:;text-align:center}");
        sbDocBody.Append(".Content { background-color:#FFFFFF; color:black; font-family:Verdana; font-size:10px;text-align:center}");
        sbDocBody.Append(".Label { background-color:#ccccee; color:#000000; font-family:Verdana; font-size:10px; text-align:center;}");
        sbDocBody.Append("</style>");
 
        //
        StringBuilder sbContent = new StringBuilder(); ;
        sbDocBody.Append("<br><table align="\" cellpadding="1" cellspacing="0" style="\">");
        sbDocBody.Append("<tr><td width="\">");
        sbDocBody.Append("<table width="\" cellpadding="1" cellspacing="1" style="\">");
        //
        if (dt.Rows.Count > 0)
        {
            sbDocBody.Append("<tr><td>");
            sbDocBody.Append("<table width="\" cellpadding="\" cellspacing="\"><tr><td>");
            //
            // Add Column Headers
            sbDocBody.Append("<tr><td width="\"> </td></tr>");
            sbDocBody.Append("<tr>");
            sbDocBody.Append("<td> </td>");
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                sbDocBody.Append("<td class="\" width="\">" + dt.Columns[i].ToString().Replace(".", "<br>") + "</br></td>");
            }
            sbDocBody.Append("</tr>");
            //
            // Add Data Rows
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                sbDocBody.Append("<tr>");
                sbDocBody.Append("<td> </td>");
                for (int j = 0; j < dt.Columns.Count; j++)
                {
                    sbDocBody.Append("<td class="\">" + dt.Rows[i][j].ToString() + "</td>");
                }
                sbDocBody.Append("</tr>");
            }
            sbDocBody.Append("</td></tr></table>");
            sbDocBody.Append("</td></tr></table>");
            sbDocBody.Append("</td></tr></table>");
        }
        //
        //HttpContext.Current.Response.Clear();
        //HttpContext.Current.Response.Buffer = true;
        ////
        //HttpContext.Current.Response.AppendHeader("Content-Type", "application/msword");
        //HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=Employee.doc");
        //HttpContext.Current.Response.Write(sbDocBody.ToString());
        //HttpContext.Current.Response.End();
    }
 
    public void course_taught(StringBuilder sbDocBody)
    {
        DataTable dt = new DataTable();
        sbDocBody.Append("<br><br>");
 
        dt.Columns.Add("Course_taught");
        dt.Rows.Add("Engineering Mechanics 1,Thermo-Fluid lab,Incompressible AeroDynamics,Viscous Aerodynamics,Aircraft Systems and Instruments,Aircraft Maintanance Engineering,computer application in Aeronautical eEngineering");
 
        //StringBuilder sbDocBody = new StringBuilder(); ;
 
        sbDocBody.Append("<left>Course Taught</left><br>");
        // Declare Styles
        sbDocBody.Append("<style>");
        sbDocBody.Append(".Header {  background-color:#B0C4DE; color:black; font-weight:bold;font-family:Verdana; font-size:10px;text-align:left}");
        sbDocBody.Append(".SectionHeader { background-color:#8080aa; color:#ffffff; font-family:Verdana; font-size:10px;font-weight:;text-align:center}");
        sbDocBody.Append(".Content { background-color:#FFFFFF; color:black; font-family:Verdana; font-size:10px;text-align:left}");
        sbDocBody.Append(".Label { background-color:#ccccee; color:#000000; font-family:Verdana; font-size:10px; text-align:center;}");
        sbDocBody.Append("</style>");
 
        StringBuilder sbContent = new StringBuilder(); ;
        sbDocBody.Append("<br><table align="\" cellpadding="1" cellspacing="0" style="\">");
        sbDocBody.Append("<tr><td width="\">");
        sbDocBody.Append("<table width="\" cellpadding="1" cellspacing="1" style="\">");
        //
        if (dt.Rows.Count > 0)
        {
            sbDocBody.Append("<tr><td>");
            sbDocBody.Append("<table width="\" cellpadding="\" cellspacing="\"><tr><td>");
            //
            // Add Column Headers
            sbDocBody.Append("<tr><td width="\"> </td></tr>");
            sbDocBody.Append("<tr>");
            sbDocBody.Append("<td> </td>");
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                sbDocBody.Append("<td class="\" width="\">" + dt.Columns[i].ToString().Replace(".", "<br>") + "</br></td>");
            }
            sbDocBody.Append("</tr>");
            //
            // Add Data Rows
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                sbDocBody.Append("<tr>");
                sbDocBody.Append("<td> </td>");
                for (int j = 0; j < dt.Columns.Count; j++)
                {
                    sbDocBody.Append("<td class="\">" + dt.Rows[i][j].ToString() + "</td>");
                }
                sbDocBody.Append("</tr>");
            }
            sbDocBody.Append("</td></tr></table>");
            sbDocBody.Append("</td></tr></table>");
            sbDocBody.Append("</td></tr></table>");
        }
        //
        //HttpContext.Current.Response.Clear();
        //HttpContext.Current.Response.Buffer = true;
        ////
        //HttpContext.Current.Response.AppendHeader("Content-Type", "application/msword");
        //HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=Employee.doc");
        //HttpContext.Current.Response.Write(sbDocBody.ToString());
        //HttpContext.Current.Response.End();
    }
 
    public void experience(StringBuilder sbDocBody)
    {
        DataTable dtTemp = new DataTable("MyDataTable");
        sbDocBody.Append("<br><br>");
        dtTemp.Columns.Add("From date");
        dtTemp.Columns.Add("Todate");
        dtTemp.Columns.Add("Role");
        dtTemp.Columns.Add("Institution");
        dtTemp.Columns.Add("Country");
        dtTemp.Columns.Add("Description");
        dtTemp.Rows.Add("1975", "1977", "Egypthian Airforce training centere", "Helwan", "Egypth", "descriptions");
        dtTemp.Rows.Add("1977", "1978", "R&D engineer,Aircraft engines Factory", "Helwan", "Egypth", "descriptions");
 
        //StringBuilder sbDocBody = new StringBuilder(); 
 
        sbDocBody.Append("<left>Experience Details</left><br>");
        // Declare Styles
        sbDocBody.Append("<style>");
        sbDocBody.Append(".Header {  background-color:#B0C4DE; color:black; font-weight:bold;font-family:Verdana; font-size:10px;text-align:center}");
        sbDocBody.Append(".SectionHeader { background-color:#8080aa; color:#ffffff; font-family:Verdana; font-size:10px;font-weight:;text-align:center}");
        sbDocBody.Append(".Content { background-color:#FFFFFF; color:black; font-family:Verdana; font-size:10px;text-align:center}");
        sbDocBody.Append(".Label { background-color:#ccccee; color:#000000; font-family:Verdana; font-size:10px; text-align:center;}");
        sbDocBody.Append("</style>");
 
        //
        StringBuilder sbContent = new StringBuilder(); ;
        sbDocBody.Append("<br><table align="\" cellpadding="1" cellspacing="0" style="\">");
        sbDocBody.Append("<tr><td width="\">");
        sbDocBody.Append("<table width="\" cellpadding="1" cellspacing="1" style="\">");
        //
        if (dtTemp.Rows.Count > 0)
        {
            sbDocBody.Append("<tr><td>");
            sbDocBody.Append("<table width="\" cellpadding="\" cellspacing="\"><tr><td>");
            //
            // Add Column Headers
            sbDocBody.Append("<tr><td width="\"> </td></tr>");
            sbDocBody.Append("<tr>");
            sbDocBody.Append("<td> </td>");
            for (int i = 0; i < dtTemp.Columns.Count; i++)
            {
                sbDocBody.Append("<td class="\" width="\">" + dtTemp.Columns[i].ToString().Replace(".", "<br>") + "</br></td>");
            }
            sbDocBody.Append("</tr>");
            //
            // Add Data Rows
            for (int i = 0; i < dtTemp.Rows.Count; i++)
            {
                sbDocBody.Append("<tr>");
                sbDocBody.Append("<td> </td>");
                for (int j = 0; j < dtTemp.Columns.Count; j++)
                {
                    sbDocBody.Append("<td class="\">" + dtTemp.Rows[i][j].ToString() + "</td>");
                }
                sbDocBody.Append("</tr>");
            }
            sbDocBody.Append("</td></tr></table>");
            sbDocBody.Append("</td></tr></table>");
            sbDocBody.Append("</td></tr></table>");
        }
    }
 
    public void research_patent(StringBuilder sbDocBody)
    {
        DataTable dtTemp = new DataTable("MyDataTable");
        sbDocBody.Append("<br><br>");
        dtTemp.Columns.Add("Grand_no");
        dtTemp.Columns.Add("Institution");
        dtTemp.Columns.Add("Project Description");
        dtTemp.Columns.Add("Project details");
        dtTemp.Columns.Add("Year");
        dtTemp.Rows.Add("1", "inst", "project des", "project details", "2011");
        dtTemp.Rows.Add("1", "inst", "project des", "project details", "2011");
        dtTemp.Rows.Add("1", "inst", "project des", "project details", "2011");
        //StringBuilder sbDocBody = new StringBuilder(); 
 
        sbDocBody.Append("<left>Research/Patent Details</left><br>");
        // Declare Styles
        sbDocBody.Append("<style>");
        sbDocBody.Append(".Header {  background-color:#B0C4DE; color:black; font-weight:bold;font-family:Verdana; font-size:10px;text-align:center}");
        sbDocBody.Append(".SectionHeader { background-color:#8080aa; color:#ffffff; font-family:Verdana; font-size:10px;font-weight:;text-align:center}");
        sbDocBody.Append(".Content {background-color:#FFFFFF; color:black; font-family:Verdana; font-size:10px;text-align:center}");
        sbDocBody.Append(".Label { background-color:#ccccee; color:#000000; font-family:Verdana; font-size:10px; text-align:center}");
        sbDocBody.Append("</style>");
 
        StringBuilder sbContent = new StringBuilder(); ;
        sbDocBody.Append("<br><table align="\" cellpadding="1" cellspacing="0" style="\">");
        sbDocBody.Append("<tr><td width="\">");
        sbDocBody.Append("<table width="\" cellpadding="1" cellspacing="1" style="\">");
        //
        if (dtTemp.Rows.Count > 0)
        {
            sbDocBody.Append("<tr><td>");
            sbDocBody.Append("<table width="\" cellpadding="\" cellspacing="\"><tr><td>");
            //
            // Add Column Headers
            sbDocBody.Append("<tr><td width="\"> </td></tr>");
            sbDocBody.Append("<tr>");
            sbDocBody.Append("<td> </td>");
            for (int i = 0; i < dtTemp.Columns.Count; i++)
            {
                sbDocBody.Append("<td class="\" width="\">" + dtTemp.Columns[i].ToString().Replace(".", "<br>") + "</br></td>");
            }
            sbDocBody.Append("</tr>");
            //
            // Add Data Rows
            for (int i = 0; i < dtTemp.Rows.Count; i++)
            {
                sbDocBody.Append("<tr>");
                sbDocBody.Append("<td> </td>");
                for (int j = 0; j < dtTemp.Columns.Count; j++)
                {
                    sbDocBody.Append("<td class="\">" + dtTemp.Rows[i][j].ToString() + "</td>");
                }
                sbDocBody.Append("</tr>");
            }
            sbDocBody.Append("</td></tr></table>");
            sbDocBody.Append("</td></tr></table>");
            sbDocBody.Append("</td></tr></table>");
        }
    }
 
    public void Licene_certification(StringBuilder sbDocBody)
    {
        DataTable dtTemp = new DataTable("MyDataTable");
        sbDocBody.Append("<br><br>");
        dtTemp.Columns.Add("Licence");
        dtTemp.Columns.Add("Country");
        dtTemp.Rows.Add("Licen", "india");
        dtTemp.Rows.Add("Licen", "india");
        dtTemp.Rows.Add("Licen", "india");
        //StringBuilder sbDocBody = new StringBuilder(); 
 
        sbDocBody.Append("<left>Licence/Certification Details</left><br>");
 
        // Declare Styles
        sbDocBody.Append("<style>");
        sbDocBody.Append(".Header {  background-color:#B0C4DE; color:black; font-weight:bold;font-family:Verdana; font-size:10px;text-align:center}");
        sbDocBody.Append(".SectionHeader { background-color:#8080aa; color:#ffffff; font-family:Verdana; font-size:10px;font-weight:;text-align:center}");
        sbDocBody.Append(".Content { background-color:#FFFFFF; color:black; font-family:Verdana; font-size:10px;text-align:center}");
        sbDocBody.Append(".Label { background-color:#ccccee; color:#000000; font-family:Verdana; font-size:10px; text-align:center;}");
        sbDocBody.Append("</style>");
 
        StringBuilder sbContent = new StringBuilder(); ;
        sbDocBody.Append("<br><table align="\" cellpadding="1" cellspacing="0" style="\">");
        sbDocBody.Append("<tr><td width="\">");
        sbDocBody.Append("<table width="\" cellpadding="1" cellspacing="1" style="\">");
        //
        if (dtTemp.Rows.Count > 0)
        {
            sbDocBody.Append("<tr><td>");
            sbDocBody.Append("<table width="\" cellpadding="\" cellspacing="\"><tr><td>");
            //
            // Add Column Headers
            sbDocBody.Append("<tr><td width="\"> </td></tr>");
            sbDocBody.Append("<tr>");
            sbDocBody.Append("<td> </td>");
            for (int i = 0; i < dtTemp.Columns.Count; i++)
            {
                sbDocBody.Append("<td class="\" width="\">" + dtTemp.Columns[i].ToString().Replace(".", "<br>") + "</br></td>");
            }
            sbDocBody.Append("</tr>");
            //
            // Add Data Rows
            for (int i = 0; i < dtTemp.Rows.Count; i++)
            {
                sbDocBody.Append("<tr>");
                sbDocBody.Append("<td> </td>");
                for (int j = 0; j < dtTemp.Columns.Count; j++)
                {
                    sbDocBody.Append("<td class="\">" + dtTemp.Rows[i][j].ToString() + "</td>");
                }
                sbDocBody.Append("</tr>");
            }
            sbDocBody.Append("</td></tr></table>");
            sbDocBody.Append("</td></tr></table>");
            sbDocBody.Append("</td></tr></table>");
            sbDocBody.Append("</body></html>");
        }
    }
 
    public void Thesis_Supervised(StringBuilder sbDocBody)
    {
        DataTable dt = new DataTable();
        sbDocBody.Append("<br><br>");
 
        dt.Columns.Add("Thesis Supervised");
        dt.Rows.Add("1.controll Law for Auto Guided vehicles tracking a predetermined Trajectory,MS Thesis");
        dt.Rows.Add("2.Generation of Optimal Trajectories for Terrain Following Vehicles,MS Thesis Trajectory,MS Thesis");
        dt.Rows.Add("3.Full envolape missile Autopilot Design,MS thesis");
 
        //StringBuilder sbDocBody = new StringBuilder(); ;
        sbDocBody.Append("<left>Thesis Supervised</left><br>");
        // Declare Styles
        sbDocBody.Append("<style>");
        sbDocBody.Append(".Header {  background-color:#B0C4DE; color:black; font-weight:bold;font-family:Verdana; font-size:10px;text-align:left}");
        sbDocBody.Append(".SectionHeader { background-color:#8080aa; color:#ffffff; font-family:Verdana; font-size:10px;font-weight:;text-align:center}");
        sbDocBody.Append(".Content { background-color:#FFFFFF; color:black; font-family:Verdana; font-size:10px;text-align:left}");
        sbDocBody.Append(".Label { background-color:#ccccee; color:#000000; font-family:Verdana; font-size:10px; text-align:center;}");
        sbDocBody.Append("</style>");
 
        StringBuilder sbContent = new StringBuilder(); ;
        sbDocBody.Append("<br><table align="\" cellpadding="1" cellspacing="0" style="\">");
        sbDocBody.Append("<tr><td width="\">");
        sbDocBody.Append("<table width="\" cellpadding="1" cellspacing="1" style="\">");
        //
        if (dt.Rows.Count > 0)
        {
            sbDocBody.Append("<tr><td>");
            sbDocBody.Append("<table width="\" cellpadding="\" cellspacing="\"><tr><td>");
            //
            // Add Column Headers
            sbDocBody.Append("<tr><td width="\"> </td></tr>");
            sbDocBody.Append("<tr>");
            sbDocBody.Append("<td> </td>");
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                sbDocBody.Append("<td class="\" width="\">" + dt.Columns[i].ToString().Replace(".", "<br>") + "</br></td>");
            }
            sbDocBody.Append("</tr>");
            //
            // Add Data Rows
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                sbDocBody.Append("<tr>");
                sbDocBody.Append("<td> </td>");
                for (int j = 0; j < dt.Columns.Count; j++)
                {
                    sbDocBody.Append("<td class="\">" + dt.Rows[i][j].ToString() + "</td>");
                }
                sbDocBody.Append("</tr>");
            }
            sbDocBody.Append("</td></tr></table>");
            sbDocBody.Append("</td></tr></table>");
            sbDocBody.Append("</td></tr></table>");
        }
        //
        //HttpContext.Current.Response.Clear();
        //HttpContext.Current.Response.Buffer = true;
        ////
        //HttpContext.Current.Response.AppendHeader("Content-Type", "application/msword");
        //HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=Employee.doc");
        //HttpContext.Current.Response.Write(sbDocBody.ToString());
        //HttpContext.Current.Response.End();
    }
   
 
}
Posted 5-Jun-13 2:48am
Edited 5-Jun-13 5:42am
v7
Comments
joshrduncan2012 at 5-Jun-13 9:28am
   
Please format your code properly using the <pre> tags.
richcb at 5-Jun-13 10:43am
   
I attempted to format the code and it is way to messy. Just changing one character throws the whole thing off.
joshrduncan2012 at 5-Jun-13 10:44am
   
I thought the length would have something to do with the attempt to format this.
Cycy The Empress at 5-Jun-13 9:33am
   
And what is the question ?
ryanb31 at 5-Jun-13 10:37am
   
Holy smokes batman. That is way too much code. You need to narrow it down to the specific issue and specific relevant code.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 490
1 Maciej Los 299
2 BillWoodruff 174
3 /\jmot 170
4 Suraj Sahoo | Coding Passion 150
0 OriginalGriff 8,484
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,159
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 5 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100