/** * @since 3.0.0 */ public void setTitle(String title) { if (this.getDocPropsCorePart()==null) { DocPropsCorePart core; try { core = new DocPropsCorePart(); org.docx4j.docProps.core.ObjectFactory coreFactory = new org.docx4j.docProps.core.ObjectFactory(); core.setJaxbElement(coreFactory.createCoreProperties() ); this.addTargetPart(core); } catch (InvalidFormatException e) { log.error(e.getMessage(), e); } } org.docx4j.docProps.core.dc.elements.ObjectFactory of = new org.docx4j.docProps.core.dc.elements.ObjectFactory(); SimpleLiteral literal = of.createSimpleLiteral(); literal.getContent().add(title); this.getDocPropsCorePart().getJaxbElement().setTitle(of.createTitle(literal) ); }
public String xpathGetString(String xpathString, String prefixMappings) throws Docx4JException { Document doc = XmlUtils.marshaltoW3CDomDocument( getJaxbElement(), Context.jcDocPropsCore ); try { String result; synchronized(xPath) { getNamespaceContext().registerPrefixMappings(prefixMappings); result = xPath.evaluate(xpathString, doc ); } log.debug(xpathString + " ---> " + result); return result; } catch (Exception e) { throw new Docx4JException("Problems evaluating xpath '" + xpathString + "'", e); } } private NamespacePrefixMappings nsContext;
/** * @throws InvalidFormatException */ public DocPropsCorePart(PartName partName) throws InvalidFormatException { super(partName); init(); }
public void init() { // Used if this Part is added to [Content_Types].xml setContentType(new org.docx4j.openpackaging.contenttype.ContentType( org.docx4j.openpackaging.contenttype.ContentTypes.PACKAGE_COREPROPERTIES)); // Used when this Part is added to a rels setRelationshipType(Namespaces.PROPERTIES_CORE); setJAXBContext(Context.jcDocPropsCore); }
public void addDocPropsCorePart() { if (docPropsCorePart==null) { try { docPropsCorePart = new org.docx4j.openpackaging.parts.DocPropsCorePart(); this.addTargetPart(docPropsCorePart); docPropsCorePart.setJaxbElement(new CoreProperties()); } catch (InvalidFormatException e) { //Won't happen, so don't throw log.error(e.getMessage(), e); } } }
/** * @since 3.0.0 */ public String getTitle() { if (this.getDocPropsCorePart()==null) { return null; } JAXBElement<SimpleLiteral> sl = this.getDocPropsCorePart().getJaxbElement().getTitle(); if (sl == null) return null; StringWriter sw = new StringWriter(); try { TextUtils.extractText(sl, sw, Context.jcDocPropsCore); } catch (Exception e) { log.error(e.getMessage(), e); } return sw.toString(); }
public Part CreateDocPropsCorePartObject(String partName) throws InvalidFormatException { return new DocPropsCorePart(new PartName(partName)); }
&& pkg.getDocPropsCorePart().getContents()!=null) { pkg.getDocPropsCorePart().getContents().setCategory(null); pkg.getDocPropsCorePart().getContents().setCreator(null); pkg.getDocPropsCorePart().getContents().setDescription(null); pkg.getDocPropsCorePart().getContents().setIdentifier(null); pkg.getDocPropsCorePart().getContents().setKeywords(null); pkg.getDocPropsCorePart().getContents().setSubject(null); pkg.getDocPropsCorePart().getContents().setTitle(null);
XMLStreamReader xsr = xif.createXMLStreamReader(is); setJAXBContext(org.docx4j.jaxb.Context.jcDocPropsCore); Unmarshaller u = jc.createUnmarshaller();
return pkg.getDocPropsCorePart().xpathGetString(xpath, prefixMappings);
public void init() { // Used if this Part is added to [Content_Types].xml setContentType(new org.docx4j.openpackaging.contenttype.ContentType( org.docx4j.openpackaging.contenttype.ContentTypes.PACKAGE_COREPROPERTIES)); // Used when this Part is added to a rels setRelationshipType(Namespaces.PROPERTIES_CORE); setJAXBContext(Context.jcDocPropsCore); }
DocPropsCorePart core = new DocPropsCorePart(); org.docx4j.docProps.core.ObjectFactory coreFactory = new org.docx4j.docProps.core.ObjectFactory(); core.setJaxbElement(coreFactory.createCoreProperties() ); wmlPack.addTargetPart(core);
public DocPropertyResolver(WordprocessingMLPackage wordMLPackage) { coreProperties = wordMLPackage.getDocPropsCorePart() == null ? null : wordMLPackage.getDocPropsCorePart().getJaxbElement(); extendedProperties = wordMLPackage.getDocPropsExtendedPart() == null ? null : wordMLPackage.getDocPropsExtendedPart().getJaxbElement(); docPropsCustomPart = wordMLPackage.getDocPropsCustomPart(); }
public Part CreateDocPropsCorePartObject(String partName) throws InvalidFormatException { return new DocPropsCorePart(new PartName(partName)); }
&& pkg.getDocPropsCorePart().getContents()!=null) { pkg.getDocPropsCorePart().getContents().setCategory(null); pkg.getDocPropsCorePart().getContents().setCreator(null); pkg.getDocPropsCorePart().getContents().setDescription(null); pkg.getDocPropsCorePart().getContents().setIdentifier(null); pkg.getDocPropsCorePart().getContents().setKeywords(null); pkg.getDocPropsCorePart().getContents().setSubject(null); pkg.getDocPropsCorePart().getContents().setTitle(null);
XMLStreamReader xsr = xif.createXMLStreamReader(is); setJAXBContext(org.docx4j.jaxb.Context.jcDocPropsCore); Unmarshaller u = jc.createUnmarshaller();
return pkg.getDocPropsCorePart().xpathGetString(xpath, prefixMappings);
/** * @since 3.0.0 */ public void setTitle(String title) { if (this.getDocPropsCorePart()==null) { DocPropsCorePart core; try { core = new DocPropsCorePart(); org.docx4j.docProps.core.ObjectFactory coreFactory = new org.docx4j.docProps.core.ObjectFactory(); core.setJaxbElement(coreFactory.createCoreProperties() ); this.addTargetPart(core); } catch (InvalidFormatException e) { log.error(e.getMessage(), e); } } org.docx4j.docProps.core.dc.elements.ObjectFactory of = new org.docx4j.docProps.core.dc.elements.ObjectFactory(); SimpleLiteral literal = of.createSimpleLiteral(); literal.getContent().add(title); this.getDocPropsCorePart().getJaxbElement().setTitle(of.createTitle(literal) ); }
public void addDocPropsCorePart() { if (docPropsCorePart==null) { try { docPropsCorePart = new org.docx4j.openpackaging.parts.DocPropsCorePart(); this.addTargetPart(docPropsCorePart); docPropsCorePart.setJaxbElement(new CoreProperties()); } catch (InvalidFormatException e) { //Won't happen, so don't throw log.error(e.getMessage(), e); } } }
Docx4jProperties.getProperties().getProperty("docx4j.dc.write", "false")); if (dcWrite) { CoreProperties cp = ((DocPropsCorePart)part).getJaxbElement();