I have modified AddImage.java sample to add WMF image (by simply pointing to load sample WMF file instead of PDF as it is in original sample) and I cannot made it to work.
Sample runs and than it spits with exception:
- Code: Select all
org.docx4j.openpackaging.parts.WordprocessingML.MetafileWmfPart cannot be cast to org.docx4j.openpackaging.parts.WordprocessingML.BinaryPartAbstractImage
If I change sample file to use MetafileWmfPart instead of BinaryPartAbstractImage than there is a problem as MetafileWmfPart class has no methods createImagePart or createImageInline. I think this is because MetafileWmfPart extends MetafilePart. Similar class MetafileEmfPart extends BinaryPartAbstractImage. Is it possible to change MetafileWmfPart to also extend BinaryPartAbstractImage? Or some other refactoring is needed as createImagePart returns BinaryPartAbstractImage, so such method of MetafileWmfPart should return MetafileWmfPart
Thanks,
Piotr