如何用VBS把一篇文章的内容保存为html格式

也就是HTML编辑器的一个功能,但我想用VBS来实现简单的文章写入,高手有代码吗,十分感谢
如果直接把文字复制到记事本,然后保存为htm的话,结果打开是不分行的
我希望htm打开后,标题放大一点,然后后面是文字就可以了

把txt文件托放到这个vbs上试一下,它会自动生成一个htm文件。需要修的地方说一下。

'BY Coo_boi
If WScript.Arguments.Count=0 Then WScript.Quit
Dim fso,txt,htm
txt=WScript.Arguments(0)
Set fso=CreateObject("Scripting.FileSystemObject")
Set htm=fso.CreateTextFile(txt&".htm",True)
title=fso.GetFile(txt).Name
title=Left(title,Len(title)-4)
MsgBox title
htm.WriteLine "<html>"
htm.WriteLine "<head>"
htm.WriteLine "<title>Convert txt into html</title>"
htm.WriteLine "</head>"
htm.WriteLine "<body>"
htm.WriteLine "<h1 align=center>"&title&"</h1>"
htm.WriteLine "<hr color=red>"
For Each line In Split(fso.OpenTextFile(txt).ReadAll ,vbCrLf)
htm.WriteLine line&"<br>"
Next
htm.WriteLine "</body>"
htm.WriteLine "</html>"
htm.Close
WScript.Echo "Converted txt into html"
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-01-10
html格式
<html>
<title>浏览器上的标题</title>
<body>
内容
<br/>每行尾加个就会换行了
</body></html>
按照上面的格式用vbs写入就可以了. 不会在我空间留言。