Page 1 of 1

Extract a chart to png ?

PostPosted: Wed Jan 25, 2012 5:51 am
by mawilils
Hi,

I want to know if it possible with the docx4j api to convert a chart generated by an excel spreadsheet. In fact, I want to re-used that chart within a docx.

Thx in advance for answer.

Re: Extract a chart to png ?

PostPosted: Wed Jan 25, 2012 10:40 am
by jason
docx4j can't convert a chart to png, but that doesn't stop you from re-using it in a docx.

To do that, you OLE embed it.

To see what your XML needs to look like, add your chart in Word, save the docx, and look at the results.

This approach makes sense if the docx will be opened by users in Word. If you don't want to do that, but rather want to emit PDF or HTML directly, then you need another approach (since docx4j's PDF/HTML output won't know what to do with it).