JAVA读取PPT文件
import java.io.InputStream;
import org.apache.lucene.document.Document;
import org.apache.poi.hslf.HSLFSlideShow;
import org.apache.poi.hslf.model.TextRun;
import org.apache.poi.hslf.model.Slide;
import org.apache.poi.hslf.usermodel.SlideShow;
public Document getDocument(Index index, String url, String title, InputStream is)
throws DocCenterException {
StringBuffer content = new StringBuffer("");
try{
SlideShow ss = new SlideShow(new HSLFSlideShow(is));//is 为文件的InputStream,建立SlideShow
Slide[] slides = ss.getSlides();//获得每一张幻灯片
for(int i=0;i<slides.length;i++){
TextRun[] t = slides[i].getTextRuns();//为了取得幻灯片的文字内容,建立TextRun
for(int j=0;j<t.length;j++){
content.append(t[j].getText());//这里会将文字内容加到content中去
}
content.append(slides[i].getTitle());
}
index.AddIndex(url, title, content.toString());
}catch(Exception ex){
System.out.println(ex.toString());
}
return null;
}
相关文档:
美国旧金山时间2005年6月28日上午,在由全球10000多名开发人员出席的“2005 Java One开发者大会&r ......
一、
Java
基础
第
01
题:
作用域
public,private,protected,
以及不写时的区别
第
02
题:
Anonymous Inner Class (
匿名内部类
)
是否可以
extends(
继承
)
其它类,是否可以
implements(
实现
......
使用Runtime.getRuntime().exec()方法可以在java程序里运行外部程序。
1. exec(String command)
2. exec(String command, String envp[], File dir)
3. exec(String cmd, String envp[])
4. exec(String cmdarray[])
5. exec(String cmdarray[], String envp[])
6. exec(S ......
public int ExecProcAdd()
{
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.StoredProcedu ......
(2010.02.12) 星星小镇v0.3 定期更新
声明:游戏所有素材来自网络,少部分源码参考Loonframework框架
基本操作:
移动:← → ↓ ↑
对话:空格键
更新日志
2010.02.12 v0.3:
功能添加:标题菜单,场景切换(可以进屋啦)
2010.02.11 v0.2:
功能添加:NPC自由行走会话,背景音乐
2010.02.06 v0 ......