AltChunkType type = afip.getAltChunkType(); log.warn("Unrecognized type for part " + afip.getPartName().getName() ); try { results = xHTMLImporter.convert(toString(afip.getBuffer()), null); result = toString(afip.getBuffer()); } catch (UnsupportedEncodingException e) { log.error(e.getMessage(), e);
@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; }
public AlternativeFormatInputPart(AltChunkType type) throws InvalidFormatException { super(new PartName(generatePartName(type))); setAltChunkType(type); init(); }
public AlternativeFormatInputPart(PartName partName) throws InvalidFormatException { super(partName); String extension = partName.getExtension().toLowerCase(); if (extension.equals("htm")) { setAltChunkType(AltChunkType.Html); } else { for(AltChunkType type: AltChunkType.values()) { if (extension.equals(type.getExtension())) { setAltChunkType(type); } } } if (altChunkType==null) { log.warn("Unrecognized type: " + extension); } init(); }
= (AlternativeFormatInputPart) mainDocumentPart.getRelationshipsPart().getPart( altChunk.getId()); if (part.getAltChunkType().equals(AltChunkType.Xhtml)) { try { XHTMLImporter xHTMLImporter = new XHTMLImporterImpl(wordprocessingMLPackage); List results = xHTMLImporter.convert( htmlImportProcessor.processHtml(toString(part.getBuffer())), null); locatedChunk.getContentList().remove(locatedChunk.getIndex()); Object chunkParent = locatedChunk.getAltChunk().getParent();
AlternativeFormatInputPart afiPart = new AlternativeFormatInputPart( getNewPartName("/chunk", ".xml", sourcePart.getRelationshipsPart())); afiPart.setBinaryData(r.getBytes("UTF-8")); afiPart.setAltChunkType(AltChunkType.Xml); // Flat OPC XML afiPart.registerInContentTypeManager();
AlternativeFormatInputPart afiPart = new AlternativeFormatInputPart( getNewPartName("/chunk", ".docx", srcPackage .getMainDocumentPart().getRelationshipsPart())); afiPart.setBinaryData(getDocxFetcher().getDocxFromIRI(iri)); afiPart.setContentType(new ContentType( "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml")); // docx
new AlternativeFormatInputPart(new PartName(partName) ); afip.setContentType(new ContentType(contentType)); return afip;
public void registerInContentTypeManager() { ContentTypeManager ctm = this.getPackage().getContentTypeManager(); if (altChunkType != null) { ctm.addDefaultContentType(altChunkType.getExtension(), altChunkType.getContentType()); } } }
= (AlternativeFormatInputPart) mainDocumentPart.getRelationshipsPart().getPart( altChunk.getId()); if (part.getAltChunkType().equals(AltChunkType.Xhtml)) { try { XHTMLImporter xHTMLImporter = new XHTMLImporterImpl(wordprocessingMLPackage); List results = xHTMLImporter.convert( htmlImportProcessor.processHtml(toString(part.getBuffer())), null); locatedChunk.getContentList().remove(locatedChunk.getIndex()); Object chunkParent = locatedChunk.getAltChunk().getParent();
AlternativeFormatInputPart afiPart = new AlternativeFormatInputPart( getNewPartName("/chunk", ".xml", sourcePart.getRelationshipsPart())); afiPart.setBinaryData(r.getBytes("UTF-8")); afiPart.setAltChunkType(AltChunkType.Xml); // Flat OPC XML afiPart.registerInContentTypeManager();
AlternativeFormatInputPart afiPart = new AlternativeFormatInputPart( getNewPartName("/chunk", ".docx", srcPackage .getMainDocumentPart().getRelationshipsPart())); afiPart.setBinaryData(getDocxFetcher().getDocxFromIRI(iri)); afiPart.setContentType(new ContentType( "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml")); // docx
public AlternativeFormatInputPart(PartName partName) throws InvalidFormatException { super(partName); String extension = partName.getExtension().toLowerCase(); if (extension.equals("htm")) { setAltChunkType(AltChunkType.Html); } else { for(AltChunkType type: AltChunkType.values()) { if (extension.equals(type.getExtension())) { setAltChunkType(type); } } } if (altChunkType==null) { log.warn("Unrecognized type: " + extension); } init(); }
new AlternativeFormatInputPart(new PartName(partName) ); afip.setContentType(new ContentType(contentType)); return afip;
public void registerInContentTypeManager() { ContentTypeManager ctm = this.getPackage().getContentTypeManager(); if (altChunkType != null) { ctm.addDefaultContentType(altChunkType.getExtension(), altChunkType.getContentType()); } } }
AltChunkType type = afip.getAltChunkType(); log.warn("Unrecognized type for part " + afip.getPartName().getName() ); try { results = xHTMLImporter.convert(toString(afip.getBuffer()), null); result = toString(afip.getBuffer()); } catch (UnsupportedEncodingException e) { log.error(e.getMessage(), e);
@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; }
public AlternativeFormatInputPart(AltChunkType type) throws InvalidFormatException { super(new PartName(generatePartName(type))); setAltChunkType(type); init(); }
@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) 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; }