Page 1 of 1

How to create flow chart using docx4j???

PostPosted: Tue May 08, 2012 4:39 pm
by Sriram
Can you please give me java sample code from which we can create flow chart in docx using docx4j???

Re: How to create flow chart using docx4j???

PostPosted: Tue May 08, 2012 8:41 pm
by jason
You have a variety of options:

- in Word, Insert > Shapes > Flowchart
- create flow chart using separate toolset, and insert as image
- SmartArt
- potentially, create flow chart using separate program, and insert as OLE object

I guess you want option 1 or 2.

If you want option 1, do this in Word, and look at the resulting XML. The basic approach with docx4j is to use JAXB to create similar XML.

Re: How to create flow chart using docx4j???

PostPosted: Thu May 10, 2012 3:36 pm
by Sriram
<w:document xmlns:ns25="http://schemas.openxmlformats.org/drawingml/2006/compatibility" xmlns:ns26="http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas" xmlns:ns24="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" xmlns:dsp="http://schemas.microsoft.com/office/drawing/2008/diagram" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:odx="http://opendope.org/xpaths" xmlns:odgm="http://opendope.org/SmartArt/DataHierarchy" xmlns:dgm="http://schemas.openxmlformats.org/drawingml/2006/diagram" xmlns:ns17="urn:schemas-microsoft-com:office:powerpoint" xmlns:ns15="urn:schemas-microsoft-com:office:excel" xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:odi="http://opendope.org/components" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:ns6="http://schemas.openxmlformats.org/schemaLibrary/2006/main" xmlns:odq="http://opendope.org/questions" xmlns:ns11="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing" xmlns:ns8="http://schemas.openxmlformats.org/drawingml/2006/chartDrawing" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:odc="http://opendope.org/conditions">
<w:body>
<w:p w:rsidRDefault="00C47C4F" w:rsidR="00701437">
<w:r>
<w:rPr>
<w:noProof/>
</w:rPr>
<w:pict>
<v:oval id="_x0000_s1030" style="position:absolute;margin-left:146.25pt;margin-top:340.5pt;width:102.75pt;height:59.25pt;z-index:251662336" fillcolor="#4f81bd [3204]" strokeweight="3pt" strokecolor="#f2f2f2 [3041]">
<v:shadow offset2="-1pt" offset="1pt" opacity=".5" color="#243f60 [1604]" type="perspective" on="t"/>
<v:textbox>
<w:txbxContent>
<w:p w:rsidRDefault="00C47C4F" w:rsidR="00C47C4F">
<w:r>
<w:t>End Text</w:t>
</w:r>
</w:p>
</w:txbxContent>
</v:textbox>
</v:oval>
</w:pict>
</w:r>
<w:r>
<w:rPr>
<w:noProof/>
</w:rPr>
<w:pict>
<v:shapetype o:oned="t" id="_x0000_t32" coordsize="21600,21600" path="m,l21600,21600e" o:spt="32.0" filled="f">
<v:path o:connecttype="none" arrowok="t" fillok="f"/>
<o:lock v:ext="edit" shapetype="t"/>
</v:shapetype>
<v:shape o:connectortype="straight" id="_x0000_s1029" style="position:absolute;margin-left:198pt;margin-top:245.25pt;width:0;height:95.25pt;z-index:251661312" type="#_x0000_t32">
<v:stroke endarrow="block"/>
</v:shape>
</w:pict>
</w:r>
<w:r>
<w:rPr>
<w:noProof/>
</w:rPr>
<w:pict>
<v:roundrect id="_x0000_s1028" style="position:absolute;margin-left:140.25pt;margin-top:146.25pt;width:115.5pt;height:95.25pt;z-index:251660288" fillcolor="#4f81bd [3204]" strokeweight="3pt" strokecolor="#f2f2f2 [3041]" arcsize="10923f">
<v:shadow offset2="-1pt" offset="1pt" opacity=".5" color="#243f60 [1604]" type="perspective" on="t"/>
<v:textbox>
<w:txbxContent>
<w:p w:rsidRDefault="00C47C4F" w:rsidR="00C47C4F">
<w:r>
<w:t>Evaluate Process</w:t>
</w:r>
</w:p>
</w:txbxContent>
</v:textbox>
</v:roundrect>
</w:pict>
</w:r>
<w:r>
<w:rPr>
<w:noProof/>
</w:rPr>
<w:pict>
<v:shape o:connectortype="straight" id="_x0000_s1027" style="position:absolute;margin-left:201.75pt;margin-top:37.5pt;width:.75pt;height:108.75pt;flip:x;z-index:251659264" type="#_x0000_t32">
<v:stroke endarrow="block"/>
</v:shape>
</w:pict>
</w:r>
<w:r>
<w:rPr>
<w:noProof/>
</w:rPr>
<w:pict>
<v:oval id="_x0000_s1026" style="position:absolute;margin-left:140.25pt;margin-top:-38.25pt;width:126pt;height:1in;z-index:251658240" fillcolor="#4f81bd [3204]" strokeweight="3pt" strokecolor="#f2f2f2 [3041]">
<v:shadow offset2="-1pt" offset="1pt" opacity=".5" color="#243f60 [1604]" type="perspective" on="t"/>
<v:textbox>
<w:txbxContent>
<w:p w:rsidRDefault="00C47C4F" w:rsidR="00C47C4F">
<w:r>
<w:t xml:space="preserve"> Start Process</w:t>
</w:r>
</w:p>
</w:txbxContent>
</v:textbox>
</v:oval>
</w:pict>
</w:r>
</w:p>
<w:sectPr w:rsidSect="006A76AD" w:rsidR="00701437">
<w:pgSz w:h="15840" w:w="12240"/>
<w:pgMar w:gutter="0" w:footer="720" w:header="720" w:left="1440" w:bottom="1440" w:right="1440" w:top="1440"/>
<w:cols w:space="720"/>
<w:docGrid w:linePitch="360"/>
</w:sectPr>
</w:body>
</w:document>



i want to create this docx can you please give me the sample java codes to create it...it would be very help full for me..thanks