poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nilez <im.ni...@gmail.com>
Subject How to create oleObject1.bin for Word (.docx)
Date Wed, 22 Nov 2017 05:04:16 GMT
Hi all,

I am new for poi.

I would like to insert objects in Microsoft word (.docx) using java.

In the editor, I can insert object (from several file types) by going to
menu : *Insert > Object...*
<http://apache-poi.1045710.n5.nabble.com/file/t340505/0.jpg> 

Following are structure of each object in *\word\embeddings\* when I have
tried to insert /file.docx, file.odt, and file.pdf/
*\word\embeddings\*
  - Microsoft_Word_Document1.docx
  - oleObject1.bin
  - oleObject2.bin

<http://apache-poi.1045710.n5.nabble.com/file/t340505/3.jpg> 

Structure of oleObject1.bin
*\word\embeddings\oleObject1.bin\*
  - [1]CompObj
  - [1]Ole
  - package_stream
  - [3]ObjInfo
  - properties_stream

<http://apache-poi.1045710.n5.nabble.com/file/t340505/4.jpg> 

Structure of oleObject2.bin
*\word\embeddings\oleObject2.bin\*
  - [3]EPRINT
  - [1]Ole
  - [3]ObjInfo
  - [1]CompObj
  - CONTENTS

<http://apache-poi.1045710.n5.nabble.com/file/t340505/5.jpg> 


I see the example to create oleObject1.bin in TestEmbed.addHtml() from  This
link
<https://stackoverflow.com/questions/40382369/embed-files-into-xssf-sheets-in-excel-using-apache-poi>
 

And I have tried to create my code as below to create sample oleObject1.bin



When I try to create ole object from .odt file



The output is oleObject1.bin but its structure does not match to
oleObject1.bin that is created by editor
*\word\embeddings\oleObject1.bin\*
  - [1]Ole10Native

However the structure of o/leObject1.bin\[1]Ole10Native/ (from my code)
match to /oleObject1.bin\package_stream/ (from structure)

This is my misunderstand about oleObject and POI APIs.

I wonder that
1. How file (several type) is stored in Word? It seem the embedded object
from each file type has different format and structure.
- file.docx ---> embedded.docx
- file.odt, file.pdf ---> oleObject1.bin (stored as binary but contain
different structure)


2. How to decide the structure of oleObject1.bin from each file type? 
For example: file.odt and file.pdf, they are stored as same format but
contain different sub-files and sub-directories. Where can i find the
specification to create ole object from each file type?
- oleObject1.bin from file.odt
  - [1]CompObj
  - [1]Ole
  - package_stream
  - [3]ObjInfo
  - properties_stream

- oleObject2.bin from file.pdf
  - [3]EPRINT
  - [1]Ole
  - [3]ObjInfo
  - [1]CompObj
  - CONTENTS

3. Can I create the complete oleObject1.bin (including its sub-files or
sub-directories) using POI library? 
How to do that? 
How to create [1]CompObj, [1]Ole, [3]ObjInfo, ... etc.?

Thanks in advance



-----
Best regards,
Nilez
--
Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message