本文整理了Java中org.apache.poi.hssf.usermodel.HSSFWorkbook.getAllEmbeddedObjects()
方法的一些代码示例,展示了HSSFWorkbook.getAllEmbeddedObjects()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HSSFWorkbook.getAllEmbeddedObjects()
方法的具体详情如下:
包路径:org.apache.poi.hssf.usermodel.HSSFWorkbook
类名称:HSSFWorkbook
方法名:getAllEmbeddedObjects
[英]Gets all embedded OLE2 objects from the Workbook.
[中]从工作簿中获取所有嵌入的OLE2对象。
代码示例来源:origin: org.apache.poi/poi
/**
* Gets all embedded OLE2 objects from the Workbook.
*
* @return the list of embedded objects (a list of {@link HSSFObjectData} objects.)
*/
public List<HSSFObjectData> getAllEmbeddedObjects()
{
List<HSSFObjectData> objects = new ArrayList<>();
for (HSSFSheet sheet : _sheets)
{
getAllEmbeddedObjects(sheet, objects);
}
return Collections.unmodifiableList(objects);
}
代码示例来源:origin: org.apache.poi/poi
/**
* Gets all embedded OLE2 objects from the Workbook.
*
* @param sheet embedded object attached to
* @param objects the list of embedded objects to populate.
*/
private void getAllEmbeddedObjects(HSSFSheet sheet, List<HSSFObjectData> objects)
{
HSSFPatriarch patriarch = sheet.getDrawingPatriarch();
if (null == patriarch){
return;
}
getAllEmbeddedObjects(patriarch, objects);
}
/**
代码示例来源:origin: org.apache.poi/poi
/**
* Recursively iterates a shape container to get all embedded objects.
*
* @param parent the parent.
* @param objects the list of embedded objects to populate.
*/
private void getAllEmbeddedObjects(HSSFShapeContainer parent, List<HSSFObjectData> objects)
{
for (HSSFShape shape : parent.getChildren()) {
if (shape instanceof HSSFObjectData) {
objects.add((HSSFObjectData) shape);
} else if (shape instanceof HSSFShapeContainer) {
getAllEmbeddedObjects((HSSFShapeContainer) shape, objects);
}
}
}
@Override
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Gets all embedded OLE2 objects from the Workbook.
*
* @return the list of embedded objects (a list of {@link HSSFObjectData} objects.)
*/
public List<HSSFObjectData> getAllEmbeddedObjects()
{
List<HSSFObjectData> objects = new ArrayList<>();
for (HSSFSheet sheet : _sheets)
{
getAllEmbeddedObjects(sheet, objects);
}
return Collections.unmodifiableList(objects);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Gets all embedded OLE2 objects from the Workbook.
*
* @param sheet embedded object attached to
* @param objects the list of embedded objects to populate.
*/
private void getAllEmbeddedObjects(HSSFSheet sheet, List<HSSFObjectData> objects)
{
HSSFPatriarch patriarch = sheet.getDrawingPatriarch();
if (null == patriarch){
return;
}
getAllEmbeddedObjects(patriarch, objects);
}
/**
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Recursively iterates a shape container to get all embedded objects.
*
* @param parent the parent.
* @param objects the list of embedded objects to populate.
*/
private void getAllEmbeddedObjects(HSSFShapeContainer parent, List<HSSFObjectData> objects)
{
for (HSSFShape shape : parent.getChildren()) {
if (shape instanceof HSSFObjectData) {
objects.add((HSSFObjectData) shape);
} else if (shape instanceof HSSFShapeContainer) {
getAllEmbeddedObjects((HSSFShapeContainer) shape, objects);
}
}
}
@Override
代码示例来源:origin: com.haulmont.thirdparty/poi
/**
* Gets all embedded OLE2 objects from the Workbook.
*
* @return the list of embedded objects (a list of {@link HSSFObjectData} objects.)
*/
public List<HSSFObjectData> getAllEmbeddedObjects()
{
List<HSSFObjectData> objects = new ArrayList<HSSFObjectData>();
for (int i = 0; i < getNumberOfSheets(); i++)
{
getAllEmbeddedObjects(getSheetAt(i), objects);
}
return objects;
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
/**
* Gets all embedded OLE2 objects from the Workbook.
*
* @return the list of embedded objects (a list of {@link HSSFObjectData} objects.)
*/
public List<HSSFObjectData> getAllEmbeddedObjects()
{
List<HSSFObjectData> objects = new ArrayList<HSSFObjectData>();
for (int i = 0; i < getNumberOfSheets(); i++)
{
getAllEmbeddedObjects(getSheetAt(i).getSheet().getRecords(), objects);
}
return objects;
}
代码示例来源:origin: stackoverflow.com
import java.io.*;
import java.net.URL;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.poifs.filesystem.*;
import org.apache.poi.util.IOUtils;
public class EmbeddedPdfInExcel {
public static void main(String[] args) throws Exception {
NPOIFSFileSystem fs = new NPOIFSFileSystem(new URL("http://jamesshaji.com/sample.xls").openStream());
HSSFWorkbook wb = new HSSFWorkbook(fs.getRoot(), true);
for (HSSFObjectData obj : wb.getAllEmbeddedObjects()) {
String oleName = obj.getOLE2ClassName();
DirectoryNode dn = (DirectoryNode)obj.getDirectory();
if(oleName.contains("Acro") && dn.hasEntry("CONTENTS")){
InputStream is = dn.createDocumentInputStream("CONTENTS");
FileOutputStream fos = new FileOutputStream(obj.getDirectory().getName()+".pdf");
IOUtils.copy(is, fos);
fos.close();
is.close();
}
}
fs.close();
}
}
代码示例来源:origin: org.apache.poi/poi-examples
POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(args[0]));
try (HSSFWorkbook workbook = new HSSFWorkbook(fs)) {
for (HSSFObjectData obj : workbook.getAllEmbeddedObjects()) {
代码示例来源:origin: org.apache.poi/poi-examples
public static void loadEmbedded(HSSFWorkbook workbook) throws IOException {
for (HSSFObjectData obj : workbook.getAllEmbeddedObjects()) {
内容来源于网络,如有侵权,请联系作者删除!