[bug-67510] issue with empty num format on chart axes

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1913674 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2023-11-08 12:34:41 +00:00
parent 74151ffa5b
commit e95a4d84d0
2 changed files with 6 additions and 7 deletions

View File

@ -146,10 +146,10 @@ public abstract class XDDFChartAxis implements HasShapeProperties {
}
/**
* @return axis number format
* @return axis number format (can be null if no number format is set)
*/
public String getNumberFormat() {
return getCTNumFmt().getFormatCode();
return hasNumberFormat() ? getCTNumFmt().getFormatCode() : null;
}
/**

View File

@ -17,11 +17,6 @@
package org.apache.poi.xssf.usermodel.charts;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.List;
@ -38,6 +33,8 @@ import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public final class TestXSSFChartAxis {
private static final double EPSILON = 1E-7;
@ -52,6 +49,8 @@ public final class TestXSSFChartAxis {
XSSFClientAnchor anchor = drawing.createAnchor(0, 0, 0, 0, 1, 1, 10, 30);
XSSFChart chart = drawing.createChart(anchor);
axis = chart.createValueAxis(AxisPosition.BOTTOM);
// no format set yet
assertNull(axis.getNumberFormat());
}
@AfterEach