/** * @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 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;
public DocPropertyResolver(WordprocessingMLPackage wordMLPackage) { coreProperties = wordMLPackage.getDocPropsCorePart() == null ? null : wordMLPackage.getDocPropsCorePart().getJaxbElement(); extendedProperties = wordMLPackage.getDocPropsExtendedPart() == null ? null : wordMLPackage.getDocPropsExtendedPart().getJaxbElement(); docPropsCustomPart = wordMLPackage.getDocPropsCustomPart(); }
Docx4jProperties.getProperties().getProperty("docx4j.dc.write", "false")); if (dcWrite) { CoreProperties cp = ((DocPropsCorePart)part).getJaxbElement();
/** * @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) ); }
CoreProperties cp = ((DocPropsCorePart)part).getJaxbElement();
pkg.getDocPropsCorePart().getJaxbElement().setContentStatus("Final");
/** * @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 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;
public DocPropertyResolver(WordprocessingMLPackage wordMLPackage) { coreProperties = wordMLPackage.getDocPropsCorePart() == null ? null : wordMLPackage.getDocPropsCorePart().getJaxbElement(); extendedProperties = wordMLPackage.getDocPropsExtendedPart() == null ? null : wordMLPackage.getDocPropsExtendedPart().getJaxbElement(); docPropsCustomPart = wordMLPackage.getDocPropsCustomPart(); }
Docx4jProperties.getProperties().getProperty("docx4j.dc.write", "false")); if (dcWrite) { CoreProperties cp = ((DocPropsCorePart)part).getJaxbElement();
/** * @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) ); }
CoreProperties cp = ((DocPropsCorePart)part).getJaxbElement();
pkg.getDocPropsCorePart().getJaxbElement().setContentStatus("Final");