如何用ASP程序将数据转换成word文档,如果有源代码就更好啊!

cocozzx 2002-01-08 10:06:39
如何用ASP程序将数据转换成word文档,如果有源代码就更好啊!
...全文
88 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ar7_top 2002-01-09
  • 打赏
  • 举报
回复
┏━━━━━━━━━━━━━━━┓
┃               ┃
┃Good Good Study┃
┃ Sky  Sky  Up  ┃
┃               ┃
┗━━━━━━━━━━━━━━━┛
希偌 2002-01-08
  • 打赏
  • 举报
回复
' 生成文件 xxx.doc
applpath = Request.ServerVariables("APPL_PHYSICAL_PATH")
docspec = applpath & "xxx.doc"
dotspec = applpath & "xxx.dot"

' 删除旧文件
set fso = CreateObject("Scripting.FileSystemObject")
if fso.FileExists(docspec) then
fso.DeleteFile docspec
end if
set fso = nothing

' 生成新文件
on error resume next
set wdApp = CreateObject("Word.Application")
wdApp.Documents.Add dotspec, false
wdApp.DisplayAlerts = wdAlertsNone

if Err.number <> 0 then
MsgBox ("Error # " & CStr(Err.Number) & " " & Err.Description)
Err.Clear
end if

set wdTable = wdApp.ActiveDocument.Tables(1)
wdTable.Cell(1,1).Range.Text = "somthing you want"
...

wdApp.ActiveDocument.SaveAs docspec
wdApp.Quit

set wdTable = nothing
set wdApp = nothing

28,405

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧