Page 1 of 1

Getting started with charts

PostPosted: Fri Feb 22, 2013 8:44 am
by dracolytch
Hey folks,

I'm pretty new to this. I created my first Excel document without difficulty. However, I'd like to add a chart to the spreadsheet, and that's considerably more difficult. Can someone show me a straightforward example of how to go about adding a chart? Even an overview.

I've created my package, a sheet, some rows, and some cells. I add the cells to the rows, the rows to the sheet, and the sheet to the package. What objects do I need to create from here, and what relationship do they have to each other?

Re: Getting started with charts

PostPosted: Fri Feb 22, 2013 12:10 pm
by jason
Someone may have a code sample you can cut/paste, but in the absence of that, I suggest you create a simple spreadsheet in Excel (or LibreOffice/OpenOffice) with a chart, and then:

1. unzip it and visually inspect its contents

2. run it through docx4j's PartsList; this'll show you the parts you can see in 1 above, but also how docx4j represents them

It would be helpful if there was some code which traversed a WorksheetPart and told you which JAXB object represented the various elements present. I'll see if I can't write something like this later today.

You might also find the pptx4j sample EditEmbeddedCharts of some assistance.