Hi there, I'm trying to use ActiveXControlXmlPart to add ActiveX control in docx, but it report an error when I opened this created documents, says can't open file because content is wrong in position /word/activeX/activeX1.xml. Can someone help me with this?
Here is my code:
WordprocessingMLPackage wordPackage = WordprocessingMLPackage.createPackage();
MainDocumentPart part = wordPackage.getMainDocumentPart();
//[]word/activeX/activeX1.xml
String proposedRelId = part.getRelationshipsPart().getNextId();
ActiveXControlXmlPart activeXPart = new ActiveXControlXmlPart();
activeXPart.setDocument(GetBinaryDataStream(embeddedControlPersistencePart1Data));
Relationship relActiveX = part.addTargetPart(activeXPart,proposedRelId);
//[]word/activeX/activeX1.bin
//ActiveXControlBinaryPart is extends ActiveXControlXmlPart , ...