xls數據文件轉成xml格式的一種方法

首先你需要做一個映射模板,來映射xls文件中所有的列。
如下:

<?xml version="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語言: 高亮代碼由發芽網提供
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <record>
       <company>アトラスピアノ製造株式會社</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>アトラスピアノ製造株式會社</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>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章