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

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

本文整理了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

  1. /**
  2. * Gets all pictures from the Workbook.
  3. *
  4. * @return the list of pictures (a list of {@link HSSFPictureData} objects.)
  5. */
  6. @Override
  7. public List<HSSFPictureData> getAllPictures()
  8. {
  9. // The drawing group record always exists at the top level, so we won't need to do this recursively.
  10. List<HSSFPictureData> pictures = new ArrayList<>();
  11. for (Record r : workbook.getRecords()) {
  12. if (r instanceof AbstractEscherHolderRecord) {
  13. ((AbstractEscherHolderRecord) r).decode();
  14. List<EscherRecord> escherRecords = ((AbstractEscherHolderRecord) r).getEscherRecords();
  15. searchForPictures(escherRecords, pictures);
  16. }
  17. }
  18. return Collections.unmodifiableList(pictures);
  19. }

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

  1. /**
  2. * Performs a recursive search for pictures in the given list of escher records.
  3. *
  4. * @param escherRecords the escher records.
  5. * @param pictures the list to populate with the pictures.
  6. */
  7. private void searchForPictures(List<EscherRecord> escherRecords, List<HSSFPictureData> pictures)
  8. {
  9. for(EscherRecord escherRecord : escherRecords) {
  10. if (escherRecord instanceof EscherBSERecord)
  11. {
  12. EscherBlipRecord blip = ((EscherBSERecord) escherRecord).getBlipRecord();
  13. if (blip != null)
  14. {
  15. // TODO: Some kind of structure.
  16. HSSFPictureData picture = new HSSFPictureData(blip);
  17. pictures.add(picture);
  18. }
  19. }
  20. // Recursive call.
  21. searchForPictures(escherRecord.getChildRecords(), pictures);
  22. }
  23. }

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

  1. /**
  2. * Gets all pictures from the Workbook.
  3. *
  4. * @return the list of pictures (a list of {@link HSSFPictureData} objects.)
  5. */
  6. public List<HSSFPictureData> getAllPictures()
  7. {
  8. // The drawing group record always exists at the top level, so we won't need to do this recursively.
  9. List<HSSFPictureData> pictures = new ArrayList<HSSFPictureData>();
  10. Iterator<Record> recordIter = workbook.getRecords().iterator();
  11. while (recordIter.hasNext())
  12. {
  13. Record r = recordIter.next();
  14. if (r instanceof AbstractEscherHolderRecord)
  15. {
  16. ((AbstractEscherHolderRecord) r).decode();
  17. List<EscherRecord> escherRecords = ((AbstractEscherHolderRecord) r).getEscherRecords();
  18. searchForPictures(escherRecords, pictures);
  19. }
  20. }
  21. return pictures;
  22. }

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

  1. /**
  2. * Gets all pictures from the Workbook.
  3. *
  4. * @return the list of pictures (a list of {@link HSSFPictureData} objects.)
  5. */
  6. public List<HSSFPictureData> getAllPictures()
  7. {
  8. // The drawing group record always exists at the top level, so we won't need to do this recursively.
  9. List<HSSFPictureData> pictures = new ArrayList<HSSFPictureData>();
  10. Iterator<Record> recordIter = workbook.getRecords().iterator();
  11. while (recordIter.hasNext())
  12. {
  13. Record r = recordIter.next();
  14. if (r instanceof AbstractEscherHolderRecord)
  15. {
  16. ((AbstractEscherHolderRecord) r).decode();
  17. List<EscherRecord> escherRecords = ((AbstractEscherHolderRecord) r).getEscherRecords();
  18. searchForPictures(escherRecords, pictures);
  19. }
  20. }
  21. return pictures;
  22. }

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

  1. /**
  2. * Gets all pictures from the Workbook.
  3. *
  4. * @return the list of pictures (a list of {@link HSSFPictureData} objects.)
  5. */
  6. @Override
  7. public List<HSSFPictureData> getAllPictures()
  8. {
  9. // The drawing group record always exists at the top level, so we won't need to do this recursively.
  10. List<HSSFPictureData> pictures = new ArrayList<>();
  11. for (Record r : workbook.getRecords()) {
  12. if (r instanceof AbstractEscherHolderRecord) {
  13. ((AbstractEscherHolderRecord) r).decode();
  14. List<EscherRecord> escherRecords = ((AbstractEscherHolderRecord) r).getEscherRecords();
  15. searchForPictures(escherRecords, pictures);
  16. }
  17. }
  18. return Collections.unmodifiableList(pictures);
  19. }

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

  1. /**
  2. * Performs a recursive search for pictures in the given list of escher records.
  3. *
  4. * @param escherRecords the escher records.
  5. * @param pictures the list to populate with the pictures.
  6. */
  7. private void searchForPictures(List<EscherRecord> escherRecords, List<HSSFPictureData> pictures)
  8. {
  9. for(EscherRecord escherRecord : escherRecords) {
  10. if (escherRecord instanceof EscherBSERecord)
  11. {
  12. EscherBlipRecord blip = ((EscherBSERecord) escherRecord).getBlipRecord();
  13. if (blip != null)
  14. {
  15. // TODO: Some kind of structure.
  16. HSSFPictureData picture = new HSSFPictureData(blip);
  17. pictures.add(picture);
  18. }
  19. }
  20. // Recursive call.
  21. searchForPictures(escherRecord.getChildRecords(), pictures);
  22. }
  23. }

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

  1. /**
  2. * Performs a recursive search for pictures in the given list of escher records.
  3. *
  4. * @param escherRecords the escher records.
  5. * @param pictures the list to populate with the pictures.
  6. */
  7. private void searchForPictures(List<EscherRecord> escherRecords, List<HSSFPictureData> pictures)
  8. {
  9. for(EscherRecord escherRecord : escherRecords) {
  10. if (escherRecord instanceof EscherBSERecord)
  11. {
  12. EscherBlipRecord blip = ((EscherBSERecord) escherRecord).getBlipRecord();
  13. if (blip != null)
  14. {
  15. // TODO: Some kind of structure.
  16. HSSFPictureData picture = new HSSFPictureData(blip);
  17. pictures.add(picture);
  18. }
  19. }
  20. // Recursive call.
  21. searchForPictures(escherRecord.getChildRecords(), pictures);
  22. }
  23. }

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

  1. /**
  2. * Performs a recursive search for pictures in the given list of escher records.
  3. *
  4. * @param escherRecords the escher records.
  5. * @param pictures the list to populate with the pictures.
  6. */
  7. private void searchForPictures(List<EscherRecord> escherRecords, List<HSSFPictureData> pictures)
  8. {
  9. for(EscherRecord escherRecord : escherRecords) {
  10. if (escherRecord instanceof EscherBSERecord)
  11. {
  12. EscherBlipRecord blip = ((EscherBSERecord) escherRecord).getBlipRecord();
  13. if (blip != null)
  14. {
  15. // TODO: Some kind of structure.
  16. HSSFPictureData picture = new HSSFPictureData(blip);
  17. pictures.add(picture);
  18. }
  19. }
  20. // Recursive call.
  21. searchForPictures(escherRecord.getChildRecords(), pictures);
  22. }
  23. }

相关文章

HSSFWorkbook类方法