473,396 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Writing html files

guy
Does .NET have a class or set of functions that facilitate the creating and
writing of html files?

I have been creating files in streams and constructing html strings and
writing them out but it seems that a class could facilitate this better.

Thanks
Nov 16 '05 #1
6 21418
Hi. Check out the HtmlWriter class.
John Puopolo

"guy" <wi*********@hotmail.com> wrote in message
news:Oq****************@TK2MSFTNGP10.phx.gbl...
Does .NET have a class or set of functions that facilitate the creating and writing of html files?

I have been creating files in streams and constructing html strings and
writing them out but it seems that a class could facilitate this better.

Thanks

Nov 16 '05 #2
Hi Guy,

HtmlTextWriter looks like it could help:

using System;
using System.IO;
using System.Text;
using System.Web.UI;

public class Test
{
public static void Main()
{
StringBuilder strBldr = new StringBuilder();
StringWriter strWriter = new StringWriter(strBldr);

HtmlTextWriter writer = new HtmlTextWriter(strWriter);

//<html>
writer.RenderBeginTag(HtmlTextWriterTag.Html);

// <head>
writer.RenderBeginTag(HtmlTextWriterTag.Head);

// </head>
writer.RenderEndTag();

// <body>
writer.RenderBeginTag(HtmlTextWriterTag.Body);

writer.Write("This is text for my web page.");

// </body>
writer.RenderEndTag();

// </html>
writer.RenderEndTag();

Console.WriteLine(strBldr.ToString());
}
}

Joe
--
http://www.csharp-station.com

"guy" <wi*********@hotmail.com> wrote in message
news:Oq****************@TK2MSFTNGP10.phx.gbl...
Does .NET have a class or set of functions that facilitate the creating
and writing of html files?

I have been creating files in streams and constructing html strings and
writing them out but it seems that a class could facilitate this better.

Thanks

Nov 16 '05 #3
guy
Thanks.

"Joe Mayo" <jm***@nospamAtCSharpDashStation.com> wrote in message
news:uv****************@TK2MSFTNGP09.phx.gbl...
Hi Guy,

HtmlTextWriter looks like it could help:

using System;
using System.IO;
using System.Text;
using System.Web.UI;

public class Test
{
public static void Main()
{
StringBuilder strBldr = new StringBuilder();
StringWriter strWriter = new StringWriter(strBldr);

HtmlTextWriter writer = new HtmlTextWriter(strWriter);

//<html>
writer.RenderBeginTag(HtmlTextWriterTag.Html);

// <head>
writer.RenderBeginTag(HtmlTextWriterTag.Head);

// </head>
writer.RenderEndTag();

// <body>
writer.RenderBeginTag(HtmlTextWriterTag.Body);

writer.Write("This is text for my web page.");

// </body>
writer.RenderEndTag();

// </html>
writer.RenderEndTag();

Console.WriteLine(strBldr.ToString());
}
}

Joe
--
http://www.csharp-station.com

"guy" <wi*********@hotmail.com> wrote in message
news:Oq****************@TK2MSFTNGP10.phx.gbl...
Does .NET have a class or set of functions that facilitate the creating
and writing of html files?

I have been creating files in streams and constructing html strings and
writing them out but it seems that a class could facilitate this better.

Thanks


Nov 16 '05 #4
guy
Thanks.

"John Puopolo" <jo**********@fastsearch.com.nospam> wrote in message
news:e3****************@TK2MSFTNGP12.phx.gbl...
Hi. Check out the HtmlWriter class.
John Puopolo

"guy" <wi*********@hotmail.com> wrote in message
news:Oq****************@TK2MSFTNGP10.phx.gbl...
Does .NET have a class or set of functions that facilitate the creating

and
writing of html files?

I have been creating files in streams and constructing html strings and
writing them out but it seems that a class could facilitate this better.

Thanks


Nov 16 '05 #5
guy
It looks like you can only use HtmlTextWriter if you're writing an ASP.NET
app. This is just a normal windows forms app and I want to put some of my
result out in HTML format such that they can be loaded onto the net at a
later stage or view with a browser.

"Joe Mayo" <jm***@nospamAtCSharpDashStation.com> wrote in message
news:uv****************@TK2MSFTNGP09.phx.gbl...
Hi Guy,

HtmlTextWriter looks like it could help:

using System;
using System.IO;
using System.Text;
using System.Web.UI;

public class Test
{
public static void Main()
{
StringBuilder strBldr = new StringBuilder();
StringWriter strWriter = new StringWriter(strBldr);

HtmlTextWriter writer = new HtmlTextWriter(strWriter);

//<html>
writer.RenderBeginTag(HtmlTextWriterTag.Html);

// <head>
writer.RenderBeginTag(HtmlTextWriterTag.Head);

// </head>
writer.RenderEndTag();

// <body>
writer.RenderBeginTag(HtmlTextWriterTag.Body);

writer.Write("This is text for my web page.");

// </body>
writer.RenderEndTag();

// </html>
writer.RenderEndTag();

Console.WriteLine(strBldr.ToString());
}
}

Joe
--
http://www.csharp-station.com

"guy" <wi*********@hotmail.com> wrote in message
news:Oq****************@TK2MSFTNGP10.phx.gbl...
Does .NET have a class or set of functions that facilitate the creating
and writing of html files?

I have been creating files in streams and constructing html strings and
writing them out but it seems that a class could facilitate this better.

Thanks


Nov 16 '05 #6
guy
I was being stupid. Forgot to add System.Web to resources.

"guy" <wi*********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
It looks like you can only use HtmlTextWriter if you're writing an ASP.NET
app. This is just a normal windows forms app and I want to put some of my
result out in HTML format such that they can be loaded onto the net at a
later stage or view with a browser.

"Joe Mayo" <jm***@nospamAtCSharpDashStation.com> wrote in message
news:uv****************@TK2MSFTNGP09.phx.gbl...
Hi Guy,

HtmlTextWriter looks like it could help:

using System;
using System.IO;
using System.Text;
using System.Web.UI;

public class Test
{
public static void Main()
{
StringBuilder strBldr = new StringBuilder();
StringWriter strWriter = new StringWriter(strBldr);

HtmlTextWriter writer = new HtmlTextWriter(strWriter);

//<html>
writer.RenderBeginTag(HtmlTextWriterTag.Html);

// <head>
writer.RenderBeginTag(HtmlTextWriterTag.Head);

// </head>
writer.RenderEndTag();

// <body>
writer.RenderBeginTag(HtmlTextWriterTag.Body);

writer.Write("This is text for my web page.");

// </body>
writer.RenderEndTag();

// </html>
writer.RenderEndTag();

Console.WriteLine(strBldr.ToString());
}
}

Joe
--
http://www.csharp-station.com

"guy" <wi*********@hotmail.com> wrote in message
news:Oq****************@TK2MSFTNGP10.phx.gbl...
Does .NET have a class or set of functions that facilitate the creating
and writing of html files?

I have been creating files in streams and constructing html strings and
writing them out but it seems that a class could facilitate this better.

Thanks



Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Els | last post by:
***newbie question*** Hi, I am trying to make my server (Apache) parse .html files as .php. I found this line of code: ForceType application/x-httpd-php placed it in an .htaccess file and...
0
by: Dariusz | last post by:
I currently have a layout that is part written in SHTML - in other words, it gets processed by the web server to execute any calls for PHP or Perl code as well as the html (and external imported...
3
by: Ladykiller | last post by:
Hi everybody , I'm writing because i'm new in C++ and i have a big problem , I want my program to find files in a directory, (*.jpg, for example)and create alist of these files, Does anybody...
9
by: Robby Bankston | last post by:
I'm working on some code and am running into brick walls. I'm trying to write out Javascript with Javascript and I've read the clj Meta FAQ and didn't see the answer, read many similar posts (with...
5
by: MK | last post by:
Dear friends, I have many HTML files and they all have some common HTML code which is basically bunch of tags which are in all the files. How can I put the common code in one file and then share...
1
by: ajk | last post by:
. Hi, All: I know how to insert files into a Word doc using C#. However, the program I've written to do this runs much too slowly. The "myObj".Application.Selection.InsertFile method executes...
5
by: nick | last post by:
I need to create a simple asp.net application that use password protect some html pages. The html page provider doesn't know asp.net. And the host doesn't allow me to create user accounts. ...
2
by: nick | last post by:
I have an Asp.Net 2.0 application using form authentication. I want the html pages be protected by the authentication system too. The accessing of html files need to be authenticated in my local...
1
by: Michael Leithold, WWK | last post by:
Hello, is there a .NET library for writing log files? I'm looking for something to configure the log files. E.g. using date-/timestamps, deleting old log files, log file rotation for big log...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.