Inserting OLE objects in docx, pptx or xlsx, using Java
OLE Helper makes it easy to use docx4j to programmatically embed or link files as OLE objects in a docx, pptx, or xlsx.
File types which can be embedded/linked with this tool include:
- PDF
- Binary Office documents (eg Word .doc, PowerPoint .ppt, Visio .vsd, Excel .xls files)
- Office OpenXML documents (eg Word .docx, PowerPoint .pptx, Visio .vsdx, Excel .xlsx files)
- Outlook message files
- Video files (.MOV, .WMV)
- Zip files
- Text files (plain text, CSV, XML etc)
- HTML and MHT files
- Open Document Format (LibreOffice/OpenOffice) files
Without this OLE Helper, it can be a real challenge to convert your file into a suitably structured OLE object, which works across Office 2007, 2010 and 2013.
OLE Helper is part of Plutext's commercial Docx4j Enterprise Edition, but you can still use it if you are using Apache POI or Aspose.Words.
You can download a trial version of Docx4j Enterprise from our products page (including as an Eclipse project ready to run); you’ll also find pricing and ordering info there.
Sample code
Example code includes the following:
EmbeddingType
|
docx
|
pptx
|
xlsx
|
DOC, PPT, XLS
|
Docx_ole_Doc.java
|
-
|
-
|
DOCX, PPTX, XLSX
|
-
|
-
|
-
|
MSG (Outlook msg)
|
Docx_ole_OutlookMsg.java
|
-
|
-
|
PDF
|
Docx_ole_PDF.java
|
Pptx_ole_PDF
|
Xlsx_ole_PDF
|
TXT
|
Docx_ole_txt.java
|
Pptx_ole_txt.java
|
-
|
ZIP
|
Docx_ole_zip.java
|
-
|
-
|
MOV, WMV
|
Docx_ole_wmv.java
|
Pptx_ole_wmv.java
|
Xlsx_ole_wmv.java
|