locked
write html content in word document RRS feed

  • Question

  • User1732817135 posted

     i have a problem where i want to write contents from web form in word document in tabular format and send word doc in mail

    although its taking font etc correctly its not really taking table and rows nd td etc in word doc in html format here is my code to show

    strMemberDetails.Append(

    strMemberDetails.Append(

    strMemberDetails.Append(

    strMemberDetails.Append(

    strMemberDetails.Append(

    "<html><head></head><body>");@"<h1 title=Heading align=Center style=font-family: verdana; font -size:2 ;color: black'><u>MemberDetails</u> </ h1 > ");@"<br/><table align=center>");@"<tr><td>Name:</td><td>" + objMemberRegHeader.FirstName + "</td></tr></table>");"</body></html>");

    this code doesnt seem to render  table content in word doc 

    code used for saving in doc format on server is as follows

     

     

     

     

     

     

     

    {

    fp =

    fp.WriteLine(Server.HtmlDecode(data));

    fp.Close();

    }

     

    StreamWriter fp;string data = strData;string filename = DateTime.Now.Ticks.ToString() + ".doc";StringBuilder strvirtPath = new StringBuilder(Server.MapPath("testFolder"));if (System.IO.Directory.Exists(Server.MapPath("testFolder")))File.CreateText(strvirtPath.Append(@"\").Append(filename).ToString());else

    {

    System.IO.

    fp =

    fp.WriteLine(Server.HtmlDecode(data));

    fp.Close();

    }

     

    Directory.CreateDirectory(Server.MapPath("testfolder"));File.CreateText(strvirtPath.Append(@"\").Append(filename).ToString());return (strvirtPath).ToString();

    Tuesday, September 22, 2009 5:57 AM

All replies