How can I Embed zip,text,pdf or any format in Word document using Aspose.Words for JAVA.
Thanks for your inquiry. Yes, you can insert word/pdf/text files in word document at any place. Please use DocumentBuilder.insertOleObject method to insert an embedded or linked OLE object from a file into the document.
Please check following code example for your kind reference. Hope this helps you.
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); BufferedImage image = ImageIO.read(new File(MyDir + "Aspose.Words.png")); Shape oleObject = builder.insertOleObject(MyDir + "ActualOutput.docx", true, false, image); doc.save(MyDir + "out.docx");
Is it possible to embed zip as well as that didn’t work for me.
Thanks for your inquiry. Yes, you can embed zip file in Word document using DocumentBuilder.insertOleObject. Could you please share your scenario along with documents in which this method does not work at your side? I will investigate the issue on my side and provide you more information.
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.insertOleObject(MyDir + "in.zip", false, false, null); doc.save(MyDir + "Out.docx");
i could not find in which jar file DocumentBuilder.insertOleobject method is present.
can you please help me out of this
Thanks for your inquiry. Please use latest version of Aspose.Words for Java 16.1.0 and let us know if you have any more queries.
Under which jar file will i get the method “builder.insertOleObject” ?
I have used aspose-words-16.12.0-jdk16.jar and also