By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,361 Members | 1,677 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,361 IT Pros & Developers. It's quick & easy.

save text file (stream) as html

P: n/a
a
Save text file as html kloepper 17:42 23 Jul '04
I'm using httpwebresponse and a StringBuilder to return a stream that originates as a file with the .txt suffix (My download code converts the html tags in this text file to well formed XHTML tags). The contents of the file contain html tags and the data in those tags.
eg.,

<table cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
<TBODY>
<tr>
<td width="48%"></td>
<td vAlign=bottom width="5%"><FONT
face="Times New Roman" size=1><B> Howdy!! </B></FONT></td>
<td width="47%"></td></tr>
</TBODY></table>

When I copy, paste and save the returned file from the textbox (txtOutput)with a .html extension, the file opens as a normal looking html file, but when I try to save the stream with an html suffix with the following code, something changes in the file and instead of opening as a normal html file, I instead get what looks like a text file with strikethrough font in numerous places...eg., <strike>Howdy !!</strike>

// Save File-----------------------------------
StreamWriter writer = new StreamWriter(sec_save);
writer.WriteLine(txtOutput.Text.ToString());
writer.Close();

The StreamWriter gets its input from a textbox (txtOutput) that has been populated by a StringBuilder (the html tags in the original text file have actually been converted to an XHTML file, ie well-formed html tags.)

I can supply the code that converts the html to xhtml if needed...

Basically, I'm just trying to find a way to save the stream as an .html file and have it open as any other html file would open, without the strikethroughs.

A different way to save the stream perhaps?

Thanks,

Paul

Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.