很简单,如果你看不懂,我也没有办法了。
<%
wdAlignParagraphLeft=0
wdAlignParagraphCenter=1
wdAlignParagraphRight=2
dim objWdDoc
sub wdopen(sTempFile)
Set objWdDoc = Server.CreateObject("Word.Application")
If Err.number > 0 Then
response.write "没有安装WORD 2000,没法保存为Word文件,请正确安装Word2000!"
response.end
end if
objWdDoc.Documents.open server.mappath("/")&replace(sTempFile,"/","\")
end sub
sub wdclose(sSaveFile)
if(isobject(objWdDoc)) then
sSaveFilePath=server.mappath("/")&replace(sSaveFile,"/","\")
'response.write sSaveFilePath
objWdDoc.Documents(1).SaveAs sSaveFilePath
objWdDoc.Documents(1).close
objWdDoc.quit
set objWdDoc=nothing
response.write "<a href="&sSaveFile&">"&sSaveFile&"</a>"
else
response.write "Word对象没有初始化!"
response.end
end if
end sub
sub wdquit(sSaveFile)
if(isobject(objWdDoc)) then
sSaveFilePath=server.mappath("/")&replace(sSaveFile,"/","\")
objWdDoc.Documents(1).SaveAs sSaveFilePath
objWdDoc.Documents(1).close
objWdDoc.quit
set objWdDoc=nothing
response.write "<script>window.alert('打开WORD文件后,请先保存后进行打印!\n否则可能出错!');"
response.write "parent.location='"&sSaveFile&"';</script>"
' response.redirect sSaveFile
else
response.write "Word对象没有初始化!"
response.end
end if
end sub
sub wdnewline(n)
for m=1 to n
objWdDoc.Selection.TypeParagraph
next
end sub
sub wdrepl(strToFind,strReplace)
objWdDoc.Selection.Find.ClearFormatting
objWdDoc.Selection.Find.Replacement.ClearFormatting
objWdDoc.Selection.Find.Execute strToFind,0,0,0,0,0,0,1,0,strReplace,2,0,0,0,0
end sub
sub wdLeft()
objWdDoc.Selection.ParagraphFormat.Alignment=wdAlignParagraphLeft
end sub
sub wdcenter()
objWdDoc.Selection.ParagraphFormat.Alignment=wdAlignParagraphCenter
end sub
sub wdright()
objWdDoc.Selection.ParagraphFormat.Alignment=wdAlignParagraphRight
end sub
sub wdsetfont(FontName,FontSize)
objWdDoc.Selection.Font.Name = FontName
objWdDoc.Selection.Font.Size = FontSize
end sub
sub wdsetbold(IsBold)
objWdDoc.Selection.Font.Bold = IsBold
end sub
sub wdnewline(n)
for m=1 to n
objWdDoc.Selection.TypeParagraph
next
end sub
sub wdWrite(typetext)
objWdDoc.Selection.TypeText cstr(typetext)
end sub
sub wdinserttable(NumRows, NumColumns)
objWdDoc.Selection.Tables.Add objWdDoc.Selection.Range, NumRows, NumColumns, wdWord9TableBehavior, wdAutoFitFixed
end sub
sub wdindent(n)
objWdDoc.Selection.ParagraphFormat.IndentCharWidth n
end sub
sub wddown(n)
objWdDoc.Selection.MoveDown 5, n
end sub
%>