当前位置: 网学 > 编程文档 > ASP > 正文

用ASP创建Word文件

来源:Http://myeducs.cn 联系QQ:点击这里给我发消息 作者: 用户投稿 来源: 网络 发布时间: 12/10/17
下载{$ArticleTitle}原创论文样式
the form fields
itemCount = itemCount + 1 ''using For..Next loop
%>  
<INPUT TYPE="hidden" NAME="<%=Item%>" VALUE="<%=Request(Item)%>">  
<% Next %>  
<INPUT TYPE="hidden" NAME="numbRows" VALUE="<%=intRowCount%>">  
<INPUT TYPE="hidden" NAME="fieldCount" VALUE="<%=itemCount%>">  
</FORM>  
</BODY>  
</HTML>  
We create an instance of the Word Document object, using the sample co

de immediately below. Note that in Internet Explorer 4+ this will fail

unless the browser security is set to Low, or Custom with the appropr

iate setting to run programs.  

<%
Set objWordDoc = CreateObject("Word.Document")
ObjWordDoc.Application.Documents.Add theTemplate, False
ObjWordDoc.Application.Visible=True
%>  
We re-dimension our array so that it is the same size as the number of

rows that are contained in the Web page''s form. In this case, we set  

the Y-axis to a constant value of four because that is the number of c

olumns we need in the output document. The X-axis contains the number  

of received rows from the form.  

<%
Redim Preserve theArray(4,intTableRows)
%>  
Now we are ready to examine all of the form rows. We do this by loopin

g through all the input Web page form fields to collect each form fiel

d name and corresponding value. We test each to determine which array  

element to put it into, and then we put it there. The SELECT CASE stat

ement in the code sample below is important. It is where we determine  

in which column the form field belongs. We used hard coded CASE option

s here for expediency.  

<%
For intCount = 0 to frmData.fieldCount.value
strOkay = "Y"
strSearch = frmData.elements(intCount).name ''load the field name


strValue = frmData.elements(intCount).value ''load the field value


strPosition = Instr(1,strSearch,"_") ''get pos val of "_"
intStringLen=strPosition-1
If intStrLen > 0 Then  
      strLeft = Left(strSearch,intStringLen)  
      strRight = Right(strSearch,(Len(strSearch)-Len(strLeft)-1))  
      Select Case strLeft  
         Case "SKU"                          intArrayY=0  
         Case "description"                  intArrayY=1  
         Case "p

网学推荐

免费论文

原创论文

浏览:
设为首页 | 加入收藏 | 论文首页 | 论文专题 | 设计下载 | 网学软件 | 论文模板 | 论文资源 | 程序设计 | 关于网学 | 站内搜索 | 网学留言 | 友情链接 | 资料中心
版权所有 QQ:3710167 邮箱:3710167@qq.com 网学网 [Myeducs.cn] 您电脑的分辨率是 像素
Copyright 2008-2015 myeducs.Cn www.myeducs.Cn All Rights Reserved
湘ICP备09003080号