現在、Excelファイル(* .xlsm)とApache POIで作業しています。 PDFが埋め込まれたExcelファイルをいくつか受け取っていますが、それらのファイルを抽出し、行と列に基づいて名前を変更したいのですが 埋め込まれたオブジェクトがイメージとして表され、 1つのセルよりも大きく、技術的にはセルの「In」ではありません。POIを含む埋め込みオブジェクトの行とColを取得
次のコードスニペットを使用すると、埋め込まれたPDFを抽出できますが、OleObject [1..2..3.etc ..]という名前が付けられています。
inStream = new FileInputStream(file);
XSSFWorkbook workbook = new XSSFWorkbook(inStream);
for (PackagePart pPart : workbook.getAllEmbedds()) {
String contentType = pPart.getContentType();
if (contentType.equals("application/vnd.openxmlformats-officedocument.oleObject")){
POIFSFileSystem fs = new POIFSFileSystem(pPart.getInputStream());
TikaInputStream stream = TikaInputStream.get(fs.createDocumentInputStream("CONTENTS"));
byte[] bytes = IOUtil.toByteArray(stream);
stream.close();
OutputStream outStream = new FileOutputStream(new File(ROOT_DIRECTORY.getAbsolutePath()+"\\PDF"+i+".pdf"));
IOUtil.copy(bytes, outStream);
outStream.close();
}}
私はorg.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheetは私がエクセルシートのXMLコードを見てみましょうし、多分taht EITH私は必要な情報を得ることができるかどうかを知りたいと思いました。このような。
<oleObjects><mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"><mc:Choice Requires="x14"><oleObject progId="Acrobat Document" dvAspect="DVASPECT_ICON" shapeId="1028" r:id="rId4"><objectPr defaultSize="0" r:id="rId5"><anchor moveWithCells="1"><from><xdr:col>8</xdr:col><xdr:colOff>0</xdr:colOff><xdr:row>11</xdr:row><xdr:rowOff>0</xdr:rowOff></from><to><xdr:col>8</xdr:col><xdr:colOff>1143000</xdr:colOff><xdr:row>13</xdr:row><xdr:rowOff>171450</xdr:rowOff></to></anchor></objectPr></oleObject></mc:Choice><mc:Fallback><oleObject progId="Acrobat Document" dvAspect="DVASPECT_ICON" shapeId="1028" r:id="rId4"/></mc:Fallback></mc:AlternateContent></oleObjects>
-
<objectPr defaultSize="0" r:id="rId5"><anchor moveWithCells="1"><from><xdr:col>8</xdr:col><xdr:colOff>0</xdr:colOff><xdr:row>11</xdr:row><xdr:rowOff>0</xdr:rowOff></from><to><xdr:col>8</xdr:col><xdr:colOff>1143000</xdr:colOff><xdr:row>13</xdr:row><xdr:rowOff>171450</xdr:rowOff></to></anchor></objectPr>
私はアンカーの情報を使用して、それを取得する方法を見つけることができないだけで可能ですが、イムだろうと思います。
この情報は、私が何をしようとしているのかを明確にしたいと考えています。
ありがとうございます。