打印本文 打印本文 关闭窗口 关闭窗口
关于ASP调用WORD打印
作者:武汉SEO闵涛  文章来源:本站原创  点击数1949  更新时间:2011/10/13 14:47:26  文章录入:mintao  责任编辑:mintao
关于ASP调用WORD打印我看了一个例子,是ASP调用WORD打印,非常好。
但它是通过表单提交的方式进行的,我想通过链接传递参数,不知该如何写,
请大家帮忙:

全部语句见下,

以下是代码片段:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<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文件,请正确安装Word97"
    else
    wApp.visible = True
    wApp.Documents.add
   
                     wApp.Selection.TypeParagraph
                     wApp.Selection.Font.Bold = True
                     wApp.Selection.TypeText "九八Joy ASP维护工作意见"
                    
                     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 "认真落实CHINA ASP为网友解难题,办实事精神,强化运行管理,优化网络。"                         
                         wapp.selection.typetext document.form1.doc1.value   '问题:这句话是通过表单提交得到参数的,若是页面通过.asp?a=name&b=sex这样的方式将参数传过来,该怎么接受呢?我用aa=request.QueryString("a") 是无法提出传递参数的,该怎么做呢?                        wApp.Selection.TypeParagraph  
                    

                      rem 居 右
                     wApp.Selection.TypeParagraph  
                     wApp.Selection.Font.Bold = false                 
                     wApp.Selection.TypeText "一九九九年五月"
                     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>
打印本文 打印本文 关闭窗口 关闭窗口