将多个excel单元格映射到xml
我会尽力用最好的方式解释我的问题(对不起,我的英语太差了) 我有一个excel文件是这样构造的 第1列第2列第3列。。。专栏作家 1马里奥·路易吉 2桃瓦里奥 . . . 我有一个XML模式(.xds)来映射该电子表格。 模式是:将多个excel单元格映射到xml,xml,excel,Xml,Excel,我会尽力用最好的方式解释我的问题(对不起,我的英语太差了) 我有一个excel文件是这样构造的 第1列第2列第3列。。。专栏作家 1马里奥·路易吉 2桃瓦里奥 . . . 我有一个XML模式(.xds)来映射该电子表格。 模式是: <root id="x"> <Column1> *something*</Column1> <Column2> *something*</Column2> *...and so on...* &
<root id="x">
<Column1> *something*</Column1>
<Column2> *something*</Column2>
*...and so on...*
</root>
*某物*
*某物*
*……等等*
当我将excel文件映射到XML模式时,我只能将一个单元格映射到一个XML元素。所以我可以将Column1的单元格和Column1元素映射到XML模式中。我希望这是清楚的。
但是我想在XML模式中映射元素Column1的多个单元格。
换句话说,当我从Excel导出XML文件时,我希望接收多个(每行一个)
我应该期望映射多个单元格
1.
马里奥
*……等等*
1.
桃
*……等等*
我只映射了一个单元格
1.
马里奥
*……等等*
我希望我的问题很清楚:如何为XML方案的一个元素映射多个单元格
谢谢。尝试将XLS文件转换为CSV文件,然后使用python脚本将CSV文件转换为XML文件。
检查此代码,或者您可以简单地用xml代码编写一个文本文件,然后用所需的扩展名保存它。比如说
Dim fsT As Object
Set fsT = CreateObject("ADODB.Stream")
fsT.Type = 2 ' Specifies stream type - save text data.
fsT.Charset = "utf-8" ' Specifies charset For the source text data.
fsT.lineseparator = 10 ' Pushes enter when a line is finished
fsT.Open
fsT.WriteText <root id="1">, 1
fsT.WriteText <Column1> 1</Column1>, 1 ' you can substitute a Cell.Column to this "1"
fsT.WriteText <Column2> Mario</Column2>, 1 ' same here, you can give input by a cell for example
fsT.WriteText *...and so on...* , 1
fsT.WriteText </root>, 1
' Do it how many times you want then...
fsT.SaveToFile YourFileName, 2 ' Saves (and overwrites) data
fsT.Close
Set fsT = Nothing
Dim fsT作为对象
设置fsT=CreateObject(“ADODB.Stream”)
fsT.Type=2'指定流类型-保存文本数据。
fsT.Charset=“utf-8”指定源文本数据的字符集。
fsT.lineseparator=10'在一行结束时按enter键
开放
fsT.WriteText,1
fsT.WriteText 1,1'您可以将Cell.Column替换为此“1”
fsT.WriteText Mario,1'此处相同,例如,您可以通过单元格提供输入
fsT.WriteText*…等等…*,1
fsT.WriteText,1
“那么你想做多少次。。。
fsT.SaveToFile YourFileName,2'保存(并覆盖)数据
关闭
设置fsT=Nothing
您使用的是哪种工具?不是clear@RiccardoCossu内置excelmapping@user3864091我已经在之前的回复中添加了链接
<root id="1">
<Column1> 1</Column1>
<Column2> Mario</Column2>
*...and so on...*
</root>
Dim fsT As Object
Set fsT = CreateObject("ADODB.Stream")
fsT.Type = 2 ' Specifies stream type - save text data.
fsT.Charset = "utf-8" ' Specifies charset For the source text data.
fsT.lineseparator = 10 ' Pushes enter when a line is finished
fsT.Open
fsT.WriteText <root id="1">, 1
fsT.WriteText <Column1> 1</Column1>, 1 ' you can substitute a Cell.Column to this "1"
fsT.WriteText <Column2> Mario</Column2>, 1 ' same here, you can give input by a cell for example
fsT.WriteText *...and so on...* , 1
fsT.WriteText </root>, 1
' Do it how many times you want then...
fsT.SaveToFile YourFileName, 2 ' Saves (and overwrites) data
fsT.Close
Set fsT = Nothing