I have a worksheet with 2 sheets. In the 1st sheet i have the data and in the 2nd one a graph - i open it thru java and load data into 1st sheet and then i need to create some series in 2nd tab's graph dynamically depending on data. The graph already have a dummy series - I need it to have setSeriesTitle working and I will delete it later. When I add a new series to the graph, it works fine. The problem is if I add more than one. My file gets corrupted and if I add 4 series to the graph it only displays 3... This is my code: HSSFSeries series; int employeeGradedPercColumn=4; CellRangeAddress productsRange = new CellRangeAddress(rowStartingSecondReport+1, rowStartingSecondReport+totalProducts, 1, 1) ; Iterator<String> iterator = employeeSeriesHeader.iterator(); while(iterator.hasNext()){ series = chart.createSeries(); series.setCategoryLabelsCellRange(productsRange) ; series.setValuesCellRange( new CellRangeAddress( rowStartingSecondReport+1, rowStartingSecondReport+totalProducts, employeeGradedPercColumn, employeeGradedPercColumn)) ; series.setSeriesTitle(iterator.next()); employeeGradedPercColumn=employeeGradedPercColumn+2; } Thanks, Maria
I'm seeing the exact same behavior using version 3.9. I create lots of series in a loop, using a pre-constructed excel file (template). When I open up the modified file in Excel, the charts shows series 1,2,3, then series 11,12,13, then 18,19,20. All other series are missing. Can someone please provide a solution or workaround?
I think I pinned down this bug. Reason is new series are cloned into sheet records one index too late. Lines 1208~1209: /* next index in the records list where the new series can be inserted */ idx = endSeriesRecordIdx + 1; just change idx to: idx = endSeriesRecordIdx; Works for me. Unfortunately I am not able to provide test case covering this - bug shows only after opening file in Excel.