throw new Docx4JException(this.getClass().getName() + " doesn't implement ContentAccessor"); PartName partName = this.getPartName(); WordprocessingMLPackage clonePkg = (WordprocessingMLPackage)this.getPackage().clone(); // consistent with MergeDocx approach JaxbXmlPartAltChunkHost clonedPart = (JaxbXmlPartAltChunkHost)clonePkg.getParts().get(partName); = (AlternativeFormatInputPart)clonedPart.getRelationshipsPart().getPart( altChunk.getId() ); results = xHTMLImporter.convert(toString(afip.getBuffer()), null); result = toString(afip.getBuffer()); } catch (UnsupportedEncodingException e) { log.error(e.getMessage(), e); return clonePkg; } catch (ClassNotFoundException e) { extensionMissing(e); return clonePkg; } catch (IllegalArgumentException e) { return clonePkg; } catch (NoSuchMethodException e) { extensionMissing(e); return clonePkg; } catch (IllegalAccessException e) {
@Override public AlternativeFormatInputPart addAltChunk(AltChunkType type, byte[] bytes) throws Docx4JException { AlternativeFormatInputPart afiPart = new AlternativeFormatInputPart(type); Relationship altChunkRel = this.addTargetPart(afiPart, AddPartBehaviour.RENAME_IF_NAME_EXISTS); // now that its attached to the package .. afiPart.registerInContentTypeManager(); afiPart.setBinaryData(bytes); // .. the bit in document body CTAltChunk ac = Context.getWmlObjectFactory().createCTAltChunk(); ac.setId(altChunkRel.getId() ); if (this instanceof ContentAccessor) { ((ContentAccessor)this).getContent().add(ac); } else { throw new Docx4JException(this.getClass().getName() + " doesn't implement ContentAccessor"); } return afiPart; }
CTAltChunk altChunk = locatedChunk.getAltChunk(); AlternativeFormatInputPart part = (AlternativeFormatInputPart) mainDocumentPart.getRelationshipsPart().getPart( altChunk.getId()); if (part.getAltChunkType().equals(AltChunkType.Xhtml)) {
CTAltChunk altChunk = locatedChunk.getAltChunk(); AlternativeFormatInputPart part = (AlternativeFormatInputPart) mainDocumentPart.getRelationshipsPart().getPart( altChunk.getId()); if (part.getAltChunkType().equals(AltChunkType.Xhtml)) {
throw new Docx4JException(this.getClass().getName() + " doesn't implement ContentAccessor"); PartName partName = this.getPartName(); WordprocessingMLPackage clonePkg = (WordprocessingMLPackage)this.getPackage().clone(); // consistent with MergeDocx approach JaxbXmlPartAltChunkHost clonedPart = (JaxbXmlPartAltChunkHost)clonePkg.getParts().get(partName); = (AlternativeFormatInputPart)clonedPart.getRelationshipsPart().getPart( altChunk.getId() ); results = xHTMLImporter.convert(toString(afip.getBuffer()), null); result = toString(afip.getBuffer()); } catch (UnsupportedEncodingException e) { log.error(e.getMessage(), e); return clonePkg; } catch (ClassNotFoundException e) { extensionMissing(e); return clonePkg; } catch (IllegalArgumentException e) { return clonePkg; } catch (NoSuchMethodException e) { extensionMissing(e); return clonePkg; } catch (IllegalAccessException e) {
@Override public AlternativeFormatInputPart addAltChunk(AltChunkType type, InputStream is) throws Docx4JException { AlternativeFormatInputPart afiPart = new AlternativeFormatInputPart(type); Relationship altChunkRel = this.addTargetPart(afiPart, AddPartBehaviour.RENAME_IF_NAME_EXISTS); // now that its attached to the package .. afiPart.registerInContentTypeManager(); afiPart.setBinaryData(is); // .. the bit in document body CTAltChunk ac = Context.getWmlObjectFactory().createCTAltChunk(); ac.setId(altChunkRel.getId() ); if (this instanceof ContentAccessor) { ((ContentAccessor)this).getContent().add(ac); } else { throw new Docx4JException(this.getClass().getName() + " doesn't implement ContentAccessor"); } return afiPart; }
@Override public AlternativeFormatInputPart addAltChunk(AltChunkType type, byte[] bytes, ContentAccessor attachmentPoint) throws Docx4JException { AlternativeFormatInputPart afiPart = new AlternativeFormatInputPart(type); Relationship altChunkRel = this.addTargetPart(afiPart, AddPartBehaviour.RENAME_IF_NAME_EXISTS); // now that its attached to the package .. afiPart.registerInContentTypeManager(); afiPart.setBinaryData(bytes); // .. the bit in document body CTAltChunk ac = Context.getWmlObjectFactory().createCTAltChunk(); ac.setId(altChunkRel.getId() ); attachmentPoint.getContent().add(ac); return afiPart; }
@Override public AlternativeFormatInputPart addAltChunk(AltChunkType type, InputStream is, ContentAccessor attachmentPoint) throws Docx4JException { AlternativeFormatInputPart afiPart = new AlternativeFormatInputPart(type); Relationship altChunkRel = this.addTargetPart(afiPart, AddPartBehaviour.RENAME_IF_NAME_EXISTS); // now that its attached to the package .. afiPart.registerInContentTypeManager(); afiPart.setBinaryData(is); // .. the bit in document body CTAltChunk ac = Context.getWmlObjectFactory().createCTAltChunk(); ac.setId(altChunkRel.getId() ); attachmentPoint.getContent().add(ac); return afiPart; }
@Override public AlternativeFormatInputPart addAltChunk(AltChunkType type, InputStream is) throws Docx4JException { AlternativeFormatInputPart afiPart = new AlternativeFormatInputPart(type); Relationship altChunkRel = this.addTargetPart(afiPart, AddPartBehaviour.RENAME_IF_NAME_EXISTS); // now that its attached to the package .. afiPart.registerInContentTypeManager(); afiPart.setBinaryData(is); // .. the bit in document body CTAltChunk ac = Context.getWmlObjectFactory().createCTAltChunk(); ac.setId(altChunkRel.getId() ); if (this instanceof ContentAccessor) { ((ContentAccessor)this).getContent().add(ac); } else { throw new Docx4JException(this.getClass().getName() + " doesn't implement ContentAccessor"); } return afiPart; }
@Override public AlternativeFormatInputPart addAltChunk(AltChunkType type, byte[] bytes) throws Docx4JException { AlternativeFormatInputPart afiPart = new AlternativeFormatInputPart(type); Relationship altChunkRel = this.addTargetPart(afiPart, AddPartBehaviour.RENAME_IF_NAME_EXISTS); // now that its attached to the package .. afiPart.registerInContentTypeManager(); afiPart.setBinaryData(bytes); // .. the bit in document body CTAltChunk ac = Context.getWmlObjectFactory().createCTAltChunk(); ac.setId(altChunkRel.getId() ); if (this instanceof ContentAccessor) { ((ContentAccessor)this).getContent().add(ac); } else { throw new Docx4JException(this.getClass().getName() + " doesn't implement ContentAccessor"); } return afiPart; }
@Override public AlternativeFormatInputPart addAltChunk(AltChunkType type, InputStream is, ContentAccessor attachmentPoint) throws Docx4JException { AlternativeFormatInputPart afiPart = new AlternativeFormatInputPart(type); Relationship altChunkRel = this.addTargetPart(afiPart, AddPartBehaviour.RENAME_IF_NAME_EXISTS); // now that its attached to the package .. afiPart.registerInContentTypeManager(); afiPart.setBinaryData(is); // .. the bit in document body CTAltChunk ac = Context.getWmlObjectFactory().createCTAltChunk(); ac.setId(altChunkRel.getId() ); attachmentPoint.getContent().add(ac); return afiPart; }
@Override public AlternativeFormatInputPart addAltChunk(AltChunkType type, byte[] bytes, ContentAccessor attachmentPoint) throws Docx4JException { AlternativeFormatInputPart afiPart = new AlternativeFormatInputPart(type); Relationship altChunkRel = this.addTargetPart(afiPart, AddPartBehaviour.RENAME_IF_NAME_EXISTS); // now that its attached to the package .. afiPart.registerInContentTypeManager(); afiPart.setBinaryData(bytes); // .. the bit in document body CTAltChunk ac = Context.getWmlObjectFactory().createCTAltChunk(); ac.setId(altChunkRel.getId() ); attachmentPoint.getContent().add(ac); return afiPart; }