怎么用java读取excel中的内嵌对象的文件地址

现在用的是poi读取到的数据类型是:application/vnd.openxmlformats-officedocument.oleObject
excel里面的PDF还是rar压缩包都读出这个类型

img


,怎么解析这个类型的文件获取文件路径

public static void main(String[] arge) throws IOException, OpenXML4JException {
    String xlsName = "D:\\testa.xlsx";
    XSSFWorkbook workbook = new XSSFWorkbook(xlsName);
    try (FileInputStream fis = new FileInputStream(xlsName);
         Workbook xls = WorkbookFactory.create(fis)) {
            Sheet s = xls.getSheetAt(0);
            Drawing<?> dp = s.getDrawingPatriarch();
            if (dp != null) {
                for (Shape sh : dp) {
                    if (sh instanceof ObjectData) {
                        ObjectData od = (ObjectData)sh;
                        String filename = od.getFileName();
                        String fileType = od.getContentType();
                        String ext = null;

                        if (filename != null && !filename.isEmpty()) {
                            int i = filename.lastIndexOf('.');
                            ext = (i > 0) ? filename.substring(i) : ".bin";
                        } else {
                            String ct = null;
                            try {
                                DirectoryEntry de = od.getDirectory();

                                if (de != null) {
                                    ClassIDPredefined ctcls = ClassIDPredefined.lookup(de.getStorageClsid());
                                    if (ctcls != null) {
                                        ext = ctcls.getFileExtension();
                                    }
                                }
                            } catch (Exception ignore) {
                            }
                        }
                        if (ext == null) {
                            ext = ".bin";
                        }
                        String ssn=sh.getShapeName();
                        ChildAnchor chAnc = sh.getAnchor();
                        if (chAnc instanceof ClientAnchor) {
                            ClientAnchor anc = (ClientAnchor) chAnc;
                            System.out.println("fileType:"+fileType+"- Sheet:"+s.getSheetName()+"- Rows: " + anc.getRow1() + " to " + anc.getRow2() + " - filename: "+filename+" - ext: "+ext+"");
                        }
                    }
                }
            }
    }
}

ObjectData是获取出的对象信息
另外一个方法是

    XSSFWorkbook workbook = new XSSFWorkbook(xlsName);
    for (PackagePart pPart : workbook.getAllEmbeddedParts()) {
        String contentType = pPart.toString();
        System.out.println(contentType);
    }

excel里面的文件对象是下面这种形式的

img

4月1日:
用Spire.XLS for Java里面的方法提取出文件了,只是在提取过程中获取不到文件名,压缩包格式的文件不好判断是rar还在zip,有方法获取ole类文件的名称吗
https://www.e-iceblue.cn/xls_java_other/extract-ole-objects-from-an-excel-document-in-java.html

1:你把主要代码 贴出来 很比较好