Examples of CTSdtDate


Examples of org.docx4j.wml.CTSdtDate

    try {
      String r= part.xpathGetString(xpath, prefixMappings);       
      log.debug(xpath + " yielded result " + r);
      if (r==null) return nullResultParagraph(sdtParent, "[missing!]");
     
      CTSdtDate sdtDate = null;
      Node dateNode = dateNodeIt.nextNode();
      if (dateNode!=null) {
        //sdtDate = (CTSdtDate)XmlUtils.unmarshal(dateNode);
        sdtDate = (CTSdtDate)XmlUtils.unmarshal(dateNode, Context.jc, CTSdtDate.class);
      }
     
      /*
            <w:date w:fullDate="2012-08-19T00:00:00Z">
              <w:dateFormat w:val="d/MM/yyyy"/>
              <w:lid w:val="en-AU"/>
              <w:storeMappedDataAs w:val="dateTime"/>
              <w:calendar w:val="gregorian"/>
            </w:date>
           
            Assume our String r contains something like "2012-08-19T00:00:00Z"
           
            We need to convert it to the given dateFormat string.
           
       */
      // Drop the Z
      if (r.indexOf("Z")>0) {
        r = r.substring(0, r.indexOf("Z")-1);
        log.warn("date now " + r);
      }
     
      DateFormat dateTimeFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
     
      String format = sdtDate.getDateFormat().getVal();
      log.debug("Using format: " + format);
     
      // C# dddd (eg "Monday') needs translation
      // to "EEEE"
      if (format.contains("dddd")) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.