一个小问题..几天都没能解决..谁帮我看一下,谢谢!
在asp按指定格式生成word的时候,,,为什么老是提示错误这行中的builddoc()类型不匹配...这是为什么呀?????谁帮我一下..一但解决./..在加50分!
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>生成word文档</title>
</head>
<script language="vbscript">
sub builddoc()
On Error Resume Next
Dim wApp
Set wApp = CreateObject("Word.Application")
If Err.number > 0 Then
Alert "没法保存为Word文件,请正确安装Word2000"
else
wApp.visible = True
wApp.document..add
wApp.Selection.TypeParagraph
wApp.Selection.Font.Bold = True
wApp.Selection.TypeText "生成word文件"
wApp.Selection.ParagraphFormat.Alignment = 1
rem 居 中
wApp.Selection.TypeParagraph
wApp.Selection.Font.Bold = false
wApp.Selection.TypeText "-- 小雨"
wApp.Selection.TypeParagraph
wApp.Selection.ParagraphFormat.LeftIndent = wApp.CentimetersToPoints(0)
wApp.Selection.ParagraphFormat.FirstLineIndent = wApp.CentimetersToPoints(0.72/2*2)
wApp.Selection.TypeParagraph
wApp.Selection.Font.Bold = false
wApp.Selection.ParagraphFormat.Alignment = 0
' wApp.Selection.TypeText "测试内容。"
wapp.selection.typetext document.form1.doc1.value
wApp.Selection.TypeParagraph
rem 居 右
wApp.Selection.TypeParagraph
wApp.Selection.Font.Bold = false
wApp.Selection.TypeText "二00五年五月"
wApp.Selection.TypeParagraph
wApp.Saved = true
wapp.Activedocument.SaveAs "c:\a.doc"
wapp.close
end if
end sub
</script>
<body>
<form name="form1" >
<p> </p>
<p><textarea rows="8" name="doc1" cols="46"></textarea></p>
<p> </p>
<p>生成word文档<input type="button" value="生成" name="B1" onclick="builddoc()"></p>
</form>
</body>
</html>
问题点数:20、回复次数:4Top
1 楼fosjos(无聊的菜鸟程序员)回复于 2006-05-03 12:19:28 得分 0
Set wApp = CreateObject("Word.Application")
If Err.number > 0 Then
Alert "没法保存为Word文件,请正确安装Word2000"
else
wApp.visible = True
wApp.document..add//这里是wApp.document.add, IE的第一个报错
...Top
2 楼youzi520(釉子-MeChecksV)回复于 2006-05-03 12:56:46 得分 0
按楼上的改一下后,测试没出啥问题-_-!!Top
3 楼lxrcher(小潇)回复于 2006-05-03 15:52:45 得分 0
改成一个点还是不可以呀...测试的时候还是"没法保存为Word文件,请正确安装Word2000"
如果去掉if语句的话 还是继续报错_网页上有错误,,,,我查看错误类型是builddoc()类型不匹配呀..Top
4 楼lxrcher(小潇)回复于 2006-05-04 10:20:25 得分 0
怎么就没人回答啊呀..难道 没有人知道吗.?Top




