加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

xls数据文件转成xml格式的一种方法

发布时间:2020-12-16 06:40:18 所属栏目:百科 来源:网络整理
导读:首先你需要做一个映射模板,来映射xls文件中所有的列。如下:?xmlversion="1.0"encoding="UTF-8"?listrecordcompany/companylogo/logomodel/modelhight/hightwidth/widthlength/lengthheight/heightsince/sinceend/endprice/pricekind/kindcolor/colorselect
首先你需要做一个映射模板,来映射xls文件中所有的列。
如下:

<?xmlversion="1.0"encoding="UTF-8"?>
<list>
<record>
<company></company>
<logo></logo>
<model></model>
<hight></hight>
<width></width>
<length></length>
<height></height>
<since></since>
<end></end>
<price></price>
<kind></kind>
<color></color>
<selection></selection>
<remarks></remarks>
</record>
<record>
<company></company>
<logo></logo>
<model></model>
<hight></hight>
<width></width>
<length></length>
<height></height>
<since></since>
<end></end>
<price></price>
<kind></kind>
<color></color>
<selection></selection>
<remarks></remarks>
</record>
</list>	
编辑好后,保存为test.xml.先用Excel打开你将要导出数据的.xls文件,【开发工具】-【源】右下角中有【xml映射】,进去后添加test.xml,手动对应好映射。(点击左边list的record,然后选中数据表中的第一列),导出即可。下面是导出的数据。


XML语言:高亮代码由发芽网提供
<?xmlversion="1.0"encoding="UTF-8"standalone="yes"?>
<listxmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<record>
<company>アトラスピアノ?u造株式会社</company>
<logo>ADELSTEIN</logo>
<model>AD-ⅢM</model>
<hight>124</hight>
<width>63</width>
<length>151</length>
<height>250</height>
<since>1985年4月</since>
<end>1988年10月</end>
<price>780000</price>
<kind>アップライト</kind>
<color>マホガニ?`(桃花心木)</color>
<selection>なし</selection>
<remarks/>
</record>
<record>
<company>アトラスピアノ?u造株式会社</company>
<logo>ADELSTEIN</logo>
<model>AD-VⅢM</model>
<hight>132</hight>
<width>63</width>
<length>153</length>
<height>280</height>
<since>1985年4月</since>
<end>1988年10月</end>
<price>980000</price>
<kind>アップライト</kind>
<color>マホガニ?`(桃花心木)</color>
<selection>なし</selection>
<remarks/>
</record>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读