**************如何将网页中的文本转化到world、excel、ppt中?

beifanglang521 2006-03-23 01:32:18
如题,最好是由demo原代码,谢谢各位了。我从网上找到的几个例子好像都有错误,请大侠一定要确定能用阿!!!
...全文
155 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
beifanglang521 2006-03-23
  • 打赏
  • 举报
回复
大家给看看这段代码哪有问题,是将信息写到word里的代码copy到htm直接看就可以了

<html>
<body>
<input type="button" value=ok onclick="vbscript:openword '公安局','2006年2月27日','李贵山','李万寿','详细信息','','',''">
</body>
</html>
<script language="vbscript">
function openword(unit,docutime,man,leader,grouprun,roundrun,leaderun,roundthing) set Wordsheet=CreateObject("Word.Application")
Wordsheet.Application.Visible = true
set doc=Wordsheet.Application.Documents.Add("",False,0,True)
Wordsheet.Selection.ParagraphFormat.Alignment = 1
Wordsheet.Selection.Font.Bold = true
Wordsheet.Selection.Font.size = 30
Wordsheet.Selection.TypeText "值 班 日 报"
Wordsheet.Selection.Font.size = 25
Wordsheet.Selection.TypeParagraph
Wordsheet.Selection.Font.size = 16
Wordsheet.Selection.TypeParagraph
Wordsheet.Selection.Font.Bold = true
Wordsheet.Selection.ParagraphFormat.Alignment = 0
Wordsheet.Selection.TypeText unit & "指挥中心 " & docutime
doc.Shapes.AddLine 85, 185, 510, 185
set shap=doc.Shapes.AddLine( 440, 185, 440, 770)
shap.WrapFormat.AllowOverlap = True
shap.WrapFormat.Side = 3
shap.WrapFormat.DistanceTop = 0
shap.WrapFormat.DistanceBottom = 0
shap.WrapFormat.DistanceLeft = 9
shap.WrapFormat.DistanceRight = 9
shap.WrapFormat.Type = 0
Wordsheet.ActiveWindow.ActivePane.View.SeekView = 10
Wordsheet.ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = True
Wordsheet.Selection.HeaderFooter.Shapes.AddLine 85, 770, 510, 770
Wordsheet.Selection.Font.size = 16
Wordsheet.Selection.Font.Bold = true
Wordsheet.Selection.TypeText "值班首长:"
Wordsheet.Selection.Font.Bold = false
Wordsheet.Selection.TypeText leader
Wordsheet.Selection.Font.Bold = true
Wordsheet.Selection.TypeText " 值班员:"
Wordsheet.Selection.Font.Bold = false
Wordsheet.Selection.TypeText man
Wordsheet.ActiveWindow.ActivePane.View.SeekView = 0
Wordsheet.Selection.TypeParagraph
With Wordsheet.Selection.ParagraphFormat
.SpaceBeforeAuto = False
.SpaceAfterAuto = False
.FirstLineIndent = 20
End With
'Wordsheet.Selection.WholeStory
Wordsheet.Selection.ParagraphFormat.Alignment = 3
Wordsheet.Selection.Font.Bold = flase
Wordsheet.Selection.TypeText grouprun
Wordsheet.Selection.TypeParagraph
Wordsheet.Selection.TypeText roundrun
Wordsheet.Selection.TypeParagraph
Wordsheet.Selection.TypeText leaderun
Wordsheet.Selection.TypeParagraph
Wordsheet.Selection.TypeText roundthing
end function
</script>
beifanglang521 2006-03-23
  • 打赏
  • 举报
回复
谢谢,不过这样可以创建word怎么才能将文字写到word里呢??
阿_浩 2006-03-23
  • 打赏
  • 举报
回复
在页面的最后加上
Response.ContentType ="application/vnd.ms-xls"
Response.AddHeader "Content-Disposition", "attachment; filename="& curYear & "项目目录册(" & date & ").xls"

response.ContentType ="application/vnd.ms-word"
Response.AddHeader "Content-Disposition", "attachment; filename="& curYear & "参展企业名录一(" & date & ").doc"

response.ContentType ="application/vnd.ms-ppt"
Response.AddHeader "Content-Disposition", "attachment; filename="& curYear & "参展企业名录一(" & date & ").ppt"
beifanglang521 2006-03-23
  • 打赏
  • 举报
回复
什么页面?什么语言?啊,能不能给个完整点的啊,小小的demo就行了,谢谢
sky0120 2006-03-23
  • 打赏
  • 举报
回复
页面顶部加上代码:
1、Response.AppendHeader("Content-Disposition","attachment;filename=msg.doc");
  
Response.ContentType = "application/ms-word"; '导出WORD


2、Response.ContentType = "application/ms-excel"; '导出excel

28,390

社区成员

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

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