包含pptandjava的词条
本篇文章给大家谈谈pptandjava,以及对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
java中pRand()方法的含义是什么?
java中没有这个方法,你肯定是看例子的时候拉掉了一部分,断章取义了!
如何在PPT中添加JAVA或网页效果
var RevealTrans = Class.create();
RevealTrans.prototype = {
initialize: function(container, options) {
this._img = document.createElement("img");
this._a = document.createElement("a");
this._timer = null;//计时器
this.Index = 0;//显示索引
this._onIndex = -1;//当前索引
this.SetOptions(options);
this.Auto = !!this.options.Auto;
this.Pause = Math.abs(this.options.Pause);
this.Duration = Math.abs(this.options.Duration);
this.Transition = parseInt(this.options.Transition);
this.List = this.options.List;
this.onShow = this.options.onShow;
//初始化显示区域
this._img.style.visibility = "hidden";//第一次变换时不显示红x图
this._img.style.width = this._img.style.height = "100%"; this._img.style.border = 0;
this._img.onmouseover = Bind(this, this.Stop);
this._img.onmouseout = Bind(this, this.Start);
isIE (this._img.style.filter = "revealTrans()");
this._a.target = "_blank";
$(container).appendChild(this._a).appendChild(this._img);
},
//设置默认属性
SetOptions: function(options) {
this.options = {//默认值
Auto: true,//是否自动切换
Pause: 1000,//停顿时间(微妙)
Duration: 1,//变换持续时间(秒)
Transition: 23,//变换效果(23为随机)
List: [],//数据集合,如果这里不设置可以用Add方法添加
onShow: function(){}//变换时执行
};
Extend(this.options, options || {});
},
Start: function() {
clearTimeout(this._timer);
//如果没有数据就返回
if(!this.List.length) return;
//修正Index
if(this.Index 0 || this.Index = this.List.length){ this.Index = 0; }
//如果当前索引不是显示索引就设置显示
if(this._onIndex != this.Index){ this._onIndex = this.Index; this.Show(this.List[this.Index]); }
//如果要自动切换
if(this.Auto){
this._timer = setTimeout(Bind(this, function(){ this.Index++; this.Start(); }), this.Duration * 1000 + this.Pause);
}
},
//显示
Show: function(list) {
if(isIE){
//设置变换参数
with(this._img.filters.revealTrans){
Transition = this.Transition; Duration = this.Duration; apply(); play();
}
}
this._img.style.visibility = "";
//设置图片属性
this._img.src = list.img; this._img.alt = list.text;
//设置链接
!!list["url"] ? (this._a.href = list["url"]) : this._a.removeAttribute("href");
//附加函数
this.onShow();
},
//添加变换对象
Add: function(sIimg, sText, sUrl) {
this.List.push({ img: sIimg, text: sText, url: sUrl });
},
//停止
Stop: function() {
clearTimeout(this._timer);
}
};
加入VBA编辑器
java调用dll操作ppt
你这个操作可以简化为复制你这个ppt文件嘛,然后将ppt复制后的文件名称修改了下,不调用外部dll也可以实现吧
给你推荐两种方法:
方法1:使用Java执行cmd命令操作
try {
Runtime.getRuntime().exec("这里写dos命令");
} catch (IOException e) {
e.printStackTrace();
}
复制文件的cmd命令是[copy 文件1路径 文件2路径]
例如复制c盘上的test.ppt 到 c盘上的test1.ppt
命令:copy c:\test.ppt c:\test1.ppt
在Java中就是 copy c:\\test.ppt c:\\test1.ppt或者copy c:/test.ppt c:/test1.ppt
方法2:使用Java io复制文件
import java.io.*;
public class CopyAll {
public void copyDir(File from, File to) {
if (!to.exists()) {
to.mkdirs();
}
File[] files = from.listFiles();
for (int i = 0; i files.length; i++) {
File file1 = files[i];
File file2 = new File(to.getPath() + File.separator
+ files[i].getName());
if (!file1.isDirectory()) {
copyFile(file1, file2);
} else {
copyDir(file1, file2);
}
}
}
public void copyFile(File src, File dest) {
try {
System.out.println(src.getAbsoluteFile() + " - "
+ dest.getAbsoluteFile());
FileInputStream in = new FileInputStream(src);
FileOutputStream out = new FileOutputStream(dest);
byte[] buffer = new byte[1024];
while (in.read(buffer) != -1) {
out.write(buffer);
}
out.close();
in.close();
System.out.println("文件拷贝成功");
} catch (Exception e) {
System.out.println("文件拷贝失败");
}
}
public static void main(String[] args) {
CopyAll t = new CopyAll();
t.copyDir(new File("原文件路径"), new File("要复制文件路径"));
}
}
哦 不好意思,跑题了
Java是可以利用Java的JNI(Java native interface)Java本地接口调用dll的,但是这个dll与一般的dll不同,定义要遵循一些规则,所以Java是不能操作一般的dll。还有就是你得懂C或C++才能写出Java可调用的dll,我也只会操作helloword等简单的dll,还有一般Java操作word、excel、ppt这些文件都有开源项目,你可以到百度 Google上去搜索一下
例如:
pptandjava的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于、pptandjava的信息别忘了在本站进行查找喔。
发布于:2022-11-27,除非注明,否则均为
原创文章,转载请注明出处。