Create a HTML file programatically

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello !
With c# , I want to create a HTML file programatically .
How can I do it ?
Thank U !
 
Eliyahu ,
I want to know how I open a new html file , write to the file in specific
font and colour.
The file intend to give indications about success and failure of some
operations (documentation ).
Thanks,
 
What exactly do you need assisstance for? Creating file? Forming html? And
what is the file for? May be you don't need in the first place?

Eliyahu
 
Thank U very very much !

Eliyahu Goldin said:
Nir,

See if you need anything else apart from the following operations:

Open a file:
StreamWriter sw = new StreamWriter("TestFile.txt");

Write your html there:
sw.Write ("<span style='color:red'>Error</span>");

Close the stream:
sw.Close();

Eliyahu
 
Eliyahu ,
For this line:
StreamWriter sw = new StreamWriter("TestFile.txt");
The suffix need to be : "html" and not "txt" ?!
 
Nir,

See if you need anything else apart from the following operations:

Open a file:
StreamWriter sw = new StreamWriter("TestFile.txt");

Write your html there:
sw.Write ("<span style='color:red'>Error</span>");

Close the stream:
sw.Close();

Eliyahu
 
Yes, sure. Also you might have to take care about your asp.net account
security rights.

Note, that the file will be written in the application directory.

Eliyahu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top