Page 1 of 1

How to create a curve

PostPosted: Tue Jan 03, 2012 3:47 am
by UndefienedUser
Hi all,

I want to create a curve from data which are store in a java list.

Can anybody help me.

Thanks.

Re: How to create a curve

PostPosted: Wed Jan 04, 2012 2:29 pm
by jason
You've probably got 3 broad choices:

1. create your curve as an image using your own choice of graphing/plotting software, and add the image to your docx (this is probably the simplest, and you can also export your docx to PDF and HTML directly from docx4j)

2. draw it using DrawingML or VML primitives (much as you would if you were to draw a curve in SVG)

3. use Word's chart features. You end up with an embedded xlsx, a part c:chartSpace where xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart", and something like this in your main document part:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
        <w:drawing>
          <wp:inline distT="0" distB="0" distL="0" distR="0">
            <wp:extent cx="5486400" cy="3200400"/>
            <wp:effectExtent l="0" t="0" r="19050" b="19050"/>
            <wp:docPr id="1" name="Chart 1"/>
            <wp:cNvGraphicFramePr/>
            <a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
              <a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/chart">
                <c:chart xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:id="rId5"/>
              </a:graphicData>
            </a:graphic>
          </wp:inline>
        </w:drawing>
 
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


docx4j's HTML and PDF output can't render charts created by the third approach; you'll need to open the docx in Word (or possibly LibreOffice?) to see them.

Re: How to create a curve

PostPosted: Thu Jan 05, 2012 10:35 pm
by UndefienedUser
Thanks a lot

Finally i m going to find a way to generate my curve as an image and add it as you describe it in the solution 1.
It's seem too complicated to draw it using DrawingML with what i m expecting.