You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Miguel Gómez <zu...@gmail.com> on 2010/11/05 11:40:02 UTC

change chart range values

Hi, first sorry about my english.

I'm trying to change the range cells of one charts with poi 3.7 final, but I
can´t. Is it possible?

I did this:

HSSFSeries serie= chart[0].getSeries()[0];

CellRangeAddressBase crab= serie.getValuesCellRange();
crab.setFirstColumn(5);
crab.setLastColumn(5);
crab.setFirstRow(3);
crab.setLastRow(3);
serie.setValuesCellRange(crab);

but doesn't work. If I do simply
serie.setValuesCellRange(serie.getValuesCellRange()) also doesn't work, the
excel file final is corrupt.

Thanks and Best regards!

Re: change chart range values

Posted by Nick Burch <ni...@alfresco.com>.
On Fri, 5 Nov 2010, Miguel Gómez wrote:
> I'm trying to change the range cells of one charts with poi 3.7 final, 
> but I can´t. Is it possible?

It's a bit iffy. The safest bet is to create a named range, then use that 
in your chart. You then use POI to update the named range, then excel sees 
the new data in the chart

Nick