无为清净楼资源网 Design By www.qnjia.com
调用Word打印...
运行下列的脚本需要将IE的安全级别设为低,或在中级安全级别下将那个ActiveX控件设为启用,别忘记了:
<html>
<head>
<title>Build Document by Script</TITLE>
</HEAD>
<Table id="myData" border=1 align=center>
<Tr align=center>
<Td>产品名称</Td>
<Td>产品描述</Td>
<Td>产品单价</Td>
<Td>产品等级</Td>
</Tr>
<Tr align=center>
<Td>产品一</Td>
<Td>This is a test</Td>
<Td align=right>300.50</Td>
<Td>一级</Td>
</Tr>
<Tr align=center>
<Td>产品二</Td>
<Td>This is a test</Td>
<Td align=right>300.50</Td>
<Td>一级</Td>
</Tr>
<Tr align=center>
<Td>产品三</Td>
<Td>This is a test</Td>
<Td align=right>300.50</Td>
<Td>一级</Td>
</Tr>
</Tabld>
<input type=button onclick="vbscript:buildDoc '',4" value="build">
<BODY>
</BODY>
</HTML>
<script language="vbscript">
Sub buildDoc(theTemplate,intTableRows)
Dim Table1
set Table1 = document.all.myData
row = Table1.rows.length
Set objWordDoc = CreateObject("Word.Document")
ObjWordDoc.Application.Visible=True
Dim theArray(4,4)
'Redim Preserve theArray(4,row)
colnum = Table1.rows(1).cells.length
for i=0 to row-1
for j=0 to colnum-1
theArray(j+1,i+1) = Table1.rows(i).cells(j).innerHTML
next
next
intNumrows = 4
objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertBefore("测试的表格")
objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertBefore("")
objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertBefore("")
Set rngPara = objWordDoc.Application.ActiveDocument.Paragraphs(1).Range
With rngPara
.Bold = True
.ParagraphFormat.Alignment = 1
.Font.Name = "Arial"
.Font.Size = 12
End With
Set rngCurrent = objWordDoc.Application.ActiveDocument.Paragraphs(3).Range
Set tabCurrent = ObjWordDoc.Application.ActiveDocument.Tables.Add(rngCurrent,intNumrows,4)
for i = 1 to colnum
objWordDoc.Application.ActiveDocument.Tables(1).Rows(1).Cells(i).Range.InsertAfter theArray(i,1)
objWordDoc.Application.ActiveDocument.Tables(1).Rows(1).Cells(i).Range.ParagraphFormat.alignment=1
next
tabRow = 2
For j = 2 to intNumrows
'ObjWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Borders.Enable=False
objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(1).Range.InsertAfter theArray(1,j)
objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(1).Range.ParagraphFormat.alignment=1
objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(2).Range.InsertAfter theArray(2,j)
objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(2).Range.ParagraphFormat.alignment=1
objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(3).Range.InsertAfter FormatCurrency(theArray(3,j))
objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(3).Range.ParagraphFormat.alignment=2
objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(4).Range.InsertAfter theArray(4,j)
'objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(4).Range.InsertAfter Chr(10)
objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(4).Range.ParagraphFormat.alignment=1
tabRow = tabRow + 1
Next
' objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(4).Range.ParagraphFormat.alignment=1
'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter(" ")
'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter(" ")
'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter("Regards,")
'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter(" ")
'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter("Daryl B. Morticum")
'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter("Sales Associate")
'objWordDoc.Application.ActiveDocument.Envelope.Insert Address
' objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertAfter("由廖家远设计")
objWordDoc.Application.ActiveDocument.SaveAs "tempSample.doc", 0,False,"",True,"",False,False,False, False,False
'objWordDoc.Application.printout()
End Sub
</script>
运行下列的脚本需要将IE的安全级别设为低,或在中级安全级别下将那个ActiveX控件设为启用,别忘记了:
<html>
<head>
<title>Build Document by Script</TITLE>
</HEAD>
<Table id="myData" border=1 align=center>
<Tr align=center>
<Td>产品名称</Td>
<Td>产品描述</Td>
<Td>产品单价</Td>
<Td>产品等级</Td>
</Tr>
<Tr align=center>
<Td>产品一</Td>
<Td>This is a test</Td>
<Td align=right>300.50</Td>
<Td>一级</Td>
</Tr>
<Tr align=center>
<Td>产品二</Td>
<Td>This is a test</Td>
<Td align=right>300.50</Td>
<Td>一级</Td>
</Tr>
<Tr align=center>
<Td>产品三</Td>
<Td>This is a test</Td>
<Td align=right>300.50</Td>
<Td>一级</Td>
</Tr>
</Tabld>
<input type=button onclick="vbscript:buildDoc '',4" value="build">
<BODY>
</BODY>
</HTML>
<script language="vbscript">
Sub buildDoc(theTemplate,intTableRows)
Dim Table1
set Table1 = document.all.myData
row = Table1.rows.length
Set objWordDoc = CreateObject("Word.Document")
ObjWordDoc.Application.Visible=True
Dim theArray(4,4)
'Redim Preserve theArray(4,row)
colnum = Table1.rows(1).cells.length
for i=0 to row-1
for j=0 to colnum-1
theArray(j+1,i+1) = Table1.rows(i).cells(j).innerHTML
next
next
intNumrows = 4
objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertBefore("测试的表格")
objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertBefore("")
objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertBefore("")
Set rngPara = objWordDoc.Application.ActiveDocument.Paragraphs(1).Range
With rngPara
.Bold = True
.ParagraphFormat.Alignment = 1
.Font.Name = "Arial"
.Font.Size = 12
End With
Set rngCurrent = objWordDoc.Application.ActiveDocument.Paragraphs(3).Range
Set tabCurrent = ObjWordDoc.Application.ActiveDocument.Tables.Add(rngCurrent,intNumrows,4)
for i = 1 to colnum
objWordDoc.Application.ActiveDocument.Tables(1).Rows(1).Cells(i).Range.InsertAfter theArray(i,1)
objWordDoc.Application.ActiveDocument.Tables(1).Rows(1).Cells(i).Range.ParagraphFormat.alignment=1
next
tabRow = 2
For j = 2 to intNumrows
'ObjWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Borders.Enable=False
objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(1).Range.InsertAfter theArray(1,j)
objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(1).Range.ParagraphFormat.alignment=1
objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(2).Range.InsertAfter theArray(2,j)
objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(2).Range.ParagraphFormat.alignment=1
objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(3).Range.InsertAfter FormatCurrency(theArray(3,j))
objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(3).Range.ParagraphFormat.alignment=2
objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(4).Range.InsertAfter theArray(4,j)
'objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(4).Range.InsertAfter Chr(10)
objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(4).Range.ParagraphFormat.alignment=1
tabRow = tabRow + 1
Next
' objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(4).Range.ParagraphFormat.alignment=1
'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter(" ")
'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter(" ")
'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter("Regards,")
'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter(" ")
'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter("Daryl B. Morticum")
'objWordDoc.Application.ActiveDocument.Paragraph.Add.Range.InsertAfter("Sales Associate")
'objWordDoc.Application.ActiveDocument.Envelope.Insert Address
' objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertAfter("由廖家远设计")
objWordDoc.Application.ActiveDocument.SaveAs "tempSample.doc", 0,False,"",True,"",False,False,False, False,False
'objWordDoc.Application.printout()
End Sub
</script>
标签:
asp调用Word打印的代码
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
2024年11月16日
2024年11月16日
- 群星.1995-坠入情网【宝丽金】【WAV+CUE】
- 群星《谁杀死了Hi-Fi音乐》涂鸦精品 [WAV+CUE][1G]
- 群星1998《宝丽金最精彩98》香港首版[WAV+CUE][1G]
- 汪峰《也许我可以无视死亡》星文[WAV+CUE][1G]
- 李嘉-1991《国语转调2》[天王唱片][WAV整轨]
- 蔡琴2008《金声回忆录101》6CD[环星唱片][WAV整轨]
- 群星《2024好听新歌36》AI调整音效【WAV分轨】
- 梁朝伟.1986-朦胧夜雨裡(华星40经典)【华星】【WAV+CUE】
- 方芳.1996-得意洋洋【中唱】【WAV+CUE】
- 辛欣.2001-放120个心【上海音像】【WAV+CUE】
- 柏菲·万山红《花开原野1》限量开盘母带ORMCD[低速原抓WAV+CUE]
- 柏菲·万山红《花开原野2》限量开盘母带ORMCD[低速原抓WAV+CUE]
- 潘安邦《思念精选集全纪录》5CD[WAV+CUE]
- 杨千嬅《千嬅新唱金牌金曲》金牌娱乐 [WAV+CUE][985M]
- 杨钰莹《依然情深》首版[WAV+CUE][1G]