https://bz.apache.org/bugzilla/show_bug.cgi?id=66565
Bug ID: 66565
Summary: NumCache - Do not load last data version on chart
Product: POI
Version: unspecified
Hardware: PC
OS: Mac OS X 10.1
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
I use [Apache POI](https://poi.apache.org/) 4.1.2 to load chart data from
**XLSx** file, parse it, and transform them to **ChartJS JSON** format with
[chartjs4java](https://github.com/GotanDev/chartjs4java). The goal is to
display excel data in a web app.
My issue concerns data loading from apache POI (with extension
`poi-ooxml-schema`).
If data have been upgraded by a machine (without opening Excel), it does not
upgrade chart data with new values.
It seems to be located about
[NumCache](https://developer.adobe.com/experience-manager/reference-materials/cloud-service/javadoc/org/openxmlformats/schemas/drawingml/x2006/chart/CTNumRef.html#getNumCache())
feature on lib.
But I do not find how to load data without this kind of cache.
### Steps to reproduce
1. Create a simple xlsx file [example](https://tinyurl.com/24o69nqm).
2. Opening and upgrading this file **without Excel** with external tool.
> For instance,
> [here](https://gist.github.com/damiencuvillier/c5e440704f9ec5af1737b7959d412ec1)
> is an example
3. Trying to get chart data from Apache POI in a separate code.
Here is a code fragment where I load & browse into my chart data.
```
public LineDataset getDataset(CTLineSer ctLineSer, CTPlotArea plot,
List<CTUnsignedInt> axIdList) {
LineDataset dataset = new LineDataset();
int count = 0;
dataset = this.setLabelToDataset(dataset, ctLineSer);
CTNumData ctStrVals = ctLineSer.getVal().getNumRef().getNumCache();
for (int i = 0; i <
Integer.parseInt(String.valueOf(ctStrVals.getPtCount().getVal())); i++) {
// My code here to parse data
}
}
```
4. At the end, I put loaded data in a ChartJS format to display data.
5. It still displays the old data.
The right data is loaded only if I open & close (with saving but without doing
anything else) the file with Excel.
### Tries
I've done following tries, without any successful result
* Tried to force data calculation with
[`setForceFormulaRecalculation`](https://poi.apache.org/apidocs/dev/org/apache/poi/ss/usermodel/Workbook.html#setForceFormulaRecalculation-boolean-)
method
```workbook.setForceFormulaRecalculation(true);```
* I've been looking for an other way to load data with [CTPlotArea]() class in
Apache POI doc without any result
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]