开发者

Convert excel to xml in asp.net

Hai,

I have two columns with id,name in the excel sheet.I want to convert into xml file in the below format

Copper Kettle Copper Penny Copperhead Coppertone 开发者_高级运维 Copy Boy

suggest me with sample code in ASP.NET.

Thanks


Why use .NET?
You can use string concatenation in excel itself to achieve the same thing. Your sample does not appear as xml in the question. I have converted Excel to XML many times using cell formulae: e.g.
Excel:
A B
1 Copper_Kettle
2 Copper_Penny
3 Copperhead
4 Coppertone
5 Copy_Boy

then the excel formula you need is:

="<" & B1 & " id="" & A1 & "" />"

Drag this formula down, and you will get what looks like:

<Copper_Kettle id="1">
<Copper_Penny id="2">
<Copperhead id="3">
<Coppertone id="4">
<Copper_Boy id="5">

Remember, you will want a root node for this to be valid XML.
Note: I have replaced the spaces with underscores.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜