开发者

SimpleXML adding childs and attributes for excel

开发者 https://www.devze.com 2023-04-12 11:54 出处:网络
I\'n really new to this and my question should be simple. Lets say i have this xml: <?xml version=\"1.0\"?>

I'n really new to this and my question should be simple. Lets say i have this xml:

    <?xml version="1.0"?>
    ....
        xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
    ....
    <Worksheet ss:Name="sheet1">
    ....
    <Worksheet ss:Name="sheet2">
    ....

How do i add in worksheet 1 a cell in row 5 looking like this:

    <Cell ss:Index="5" ss:StyleID="s22"><Data ss:Type="Str开发者_开发问答ing">Some text</Data></Cell>

using SimpleXML? Anyone with sample of code, please.


First of all, you have to retrieve the node you need using a Location Path and then, after you construct the new element, you can use the method addchild.

0

精彩评论

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