本文整理汇总了Java中org.apache.poi.hslf.HSLFSlideShow类的典型用法代码示例。如果您正苦于以下问题:Java HSLFSlideShow类的具体用法?Java HSLFSlideShow怎么用?Java HSLFSlideShow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HSLFSlideShow类属于org.apache.poi.hslf包,在下文中一共展示了HSLFSlideShow类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: extractImageText
import org.apache.poi.hslf.HSLFSlideShow; //导入依赖的package包/类
private void extractImageText(XHTMLContentHandler xhtml,
HSLFSlideShow document) {
if (Config.inst().getProp(ConfigBool.ENABLE_IMAGE_OCR)) {
TikaImageHelper helper = new TikaImageHelper(metadata);
try {
PictureData[] pictures = document.getPictures();
for (PictureData picture : pictures) {
ByteArrayInputStream imageData = new ByteArrayInputStream(
picture.getData());
helper.addImage(ImageIO.read(imageData));
}
// TODO: find out page number
helper.addTextToHandler(xhtml);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (helper != null) {
helper.close();
}
}
}
}
开发者ID:kolbasa,项目名称:OCRaptor,代码行数:23,代码来源:HSLFExtractor.java
示例2: SlideShow
import org.apache.poi.hslf.HSLFSlideShow; //导入依赖的package包/类
/**
* Constructs a Powerpoint document from the underlying
* HSLFSlideShow object. Finds the model stuff from this
*
* @param hslfSlideShow the HSLFSlideShow to base on
*/
public SlideShow(HSLFSlideShow hslfSlideShow) {
// Get useful things from our base slideshow
_hslfSlideShow = hslfSlideShow;
_records = _hslfSlideShow.getRecords();
// Handle Parent-aware Records
for (Record record : _records) {
if(record instanceof RecordContainer){
RecordContainer.handleParentAwareRecords((RecordContainer)record);
}
}
// Find the versions of the core records we'll want to use
findMostRecentCoreRecords();
// Build up the model level Slides and Notes
buildSlidesAndNotes();
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:25,代码来源:SlideShow.java
示例3: PowerPointExtractor
import org.apache.poi.hslf.HSLFSlideShow; //导入依赖的package包/类
/**
* Creates a PowerPointExtractor, from a HSLFSlideShow
*
* @param ss the HSLFSlideShow to extract text from
*/
public PowerPointExtractor(HSLFSlideShow ss) {
super(ss);
_hslfshow = ss;
_show = new SlideShow(_hslfshow);
_slides = _show.getSlides();
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:12,代码来源:PowerPointExtractor.java
示例4: getText
import org.apache.poi.hslf.HSLFSlideShow; //导入依赖的package包/类
/**
* Extract text from a power point 97-2003 document.
* @throws Exception
*
* @see edu.ur.ir.index.FileTextExtractor#getText(java.io.File)
*/
public String getText(File f) throws Exception {
String text = null;
if( isFileTooLarge(f) || f.length() <= 0l)
{
return text;
}
FileInputStream inputStream = null;
try
{
inputStream = new FileInputStream(f);
HSLFSlideShow powerPointDocument = new HSLFSlideShow(inputStream);
PowerPointExtractor pptExtractor = new PowerPointExtractor(powerPointDocument);
String myText = pptExtractor.getText(true,true);
if( myText != null && !myText.trim().equals(""))
{
text = myText;
}
}
catch(OutOfMemoryError oome)
{
text = null;
log.error("could not extract text", oome);
throw(oome);
}
catch(Exception e)
{
text = null;
log.error("could not get text for power point document " + f.getAbsolutePath(), e);
throw(e);
}
finally
{
closeInputStream(inputStream);
inputStream = null;
}
return text;
}
开发者ID:nate-rcl,项目名称:irplus,代码行数:48,代码来源:DefaultPowerPointTextExtractor.java
示例5: main
import org.apache.poi.hslf.HSLFSlideShow; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
if(args.length < 1) {
System.err.println("Need to give a filename");
System.exit(1);
}
HSLFSlideShow ss = new HSLFSlideShow(args[0]);
// Find the documents, and then their SLWT
Record[] records = ss.getRecords();
for(int i=0; i<records.length; i++) {
if(records[i] instanceof Document) {
Document doc = (Document)records[i];
SlideListWithText[] slwts = doc.getSlideListWithTexts();
System.out.println("Document at " + i + " had " + slwts.length + " SlideListWithTexts");
if(slwts.length == 0) {
System.err.println("** Warning: Should have had at least 1! **");
}
if(slwts.length > 3) {
System.err.println("** Warning: Shouldn't have more than 3!");
}
// Check the SLWTs contain what we'd expect
for(int j=0; j<slwts.length; j++) {
SlideListWithText slwt = slwts[j];
Record[] children = slwt.getChildRecords();
System.out.println(" - SLWT at " + j + " had " + children.length + " children:");
// Should only have SlideAtomSets if the second one
int numSAS = slwt.getSlideAtomsSets().length;
if(j == 1) {
if(numSAS == 0) {
System.err.println(" ** 2nd SLWT didn't have any SlideAtomSets!");
} else {
System.out.println(" - Contains " + numSAS + " SlideAtomSets");
}
} else {
if(numSAS > 0) {
System.err.println(" ** SLWT " + j + " had " + numSAS + " SlideAtomSets! (expected 0)");
}
}
// Report the first 5 children, to give a flavour
int upTo = 5;
if(children.length < 5) { upTo = children.length; }
for(int k=0; k<upTo; k++) {
Record r = children[k];
int typeID = (int)r.getRecordType();
String typeName = RecordTypes.recordName(typeID);
System.out.println(" - " + typeID + " (" + typeName + ")");
}
}
}
}
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:58,代码来源:SLWTListing.java
示例6: main
import org.apache.poi.hslf.HSLFSlideShow; //导入依赖的package包/类
public static void main(String args[]) throws IOException {
if (args.length < 1) {
System.err.println("Usage:");
System.err.println("\tImageExtractor <file>");
return;
}
SlideShow ppt = new SlideShow(new HSLFSlideShow(args[0]));
//extract all pictures contained in the presentation
PictureData[] pdata = ppt.getPictureData();
for (int i = 0; i < pdata.length; i++) {
PictureData pict = pdata[i];
// picture data
byte[] data = pict.getData();
int type = pict.getType();
String ext;
switch (type) {
case Picture.JPEG:
ext = ".jpg";
break;
case Picture.PNG:
ext = ".png";
break;
case Picture.WMF:
ext = ".wmf";
break;
case Picture.EMF:
ext = ".emf";
break;
case Picture.PICT:
ext = ".pict";
break;
case Picture.DIB:
ext = ".dib";
break;
default:
continue;
}
FileOutputStream out = new FileOutputStream("pict_" + i + ext);
out.write(data);
out.close();
}
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:46,代码来源:ImageExtractor.java
示例7: SlideShowRecordDumper
import org.apache.poi.hslf.HSLFSlideShow; //导入依赖的package包/类
/**
* Constructs a Powerpoint dump from fileName. Parses the document
* and dumps out the contents
*
* @param fileName The name of the file to read.
* @throws IOException if there is a problem while parsing the document.
*/
public SlideShowRecordDumper(String fileName, boolean verbose, boolean escher) throws IOException
{
optVerbose = verbose;
optEscher = escher;
doc = new HSLFSlideShow(fileName);
}
开发者ID:rmage,项目名称:gnvc-ims,代码行数:14,代码来源:SlideShowRecordDumper.java
注:本文中的org.apache.poi.hslf.HSLFSlideShow类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论