Search code examples
javaxmlapache-poipowerpointopenxml

How to Generate DataXML in OpenXML for powerpoint in java


I have added one smart art shape in the Microsoft power point presentation slide. I have retrieved the data of that diagram in Java using apache POI.

I want to generate my Own DataXML for that presentation from scratch using apache poi or any other free java API. How i can generate that DataXML.

enter image description here

Presentation consists of hierarchy smart art object only. Following is the XML from which i want to generate the Data XML.

<cds>
<parent name="Hierarchy Parent">
    <child id="1" name="Child 1"/>
    <child id="2" name="Child 2"/>
</parent>
<parent name="Hierarchy Parent 2">
    <child id="1" name="Child 1"/>
    <child id="2" name="Child 2"/>
</parent>


Solution

  • I couldn't find any solution in apache poi. I used java in order to generate manually XML. the hierarchy should be a such a way.

    1. Create node in pointer list [ ptlst ] with unique GUID and after that node create parent and sibling node
    2. Change those parent sibling nodes connection ID to new GUiD but same.
    3. Create new connection node in list [ cxnlst ] with new GUID i-e of 2 step ^ and update the src and destination ID and step 1 GUID.

    enter image description here