当前位置: 首页>>代码示例>>Java>>正文


Java SlideShow.getPictureData方法代码示例

本文整理汇总了Java中org.apache.poi.hslf.usermodel.SlideShow.getPictureData方法的典型用法代码示例。如果您正苦于以下问题:Java SlideShow.getPictureData方法的具体用法?Java SlideShow.getPictureData怎么用?Java SlideShow.getPictureData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.poi.hslf.usermodel.SlideShow的用法示例。


在下文中一共展示了SlideShow.getPictureData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPictureData

import org.apache.poi.hslf.usermodel.SlideShow; //导入方法依赖的package包/类
/**
 * Returns the picture data for this picture.
 *
 * @return the picture data for this picture.
 */
public PictureData getPictureData(){
    SlideShow ppt = getSheet().getSlideShow();
    PictureData[] pict = ppt.getPictureData();

    EscherBSERecord bse = getEscherBSERecord();
    if (bse == null){
        logger.log(POILogger.ERROR, "no reference to picture data found ");
    } else {
        for ( int i = 0; i < pict.length; i++ ) {
            if (pict[i].getOffset() ==  bse.getOffset()){
                return pict[i];
            }
        }
        logger.log(POILogger.ERROR, "no picture found for our BSE offset " + bse.getOffset());
    }
    return null;
}
 
开发者ID:rmage,项目名称:gnvc-ims,代码行数:23,代码来源:Picture.java

示例2: handleSlideEmbeddedPictures

import org.apache.poi.hslf.usermodel.SlideShow; //导入方法依赖的package包/类
private void handleSlideEmbeddedPictures(SlideShow slideshow,
    XHTMLContentHandler xhtml) throws TikaException, SAXException,
    IOException {
  for (PictureData pic : slideshow.getPictureData()) {
    String mediaType = null;

    switch (pic.getType()) {
    case Picture.EMF:
      mediaType = "application/x-emf";
      break;
    case Picture.JPEG:
      mediaType = "image/jpeg";
      break;
    case Picture.PNG:
      mediaType = "image/png";
      break;
    case Picture.WMF:
      mediaType = "application/x-msmetafile";
      break;
    case Picture.DIB:
      mediaType = "image/bmp";
      break;
    }

    try {
      handleEmbeddedResource(TikaInputStream.get(pic.getData()), null, null,
          mediaType, xhtml, false);
    } catch (Exception e) {
      // log as info
    }
  }
}
 
开发者ID:kolbasa,项目名称:OCRaptor,代码行数:33,代码来源:HSLFExtractor.java

示例3: getPictureData

import org.apache.poi.hslf.usermodel.SlideShow; //导入方法依赖的package包/类
/**
 * <code>PictureData</code> object used in a texture, pattern of picture fill.
 */
public PictureData getPictureData(){
    EscherOptRecord opt = (EscherOptRecord)Shape.getEscherChild(shape.getSpContainer(), EscherOptRecord.RECORD_ID);
    EscherSimpleProperty p = (EscherSimpleProperty)Shape.getEscherProperty(opt, EscherProperties.FILL__PATTERNTEXTURE);
    if (p == null) return null;

    SlideShow ppt = shape.getSheet().getSlideShow();
    PictureData[] pict = ppt.getPictureData();
    Document doc = ppt.getDocumentRecord();

    EscherContainerRecord dggContainer = doc.getPPDrawingGroup().getDggContainer();
    EscherContainerRecord bstore = (EscherContainerRecord)Shape.getEscherChild(dggContainer, EscherContainerRecord.BSTORE_CONTAINER);

    java.util.List<EscherRecord> lst = bstore.getChildRecords();
    int idx = p.getPropertyValue();
    if (idx == 0){
        logger.log(POILogger.WARN, "no reference to picture data found ");
    } else {
        EscherBSERecord bse = (EscherBSERecord)lst.get(idx - 1);
        for ( int i = 0; i < pict.length; i++ ) {
            if (pict[i].getOffset() ==  bse.getOffset()){
                return pict[i];
            }
        }
    }

    return null;
}
 
开发者ID:rmage,项目名称:gnvc-ims,代码行数:31,代码来源:Fill.java

示例4: main

import org.apache.poi.hslf.usermodel.SlideShow; //导入方法依赖的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


注:本文中的org.apache.poi.hslf.usermodel.SlideShow.getPictureData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。