Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
StringBuilder sb = new StringBuilder();
            sb.Append("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd \"> \r\n ");
            sb.Append("<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n");
            sb.Append("<head>\r\n");
            sb.Append("<meta content=\"text/html; charset=utf-8\" http-equiv=\"Content-Type\" />\r\n");
            sb.Append("<title>My HTMl Page</title>\r\n");
            sb.Append("</head>\r\n");
            sb.Append("<body>\r\n");
            sb.Append("<table>\r\n");
            //If you are emiting some data like a list of items               
            foreach (var item in Items)
            {
                sb.Append("<tr>\r\n");
                sb.Append("<td>\r\n");
                sb.Append(item.ToString());
                sb.Append("</td>\r\n");
                sb.Append("</tr>\r\n");
            }
            sb.Append("</table>\r\n");
            sb.Append("</body>\r\n");
            sb.Append("</html>\r\n");

            using (FileStream fs = new FileStream("HTMLLLLLLLLLLLL.htm", FileMode.Create))
            {
                using (StreamWriter w = new StreamWriter(fs, Encoding.UTF8))
                {
                    w.WriteLine(sb.ToString());
                }
            }

i want to create .htm file and i have to store that .htm file in that same project dynamically..
Can any one help me..am struggling for couple of hours...
Posted

you can create it with c# or php or cgi
when you need in your source you echo or print the text of dhtm with format you need
which language you want to do it ?
 
Share this answer
 
Comments
MuhammadUSman1 7-Oct-13 0:29am    
Not a solution, type it in comments.
DONE BRO..FINALLY I GOT LIKE THIS...

C#
string path = "CopyHtml.htm";
            byte[] b = System.Text.Encoding.UTF8.GetBytes(html.ToString());
            // This text is added only once to the file.
            if (!File.Exists(path))
            {
                File.WriteAllBytes(Server.MapPath(path), b);
            }
 
Share this answer
 
v3

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900