| 网站首页 | 行业资讯 | 操作系统 | 网络技术 | 网页设计 | 平面设计 | 媒体制作 | 编程开发 | 
 | 办公软件 | 网络安全 | 电脑技术 | 数 据 库 | 课程在线 | 成功案例 | 项目合作 | 团队简介 | 
蓝色极速感谢大家的支持!站长:干戈 QQ:495979847     IAS网上答疑系统V1.0发布  [Sunpeople  2007年9月15日]        
  您现在的位置: 蓝色极速 >> 网络技术 >> ASP >> 教程正文
 

首页所应该达到的几个…

          ★★★ 
PowerPoint文件转图像脚本(ppt2img)
作者:未知    教程来源:蓝派网    点击数:    更新时间:2007-4-20    
使用方法:将代码保存为ppt2img.vbs,然后将文件放在sendto文件夹(开始菜单=》选行中输入sendto可以打开)中,然后在ppt文件上点右键,发送到,ppt2img.vbs中,输入要输出图像的格式,然后输入图像的宽与高,脚本会生成一个同名的文件,里面为生成的图像文件。
操作环境:安装Powerpoint程序的window操作系统。

'/////////////////////////////
'/PowerPoint文件转图像脚本(ppt2img)
'/作者:www.51windows.net,海娃
'/使用方法:将此文件放在sendto文件中,然后在ppt文件上点右键,发送到,ppt2img.vbs中,输入要输出图像的格式,然后输入图像的宽与高,脚本会生成一个同名的文件,里面为生成的图像文件。
'/机器上要安装Powerpoint程序
'/////////////////////////////
'on error resume next
Set ArgObj = WScript.Arguments
pptfilepath = ArgObj(0)
imgType = InputBox("输入导出文件的格式,可以是jpg,png,bmp,gif","输入导出文件的格式","png")

if imgType = "" or (lcase(imgType)<>"jpg" and lcase(imgType)<>"png" and lcase(imgType)<>"bmp" and lcase(imgType)<>"gif") then
imgType = "png"
msgbox "输入不正确,以png格式输出"
end if

imgW = InputBox("输入导出图像的宽度","输入导出图像的宽度","640")
if imgW = "" or isnumeric(imgW)=false then
imgW = 640
msgbox "输入不正确,程序使用默认值:640"
end if


imgH = InputBox("输入导出图像的高度","输入导出图像的高度","480")

if imgH = "" or isnumeric(imgH)=false then
imgH = imgW*0.75
msgbox "输入不正确,程序使用默认值:"&imgH
end if


call Form_Load(pptfilepath,imgType)

Private Sub Form_Load(Filepath,format)
if format = "" then
format = "gif"
end if
Folderpath = left(Filepath,len(Filepath)-4)
if lcase(right(Filepath,4))<>".ppt" then
call ConvertPPT(Filepath,Folderpath&".ppt")
end if
Filepath = Folderpath&".ppt"
CreateFolder(Folderpath)
    Set ppApp = CreateObject("PowerPoint.Application")
    Set ppPresentations = ppApp.Presentations
    Set ppPres = ppPresentations.Open(Filepath, -1, 0, 0)
    Set ppSlides = ppPres.Slides

For i = 1 To ppSlides.Count

iname = "000000"&i
iname = right(iname,4)'取四位数
Call ppSlides.Item(i).Export(Folderpath&"\"&iname&"."&format, format, imgW, imgH)
Next

Set ppApp = Nothing
Set ppPres = Nothing
End Sub

Function CreateFolder(Filepath)
Dim fso, f
on error resume next
Set fso = CreateObject("Scripting.FileSystemObject")
if not fso.FolderExists(Filepath) then
Set f = fso.CreateFolder(Filepath)
end if
CreateFolder = f.Path
set fso = Nothing
set f = Nothing
End Function

Sub ConvertPPT(FileName1, FileName2)
    Dim PPT
    Dim Pres

    Set PPT = CreateObject("PowerPoint.Application")
    Set Pres = PPT.Presentations.Open(FileName1, False, False, False)
    Pres.SaveAs FileName2, , True

    Pres.Close
    PPT.Quit

    Set Pres = Nothing
    Set PPT = Nothing
End Sub
教程录入:Sunpeople    责任编辑:Sunpeople  
  • 上一个教程:

  • 下一个教程:

  •      
    点击申请点击申请点击申请点击申请点击申请点击申请点击申请
    | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 |

    Copyright(C)2006-2009 Exploit Team All Rights Reserved
    QQ:495979847 网络备案号:陇ICP备07001585号