新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     计算机科学论坛     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> XML与各种文件格式的相互转换及相关工具。 word to xml, xml to word, html to xml, xml to pdf,
    csv to xml, rtf to xml, text to xml, xml to text, xls to xml, xml to xls
    FOP
    [返回] 中文XML论坛 - 专业的XML技术讨论区XML.ORG.CN讨论区 - XML技术『 WORD to XML, HTML to XML 』 → 如何在xml文档中读取数据并且在word中显示? 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 5671 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: 如何在xml文档中读取数据并且在word中显示? 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     daman999 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:0
      积分:52
      门派:XML.ORG.CN
      注册:2005/9/17

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给daman999发送一个短消息 把daman999加入好友 查看daman999的个人资料 搜索daman999在『 WORD to XML, HTML to XML 』的所有贴子 引用回复这个贴子 回复这个贴子 查看daman999的博客楼主
    发贴心情 如何在xml文档中读取数据并且在word中显示?

    我现在在做opencrx的crm系统开发,其中有一个功能就是要输出word文档。在opencrx1.5.0版本中,可以将“联系人“的自身属性”称谓,名称“与其相关属性”地址,号码“等输出到一个xml文档中,然后在转换成word文档。word文档模板中已经有了函数来调用xml文档中的数据。但是只能输出其自身属性。
      xml文档如下:
       ”
         <?xml version="1.0" encoding="UTF-8" ?>
      <?StartPath org::opencrx::kernel::account1/provider/CRX/segment/Standard/account/33a18130-2681-11da-a265-4340e42a74c3?>
    - <org.openmdx.base.Authority name="org:opencrx:kernel:account1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xri:+resource/org/opencrx/kernel/account1/xmi/account1.xsd">
      <_object />
    - <_content>
    - <provider>
    - <org.openmdx.base.Provider qualifiedName="CRX" _operation="null">
      <_object />
    - <_content>
    - <segment>
    - <org.opencrx.kernel.account1.Segment qualifiedName="Standard" _operation="null">
      <_object />
    - <_content>
    - <account>
    - <org.opencrx.kernel.account1.Contact id="33a18130-2681-11da-a265-4340e42a74c3">
    - <_object>
      <education>0</education>
    - <!--  @see CodeValueContainer name="education"
      -->
      <firstName>999</firstName>
      <middleName>999</middleName>
      <accessLevelUpdate>2</accessLevelUpdate>
    - <!--  @see CodeValueContainer name="accessLevel"
      -->
      <gender>0</gender>
    - <!--  @see CodeValueContainer name="gender"
      -->
      <owningUser>xri:@openmdx:org.opencrx.security.identity1/provider/CRX/segment/Standard/subject/admin</owningUser>
      <annualIncomeCurrency>0</annualIncomeCurrency>
    - <!--  @see CodeValueContainer name="currency"
      -->
    - <owner>
      <_item>Standard:admin</_item>
      <_item>Standard:Administrators</_item>
      </owner>
      <disabled>false</disabled>
      <salutationCode>8</salutationCode>
    - <!--  @see CodeValueContainer name="salutationCode"
      -->
      <accountRating>0</accountRating>
    - <!--  @see CodeValueContainer name="accountRating"
      -->
      <preferredSpokenLanguage>75</preferredSpokenLanguage>
    - <!--  @see CodeValueContainer name="language"
      -->
      <annualIncomeAmount>0.000000000</annualIncomeAmount>
      <numberOfChildren>0</numberOfChildren>
      <accessLevelBrowse>3</accessLevelBrowse>
    - <!--  @see CodeValueContainer name="accessLevel"
      -->
      <fullName>999, 999 999</fullName>
      <accessLevelDelete>2</accessLevelDelete>
    - <!--  @see CodeValueContainer name="accessLevel"
      -->
    - <modifiedBy>
      <_item>admin-Standard</_item>
      </modifiedBy>
      <identity>xri:@openmdx:org.opencrx.kernel.account1/provider/CRX/segment/Standard/account/33a18130-2681-11da-a265-4340e42a74c3</identity>
      <accountType>0</accountType>
    - <!--  @see CodeValueContainer name="accountType"
      -->
      <createdAt>2005-09-16T07:12:37.969Z</createdAt>
      <doNotPhone>false</doNotPhone>
      <doNotBulkPostalMail>false</doNotBulkPostalMail>
      <doNotEMail>false</doNotEMail>
    - <owningGroup>
      <_item>xri:@openmdx:org.opencrx.security.identity1/provider/CRX/segment/Standard/subject/Administrators</_item>
      </owningGroup>
      <preferredWrittenLanguage>75</preferredWrittenLanguage>
    - <!--  @see CodeValueContainer name="language"
      -->
    - <createdBy>
      <_item>admin-Standard</_item>
      </createdBy>
      <accountState>0</accountState>
    - <!--  @see CodeValueContainer name="accountState"
      -->
      <familyStatus>0</familyStatus>
    - <!--  @see CodeValueContainer name="familyStatus"
      -->
      <lastName>999</lastName>
      <preferredContactMethod>0</preferredContactMethod>
    - <!--  @see CodeValueContainer name="contactMethod"
      -->
      <doNotPostalMail>false</doNotPostalMail>
      <doNotFax>false</doNotFax>
      <modifiedAt>2005-09-16T07:33:56.467Z</modifiedAt>
      </_object>
    - <_content>
    - <address>
    - <org.opencrx.kernel.account1.PhoneNumber id="31347170-2684-11da-8586-87c3e1604b49">
    - <_object>
      <phoneCountryPrefix>0</phoneCountryPrefix>
    - <!--  @see CodeValueContainer name="phoneCountryPrefix"
      -->
      <automaticParsing>false</automaticParsing>
      <accessLevelUpdate>2</accessLevelUpdate>
    - <!--  @see CodeValueContainer name="accessLevel"
      -->
      <owningUser>xri:@openmdx:org.opencrx.security.identity1/provider/CRX/segment/Standard/subject/admin</owningUser>
    - <owner>
      <_item>Standard:admin</_item>
      <_item>Standard:Administrators</_item>
      </owner>
      <disabled>false</disabled>
      <accessLevelBrowse>3</accessLevelBrowse>
    - <!--  @see CodeValueContainer name="accessLevel"
      -->
      <accessLevelDelete>2</accessLevelDelete>
    - <!--  @see CodeValueContainer name="accessLevel"
      -->
    - <modifiedBy>
      <_item>admin-Standard</_item>
      </modifiedBy>
      <identity>xri:@openmdx:org.opencrx.kernel.account1/provider/CRX/segment/Standard/account/33a18130-2681-11da-a265-4340e42a74c3/address/31347170-2684-11da-8586-87c3e1604b49</identity>
      <createdAt>2005-09-16T07:33:56.467Z</createdAt>
      <phoneNumberFull>010-62779079</phoneNumberFull>
      <isMain>false</isMain>
    - <owningGroup>
      <_item>xri:@openmdx:org.opencrx.security.identity1/provider/CRX/segment/Standard/subject/Administrators</_item>
      </owningGroup>
    - <createdBy>
      <_item>admin-Standard</_item>
      </createdBy>
      <modifiedAt>2005-09-16T07:33:56.467Z</modifiedAt>
      </_object>
    - <_content>
    - <audit>
    - <org.opencrx.kernel.base.ObjectCreationAuditEntry id="3d3c6e00-2684-11da-8586-87c3e1604b49">
    - <_object>
      <owningUser>xri:@openmdx:org.opencrx.security.identity1/provider/CRX/segment/Standard/subject/admin</owningUser>
    - <modifiedBy>
      <_item>admin-Standard</_item>
      </modifiedBy>
      <identity>xri:@openmdx:org.opencrx.kernel.account1/provider/CRX/segment/Standard/account/33a18130-2681-11da-a265-4340e42a74c3/address/31347170-2684-11da-8586-87c3e1604b49/audit/3d3c6e00-2684-11da-8586-87c3e1604b49</identity>
    - <owner>
      <_item>Standard:admin</_item>
      <_item>Standard:Administrators</_item>
      </owner>
    - <owningGroup>
      <_item>xri:@openmdx:org.opencrx.security.identity1/provider/CRX/segment/Standard/subject/Administrators</_item>
      </owningGroup>
    - <createdBy>
      <_item>admin-Standard</_item>
      </createdBy>
      <createdAt>2005-09-16T07:33:56.467Z</createdAt>
      <auditee>xri:@openmdx:org.opencrx.kernel.account1/provider/CRX/segment/Standard/account/33a18130-2681-11da-a265-4340e42a74c3/address/31347170-2684-11da-8586-87c3e1604b49</auditee>
      <accessLevelBrowse>3</accessLevelBrowse>
    - <!--  @see CodeValueContainer name="accessLevel"
      -->
      <unitOfWork>eeb5e477-2683-11da-8586-87c3e1604b49</unitOfWork>
      <accessLevelUpdate>0</accessLevelUpdate>
    - <!--  @see CodeValueContainer name="accessLevel"
      -->
      <accessLevelDelete>0</accessLevelDelete>
    - <!--  @see CodeValueContainer name="accessLevel"
      -->
      <modifiedAt>2005-09-16T07:33:56.467Z</modifiedAt>
      </_object>
      <_content />
      </org.opencrx.kernel.base.ObjectCreationAuditEntry>
      </audit>
      </_content>
      </org.opencrx.kernel.account1.PhoneNumber>
      </address>
    - <audit>
    - <org.opencrx.kernel.base.ObjectCreationAuditEntry id="fd6b7bd7-2680-11da-a265-4340e42a74c3">
    - <_object>
      <owningUser>xri:@openmdx:org.opencrx.security.identity1/provider/CRX/segment/Standard/subject/admin</owningUser>
    - <modifiedBy>
      <_item>admin-Standard</_item>
      </modifiedBy>
      <identity>xri:@openmdx:org.opencrx.kernel.account1/provider/CRX/segment/Standard/account/33a18130-2681-11da-a265-4340e42a74c3/audit/fd6b7bd7-2680-11da-a265-4340e42a74c3</identity>
    - <owner>
      <_item>Standard:admin</_item>
      <_item>Standard:Administrators</_item>
      </owner>
    - <owningGroup>
      <_item>xri:@openmdx:org.opencrx.security.identity1/provider/CRX/segment/Standard/subject/Administrators</_item>
      </owningGroup>
    - <createdBy>
      <_item>admin-Standard</_item>
      </createdBy>
      <createdAt>2005-09-16T07:12:37.969Z</createdAt>
      <auditee>xri:@openmdx:org.opencrx.kernel.account1/provider/CRX/segment/Standard/account/33a18130-2681-11da-a265-4340e42a74c3</auditee>
      <accessLevelBrowse>3</accessLevelBrowse>
    - <!--  @see CodeValueContainer name="accessLevel"
      -->
      <unitOfWork>7cfa0da6-2680-11da-a265-4340e42a74c3</unitOfWork>
      <accessLevelUpdate>0</accessLevelUpdate>
    - <!--  @see CodeValueContainer name="accessLevel"
      -->
      <accessLevelDelete>0</accessLevelDelete>
    - <!--  @see CodeValueContainer name="accessLevel"
      -->
      <modifiedAt>2005-09-16T07:12:37.969Z</modifiedAt>
      </_object>
      <_content />
      </org.opencrx.kernel.base.ObjectCreationAuditEntry>
      </audit>
      </_content>
      </org.opencrx.kernel.account1.Contact>
      </account>
      </_content>
      </org.opencrx.kernel.account1.Segment>
      </segment>
      </_content>
      </org.openmdx.base.Provider>
      </provider>
      </_content>
      </org.openmdx.base.Authority>
        “
    在word中的VBA代码函数为
    ”  
    Call ReplaceField("salutationCode$ShortText", getCodeValueText(xmlclean, "salutationCode", Val(getTagValue(contact, "salutationCode")), localeIdx, False), False)
      Call ReplaceField("lastName", getTagValue(contact, "lastName"), False)
      'primary mailing address
      ReDim usagefilter(0, 1)
      usagefilter(0, 0) = "usage"
      usagefilter(0, 1) = "300" 'primary
      mailingAddress = getObjList(getContent(xmlclean, "org.opencrx.kernel.account1.Contact"), "address", usagefilter, "postalStreet")
      Call ReplaceField("postalAddressLine", getTagMultiValueAsString(getTagValue(mailingAddress(0), "postalAddressLine"), itemTag), False)
      Call ReplaceField("postalStreet", getTagMultiValueAsString(getTagValue(mailingAddress(0), "postalStreet"), itemTag), False)
      Call ReplaceField("postalCity", getTagValue(mailingAddress(0), "postalCity"), False)
      Call ReplaceField("postalState", getTagValue(mailingAddress(0), "postalState"), False)
      Call ReplaceField("postalCode", getTagValue(mailingAddress(0), "postalCode"), False)
      Call ReplaceField("postalCountry$ShortText", getCodeValueText(xmlclean, "country", Val(getTagValue(mailingAddress(0), "postalCountry")), localeIdx, False), False)
      
      ReDim usagefilter(0, 1)
      usagefilter(0, 0) = "usage"
      usagefilter(0, 1) = "300" 'primary
      phoneNumber = getObjList(getContent(xmlclean, "org.opencrx.kernel.account1.Contact"), "address", usagefilter, "phoneNumberFull")
      Call ReplaceField("primaryPhone", getTagValue(phoneNumber(0), "phoneNumberFull"), False)

    我想请大家看看该怎么调试?

       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2005/9/17 11:04:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 WORD to XML, HTML to XML 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2024/11/25 18:59:20

    本主题贴数1,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    78.125ms