Copy media image from one HeaderPart to another
Posted: Fri Feb 22, 2019 12:05 am
I want to copy the image resource which is typically in the docx word/media folder to another docx headerpart.
At the moment I have to store the image as a resource in my project and retrieve it to add it to the HeaderPart like this:
But I have an template docx file with a template HeaderPart and I woud like to copy the image out of the template part and add it to my main HeaderPart.
How could I copy the image resource from the template headerpart media folder to my main HeaderPart?
At the moment I have to store the image as a resource in my project and retrieve it to add it to the HeaderPart like this:
- Code: Select all
BinaryPartAbstractImage.createImagePart(wordMLPackage,
headerPart, BufferUtil.getBytesFromInputStream(WordX.class.getResourceAsStream("myimage.png")));
But I have an template docx file with a template HeaderPart and I woud like to copy the image out of the template part and add it to my main HeaderPart.
How could I copy the image resource from the template headerpart media folder to my main HeaderPart?