请问怎么根据一段html字符串生成一个.htm文件
在线等! 问题点数:80、回复次数:13Top
1 楼saucer(思归)回复于 2003-12-03 20:40:27 得分 40
using System.IO;
StreamWriter sw = new StreamWriter("yourhtml.html", false, System.Text.Encoding.GetEncoding("GB2312"));
sw.Write(YourHTMLString);
sw.Close();Top
2 楼xhn(雪候鸟)回复于 2003-12-03 20:51:43 得分 0
谢谢思归,但我用IE打开这个文件却什么也没有,这是为什么啊?Top
3 楼saucer(思归)回复于 2003-12-03 20:55:44 得分 0
what is in your html string? try to view the source in IETop
4 楼xhn(雪候鸟)回复于 2003-12-03 21:12:20 得分 0
字符串是邮件中的htmlbody,Top
5 楼cnhgj(戏子) (没时间练太极)回复于 2003-12-03 21:48:03 得分 20
string htmlcode = "<html><body>ddddddddddddddd</body></html>";
StreamWriter sw = new StreamWriter(@"c:\yourhtml.html", false, System.Text.Encoding.GetEncoding("GB2312"));
sw.Write(htmlcode);
sw.Close();Top
6 楼simanh()回复于 2003-12-03 22:05:37 得分 5
楼上解决了Top
7 楼xhn(雪候鸟)回复于 2003-12-04 09:11:12 得分 0
解决了,谢谢
但用IE打开,显示的是乱码啊,怎么办?Top
8 楼soulroom(易水之风)回复于 2003-12-04 09:39:49 得分 5
加头部
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">Top
9 楼xhn(雪候鸟)回复于 2003-12-04 09:55:05 得分 0
楼上,我查看源文件,里面有你所说的头部信息啊Top
10 楼jianglinchun(萧丰)回复于 2003-12-04 10:12:23 得分 5
string htmlcode = "<html><meta http-equiv="Content-Type" content="text/html;charset=gb2312"><body>ddddddddddddddd</body></html>";
soulroom是这个意思。Top
11 楼xhn(雪候鸟)回复于 2003-12-04 10:36:21 得分 0
这些信息字符串里本来就有,还要加进去吗?Top
12 楼binbin2000(binbin)回复于 2003-12-04 11:01:12 得分 5
头信息有了吗?另外你老人家到底出现什么问题我还没有发觉。Top
13 楼xhn(雪候鸟)回复于 2003-12-04 11:19:32 得分 0
我用IE打开,内容如下
xhn_21199锛?/FONT>浣犲ソ锛?/FONT>
銆€銆€66666666
銆€銆€銆€銆€銆€銆€銆€銆€鑷?BR>绀硷紒
銆€銆€銆€銆€銆€銆€ 榛勫畻鎴?BR> xhn_21199@tom.com
2003-11-17Top




