org.apache.poi.hssf.usermodel.HSSFWorkbook.searchForPictures()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中org.apache.poi.hssf.usermodel.HSSFWorkbook.searchForPictures()方法的一些代码示例,展示了HSSFWorkbook.searchForPictures()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HSSFWorkbook.searchForPictures()方法的具体详情如下:
包路径:org.apache.poi.hssf.usermodel.HSSFWorkbook
类名称:HSSFWorkbook
方法名:searchForPictures

HSSFWorkbook.searchForPictures介绍

[英]Performs a recursive search for pictures in the given list of escher records.
[中]对给定的escher记录列表中的图片执行递归搜索。

代码示例

代码示例来源:origin: org.apache.poi/poi

/**
 * Gets all pictures from the Workbook.
 *
 * @return the list of pictures (a list of {@link HSSFPictureData} objects.)
 */
@Override
public List<HSSFPictureData> getAllPictures()
{
  // The drawing group record always exists at the top level, so we won't need to do this recursively.
  List<HSSFPictureData> pictures = new ArrayList<>();
  for (Record r : workbook.getRecords()) {
    if (r instanceof AbstractEscherHolderRecord) {
      ((AbstractEscherHolderRecord) r).decode();
      List<EscherRecord> escherRecords = ((AbstractEscherHolderRecord) r).getEscherRecords();
      searchForPictures(escherRecords, pictures);
    }
  }
  return Collections.unmodifiableList(pictures);
}

代码示例来源:origin: org.apache.poi/poi

/**
 * Performs a recursive search for pictures in the given list of escher records.
 *
 * @param escherRecords the escher records.
 * @param pictures the list to populate with the pictures.
 */
private void searchForPictures(List<EscherRecord> escherRecords, List<HSSFPictureData> pictures)
{
  for(EscherRecord escherRecord : escherRecords) {
    if (escherRecord instanceof EscherBSERecord)
    {
      EscherBlipRecord blip = ((EscherBSERecord) escherRecord).getBlipRecord();
      if (blip != null)
      {
        // TODO: Some kind of structure.
        HSSFPictureData picture = new HSSFPictureData(blip);
        pictures.add(picture);
      }
    }
    // Recursive call.
    searchForPictures(escherRecord.getChildRecords(), pictures);
  }
}

代码示例来源:origin: com.haulmont.thirdparty/poi

/**
 * Gets all pictures from the Workbook.
 *
 * @return the list of pictures (a list of {@link HSSFPictureData} objects.)
 */
public List<HSSFPictureData> getAllPictures()
{
  // The drawing group record always exists at the top level, so we won't need to do this recursively.
  List<HSSFPictureData> pictures = new ArrayList<HSSFPictureData>();
  Iterator<Record> recordIter = workbook.getRecords().iterator();
  while (recordIter.hasNext())
  {
    Record r = recordIter.next();
    if (r instanceof AbstractEscherHolderRecord)
    {
      ((AbstractEscherHolderRecord) r).decode();
      List<EscherRecord> escherRecords = ((AbstractEscherHolderRecord) r).getEscherRecords();
      searchForPictures(escherRecords, pictures);
    }
  }
  return pictures;
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/**
 * Gets all pictures from the Workbook.
 *
 * @return the list of pictures (a list of {@link HSSFPictureData} objects.)
 */
public List<HSSFPictureData> getAllPictures()
{
  // The drawing group record always exists at the top level, so we won't need to do this recursively.
  List<HSSFPictureData> pictures = new ArrayList<HSSFPictureData>();
  Iterator<Record> recordIter = workbook.getRecords().iterator();
  while (recordIter.hasNext())
  {
    Record r = recordIter.next();
    if (r instanceof AbstractEscherHolderRecord)
    {
      ((AbstractEscherHolderRecord) r).decode();
      List<EscherRecord> escherRecords = ((AbstractEscherHolderRecord) r).getEscherRecords();
      searchForPictures(escherRecords, pictures);
    }
  }
  return pictures;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
 * Gets all pictures from the Workbook.
 *
 * @return the list of pictures (a list of {@link HSSFPictureData} objects.)
 */
@Override
public List<HSSFPictureData> getAllPictures()
{
  // The drawing group record always exists at the top level, so we won't need to do this recursively.
  List<HSSFPictureData> pictures = new ArrayList<>();
  for (Record r : workbook.getRecords()) {
    if (r instanceof AbstractEscherHolderRecord) {
      ((AbstractEscherHolderRecord) r).decode();
      List<EscherRecord> escherRecords = ((AbstractEscherHolderRecord) r).getEscherRecords();
      searchForPictures(escherRecords, pictures);
    }
  }
  return Collections.unmodifiableList(pictures);
}

代码示例来源:origin: com.haulmont.thirdparty/poi

/**
 * Performs a recursive search for pictures in the given list of escher records.
 *
 * @param escherRecords the escher records.
 * @param pictures the list to populate with the pictures.
 */
private void searchForPictures(List<EscherRecord> escherRecords, List<HSSFPictureData> pictures)
{
  for(EscherRecord escherRecord : escherRecords) {
    if (escherRecord instanceof EscherBSERecord)
    {
      EscherBlipRecord blip = ((EscherBSERecord) escherRecord).getBlipRecord();
      if (blip != null)
      {
        // TODO: Some kind of structure.
        HSSFPictureData picture = new HSSFPictureData(blip);
        pictures.add(picture);
      }
      
      
    }
    // Recursive call.
    searchForPictures(escherRecord.getChildRecords(), pictures);
  }
  
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
 * Performs a recursive search for pictures in the given list of escher records.
 *
 * @param escherRecords the escher records.
 * @param pictures the list to populate with the pictures.
 */
private void searchForPictures(List<EscherRecord> escherRecords, List<HSSFPictureData> pictures)
{
  for(EscherRecord escherRecord : escherRecords) {
    if (escherRecord instanceof EscherBSERecord)
    {
      EscherBlipRecord blip = ((EscherBSERecord) escherRecord).getBlipRecord();
      if (blip != null)
      {
        // TODO: Some kind of structure.
        HSSFPictureData picture = new HSSFPictureData(blip);
        pictures.add(picture);
      }
    }
    // Recursive call.
    searchForPictures(escherRecord.getChildRecords(), pictures);
  }
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/**
 * Performs a recursive search for pictures in the given list of escher records.
 *
 * @param escherRecords the escher records.
 * @param pictures the list to populate with the pictures.
 */
private void searchForPictures(List<EscherRecord> escherRecords, List<HSSFPictureData> pictures)
{
  for(EscherRecord escherRecord : escherRecords) {
    if (escherRecord instanceof EscherBSERecord)
    {
      EscherBlipRecord blip = ((EscherBSERecord) escherRecord).getBlipRecord();
      if (blip != null)
      {
        // TODO: Some kind of structure.
        HSSFPictureData picture = new HSSFPictureData(blip);
        pictures.add(picture);
      }
      
      
    }
    // Recursive call.
    searchForPictures(escherRecord.getChildRecords(), pictures);
  }
  
}

相关文章

HSSFWorkbook类方法