addDefaultContentType( defaultCT.getExtension(), defaultCT );
public void registerInContentTypeManager() { ContentTypeManager ctm = this.getPackage().getContentTypeManager(); if (altChunkType != null) { ctm.addDefaultContentType(altChunkType.getExtension(), altChunkType.getContentType()); } } }
public static RelationshipsPart createRelationshipsPartForPart( Base sourcePart) { if (sourcePart.relationships != null) return sourcePart.relationships; RelationshipsPart rp = null; try { rp = new RelationshipsPart(sourcePart); } catch (InvalidFormatException e) { // shouldn't happen log.error(e.getMessage(), e); } rp.setPackage(sourcePart.getPackage()); // Make sure content manager knows how to handle .rels sourcePart .getPackage() .getContentTypeManager() .addDefaultContentType( "rels", org.docx4j.openpackaging.contenttype.ContentTypes.RELATIONSHIPS_PART); return rp; }
ctm.addDefaultContentType("rels", "application/vnd.openxmlformats-package.relationships+xml"); ctm.addDefaultContentType("xml", "application/xml");
ctm.addDefaultContentType(ext,ContentTypes.IMAGE_JPEG ); } else if ( part.getContentType().equals( ContentTypes.EXTENSION_GIF ) ) { ctm.addDefaultContentType(ext, ContentTypes.EXTENSION_GIF); } else if ( part.getContentType().equals( ContentTypes.EXTENSION_PNG ) ) { ctm.addDefaultContentType(ext, ContentTypes.IMAGE_PNG);
public void inlineToDocx(WordprocessingMLPackage wordPackage, Text text, Object paramValue, Matcher matcher) { try { R run = (R) text.getParent(); wordPackage.getContentTypeManager().addDefaultContentType("xhtml", "text/xhtml"); MainDocumentPart mainDocumentPart = wordPackage.getMainDocumentPart(); mainDocumentPart.addAltChunk(AltChunkType.Xhtml, paramValue.toString().getBytes(), run); text.setValue(""); } catch (Exception e) { throw new ReportFormattingException("An error occurred while inserting html to docx file", e); } }
public void inlineToDocx(WordprocessingMLPackage wordPackage, Text text, Object paramValue, Matcher matcher) { try { R run = (R) text.getParent(); wordPackage.getContentTypeManager().addDefaultContentType("xhtml", "text/xhtml"); MainDocumentPart mainDocumentPart = wordPackage.getMainDocumentPart(); mainDocumentPart.addAltChunk(AltChunkType.Xhtml, paramValue.toString().getBytes(), run); text.setValue(""); } catch (Exception e) { throw new ReportFormattingException("An error occurred while inserting html to docx file", e); } }
addDefaultContentType( defaultCT.getExtension(), defaultCT );
public void registerInContentTypeManager() { ContentTypeManager ctm = this.getPackage().getContentTypeManager(); if (altChunkType != null) { ctm.addDefaultContentType(altChunkType.getExtension(), altChunkType.getContentType()); } } }
public static RelationshipsPart createRelationshipsPartForPart( Base sourcePart) { if (sourcePart.relationships != null) return sourcePart.relationships; RelationshipsPart rp = null; try { rp = new RelationshipsPart(sourcePart); } catch (InvalidFormatException e) { // shouldn't happen log.error(e.getMessage(), e); } rp.setPackage(sourcePart.getPackage()); // Make sure content manager knows how to handle .rels sourcePart .getPackage() .getContentTypeManager() .addDefaultContentType( "rels", org.docx4j.openpackaging.contenttype.ContentTypes.RELATIONSHIPS_PART); return rp; }
ctm.addDefaultContentType("rels", "application/vnd.openxmlformats-package.relationships+xml"); ctm.addDefaultContentType("xml", "application/xml");
ctm.addDefaultContentType(ext,ContentTypes.IMAGE_JPEG ); } else if ( part.getContentType().equals( ContentTypes.EXTENSION_GIF ) ) { ctm.addDefaultContentType(ext, ContentTypes.EXTENSION_GIF); } else if ( part.getContentType().equals( ContentTypes.EXTENSION_PNG ) ) { ctm.addDefaultContentType(ext, ContentTypes.IMAGE_PNG);