svn commit: r1870487 - /poi/site/src/documentation/content/xdocs/changes.xml
Author: abearez Date: Wed Nov 27 04:55:31 2019 New Revision: 1870487 URL: http://svn.apache.org/viewvc?rev=1870487=rev Log: Add, insert and remove columns on XSLFTable Modified: poi/site/src/documentation/content/xdocs/changes.xml Modified: poi/site/src/documentation/content/xdocs/changes.xml URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/changes.xml?rev=1870487=1870486=1870487=diff == --- poi/site/src/documentation/content/xdocs/changes.xml (original) +++ poi/site/src/documentation/content/xdocs/changes.xml Wed Nov 27 04:55:31 2019 @@ -89,6 +89,7 @@ Fix texture fill - scale stretched images correctly +Add, insert and remove columns on XSLFTable - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1870604 - in /poi/trunk/src: examples/src/org/apache/poi/xslf/usermodel/ ooxml/java/org/apache/poi/xddf/usermodel/chart/
Author: abearez Date: Sat Nov 30 01:20:23 2019 New Revision: 1870604 URL: http://svn.apache.org/viewvc?rev=1870604=rev Log: Bug 63889: BarChartDemo now produces a valid file Modified: poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/BarChartDemo.java poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/ChartFromScratch.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFTitle.java Modified: poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/BarChartDemo.java URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/BarChartDemo.java?rev=1870604=1870603=1870604=diff == --- poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/BarChartDemo.java (original) +++ poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/BarChartDemo.java Sat Nov 30 01:20:23 2019 @@ -100,23 +100,27 @@ public class BarChartDemo { final XDDFBarChartData bar = (XDDFBarChartData) data.get(0); final int numOfPoints = categories.length; -final String categoryDataRange = chart.formatRange(new CellRangeAddress(1, numOfPoints, 0, 0)); -final String valuesDataRange = chart.formatRange(new CellRangeAddress(1, numOfPoints, 1, 1)); -final String valuesDataRange2 = chart.formatRange(new CellRangeAddress(1, numOfPoints, 2, 2)); -final XDDFDataSource categoriesData = XDDFDataSourcesFactory.fromArray(categories, categoryDataRange, 0); -final XDDFNumericalDataSource valuesData = XDDFDataSourcesFactory.fromArray(values1, valuesDataRange, 1); +final String categoryDataRange = chart.formatRange(new CellRangeAddress(1, numOfPoints, columnLanguages, columnLanguages)); +final String valuesDataRange = chart.formatRange(new CellRangeAddress(1, numOfPoints, columnCountries, columnCountries)); +final String valuesDataRange2 = chart.formatRange(new CellRangeAddress(1, numOfPoints, columnSpeakers, columnSpeakers)); +final XDDFDataSource categoriesData = XDDFDataSourcesFactory.fromArray(categories, categoryDataRange, columnLanguages); +final XDDFNumericalDataSource valuesData = XDDFDataSourcesFactory.fromArray(values1, valuesDataRange, columnCountries); values1[6] = 16.0; // if you ever want to change the underlying data -final XDDFNumericalDataSource valuesData2 = XDDFDataSourcesFactory.fromArray(values2, valuesDataRange2, 2); +final XDDFNumericalDataSource valuesData2 = XDDFDataSourcesFactory.fromArray(values2, valuesDataRange2, columnSpeakers); XDDFChartData.Series series1 = bar.getSeries(0); series1.replaceData(categoriesData, valuesData); -series1.setTitle(series[0], chart.setSheetTitle(series[0], 0)); +series1.setTitle(series[0], chart.setSheetTitle(series[0], columnCountries)); XDDFChartData.Series series2 = bar.addSeries(categoriesData, valuesData2); -series2.setTitle(series[1], chart.setSheetTitle(series[1], 1)); +series2.setTitle(series[1], chart.setSheetTitle(series[1], columnSpeakers)); chart.plot(bar); chart.setTitleText(chartTitle); // https://stackoverflow.com/questions/30532612 // chart.setTitleOverlay(overlay); + +// adjust font size for readability +bar.getCategoryAxis().getOrAddTextProperties().setFontSize(11.5); +chart.getTitle().getOrAddTextProperties().setFontSize(18.2); } private static void setColumnData(XSLFChart chart, String chartTitle) { @@ -150,4 +154,8 @@ public class BarChartDemo { } return chart; } + +private static final int columnLanguages = 0; +private static final int columnCountries = 1; +private static final int columnSpeakers = 2; } Modified: poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/ChartFromScratch.java URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/ChartFromScratch.java?rev=1870604=1870603=1870604=diff == --- poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/ChartFromScratch.java (original) +++ poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/ChartFromScratch.java Sat Nov 30 01:20:23 2019 @@ -93,7 +93,7 @@ public class ChartFromScratch { slide.addChart(chart, rect2D); setBarData(chart, chartTitle, series, categories, values1, values2); // save the result -try (OutputStream out = new FileOutputStream("bar-chart-demo-output.pptx")) { +try (OutputStream out = new FileOutputStream("chart-from-scratch.pptx")) { ppt.write(out); } } @@ -114,21 +114,21 @@ public cl
svn commit: r1870603 - /poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/
Author: abearez Date: Sat Nov 30 01:20:20 2019 New Revision: 1870603 URL: http://svn.apache.org/viewvc?rev=1870603=rev Log: Clean-up code for more recent chart types Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFArea3DChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFAreaChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBar3DChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLine3DChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFPie3DChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFSurface3DChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFSurfaceChartData.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFArea3DChartData.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFArea3DChartData.java?rev=1870603=1870602=1870603=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFArea3DChartData.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFArea3DChartData.java Sat Nov 30 01:20:20 2019 @@ -126,7 +126,7 @@ public class XDDFArea3DChartData extends @Override public XDDFChartData.Series addSeries(XDDFDataSource category, XDDFNumericalDataSource values) { -final int index = this.series.size(); +final long index = this.parent.incrementSeriesCount(); final CTAreaSer ctSer = this.chart.addNewSer(); ctSer.addNewCat(); ctSer.addNewVal(); Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFAreaChartData.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFAreaChartData.java?rev=1870603=1870602=1870603=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFAreaChartData.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFAreaChartData.java Sat Nov 30 01:20:20 2019 @@ -104,7 +104,7 @@ public class XDDFAreaChartData extends X @Override public XDDFChartData.Series addSeries(XDDFDataSource category, XDDFNumericalDataSource values) { -final int index = this.series.size(); +final long index = this.parent.incrementSeriesCount(); final CTAreaSer ctSer = this.chart.addNewSer(); ctSer.addNewCat(); ctSer.addNewVal(); Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBar3DChartData.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBar3DChartData.java?rev=1870603=1870602=1870603=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBar3DChartData.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBar3DChartData.java Sat Nov 30 01:20:20 2019 @@ -181,7 +181,7 @@ public class XDDFBar3DChartData extends @Override public XDDFChartData.Series addSeries(XDDFDataSource category, XDDFNumericalDataSource values) { -final int index = this.series.size(); +final long index = this.parent.incrementSeriesCount(); final CTBarSer ctSer = this.chart.addNewSer(); ctSer.addNewTx(); ctSer.addNewCat(); Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java?rev=1870603=1870602=1870603=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java Sat Nov 30 01:20:20 2019 @@ -380,7 +380,7 @@ public abstract class XDDFChart extends } public XDDFManualLayout getOrAddManualLayout() { -return new XDDFManualLayout(chart.getPlotArea()); +return new XDDFManualLayout(getCTPlotArea()); } private long seriesCount = 0; @@ -390,7 +390,8 @@ public abstract class XDDFChart extends public void plot(XDDFChartData data) { XSSFSheet sheet = getSheet(); -for (XDDFChartData.Series series : data.getSeries()) { +for (int idx = 0; idx < data.getSeriesCount(); idx++) { +XDDFChartData.Series series = data.getSeries(
svn commit: r1870602 - in /poi/trunk/src/ooxml: java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFChartRemoveSeries.java
Author: abearez Date: Sat Nov 30 01:20:16 2019 New Revision: 1870602 URL: http://svn.apache.org/viewvc?rev=1870602=rev Log: Add test to remove chart data series Added: poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFChartRemoveSeries.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java?rev=1870602=1870601=1870602=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java Sat Nov 30 01:20:16 2019 @@ -99,7 +99,7 @@ public abstract class XDDFChartData { */ @Deprecated public List getSeries() { -return series; +return Collections.unmodifiableList(series); } public final int getSeriesCount() { Added: poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFChartRemoveSeries.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFChartRemoveSeries.java?rev=1870602=auto == --- poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFChartRemoveSeries.java (added) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFChartRemoveSeries.java Sat Nov 30 01:20:16 2019 @@ -0,0 +1,191 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ +package org.apache.poi.xddf.usermodel.chart; + +import static org.junit.Assert.assertEquals; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Locale; + +import org.apache.poi.xssf.usermodel.XSSFClientAnchor; +import org.apache.poi.xssf.usermodel.XSSFDrawing; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +/** + * Test case for bug 63153 + */ +public class TestXDDFChartRemoveSeries { +final File resultDir = new File("build/custom-reports-test"); +String procName = null; +String fileName = null; +XSSFWorkbook workbook = null; +XSSFSheet sheet = null; +XDDFScatterChartData chartData = null; +XDDFChart chart = null; +final int MAX_NUM_SERIES = 1; + +public TestXDDFChartRemoveSeries() { +resultDir.mkdirs(); +} + +/** + * This creates a workbook with one worksheet, which contains a single + * scatter chart. + */ +@Before +public void setup() { +final boolean bDebug = false; +workbook = new XSSFWorkbook(); +sheet = workbook.createSheet(); + +final XSSFDrawing xssfDrawing = sheet.createDrawingPatriarch(); +final XSSFClientAnchor anchor = xssfDrawing.createAnchor(0, 0, 0, 0, 1, 5, 20, 20); +if (bDebug) { +return; +} +chart = xssfDrawing.createChart(anchor); +final XDDFValueAxis bottomAxis = chart.createValueAxis(AxisPosition.BOTTOM); +final XDDFValueAxis leftAxis = chart.createValueAxis(AxisPosition.LEFT); + +// Initialize data data sources + +final Double dX[] = new Double[5]; +final Double dY1[] = new Double[5]; +final Double dY2[] = new Double[5]; + +for (int n = 0; n < 5; ++n) { +dX[n] = (double) n; +dY1[n] = 2.0 * n; +dY2[n] = (double) (n * n); + +} + +final XDDFNumericalDataSource xData = XDDFDataSourcesFactory.fromArray(dX, null); +final XDDFNumericalDataSource yData1 = XDDFDataSourcesFactory.fromArray(dY1, null); +final XDDFNumericalDataSource yData2 = XDDFDataS
svn commit: r1870617 - /poi/site/src/documentation/content/xdocs/changes.xml
Author: abearez Date: Sat Nov 30 10:51:33 2019 New Revision: 1870617 URL: http://svn.apache.org/viewvc?rev=1870617=rev Log: Fix 63889 for valid PPTX file with various series Modified: poi/site/src/documentation/content/xdocs/changes.xml Modified: poi/site/src/documentation/content/xdocs/changes.xml URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/changes.xml?rev=1870617=1870616=1870617=diff == --- poi/site/src/documentation/content/xdocs/changes.xml (original) +++ poi/site/src/documentation/content/xdocs/changes.xml Sat Nov 30 10:51:33 2019 @@ -90,6 +90,7 @@ Fix texture fill - scale stretched images correctly Add, insert and remove columns on XSLFTable +Produce valid PPTX file with several chart series - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1870627 - /poi/site/src/documentation/content/xdocs/changes.xml
Author: abearez Date: Sat Nov 30 15:46:24 2019 New Revision: 1870627 URL: http://svn.apache.org/viewvc?rev=1870627=rev Log: Add Doughnut chart data series support Modified: poi/site/src/documentation/content/xdocs/changes.xml Modified: poi/site/src/documentation/content/xdocs/changes.xml URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/changes.xml?rev=1870627=1870626=1870627=diff == --- poi/site/src/documentation/content/xdocs/changes.xml (original) +++ poi/site/src/documentation/content/xdocs/changes.xml Sat Nov 30 15:46:24 2019 @@ -91,6 +91,7 @@ Fix texture fill - scale stretched images correctly Add, insert and remove columns on XSLFTable Produce valid PPTX file with several chart series +Add Doughnut chart data series support - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1870628 - in /poi/trunk/src/ooxml: java/org/apache/poi/xddf/usermodel/chart/ testcases/org/apache/poi/xddf/usermodel/
Author: abearez Date: Sat Nov 30 15:46:48 2019 New Revision: 1870628 URL: http://svn.apache.org/viewvc?rev=1870628=rev Log: Add Doughnut chart data series to XDDF Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDoughnutChartData.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/ChartTypes.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestNecessaryOOXMLClasses.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/ChartTypes.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/ChartTypes.java?rev=1870628=1870627=1870628=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/ChartTypes.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/ChartTypes.java Sat Nov 30 15:46:48 2019 @@ -21,6 +21,7 @@ public enum ChartTypes { AREA3D, BAR, BAR3D, +DOUGHNUT, LINE, LINE3D, PIE, Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java?rev=1870628=1870627=1870628=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java Sat Nov 30 15:46:48 2019 @@ -65,6 +65,7 @@ import org.openxmlformats.schemas.drawin import org.openxmlformats.schemas.drawingml.x2006.chart.CTChart; import org.openxmlformats.schemas.drawingml.x2006.chart.CTChartSpace; import org.openxmlformats.schemas.drawingml.x2006.chart.CTDateAx; +import org.openxmlformats.schemas.drawingml.x2006.chart.CTDoughnutChart; import org.openxmlformats.schemas.drawingml.x2006.chart.CTLine3DChart; import org.openxmlformats.schemas.drawingml.x2006.chart.CTLineChart; import org.openxmlformats.schemas.drawingml.x2006.chart.CTPie3DChart; @@ -426,6 +427,11 @@ public abstract class XDDFChart extends series.add(new XDDFBar3DChartData(this, barChart, categories, values)); } +for (int i = 0; i < plotArea.sizeOfDoughnutChartArray(); i++) { +CTDoughnutChart doughnutChart = plotArea.getDoughnutChartArray(i); +series.add(new XDDFDoughnutChartData(this, doughnutChart)); +} + for (int i = 0; i < plotArea.sizeOfLineChartArray(); i++) { CTLineChart lineChart = plotArea.getLineChartArray(i); series.add(new XDDFLineChartData(this, lineChart, categories, values)); @@ -465,7 +471,7 @@ public abstract class XDDFChart extends CTSurface3DChart surfaceChart = plotArea.getSurface3DChartArray(i); series.add(new XDDFSurface3DChartData(this, surfaceChart, categories, values)); } -// TODO repeat above code for missing charts: Bubble, Doughnut, OfPie and Stock +// TODO repeat above code for missing charts: Bubble, OfPie and Stock seriesCount = series.size(); return series; @@ -578,6 +584,8 @@ public abstract class XDDFChart extends return new XDDFBarChartData(this, plotArea.addNewBarChart(), categories, mapValues); case BAR3D: return new XDDFBar3DChartData(this, plotArea.addNewBar3DChart(), categories, mapValues); +case DOUGHNUT: +return new XDDFDoughnutChartData(this, plotArea.addNewDoughnutChart()); case LINE: return new XDDFLineChartData(this, plotArea.addNewLineChart(), categories, mapValues); case LINE3D: @@ -594,7 +602,7 @@ public abstract class XDDFChart extends return new XDDFSurfaceChartData(this, plotArea.addNewSurfaceChart(), categories, mapValues); case SURFACE3D: return new XDDFSurface3DChartData(this, plotArea.addNewSurface3DChart(), categories, mapValues); -// TODO repeat above code for missing charts: Bubble, Doughnut, OfPie and Stock +// TODO repeat above code for missing charts: Bubble, OfPie and Stock default: return null; } Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDoughnutChartData.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDoughnutChartData.java?rev=1870628=auto == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDoughnutChartData.java (added) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDoughnutChartData.java Sat Nov 30 15:46:48 2019 @@ -0,0
svn commit: r1870696 - in /poi/trunk/src: examples/src/org/apache/poi/xslf/usermodel/ examples/src/org/apache/poi/xwpf/usermodel/examples/ ooxml/java/org/apache/poi/xddf/usermodel/chart/
Author: abearez Date: Mon Dec 2 00:15:34 2019 New Revision: 1870696 URL: http://svn.apache.org/viewvc?rev=1870696=rev Log: Fix examples to build chart from scratch Modified: poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/BarChartDemo.java poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/ChartFromScratch.java poi/trunk/src/examples/src/org/apache/poi/xwpf/usermodel/examples/ChartFromScratch.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSource.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSourcesFactory.java Modified: poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/BarChartDemo.java URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/BarChartDemo.java?rev=1870696=1870695=1870696=diff == --- poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/BarChartDemo.java (original) +++ poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/BarChartDemo.java Mon Dec 2 00:15:34 2019 @@ -105,7 +105,7 @@ public class BarChartDemo { final String valuesDataRange2 = chart.formatRange(new CellRangeAddress(1, numOfPoints, columnSpeakers, columnSpeakers)); final XDDFDataSource categoriesData = XDDFDataSourcesFactory.fromArray(categories, categoryDataRange, columnLanguages); final XDDFNumericalDataSource valuesData = XDDFDataSourcesFactory.fromArray(values1, valuesDataRange, columnCountries); -values1[6] = 16.0; // if you ever want to change the underlying data +values1[6] = 16.0; // if you ever want to change the underlying data, it has to be done before building the data source final XDDFNumericalDataSource valuesData2 = XDDFDataSourcesFactory.fromArray(values2, valuesDataRange2, columnSpeakers); XDDFChartData.Series series1 = bar.getSeries(0); Modified: poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/ChartFromScratch.java URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/ChartFromScratch.java?rev=1870696=1870695=1870696=diff == --- poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/ChartFromScratch.java (original) +++ poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/ChartFromScratch.java Mon Dec 2 00:15:34 2019 @@ -28,13 +28,16 @@ import java.util.ArrayList; import java.util.List; import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.util.Units; +import org.apache.poi.xddf.usermodel.chart.AxisCrossBetween; import org.apache.poi.xddf.usermodel.chart.AxisCrosses; import org.apache.poi.xddf.usermodel.chart.AxisPosition; +import org.apache.poi.xddf.usermodel.chart.AxisTickMark; import org.apache.poi.xddf.usermodel.chart.BarDirection; +import org.apache.poi.xddf.usermodel.chart.BarGrouping; import org.apache.poi.xddf.usermodel.chart.ChartTypes; import org.apache.poi.xddf.usermodel.chart.LegendPosition; import org.apache.poi.xddf.usermodel.chart.XDDFBarChartData; -import org.apache.poi.xddf.usermodel.chart.XDDFChart; import org.apache.poi.xddf.usermodel.chart.XDDFChartAxis; import org.apache.poi.xddf.usermodel.chart.XDDFChartLegend; import org.apache.poi.xddf.usermodel.chart.XDDFDataSource; @@ -47,7 +50,7 @@ import org.apache.poi.xddf.usermodel.cha */ public class ChartFromScratch { private static void usage(){ -System.out.println("Usage: BarChartExample "); +System.out.println("Usage: ChartFromScratch "); System.out.println("bar-chart-data.txt the model to set. First line is chart title, " + "then go pairs {axis-label value}"); } @@ -86,8 +89,7 @@ public class ChartFromScratch { try (XMLSlideShow ppt = new XMLSlideShow()) { XSLFSlide slide = ppt.createSlide(); XSLFChart chart = ppt.createChart(); -Rectangle2D rect2D = new java.awt.Rectangle(XDDFChart.DEFAULT_X, XDDFChart.DEFAULT_Y, -XDDFChart.DEFAULT_WIDTH, XDDFChart.DEFAULT_HEIGHT); +Rectangle2D rect2D = new java.awt.Rectangle(fromCM(1.5), fromCM(4), fromCM(22), fromCM(14)); slide.addChart(chart, rect2D); setBarData(chart, chartTitle, series, categories, values1, values2); // save the result @@ -99,6 +101,10 @@ public class ChartFromScratch { System.out.println("Done"); } +private static int fromCM(double cm) { +return (int) (Math.rint(cm * Units.EMU_PER_CENTIMETER)); +} + private static void setBarData(XSLFChart chart, String chartTitle, String[] series, String[] categories, Double[] values1, Double[] values2) {
svn commit: r1870523 - in /poi/trunk/src/ooxml: java/org/apache/poi/xslf/usermodel/XSLFTable.java testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java
Author: abearez Date: Thu Nov 28 00:51:43 2019 New Revision: 1870523 URL: http://svn.apache.org/viewvc?rev=1870523=rev Log: Fix addition and removal of columns in XSLTTable Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java?rev=1870523=1870522=1870523=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java Thu Nov 28 00:51:43 2019 @@ -179,6 +179,9 @@ public class XSLFTable extends XSLFGraph long width = _table.getTblGrid().getGridColArray(_table.getTblGrid().sizeOfGridColArray() - 1).getW(); CTTableCol col = _table.getTblGrid().addNewGridCol(); col.setW(width); +for(CTTableRow row : _table.getTrList()) { +row.addNewTc(); +} updateRowColIndexes(); } @@ -194,6 +197,9 @@ public class XSLFTable extends XSLFGraph long width = _table.getTblGrid().getGridColArray(colIdx).getW(); CTTableCol col = _table.getTblGrid().insertNewGridCol(colIdx); col.setW(width); +for(CTTableRow row : _table.getTrList()) { +row.insertNewTc(colIdx); +} updateRowColIndexes(); } @@ -204,6 +210,9 @@ public class XSLFTable extends XSLFGraph */ public void removeColumn(int colIdx) { _table.getTblGrid().removeGridCol(colIdx); +for(CTTableRow row : _table.getTrList()) { +row.removeTc(colIdx); +} updateRowColIndexes(); } Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java?rev=1870523=1870522=1870523=diff == --- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java Thu Nov 28 00:51:43 2019 @@ -71,6 +71,7 @@ public class TestXSLFTable { tab.insertColumn(0); assertEquals(tab.getColumnWidth(1), tab.getColumnWidth(0), 0.1); tab.addColumn(); +tab.getCell(0, data[0].length + 1); assertEquals(tab.getColumnWidth(tab.getNumberOfColumns() - 2), tab.getColumnWidth(tab.getNumberOfColumns() - 1), 0.1); tab.removeColumn(0); tab.removeColumn(tab.getNumberOfColumns() - 1); - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1874704 - /poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFTitle.java
Author: abearez Date: Mon Mar 2 23:57:01 2020 New Revision: 1874704 URL: http://svn.apache.org/viewvc?rev=1874704=rev Log: Remove chart title when given text is null Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFTitle.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFTitle.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFTitle.java?rev=1874704=1874703=1874704=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFTitle.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFTitle.java Mon Mar 2 23:57:01 2020 @@ -58,10 +58,16 @@ public class XDDFTitle { } public void setText(String text) { -if (!title.isSetLayout()) { -title.addNewLayout(); +if (text == null) { +if (title.isSetTx()) { +title.unsetTx(); +} +} else{ +if (!title.isSetLayout()) { +title.addNewLayout(); +} +getBody().setText(text); } -getBody().setText(text); } public void setOverlay(Boolean overlay) { - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1874705 - in /poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart: XDDFChartData.java XDDFDataSource.java XDDFDataSourcesFactory.java XDDFNumericalDataSource.java
Author: abearez Date: Mon Mar 2 23:57:05 2020 New Revision: 1874705 URL: http://svn.apache.org/viewvc?rev=1874705=rev Log: Allow for numerical category in charts Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSource.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSourcesFactory.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFNumericalDataSource.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java?rev=1874705=1874704=1874705=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java Mon Mar 2 23:57:05 2020 @@ -211,7 +211,7 @@ public abstract class XDDFChartData { public void plot() { if (categoryData.isNumeric()) { CTNumData cache = retrieveNumCache(getAxDS(), categoryData); -((XDDFNumericalDataSource) categoryData).fillNumericalCache(cache); +categoryData.fillNumericalCache(cache); } else { CTStrData cache = retrieveStrCache(getAxDS(), categoryData); categoryData.fillStringCache(cache); Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSource.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSource.java?rev=1874705=1874704=1874705=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSource.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSource.java Mon Mar 2 23:57:05 2020 @@ -21,6 +21,8 @@ package org.apache.poi.xddf.usermodel.ch import org.apache.poi.util.Beta; import org.apache.poi.util.Internal; +import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumData; +import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumVal; import org.openxmlformats.schemas.drawingml.x2006.chart.CTStrData; import org.openxmlformats.schemas.drawingml.x2006.chart.CTStrVal; @@ -50,6 +52,44 @@ public interface XDDFDataSource { String getFormula(); +String getFormatCode(); + +/** + * @since POI 4.1.3 + */ +@Internal +default void fillNumericalCache(CTNumData cache) { +String formatCode = getFormatCode(); +if (formatCode == null) { +if (cache.isSetFormatCode()) { +cache.unsetFormatCode(); +} +} else { +cache.setFormatCode(formatCode); +} +cache.setPtArray(null); // unset old values +final int numOfPoints = getPointCount(); +int effectiveNumOfPoints = 0; +for (int i = 0; i < numOfPoints; ++i) { +Object value = getPointAt(i); +if (value != null) { +CTNumVal ctNumVal = cache.addNewPt(); +ctNumVal.setIdx(i); +ctNumVal.setV(value.toString()); +effectiveNumOfPoints++; +} +} +if (effectiveNumOfPoints == 0) { +cache.unsetPtCount(); +} else { +if (cache.isSetPtCount()) { +cache.getPtCount().setVal(numOfPoints); +} else { +cache.addNewPtCount().setVal(numOfPoints); +} +} +} + /** * @since POI 4.1.2 */ Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSourcesFactory.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSourcesFactory.java?rev=1874705=1874704=1874705=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSourcesFactory.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSourcesFactory.java Mon Mar 2 23:57:05 2020 @@ -45,6 +45,7 @@ public class XDDFDataSourcesFactory { if (categoryDS.getStrRef() == null) { return new XDDFCategoryDataSource() { private CTNumData category = (CTNumData) categoryDS.getNumRef().getNumCache().copy(); +private String formatCode = category.isSetFormatCode() ? category.getFormatCode() : null; @Override public boolean isCellRange() { @@ -70,6 +71,9 @@ public class XDDFDataSourcesFactory { public String getPointAt(int index) { return category.getPtArray(index).g
svn commit: r1873282 - in /poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart: XDDFBar3DChartData.java XDDFBarChartData.java
Author: abearez Date: Wed Jan 29 06:38:22 2020 New Revision: 1873282 URL: http://svn.apache.org/viewvc?rev=1873282=rev Log: Invert bar chart if negative by Niklas Mollenhauer Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBar3DChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBar3DChartData.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBar3DChartData.java?rev=1873282=1873281=1873282=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBar3DChartData.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBar3DChartData.java Wed Jan 29 06:38:22 2020 @@ -251,6 +251,27 @@ public class XDDFBar3DChartData extends } } +/** + * @since 4.1.2 + */ +public boolean getInvertIfNegative() { +if (series.isSetInvertIfNegative()) { +return series.getInvertIfNegative().getVal(); +} +return false; +} + +/** + * @since 4.1.2 + */ +public void setInvertIfNegative(boolean invertIfNegative) { +if (series.isSetInvertIfNegative()) { +series.getInvertIfNegative().setVal(invertIfNegative); +} else { +series.addNewInvertIfNegative().setVal(invertIfNegative); +} +} + @Override public void setShowLeaderLines(boolean showLeaderLines) { if (!series.isSetDLbls()) { Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java?rev=1873282=1873281=1873282=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java Wed Jan 29 06:38:22 2020 @@ -241,6 +241,27 @@ public class XDDFBarChartData extends XD } } +/** + * @since 4.1.2 + */ +public boolean getInvertIfNegative() { +if (series.isSetInvertIfNegative()) { +return series.getInvertIfNegative().getVal(); +} +return false; +} + +/** + * @since 4.1.2 + */ +public void setInvertIfNegative(boolean invertIfNegative) { +if (series.isSetInvertIfNegative()) { +series.getInvertIfNegative().setVal(invertIfNegative); +} else { +series.addNewInvertIfNegative().setVal(invertIfNegative); +} +} + @Override public void setShowLeaderLines(boolean showLeaderLines) { if (!series.isSetDLbls()) { - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1873283 - /poi/site/src/documentation/content/xdocs/changes.xml
Author: abearez Date: Wed Jan 29 06:42:17 2020 New Revision: 1873283 URL: http://svn.apache.org/viewvc?rev=1873283=rev Log: Invert bar chart if negative by Niklas Mollenhauer Modified: poi/site/src/documentation/content/xdocs/changes.xml Modified: poi/site/src/documentation/content/xdocs/changes.xml URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/changes.xml?rev=1873283=1873282=1873283=diff == --- poi/site/src/documentation/content/xdocs/changes.xml (original) +++ poi/site/src/documentation/content/xdocs/changes.xml Wed Jan 29 06:42:17 2020 @@ -113,6 +113,7 @@ Fix issue with setCellValue(LocalDate) not supporting nulls properly SlideShow rendering fixes XWPFRun: Whitespace in text not preserved if starting with tab character. +Expose invert if negative on bar charts - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1872690 - in /poi/trunk/src/ooxml: java/org/apache/poi/xddf/usermodel/chart/ testcases/org/apache/poi/xddf/usermodel/
Author: abearez Date: Mon Jan 13 00:26:59 2020 New Revision: 1872690 URL: http://svn.apache.org/viewvc?rev=1872690=rev Log: Implement error bars for bar and line charts Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/ErrorBarType.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/ErrorDirection.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/ErrorValueType.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFErrorBars.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBar3DChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLine3DChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLineChartData.java poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestNecessaryOOXMLClasses.java Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/ErrorBarType.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/ErrorBarType.java?rev=1872690=auto == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/ErrorBarType.java (added) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/ErrorBarType.java Mon Jan 13 00:26:59 2020 @@ -0,0 +1,45 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + */ + +package org.apache.poi.xddf.usermodel.chart; + +import java.util.HashMap; + +import org.openxmlformats.schemas.drawingml.x2006.chart.STErrBarType;; + +public enum ErrorBarType { +BOTH(STErrBarType.BOTH), +MINUS(STErrBarType.MINUS), +PLUS(STErrBarType.PLUS); + +final STErrBarType.Enum underlying; + +ErrorBarType(STErrBarType.Enum barType) { +this.underlying = barType; +} + +private final static HashMap reverse = new HashMap<>(); +static { +for (ErrorBarType value : values()) { +reverse.put(value.underlying, value); +} +} + +static ErrorBarType valueOf(STErrBarType.Enum barType) { +return reverse.get(barType); +} +} Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/ErrorDirection.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/ErrorDirection.java?rev=1872690=auto == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/ErrorDirection.java (added) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/ErrorDirection.java Mon Jan 13 00:26:59 2020 @@ -0,0 +1,44 @@ +/* +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + */ + +package org.apache.poi.xddf.usermodel.chart; + +import java.util.HashMap; + +import org.openxmlformats.schemas.drawingml.x2006.chart.STErrDir;; + +public enum ErrorDirection { +X(STErrDir.X), +Y(STErrDir.Y); + +final STErrDir.Enum underlying; + +ErrorDirection(STErrDir.Enum direction) { +this.underlying = direction; +} + +private final static H
svn commit: r1872691 - /poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFScatterChartData.java
Author: abearez Date: Mon Jan 13 00:27:03 2020 New Revision: 1872691 URL: http://svn.apache.org/viewvc?rev=1872691=rev Log: Implement error bars on scatter chart data series Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFScatterChartData.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFScatterChartData.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFScatterChartData.java?rev=1872691=1872690=1872691=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFScatterChartData.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFScatterChartData.java Mon Jan 13 00:27:03 2020 @@ -202,6 +202,41 @@ public class XDDFScatterChartData extend } } +/** + * @since POI 4.1.2 + */ +public int getErrorBarsCount() { +return series.sizeOfErrBarsArray(); +} + +/** + * @since POI 4.1.2 + */ +public XDDFErrorBars getErrorBars(int index) { +return new XDDFErrorBars(series.getErrBarsArray(index)); +} + +/** + * @since POI 4.1.2 + */ +public XDDFErrorBars addNewErrorBars() { +return new XDDFErrorBars(series.addNewErrBars()); +} + +/** + * @since POI 4.1.2 + */ +public XDDFErrorBars insertNewErrorBars(int index) { +return new XDDFErrorBars(series.insertNewErrBars(index)); +} + +/** + * @since POI 4.1.2 + */ +public void removeErrorBars(int index) { +series.removeErrBars(index); +} + @Override public void setShowLeaderLines(boolean showLeaderLines) { if (!series.isSetDLbls()) { - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1872692 - in /poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart: XDDFChartData.java XDDFDataSource.java XDDFErrorBars.java XDDFNumericalDataSource.java
Author: abearez Date: Mon Jan 13 00:27:06 2020 New Revision: 1872692 URL: http://svn.apache.org/viewvc?rev=1872692=rev Log: Error bar minus and plus as numerical data sources Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSource.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFErrorBars.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFNumericalDataSource.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java?rev=1872692=1872691=1872692=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java Mon Jan 13 00:27:06 2020 @@ -33,11 +33,9 @@ import org.openxmlformats.schemas.drawin import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumData; import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumDataSource; import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumRef; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTNumVal; import org.openxmlformats.schemas.drawingml.x2006.chart.CTSerTx; import org.openxmlformats.schemas.drawingml.x2006.chart.CTStrData; import org.openxmlformats.schemas.drawingml.x2006.chart.CTStrRef; -import org.openxmlformats.schemas.drawingml.x2006.chart.CTStrVal; import org.openxmlformats.schemas.drawingml.x2006.chart.CTUnsignedInt; /** @@ -211,16 +209,15 @@ public abstract class XDDFChartData { } public void plot() { -int numOfPoints = categoryData.getPointCount(); if (categoryData.isNumeric()) { CTNumData cache = retrieveNumCache(getAxDS(), categoryData); -fillNumCache(cache, numOfPoints, (XDDFNumericalDataSource) categoryData); +((XDDFNumericalDataSource) categoryData).fillNumericalCache(cache); } else { CTStrData cache = retrieveStrCache(getAxDS(), categoryData); -fillStringCache(cache, numOfPoints, categoryData); +categoryData.fillStringCache(cache); } CTNumData cache = retrieveNumCache(getNumDS(), valuesData); -fillNumCache(cache, numOfPoints, valuesData); +valuesData.fillNumericalCache(cache); } /** @@ -343,61 +340,5 @@ public abstract class XDDFChartData { } return numCache; } - -private void fillStringCache(CTStrData cache, int numOfPoints, XDDFDataSource data) { -cache.setPtArray(null); // unset old values -int effectiveNumOfPoints = 0; -for (int i = 0; i < numOfPoints; ++i) { -Object value = data.getPointAt(i); -if (value != null) { -CTStrVal ctStrVal = cache.addNewPt(); -ctStrVal.setIdx(i); -ctStrVal.setV(value.toString()); -effectiveNumOfPoints++; -} -} -if (effectiveNumOfPoints == 0) { -if (cache.isSetPtCount()) { -cache.unsetPtCount(); -} -} else { -if (cache.isSetPtCount()) { -cache.getPtCount().setVal(numOfPoints); -} else { -cache.addNewPtCount().setVal(numOfPoints); -} -} -} - -private void fillNumCache(CTNumData cache, int numOfPoints, XDDFNumericalDataSource data) { -String formatCode = data.getFormatCode(); -if (formatCode == null) { -if (cache.isSetFormatCode()) { -cache.unsetFormatCode(); -} -} else { -cache.setFormatCode(formatCode); -} -cache.setPtArray(null); // unset old values -int effectiveNumOfPoints = 0; -for (int i = 0; i < numOfPoints; ++i) { -Object value = data.getPointAt(i); -if (value != null) { -CTNumVal ctNumVal = cache.addNewPt(); -ctNumVal.setIdx(i); -ctNumVal.setV(value.toString()); -effectiveNumOfPoints++; -} -} -if (effectiveNumOfPoints == 0) { -cache.unsetPtCount(); -} else { -if (cache.isSetPtCount()) { -cache.getPtCount().setVal(numOfPoints); -} else { -cache.addNewPtCount().setVal(numOf
svn commit: r1872362 - /poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java
Author: abearez Date: Sun Jan 5 23:54:09 2020 New Revision: 1872362 URL: http://svn.apache.org/viewvc?rev=1872362=rev Log: Complete test with cell in newly added column Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java?rev=1872362=1872361=1872362=diff == --- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java Sun Jan 5 23:54:09 2020 @@ -72,7 +72,9 @@ public class TestXSLFTable { assertEquals(tab.getColumnWidth(1), tab.getColumnWidth(0), 0.1); assertNotNull(tab.getCell(0, 0).getTextBody()); tab.addColumn(); -tab.getCell(0, data[0].length + 1); +XSLFTableCell cell = tab.getCell(0, data[0].length + 1); +assertEquals(1, cell.getTextBody().getParagraphs().size()); +assertEquals("", cell.getTextBody().getParagraph(0).getText()); assertEquals(tab.getColumnWidth(tab.getNumberOfColumns() - 2), tab.getColumnWidth(tab.getNumberOfColumns() - 1), 0.1); assertNotNull(tab.getCell(0, tab.getNumberOfColumns() - 1).getTextBody()); tab.removeColumn(0); - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1872361 - in /poi/trunk/src/ooxml/java/org/apache/poi: xddf/usermodel/chart/XDDFBarChartData.java xddf/usermodel/text/XDDFTextRun.java xslf/usermodel/XSLFTextParagraph.java
Author: abearez Date: Sun Jan 5 23:54:06 2020 New Revision: 1872361 URL: http://svn.apache.org/viewvc?rev=1872361=rev Log: Fix JavaDoc warnings Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextRun.java poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java?rev=1872361=1872360=1872361=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java Sun Jan 5 23:54:06 2020 @@ -143,10 +143,13 @@ public class XDDFBarChartData extends XD } /** - * Minimum inclusive: -100 - * - * Maximum inclusive: 100 * @param overlap + * + *Minimum inclusive = + *-100 + *Maximum inclusive = + *100 + * */ public void setOverlap(Byte overlap) { if (overlap == null) { Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextRun.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextRun.java?rev=1872361=1872360=1872361=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextRun.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextRun.java Sun Jan 5 23:54:06 2020 @@ -376,8 +376,8 @@ public class XDDFTextRun { *Minimum inclusive = *1 *Maximum inclusive = - *400 - * + *400 + * */ public void setFontSize(Double size) { getOrCreateProperties().setFontSize(size); @@ -402,7 +402,8 @@ public class XDDFTextRun { *Minimum inclusive = *0 *Maximum inclusive = - *4000 + *4000 + * */ public void setCharacterKerning(Double kerning) { getOrCreateProperties().setCharacterKerning(kerning); @@ -435,7 +436,8 @@ public class XDDFTextRun { *Minimum inclusive = *-4000 *Maximum inclusive = - *4000 + *4000 + * */ public void setCharacterSpacing(Double spacing) { getOrCreateProperties().setCharacterSpacing(spacing); Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java?rev=1872361=1872360=1872361=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextParagraph.java Sun Jan 5 23:54:06 2020 @@ -93,6 +93,7 @@ public class XSLFTextParagraph implement return _p; } +@Override public XSLFTextShape getParentShape() { return _shape; @@ -103,6 +104,7 @@ public class XSLFTextParagraph implement return _runs; } +@Override public Iterator iterator(){ return _runs.iterator(); } @@ -149,6 +151,7 @@ public class XSLFTextParagraph implement @Override public TextAlign getTextAlign(){ ParagraphPropertyFetcher fetcher = new ParagraphPropertyFetcher(getIndentLevel()){ +@Override public boolean fetch(CTTextParagraphProperties props){ if(props.isSetAlgn()){ TextAlign val = TextAlign.values()[props.getAlgn().intValue() - 1]; @@ -166,7 +169,9 @@ public class XSLFTextParagraph implement public void setTextAlign(TextAlign align) { CTTextParagraphProperties pr = _p.isSetPPr() ? _p.getPPr() : _p.addNewPPr(); if(align == null) { -if(pr.isSetAlgn()) pr.unsetAlgn(); +if(pr.isSetAlgn()) { +pr.unsetAlgn(); +} } else { pr.setAlgn(STTextAlignType.Enum.forInt(align.ordinal() + 1)); } @@ -175,6 +180,7 @@ public class XSLFTextParagraph implement @Override public FontAlign getFontAlign(){ ParagraphPropertyFetcher fetcher = new ParagraphPropertyFetcher(getIndentLevel()){ +@Override public boolean fetch(CTTextParagraphProperties props
svn commit: r1872363 - /poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java
Author: abearez Date: Sun Jan 5 23:54:12 2020 New Revision: 1872363 URL: http://svn.apache.org/viewvc?rev=1872363=rev Log: Clear all chart's properties as if newly created Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java?rev=1872363=1872362=1872363=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java Sun Jan 5 23:54:12 2020 @@ -189,6 +189,21 @@ public abstract class XDDFChart extends } /** + * Clear all properties, as if a new instance had just been created. + * @since POI 4.1.2 + */ +public void clear() { +axes.clear(); +seriesCount = 0; +if (workbook != null) { +workbook.removeSheetAt(0); +workbook.createSheet(); +} +chart.set(CTChart.Factory.newInstance()); +chart.addNewPlotArea(); +} + +/** * @return true if only visible cells will be present on the chart, false * otherwise */ @@ -477,6 +492,78 @@ public abstract class XDDFChart extends return series; } +/** + * Clear all chart series, as if a new instance had just been created. + * @since POI 4.1.2 + */ +public void clearChartSeries() { +CTPlotArea plotArea = getCTPlotArea(); + +for (int i = plotArea.sizeOfAreaChartArray(); i > 0; i--) { +plotArea.removeAreaChart(i - 1); +} + +for (int i = plotArea.sizeOfArea3DChartArray(); i > 0; i--) { +plotArea.removeArea3DChart(i - 1); +} + +for (int i = plotArea.sizeOfBarChartArray(); i > 0; i--) { +plotArea.removeBarChart(i - 1); +} + +for (int i = plotArea.sizeOfBar3DChartArray(); i > 0; i--) { +plotArea.removeBar3DChart(i - 1); +} + +for (int i = plotArea.sizeOfBubbleChartArray(); i > 0; i--) { +plotArea.removeBubbleChart(i - 1); +} + +for (int i = plotArea.sizeOfDoughnutChartArray(); i > 0; i--) { +plotArea.removeDoughnutChart(i - 1); +} + +for (int i = plotArea.sizeOfLineChartArray(); i > 0; i--) { +plotArea.removeLineChart(i - 1); +} + +for (int i = plotArea.sizeOfLine3DChartArray(); i > 0; i--) { +plotArea.removeLine3DChart(i - 1); +} + +for (int i = plotArea.sizeOfOfPieChartArray(); i > 0; i--) { +plotArea.removeOfPieChart(i - 1); +} + +for (int i = plotArea.sizeOfPieChartArray(); i > 0; i--) { +plotArea.removePieChart(i - 1); +} + +for (int i = plotArea.sizeOfPie3DChartArray(); i > 0; i--) { +plotArea.removePie3DChart(i - 1); +} + +for (int i = plotArea.sizeOfRadarChartArray(); i > 0; i--) { +plotArea.removeRadarChart(i - 1); +} + +for (int i = plotArea.sizeOfScatterChartArray(); i > 0; i--) { +plotArea.removeScatterChart(i - 1); +} + +for (int i = plotArea.sizeOfStockChartArray(); i > 0; i--) { +plotArea.removeStockChart(i - 1); +} + +for (int i = plotArea.sizeOfSurfaceChartArray(); i > 0; i--) { +plotArea.removeSurfaceChart(i - 1); +} + +for (int i = plotArea.sizeOfSurface3DChartArray(); i > 0; i--) { +plotArea.removeSurface3DChart(i - 1); +} +} + private Map getCategoryAxes() { CTPlotArea plotArea = getCTPlotArea(); int sizeOfArray = plotArea.sizeOfCatAxArray(); - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1876409 - /poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java
Author: abearez Date: Sun Apr 12 00:26:12 2020 New Revision: 1876409 URL: http://svn.apache.org/viewvc?rev=1876409=rev Log: Add table row at correct index Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java?rev=1876409=1876408=1876409=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java Sun Apr 12 00:26:12 2020 @@ -153,14 +153,15 @@ public class XSLFTable extends XSLFGraph public XSLFTableRow addRow(){ CTTableRow tr = _table.addNewTr(); -return initializeRow(tr); +XSLFTableRow row = initializeRow(tr); +_rows.add(row); +return row; } private XSLFTableRow initializeRow(CTTableRow tr) { XSLFTableRow row = new XSLFTableRow(tr, this); // default height is 20 points row.setHeight(20.0); -_rows.add(row); for (int i = 0; i < getNumberOfColumns(); i++) { row.addCell(); } @@ -177,7 +178,9 @@ public class XSLFTable extends XSLFGraph throw new IndexOutOfBoundsException("Cannot insert row at " + rowIdx + "; table has only " + getNumberOfRows() + "rows."); } CTTableRow tr = _table.insertNewTr(rowIdx); -return initializeRow(tr); +XSLFTableRow row = initializeRow(tr); +_rows.add(rowIdx, row); +return row; } /** - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1876406 - /poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextParagraph.java
Author: abearez Date: Sat Apr 11 21:43:18 2020 New Revision: 1876406 URL: http://svn.apache.org/viewvc?rev=1876406=rev Log: Return and set paragraph indentation level Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextParagraph.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextParagraph.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextParagraph.java?rev=1876406=1876405=1876406=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextParagraph.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextParagraph.java Sat Apr 11 21:43:18 2020 @@ -172,6 +172,32 @@ public class XDDFTextParagraph { } /** + * Returns the paragraph indentation level. + * + * @return indentation level of the paragraph. + */ +public int getIndentationLevel() { +if (_p.isSetPPr()) { +return getProperties().getLevel(); +} else { +return 0; +} +} + +/** + * Specifies the paragraph indentation level, between 1 and 9. + * + * @param level + *new indentation level for the paragraph. + *Use null to unset the indentation level. + */ +public void setIndentationLevel(Integer level) { +if (_p.isSetPPr()) { +getProperties().setLevel(level); +} +} + +/** * Returns the alignment that is applied to the paragraph. * * If this attribute is omitted, then a value of left is implied. - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1876430 - in /poi/site: .gitignore src/documentation/content/xdocs/changes.xml
Author: abearez Date: Sun Apr 12 18:23:16 2020 New Revision: 1876430 URL: http://svn.apache.org/viewvc?rev=1876430=rev Log: Improvements for paragraphs in XSLF and XWPF Added: poi/site/.gitignore Modified: poi/site/src/documentation/content/xdocs/changes.xml Added: poi/site/.gitignore URL: http://svn.apache.org/viewvc/poi/site/.gitignore?rev=1876430=auto == --- poi/site/.gitignore (added) +++ poi/site/.gitignore Sun Apr 12 18:23:16 2020 @@ -0,0 +1,3 @@ +*.iml +.idea/ +.project/ \ No newline at end of file Modified: poi/site/src/documentation/content/xdocs/changes.xml URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/changes.xml?rev=1876430=1876429=1876430=diff == --- poi/site/src/documentation/content/xdocs/changes.xml (original) +++ poi/site/src/documentation/content/xdocs/changes.xml Sun Apr 12 18:23:16 2020 @@ -74,6 +74,8 @@ Upgrade to XMLSec 2.1.5 updated dependencies to Bouncycastle 1.65, Commons-Codec 1.14, Commons-Compress 1.20 +XWPF - improvements in table and paragraph +XSLF - improvements for paragraph HSMF enhancements - NamedIdChunk, MultiValueChunks, ByteChunkDeferred - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1875747 - in /poi/trunk/src/ooxml: java/org/apache/poi/xwpf/usermodel/XWPFAbstractNum.java java/org/apache/poi/xwpf/usermodel/XWPFNumbering.java testcases/org/apache/poi/xwpf/usermodel/Te
Author: abearez Date: Fri Mar 27 03:13:40 2020 New Revision: 1875747 URL: http://svn.apache.org/viewvc?rev=1875747=rev Log: XWPFNumbering.addAbstractNum will definitely throw an exception Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFAbstractNum.java poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFNumbering.java poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFAbstractNum.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFAbstractNum.java?rev=1875747=1875746=1875747=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFAbstractNum.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFAbstractNum.java Fri Mar 27 03:13:40 2020 @@ -57,4 +57,8 @@ public class XWPFAbstractNum { return ctAbstractNum; } +public void setCtAbstractNum(CTAbstractNum ctAbstractNum) { +this.ctAbstractNum = ctAbstractNum; +} + } Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFNumbering.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFNumbering.java?rev=1875747=1875746=1875747=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFNumbering.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFNumbering.java Fri Mar 27 03:13:40 2020 @@ -23,6 +23,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.math.BigInteger; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import javax.xml.namespace.QName; @@ -237,7 +238,7 @@ public class XWPFNumbering extends POIXM if (abstractNum.getAbstractNum() != null) { // Use the current CTAbstractNum if it exists ctNumbering.addNewAbstractNum().set(abstractNum.getAbstractNum()); } else { -ctNumbering.addNewAbstractNum(); +abstractNum.setCtAbstractNum(ctNumbering.addNewAbstractNum()); abstractNum.getAbstractNum().setAbstractNumId(BigInteger.valueOf(pos)); ctNumbering.setAbstractNumArray(pos, abstractNum.getAbstractNum()); } @@ -283,5 +284,20 @@ public class XWPFNumbering extends POIXM return null; return num.getCTNum().getAbstractNumId().getVal(); } + +/** + * @return all abstractNums + */ +public List getAbstractNums() { +return Collections.unmodifiableList(abstractNums); +} + +/** + * @return all nums + */ +public List getNums() { +return Collections.unmodifiableList(nums); +} + } Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java?rev=1875747=1875746=1875747=diff == --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFNumbering.java Fri Mar 27 03:13:40 2020 @@ -26,6 +26,7 @@ import java.math.BigInteger; import org.apache.poi.xwpf.XWPFTestDataSamples; import org.junit.Test; +import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTAbstractNum; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTNum; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTNumLvl; @@ -61,6 +62,45 @@ public class TestXWPFNumbering { XWPFNum num = numbering.getNum(numId); BigInteger compareAbstractNum = num.getCTNum().getAbstractNumId().getVal(); +assertEquals(abstractNumId, compareAbstractNum); +} + +@Test +public void testAddAbstractNumIfAbstractNumNotEqualNull() throws IOException { +BigInteger abstractNumId = BigInteger.valueOf(1); +XWPFDocument docOut = new XWPFDocument(); +XWPFNumbering numbering = docOut.createNumbering(); + +CTAbstractNum cTAbstractNum = CTAbstractNum.Factory.newInstance(); +// must set the AbstractNumId, Otherwise fail +cTAbstractNum.setAbstractNumId(abstractNumId); +XWPFAbstractNum abstractNum = new XWPFAbstractNum(cTAbstractNum); +abstractNumId = numbering.addAbstractNum(abstractNum); +BigInteger numId = numbering.addNum(abstractNumId); + +XWPFDocument docIn = XWPFTestDataSamples.writeOutAndReadBack(docOut); + +numbering = docIn.getNumbering(); +XWPFNum num = numbering.getNum(numId); +BigInteger compareAbstractNum = num.getCTNum().getAbstractNumId().getVal(); +assertEquals(abstractNumId
svn commit: r1875748 - in /poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel: XSLFTable.java XSLFTableCell.java
Author: abearez Date: Fri Mar 27 03:13:43 2020 New Revision: 1875748 URL: http://svn.apache.org/viewvc?rev=1875748=rev Log: Access table cell border style as line properties Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java?rev=1875748=1875747=1875748=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java Fri Mar 27 03:13:43 2020 @@ -90,11 +90,10 @@ public class XSLFTable extends XSLFGraph @Override public XSLFTableCell getCell(int row, int col) { -List rows = getRows(); -if (row < 0 || rows.size() <= row) { +if (row < 0 || _rows.size() <= row) { return null; } -XSLFTableRow r = rows.get(row); +XSLFTableRow r = _rows.get(row); if (r == null) { // empty row return null; Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java?rev=1875748=1875747=1875748=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java Fri Mar 27 03:13:43 2020 @@ -33,6 +33,7 @@ import org.apache.poi.sl.usermodel.Strok import org.apache.poi.sl.usermodel.TableCell; import org.apache.poi.sl.usermodel.VerticalAlignment; import org.apache.poi.util.Units; +import org.apache.poi.xddf.usermodel.XDDFLineProperties; import org.apache.poi.xddf.usermodel.text.XDDFTextBody; import org.apache.poi.xslf.usermodel.XSLFPropertiesDelegate.XSLFFillProperties; import org.apache.poi.xslf.usermodel.XSLFTableStyle.TablePartStyle; @@ -139,6 +140,18 @@ public class XSLFTableCell extends XSLFT } } +public XDDFLineProperties getBorderProperties(BorderEdge edge) { +CTLineProperties props = getCTLine(edge, false); +return (props == null) ? null : new XDDFLineProperties(props); +} + +public void setBorderProperties(BorderEdge edge, XDDFLineProperties properties) { +CTLineProperties props = getCTLine(edge, true); +if (props != null) { +props.set(properties.getXmlObject().copy()); +} +} + @Override public void removeBorder(BorderEdge edge) { CTTableCellProperties pr = getCellProperties(false); - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1875746 - in /poi/trunk/src/ooxml: java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java
Author: abearez Date: Fri Mar 27 03:13:37 2020 New Revision: 1875746 URL: http://svn.apache.org/viewvc?rev=1875746=rev Log: XWPFTableCell does not process bodyElements when handle paragraph Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java?rev=1875746=1875745=1875746=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java Fri Mar 27 03:13:37 2020 @@ -160,6 +160,7 @@ public class XWPFTableCell implements IB */ public void addParagraph(XWPFParagraph p) { paragraphs.add(p); +bodyElements.add(p); } /** @@ -168,8 +169,10 @@ public class XWPFTableCell implements IB * @param pos The position in the list of paragraphs, 0-based */ public void removeParagraph(int pos) { +XWPFParagraph removedParagraph = paragraphs.get(pos); paragraphs.remove(pos); ctTc.removeP(pos); +bodyElements.remove(removedParagraph); } /** Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java?rev=1875746=1875745=1875746=diff == --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java Fri Mar 27 03:13:37 2020 @@ -151,6 +151,58 @@ public class TestXWPFTableCell { } @Test +public void testAddParagraph() throws Exception { +XWPFDocument doc = new XWPFDocument(); +XWPFTable table = doc.createTable(); +XWPFTableRow tr = table.createRow(); +XWPFTableCell cell = tr.addNewTableCell(); + +// cell have at least one paragraph by default +assertEquals(1, cell.getParagraphs().size()); +assertEquals(1, cell.getBodyElements().size()); +assertEquals(cell.getParagraphArray(0), cell.getBodyElements().get(0)); + +XWPFParagraph p = cell.addParagraph(); +assertEquals(2, cell.getParagraphs().size()); +assertEquals(2, cell.getBodyElements().size()); +assertEquals(p, cell.getParagraphArray(1)); +assertEquals(cell.getParagraphArray(1), cell.getBodyElements().get(1)); + +doc.close(); +} + +@Test +public void testRemoveParagraph() throws Exception { +XWPFDocument doc = new XWPFDocument(); +XWPFTable table = doc.createTable(); +XWPFTableRow tr = table.createRow(); +XWPFTableCell cell = tr.addNewTableCell(); + +// cell have at least one paragraph by default +XWPFParagraph p0 = cell.getParagraphArray(0); +XWPFParagraph p1 = cell.addParagraph(); +cell.addParagraph(); + +// remove 3rd +cell.removeParagraph(2); +assertEquals(2, cell.getParagraphs().size()); +assertEquals(2, cell.getBodyElements().size()); +assertEquals(p0, cell.getParagraphArray(0)); +assertEquals(p1, cell.getParagraphArray(1)); +assertEquals(p0, cell.getBodyElements().get(0)); +assertEquals(p1, cell.getBodyElements().get(1)); + +// remove 2nd +cell.removeParagraph(1); +assertEquals(1, cell.getParagraphs().size()); +assertEquals(1, cell.getBodyElements().size()); +assertEquals(p0, cell.getParagraphArray(0)); +assertEquals(p0, cell.getBodyElements().get(0)); + +doc.close(); +} + +@Test public void testBug63624() throws Exception { XWPFDocument doc = new XWPFDocument(); XWPFTable table = doc.createTable(1, 1); - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1875744 - in /poi/trunk/src/ooxml: java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java
Author: abearez Date: Fri Mar 27 03:13:31 2020 New Revision: 1875744 URL: http://svn.apache.org/viewvc?rev=1875744=rev Log: #63624: setText in XWPFTableCell updates the xml and also updates the runs and iruns Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java?rev=1875744=1875743=1875744=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java Fri Mar 27 03:13:31 2020 @@ -427,8 +427,7 @@ public class XWPFTableCell implements IB } public void setText(String text) { -CTP ctP = (ctTc.sizeOfPArray() == 0) ? ctTc.addNewP() : ctTc.getPArray(0); -XWPFParagraph par = new XWPFParagraph(ctP, this); +XWPFParagraph par = (paragraphs.size() == 0) ? addParagraph() : paragraphs.get(0); par.createRun().setText(text); } Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java?rev=1875744=1875743=1875744=diff == --- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTableCell.java Fri Mar 27 03:13:31 2020 @@ -149,4 +149,18 @@ public class TestXWPFTableCell { assertEquals(2500, cell.getWidth()); doc.close(); } + +@Test +public void testBug63624() throws Exception { +XWPFDocument doc = new XWPFDocument(); +XWPFTable table = doc.createTable(1, 1); +XWPFTableRow row = table.getRow(0); +XWPFTableCell cell = row.getCell(0); + +String expected = "this must not be empty"; +cell.setText(expected); +String actual = cell.getText(); +assertEquals(expected, actual); +doc.close(); +} } - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1875745 - /poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java
Author: abearez Date: Fri Mar 27 03:13:34 2020 New Revision: 1875745 URL: http://svn.apache.org/viewvc?rev=1875745=rev Log: like getTables, returns a collection that cannot be modified Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java?rev=1875745=1875744=1875745=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java Fri Mar 27 03:13:34 2020 @@ -139,7 +139,7 @@ public class XWPFTableCell implements IB * returns a list of paragraphs */ public List getParagraphs() { -return paragraphs; +return Collections.unmodifiableList(paragraphs); } /** - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1875749 - /poi/site/src/documentation/content/xdocs/changes.xml
Author: abearez Date: Fri Mar 27 03:34:56 2020 New Revision: 1875749 URL: http://svn.apache.org/viewvc?rev=1875749=rev Log: Merged three pull requests from Sayi Modified: poi/site/src/documentation/content/xdocs/changes.xml Modified: poi/site/src/documentation/content/xdocs/changes.xml URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/changes.xml?rev=1875749=1875748=1875749=diff == --- poi/site/src/documentation/content/xdocs/changes.xml (original) +++ poi/site/src/documentation/content/xdocs/changes.xml Fri Mar 27 03:34:56 2020 @@ -82,6 +82,9 @@ Picture.resize(double scale) scales width wrong for small pictures and when dx1 is set upgrading xmlsec causes junit tests to fail XSLF - Wrong scheme colors used when rendering +setText in XWPFTableCell updates the xml and also updates the runs and iruns +XWPFTableCell does not process bodyElements when handle paragraph +XWPFNumbering.addAbstractNum will definitely throw an exception - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1875902 - in /poi/trunk/src/examples/src/org/apache/poi: xslf/usermodel/ xslf/usermodel/tutorial/ xssf/usermodel/examples/ xwpf/usermodel/examples/
Author: abearez Date: Tue Mar 31 01:16:39 2020 New Revision: 1875902 URL: http://svn.apache.org/viewvc?rev=1875902=rev Log: Sonar Fixes - public final class with private constructor for examples Modified: poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/DataExtraction.java poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/MergePresentations.java poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/PieChartDemo.java poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/Tutorial1.java poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/Tutorial2.java poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/Tutorial3.java poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/Tutorial4.java poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/Tutorial5.java poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/Tutorial6.java poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/Tutorial7.java poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/tutorial/Step1.java poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/tutorial/Step2.java poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/BarChart.java poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/ExcelChartWithTargetLine.java poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/LineChart.java poi/trunk/src/examples/src/org/apache/poi/xssf/usermodel/examples/ScatterChart.java poi/trunk/src/examples/src/org/apache/poi/xwpf/usermodel/examples/BarChartExample.java Modified: poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/DataExtraction.java URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/DataExtraction.java?rev=1875902=1875901=1875902=diff == --- poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/DataExtraction.java (original) +++ poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/DataExtraction.java Tue Mar 31 01:16:39 2020 @@ -32,6 +32,7 @@ import org.apache.poi.openxml4j.opc.Pack * Demonstrates how you can extract data from a .pptx file */ public final class DataExtraction { +private DataExtraction() {} public static void main(String[] args) throws IOException, OpenXML4JException { Modified: poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/MergePresentations.java URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/MergePresentations.java?rev=1875902=1875901=1875902=diff == --- poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/MergePresentations.java (original) +++ poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/MergePresentations.java Tue Mar 31 01:16:39 2020 @@ -26,6 +26,7 @@ import java.io.FileOutputStream; * Merge multiple pptx presentations together */ public final class MergePresentations { +private MergePresentations() {} public static void main(String[] args) throws Exception { try (XMLSlideShow ppt = new XMLSlideShow()) { Modified: poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/PieChartDemo.java URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/PieChartDemo.java?rev=1875902=1875901=1875902=diff == --- poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/PieChartDemo.java (original) +++ poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/PieChartDemo.java Tue Mar 31 01:16:39 2020 @@ -38,7 +38,9 @@ import org.apache.poi.xddf.usermodel.cha /** * Build a pie chart from a template pptx */ -public class PieChartDemo { +public final class PieChartDemo { +private PieChartDemo() {} + private static void usage(){ System.out.println("Usage: PieChartDemo "); System.out.println("pie-chart-template.pptx template with a pie chart"); Modified: poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/Tutorial1.java URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/Tutorial1.java?rev=1875902=1875901=1875902=diff == --- poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/Tutorial1.java (original) +++ poi/trunk/src/examples/src/org/apache/poi/xslf/usermodel/Tutorial1.java Tue Mar 31 01:16:39 2020 @@ -26,7 +26,8 @@ import java.io.IOException; * Demonstrates how to create slides with predefined layout * and fill the placeholder shapes */ -public class Tutorial1 { +public final class Tutorial1 { +private Tutorial1() {} public static void main(String[] args) throws IOException{ try (XMLSlideShow ppt = new XMLSlideShow()) { Modi
svn commit: r1875901 - in /poi/trunk/src/ooxml: java/org/apache/poi/xslf/usermodel/XSLFTable.java java/org/apache/poi/xslf/usermodel/XSLFTableRow.java testcases/org/apache/poi/xslf/usermodel/TestXSLFT
Author: abearez Date: Tue Mar 31 00:47:45 2020 New Revision: 1875901 URL: http://svn.apache.org/viewvc?rev=1875901=rev Log: Insert a new row in XSLFTable Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableRow.java poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java?rev=1875901=1875900=1875901=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java Tue Mar 31 00:47:45 2020 @@ -153,19 +153,41 @@ public class XSLFTable extends XSLFGraph public XSLFTableRow addRow(){ CTTableRow tr = _table.addNewTr(); +return initializeRow(tr); +} + +private XSLFTableRow initializeRow(CTTableRow tr) { XSLFTableRow row = new XSLFTableRow(tr, this); // default height is 20 points row.setHeight(20.0); _rows.add(row); -updateRowColIndexes(); +for (int i = 0; i < getNumberOfColumns(); i++) { +row.addCell(); +} return row; } /** + * Insert a new row at the given index. + * @param rowIdx the row index. + * @since POI 4.1.3 + */ +public XSLFTableRow insertRow(int rowIdx) { +if (getNumberOfRows() < rowIdx) { +throw new IndexOutOfBoundsException("Cannot insert row at " + rowIdx + "; table has only " + getNumberOfRows() + "rows."); +} +CTTableRow tr = _table.insertNewTr(rowIdx); +return initializeRow(tr); +} + +/** * Remove the row on the given index * @param rowIdx the row index */ public void removeRow(int rowIdx) { +if (getNumberOfRows() < rowIdx) { +throw new IndexOutOfBoundsException("Cannot remove row at " + rowIdx + "; table has only " + getNumberOfRows() + "rows."); +} _table.removeTr(rowIdx); _rows.remove(rowIdx); updateRowColIndexes(); @@ -176,14 +198,13 @@ public class XSLFTable extends XSLFGraph * @since POI 4.1.2 */ public void addColumn() { -long width = _table.getTblGrid().getGridColArray(_table.getTblGrid().sizeOfGridColArray() - 1).getW(); +long width = _table.getTblGrid().getGridColArray(getNumberOfColumns() - 1).getW(); CTTableCol col = _table.getTblGrid().addNewGridCol(); col.setW(width); -for(XSLFTableRow row : _rows) { +for (XSLFTableRow row : _rows) { XSLFTableCell cell = row.addCell(); new XDDFTextBody(cell, cell.getTextBody(true)).initialize(); } -updateRowColIndexes(); } /** @@ -192,17 +213,16 @@ public class XSLFTable extends XSLFGraph * @since POI 4.1.2 */ public void insertColumn(int colIdx) { -if (_table.getTblGrid().sizeOfGridColArray() < colIdx) { -throw new IndexOutOfBoundsException("Cannot insert column at " + colIdx + "; table has only " + _table.getTblGrid().sizeOfGridColArray() + "columns."); +if (getNumberOfColumns() < colIdx) { +throw new IndexOutOfBoundsException("Cannot insert column at " + colIdx + "; table has only " + getNumberOfColumns() + "columns."); } long width = _table.getTblGrid().getGridColArray(colIdx).getW(); CTTableCol col = _table.getTblGrid().insertNewGridCol(colIdx); col.setW(width); -for(XSLFTableRow row : _rows) { +for (XSLFTableRow row : _rows) { XSLFTableCell cell = row.insertCell(colIdx); new XDDFTextBody(cell, cell.getTextBody(true)).initialize(); } -updateRowColIndexes(); } /** @@ -211,11 +231,13 @@ public class XSLFTable extends XSLFGraph * @since POI 4.1.2 */ public void removeColumn(int colIdx) { +if (getNumberOfColumns() < colIdx) { +throw new IndexOutOfBoundsException("Cannot remove column at " + colIdx + "; table has only " + getNumberOfColumns() + "columns."); +} _table.getTblGrid().removeGridCol(colIdx); -for(XSLFTableRow row : _rows) { +for (XSLFTableRow row : _rows) { row.removeCell(colIdx); } -updateRowColIndexes(); } static CTGraphicalObjectFrame prototype(int shapeId){ Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableRow.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apach
svn commit: r1875978 - in /poi/trunk/src/ooxml: java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFChartTitle.java
Author: abearez Date: Wed Apr 1 01:40:52 2020 New Revision: 1875978 URL: http://svn.apache.org/viewvc?rev=1875978=rev Log: Remove chart title Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFChartTitle.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java?rev=1875978=1875977=1875978=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java Wed Apr 1 01:40:52 2020 @@ -253,6 +253,9 @@ public abstract class XDDFChart extends chart.setAutoTitleDeleted(CTBoolean.Factory.newInstance()); } chart.getAutoTitleDeleted().setVal(deleted); +if (deleted && chart.isSetTitle()) { +chart.unsetTitle(); +} } /** @@ -321,7 +324,15 @@ public abstract class XDDFChart extends } } - /** +/** + * Remove the chart title. + * @since POI 4.1.3 + */ +public void removeTitle() { +setAutoTitleDeleted(true); +} + +/** * Get or Add chart 3D view into chart * * @return this method will add 3D view Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFChartTitle.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFChartTitle.java?rev=1875978=1875977=1875978=diff == --- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFChartTitle.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFChartTitle.java Wed Apr 1 01:40:52 2020 @@ -137,6 +137,7 @@ public class TestXSSFChartTitle { XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("chartTitle_withTitle.xlsx"); XSSFChart chart = getChartFromWorkbook(wb, "Sheet1"); assertNotNull(chart); +assertNotNull(chart.getTitle()); XSSFRichTextString originalTitle = chart.getTitleText(); assertNotNull(originalTitle); final String myTitle = "My chart title"; @@ -154,6 +155,7 @@ public class TestXSSFChartTitle { XSSFChart chart = getChartFromWorkbook(wb, "Sheet1"); assertNotNull(chart); assertNull(chart.getTitleText()); +assertNull(chart.getTitle()); final String myTitle = "My chart title"; chart.setTitleText(myTitle); XSSFRichTextString queryTitle = chart.getTitleText(); @@ -176,4 +178,30 @@ public class TestXSSFChartTitle { wb.close(); } +@Test +public void testRemovingFromExistingChartNoTitle() throws IOException { +XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("chartTitle_noTitle.xlsx"); +XSSFChart chart = getChartFromWorkbook(wb, "Sheet1"); +assertNotNull(chart); +assertNull(chart.getTitleText()); +assertNull(chart.getTitle()); +chart.removeTitle(); +assertNull(chart.getTitleText()); +assertNull(chart.getTitle()); +wb.close(); +} + +@Test +public void testRemovingFromExistingChartWithTitle() throws IOException { +XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("chartTitle_withTitle.xlsx"); +XSSFChart chart = getChartFromWorkbook(wb, "Sheet1"); +assertNotNull(chart); +assertNotNull(chart.getTitleText()); +assertNotNull(chart.getTitle()); +chart.removeTitle(); +assertNull(chart.getTitleText()); +assertNull(chart.getTitle()); +wb.close(); +} + } - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1875977 - /poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextParagraph.java
Author: abearez Date: Wed Apr 1 01:40:49 2020 New Revision: 1875977 URL: http://svn.apache.org/viewvc?rev=1875977=rev Log: Keep last run properties when resetting paragraph text Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextParagraph.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextParagraph.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextParagraph.java?rev=1875977=1875976=1875977=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextParagraph.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextParagraph.java Wed Apr 1 01:40:49 2020 @@ -60,7 +60,7 @@ public class XDDFTextParagraph { final int count = paragraph.sizeOfBrArray() + paragraph.sizeOfFldArray() + paragraph.sizeOfRArray(); this._runs = new ArrayList<>(count); -for (XmlObject xo : _p.selectChildren(QNameSet.ALL)) { +for (XmlObject xo : paragraph.selectChildren(QNameSet.ALL)) { if (xo instanceof CTTextLineBreak) { _runs.add(new XDDFTextRun((CTTextLineBreak) xo, this)); } else if (xo instanceof CTTextField) { @@ -75,6 +75,11 @@ public class XDDFTextParagraph { } public void setText(String text) { +// keep the properties of current last run +XmlObject existing = null; +if (_runs.size() > 0) { +existing = _runs.get(_runs.size() - 1).getProperties().copy(); +} // remove all runs for (int i = _p.sizeOfBrArray() - 1; i >= 0; i--) { _p.removeBr(i); @@ -86,7 +91,10 @@ public class XDDFTextParagraph { _p.removeR(i); } _runs.clear(); -appendRegularRun(text); +XDDFTextRun run = appendRegularRun(text); +if (existing != null) { +run.getProperties().set(existing); +} } public String getText() { @@ -119,7 +127,7 @@ public class XDDFTextParagraph { // by default, line break has the font properties of the last text run for (XDDFTextRun tr : new IteratorIterable<>(new ReverseListIterator<>(_runs))) { CTTextCharacterProperties prevProps = tr.getProperties(); -// let's find one that is not undefined +// let's find one which is not undefined if (prevProps != null) { br.setRPr((CTTextCharacterProperties) prevProps.copy()); break; - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1875979 - in /poi/trunk/src/ooxml/java/org/apache/poi: xddf/usermodel/chart/ xddf/usermodel/text/ xslf/usermodel/ xssf/usermodel/
Author: abearez Date: Wed Apr 1 01:40:57 2020 New Revision: 1875979 URL: http://svn.apache.org/viewvc?rev=1875979=rev Log: Sonar Fixes - code smells Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartAxis.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartLegend.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLegendEntry.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/TextContainer.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextBody.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextParagraph.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextRun.java poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSimpleShape.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java?rev=1875979=1875978=1875979=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java Wed Apr 1 01:40:57 2020 @@ -31,6 +31,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.function.Function; +import java.util.function.Predicate; import javax.xml.namespace.QName; @@ -115,8 +116,6 @@ public abstract class XDDFChart extends private int chartIndex = 0; -private POIXMLDocumentPart documentPart = null; - protected List axes = new ArrayList<>(); /** @@ -362,14 +361,14 @@ public abstract class XDDFChart extends } @Override -public Optional findDefinedParagraphProperty(Function isSet, +public Optional findDefinedParagraphProperty(Predicate isSet, Function getter) { // TODO Auto-generated method stub return Optional.empty(); } @Override -public Optional findDefinedRunProperty(Function isSet, +public Optional findDefinedRunProperty(Predicate isSet, Function getter) { // TODO Auto-generated method stub return Optional.empty(); @@ -578,23 +577,23 @@ public abstract class XDDFChart extends private Map getCategoryAxes() { CTPlotArea plotArea = getCTPlotArea(); int sizeOfArray = plotArea.sizeOfCatAxArray(); -Map axes = new HashMap<>(sizeOfArray); +Map axesMap = new HashMap<>(sizeOfArray); for (int i = 0; i < sizeOfArray; i++) { CTCatAx category = plotArea.getCatAxArray(i); -axes.put(category.getAxId().getVal(), new XDDFCategoryAxis(category)); +axesMap.put(category.getAxId().getVal(), new XDDFCategoryAxis(category)); } -return axes; +return axesMap; } private Map getValueAxes() { CTPlotArea plotArea = getCTPlotArea(); int sizeOfArray = plotArea.sizeOfValAxArray(); -Map axes = new HashMap<>(sizeOfArray); +Map axesMap = new HashMap<>(sizeOfArray); for (int i = 0; i < sizeOfArray; i++) { CTValAx values = plotArea.getValAxArray(i); -axes.put(values.getAxId().getVal(), new XDDFValueAxis(values)); +axesMap.put(values.getAxId().getVal(), new XDDFValueAxis(values)); } -return axes; +return axesMap; } public XDDFValueAxis createValueAxis(AxisPosition pos) { @@ -767,15 +766,14 @@ public abstract class XDDFChart extends */ public PackageRelationship createRelationshipInChart(POIXMLRelation chartRelation, POIXMLFactory chartFactory, int chartIndex) { -documentPart = createRelationship(chartRelation, chartFactory, chartIndex, true).getDocumentPart(); +POIXMLDocumentPart documentPart = +createRelationship(chartRelation, chartFactory, chartIndex, true).getDocumentPart(); return addRelation(null, chartRelation, documentPart).getRelationship(); } /** * if embedded part was null then create new part * - * @param chartRelation - *chart relation object * @param chartWorkbookRelation *chart workbook relation object * @param chartFactory @@ -784,8 +782,8 @@ public abstract class XDDFChart extends * @throws InvalidFormatException * @since POI 4.0.0 */ -private PackagePart createWorksheetPart(POIXMLRelation chartRelation, POIXMLRelation chartWorkbookRelation, -POIXMLFactory chartFactory) throws InvalidFormatException { +private PackagePar
svn commit: r1875862 - in /poi/trunk/src: examples/src/org/apache/poi/xwpf/usermodel/examples/SimpleDocument.java ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java ooxml/testcases/org/apache
Author: abearez Date: Sun Mar 29 22:21:35 2020 New Revision: 1875862 URL: http://svn.apache.org/viewvc?rev=1875862=rev Log: allow add and remove a HyperlinkRun or a FieldRun Modified: poi/trunk/src/examples/src/org/apache/poi/xwpf/usermodel/examples/SimpleDocument.java poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFParagraph.java Modified: poi/trunk/src/examples/src/org/apache/poi/xwpf/usermodel/examples/SimpleDocument.java URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/xwpf/usermodel/examples/SimpleDocument.java?rev=1875862=1875861=1875862=diff == --- poi/trunk/src/examples/src/org/apache/poi/xwpf/usermodel/examples/SimpleDocument.java (original) +++ poi/trunk/src/examples/src/org/apache/poi/xwpf/usermodel/examples/SimpleDocument.java Sun Mar 29 22:21:35 2020 @@ -27,6 +27,7 @@ import org.apache.poi.xwpf.usermodel.Tex import org.apache.poi.xwpf.usermodel.UnderlinePatterns; import org.apache.poi.xwpf.usermodel.VerticalAlign; import org.apache.poi.xwpf.usermodel.XWPFDocument; +import org.apache.poi.xwpf.usermodel.XWPFHyperlinkRun; import org.apache.poi.xwpf.usermodel.XWPFParagraph; import org.apache.poi.xwpf.usermodel.XWPFRun; @@ -78,6 +79,11 @@ public class SimpleDocument { r3.setFontSize(20); r3.setSubscript(VerticalAlign.SUPERSCRIPT); +// hyperlink +XWPFHyperlinkRun hyperlink = p2.insertNewHyperlinkRun(0, "http://poi.apache.org/;); +hyperlink.setUnderline(UnderlinePatterns.SINGLE); +hyperlink.setColor("ff"); +hyperlink.setText("Apache POI"); XWPFParagraph p3 = doc.createParagraph(); p3.setWordWrapped(true); Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java?rev=1875862=1875861=1875862=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java Sun Mar 29 22:21:35 2020 @@ -20,6 +20,7 @@ import java.math.BigInteger; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.function.Function; import org.apache.poi.ooxml.POIXMLDocumentPart; import org.apache.poi.util.Internal; @@ -1478,50 +1479,144 @@ public class XWPFParagraph implements IB } /** - * insert a new Run in RunArray + * Appends a new field run to this paragraph + * + * @return a new field run + */ +public XWPFFieldRun createFieldRun() { +CTSimpleField ctSimpleField = paragraph.addNewFldSimple(); +XWPFFieldRun newRun = new XWPFFieldRun(ctSimpleField, ctSimpleField.addNewR(), this); +runs.add(newRun); +iruns.add(newRun); +return newRun; +} + +/** + * insert a new Run in all runs * * @param pos The position at which the new run should be added. * * @return the inserted run or null if the given pos is out of bounds. */ public XWPFRun insertNewRun(int pos) { -if (pos >= 0 && pos <= runs.size()) { -// calculate the correct pos as our run/irun list contains -// hyperlinks -// and fields so it is different to the paragraph R array. -int rPos = 0; -for (int i = 0; i < pos; i++) { -XWPFRun currRun = runs.get(i); -if (!(currRun instanceof XWPFHyperlinkRun -|| currRun instanceof XWPFFieldRun)) { -rPos++; -} -} +if (pos == runs.size()) { +return createRun(); +} +return insertNewProvidedRun(pos, newCursor -> { +String uri = CTR.type.getName().getNamespaceURI(); +String localPart = "r"; +// creates a new run, cursor is positioned inside the new +// element +newCursor.beginElement(localPart, uri); +// move the cursor to the START token to the run just created +newCursor.toParent(); +CTR r = (CTR) newCursor.getObject(); +return new XWPFRun(r, (IRunBody)this); +}); +} + +/** + * insert a new hyperlink Run in all runs + * + * @param pos The position at which the new run should be added. + * @param uri hyperlink uri + * + * @return the inserted run or null if the given pos is out of bounds. + */ +public XWPFHyperlinkRun insertNewHyperlinkRun(int pos, String uri) { +if (pos == ru
svn commit: r1878146 - in /poi/trunk/src/ooxml: java/org/apache/poi/xslf/usermodel/XSLFTextRun.java testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java
Author: abearez Date: Wed May 27 01:18:10 2020 New Revision: 1878146 URL: http://svn.apache.org/viewvc?rev=1878146=rev Log: Get rid of redundant getParentParagraph Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java?rev=1878146=1878145=1878146=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java Wed May 27 01:18:10 2020 @@ -71,10 +71,6 @@ public class XSLFTextRun implements Text } } -XSLFTextParagraph getParentParagraph(){ -return _p; -} - @Override public String getRawText(){ if (_r instanceof CTTextField) { @@ -123,14 +119,14 @@ public class XSLFTextRun implements Text CTTextCharacterProperties rPr = getRPr(true); CTSolidColorFillProperties fill = rPr.isSetSolidFill() ? rPr.getSolidFill() : rPr.addNewSolidFill(); -XSLFSheet sheet = getParentParagraph().getParentShape().getSheet(); +XSLFSheet sheet = getParagraph().getParentShape().getSheet(); XSLFColor col = new XSLFColor(fill, sheet.getTheme(), fill.getSchemeClr(), sheet); col.setColor(c); } @Override public PaintStyle getFontColor(){ -final boolean hasPlaceholder = getParentParagraph().getParentShape().getPlaceholder() != null; +final boolean hasPlaceholder = getParagraph().getParentShape().getPlaceholder() != null; CharacterPropertyFetcher fetcher = new CharacterPropertyFetcher(_p.getIndentLevel()){ @Override public boolean fetch(CTTextCharacterProperties props){ @@ -182,7 +178,7 @@ public class XSLFTextRun implements Text @Override public Double getFontSize(){ double scale = 1; -final XSLFTextShape ps = getParentParagraph().getParentShape(); +final XSLFTextShape ps = getParagraph().getParentShape(); if (ps != null) { final CTTextBodyProperties tbp = ps.getTextBodyPr(); if (tbp != null) { Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java?rev=1878146=1878145=1878146=diff == --- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextShape.java Wed May 27 01:18:10 2020 @@ -231,49 +231,49 @@ public class TestXSLFTextShape { assertEquals(VerticalAlignment.TOP, shape2.getVerticalAlignment()); XSLFTextRun pr1 = shape2.getTextParagraphs().get(0).getTextRuns().get(0); -assertEquals(0, pr1.getParentParagraph().getIndentLevel()); +assertEquals(0, pr1.getParagraph().getIndentLevel()); assertEquals("Content", pr1.getRawText()); assertEquals("Calibri", pr1.getFontFamily()); assertEquals(32.0, pr1.getFontSize(), 0); -assertEquals(27.0, pr1.getParentParagraph().getLeftMargin(), 0); -assertEquals("\u2022", pr1.getParentParagraph().getBulletCharacter()); -assertEquals("Arial", pr1.getParentParagraph().getBulletFont()); +assertEquals(27.0, pr1.getParagraph().getLeftMargin(), 0); +assertEquals("\u2022", pr1.getParagraph().getBulletCharacter()); +assertEquals("Arial", pr1.getParagraph().getBulletFont()); XSLFTextRun pr2 = shape2.getTextParagraphs().get(1).getTextRuns().get(0); -assertEquals(1, pr2.getParentParagraph().getIndentLevel()); +assertEquals(1, pr2.getParagraph().getIndentLevel()); assertEquals("Level 2", pr2.getRawText()); assertEquals("Calibri", pr2.getFontFamily()); assertEquals(28.0, pr2.getFontSize(), 0); -assertEquals(58.5, pr2.getParentParagraph().getLeftMargin(), 0); -assertEquals("\u2013", pr2.getParentParagraph().getBulletCharacter()); -assertEquals("Arial", pr2.getParentParagraph().getBulletFont()); +assertEquals(58.5, pr2.getParagraph().getLeftMargin(), 0); +assertEquals("\u2013", pr2.getParagraph().getBulletCharacter()); +assertEquals("Arial", pr2.getParagraph().getBulletFont()); XSLFTextRun pr3 = shape2.getTextParagraphs().get(2).getTextRuns().get(0); -assertEquals(2, pr3.getParentParagraph().getIndent
svn commit: r1878147 - in /poi/trunk: src/ooxml/java/org/apache/poi/xddf/usermodel/text/ src/ooxml/java/org/apache/poi/xslf/usermodel/ src/ooxml/testcases/org/apache/poi/xddf/usermodel/text/ src/ooxml
Author: abearez Date: Wed May 27 01:18:15 2020 New Revision: 1878147 URL: http://svn.apache.org/viewvc?rev=1878147=rev Log: Bug 63290: retrieve default run properties from paragraph Added: poi/trunk/test-data/slideshow/bug63290.pptx Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextRun.java poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/text/TestXDDFTextRun.java poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTextRun.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextRun.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextRun.java?rev=1878147=1878146=1878147=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextRun.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/text/XDDFTextRun.java Wed May 27 01:18:15 2020 @@ -612,7 +612,8 @@ public class XDDFTextRun { } else if (isRegularRun() && _rtr.isSetRPr()) { return _rtr.getRPr(); } -return null; +XDDFRunProperties defaultProperties = _parent.getDefaultRunProperties(); +return (defaultProperties == null) ? null : defaultProperties.getXmlObject(); } private XDDFRunProperties getOrCreateProperties() { Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java?rev=1878147=1878146=1878147=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextRun.java Wed May 27 01:18:15 2020 @@ -492,6 +492,9 @@ public class XSLFTextRun implements Text return tr.addNewRPr(); } } +if (_p.getXmlObject().isSetPPr() && _p.getXmlObject().getPPr().isSetDefRPr()) { +return _p.getXmlObject().getPPr().getDefRPr(); +} return null; } Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/text/TestXDDFTextRun.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/text/TestXDDFTextRun.java?rev=1878147=1878146=1878147=diff == --- poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/text/TestXDDFTextRun.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/text/TestXDDFTextRun.java Wed May 27 01:18:15 2020 @@ -18,16 +18,22 @@ package org.apache.poi.xddf.usermodel.te import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.io.IOException; +import java.io.InputStream; import java.util.List; +import org.apache.poi.POIDataSamples; import org.apache.poi.util.LocaleUtil; import org.apache.poi.xslf.usermodel.XMLSlideShow; +import org.apache.poi.xslf.usermodel.XSLFShape; import org.apache.poi.xslf.usermodel.XSLFSlide; +import org.apache.poi.xslf.usermodel.XSLFTextParagraph; +import org.apache.poi.xslf.usermodel.XSLFTextRun; import org.apache.poi.xslf.usermodel.XSLFTextShape; import org.apache.poi.xssf.usermodel.XSSFClientAnchor; import org.apache.poi.xssf.usermodel.XSSFDrawing; @@ -133,4 +139,29 @@ public class TestXDDFTextRun { assertNotNull(run.getText()); } } + +@Test +public void testDefaultRunProperties() throws IOException { +// bug #63290 +POIDataSamples pds = POIDataSamples.getSlideShowInstance(); +try (InputStream is = pds.openResourceAsStream("bug63290.pptx"); + XMLSlideShow ppt = new XMLSlideShow(is)) { +XSLFSlide slide = ppt.getSlides().get(0); +for (XSLFShape shape : slide.getShapes()) { +if (shape instanceof XSLFTextShape) { +XSLFTextShape text = (XSLFTextShape) shape; +XDDFTextParagraph paragraph = text.getTextBody().getParagraph(0); +XDDFTextRun defaultRun = paragraph.getTextRuns().get(0); +assertEquals("DefaultRunProperties", defaultRun.getText().trim()); +XDDFTextRun explicitRun = paragraph.getTextRuns().get(1); +assertEquals("ExplicitRunProperties", explicitRun.getText().trim()); +assertEquals(defaultRun.getDirty(), explicitRun.
svn commit: r1878148 - /poi/site/src/documentation/content/xdocs/changes.xml
Author: abearez Date: Wed May 27 01:35:50 2020 New Revision: 1878148 URL: http://svn.apache.org/viewvc?rev=1878148=rev Log: Bug 63290: retrieve default run properties from paragraph Modified: poi/site/src/documentation/content/xdocs/changes.xml Modified: poi/site/src/documentation/content/xdocs/changes.xml URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/changes.xml?rev=1878148=1878147=1878148=diff == --- poi/site/src/documentation/content/xdocs/changes.xml (original) +++ poi/site/src/documentation/content/xdocs/changes.xml Wed May 27 01:35:50 2020 @@ -88,7 +88,7 @@ Picture.resize(double scale) scales width wrong for small pictures and when dx1 is set upgrading xmlsec causes junit tests to fail XSLF - Wrong scheme colors used when rendering -setText in XWPFTableCell updates the xml and also updates the runs and iruns +Method setText in XWPFTableCell updates the xml and also updates the runs and iruns XWPFTableCell does not process bodyElements when handle paragraph XWPFNumbering.addAbstractNum will definitely throw an exception Allow try-with-resources with OPCPackage.revert() @@ -98,9 +98,10 @@ CountryRecord not found Big POIFS stream result in OOM Provide JigSaw modules -synchronize code that initialises WorkbookFactory +Synchronize code that initialises WorkbookFactory Support DateValue function -add an option for RangeCopier.copyRange() also clone styles +Add an option for RangeCopier.copyRange() also clone styles +Retrieve default run properties from paragraph - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1885771 - in /poi/trunk/src: examples/src/org/apache/poi/examples/xslf/ ooxml/java/org/apache/poi/ooxml/util/ ooxml/java/org/apache/poi/xddf/usermodel/chart/ ooxml/testcases/org/apache/po
Author: abearez Date: Thu Jan 21 21:13:27 2021 New Revision: 1885771 URL: http://svn.apache.org/viewvc?rev=1885771=rev Log: Bug 64950: handle doughnut hole size Added: poi/trunk/src/examples/src/org/apache/poi/examples/xslf/DoughnutChartFromScratch.java - copied, changed from r1885770, poi/trunk/src/examples/src/org/apache/poi/examples/xslf/ChartFromScratch.java Modified: poi/trunk/src/examples/src/org/apache/poi/examples/xslf/BarChartDemo.java poi/trunk/src/examples/src/org/apache/poi/examples/xslf/ChartFromScratch.java poi/trunk/src/examples/src/org/apache/poi/examples/xslf/PieChartDemo.java poi/trunk/src/ooxml/java/org/apache/poi/ooxml/util/POIXMLUnits.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDoughnutChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFPieChartData.java poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestNecessaryOOXMLClasses.java Modified: poi/trunk/src/examples/src/org/apache/poi/examples/xslf/BarChartDemo.java URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/examples/xslf/BarChartDemo.java?rev=1885771=1885770=1885771=diff == --- poi/trunk/src/examples/src/org/apache/poi/examples/xslf/BarChartDemo.java (original) +++ poi/trunk/src/examples/src/org/apache/poi/examples/xslf/BarChartDemo.java Thu Jan 21 21:13:27 2021 @@ -64,7 +64,7 @@ public final class BarChartDemo { } try (FileInputStream argIS = new FileInputStream(args[0]); -BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[1]), StandardCharsets.ISO_8859_1)) { +BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[1]), StandardCharsets.UTF_8)) { String chartTitle = modelReader.readLine(); // first line is chart title String[] series = modelReader.readLine().split(","); Modified: poi/trunk/src/examples/src/org/apache/poi/examples/xslf/ChartFromScratch.java URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/examples/xslf/ChartFromScratch.java?rev=1885771=1885770=1885771=diff == --- poi/trunk/src/examples/src/org/apache/poi/examples/xslf/ChartFromScratch.java (original) +++ poi/trunk/src/examples/src/org/apache/poi/examples/xslf/ChartFromScratch.java Thu Jan 21 21:13:27 2021 @@ -72,7 +72,7 @@ public final class ChartFromScratch { return; } -try (BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[0]), StandardCharsets.ISO_8859_1)) { +try (BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[0]), StandardCharsets.UTF_8)) { String chartTitle = modelReader.readLine(); // first line is chart title String[] series = modelReader.readLine().split(","); @@ -163,10 +163,10 @@ public final class ChartFromScratch { bar.setBarGrouping(BarGrouping.CLUSTERED); XDDFBarChartData.Series series1 = (XDDFBarChartData.Series) bar.addSeries(categoriesData, valuesData); -series1.setTitle(series[0], chart.setSheetTitle(series[0], COLUMN_COUNTRIES)); +series1.setTitle(series[0], chart.setSheetTitle(series[COLUMN_COUNTRIES - 1], COLUMN_COUNTRIES)); XDDFBarChartData.Series series2 = (XDDFBarChartData.Series) bar.addSeries(categoriesData, valuesData2); -series2.setTitle(series[1], chart.setSheetTitle(series[1], COLUMN_SPEAKERS)); +series2.setTitle(series[1], chart.setSheetTitle(series[COLUMN_SPEAKERS - 1], COLUMN_SPEAKERS)); bar.setVaryColors(true); bar.setBarDirection(BarDirection.COL); Copied: poi/trunk/src/examples/src/org/apache/poi/examples/xslf/DoughnutChartFromScratch.java (from r1885770, poi/trunk/src/examples/src/org/apache/poi/examples/xslf/ChartFromScratch.java) URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/examples/xslf/DoughnutChartFromScratch.java?p2=poi/trunk/src/examples/src/org/apache/poi/examples/xslf/DoughnutChartFromScratch.java=poi/trunk/src/examples/src/org/apache/poi/examples/xslf/ChartFromScratch.java=1885770=1885771=1885771=diff == --- poi/trunk/src/examples/src/org/apache/poi/examples/xslf/ChartFromScratch.java (original) +++ poi/trunk/src/examples/src/org/apache/poi/examples/xslf/DoughnutChartFromScratch.java Thu Jan 21 21:13:27 2021 @@ -19,32 +19,19 @@ package org.apache.poi.examples.xslf; -import java.awt.geom.Rectangle2D; -import java.io.BufferedReader; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.ArrayList; -i
svn commit: r1885700 - in /poi/trunk: src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSource.java src/ooxml/testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFChart.java test-data/spread
Author: abearez Date: Tue Jan 19 21:33:38 2021 New Revision: 1885700 URL: http://svn.apache.org/viewvc?rev=1885700=rev Log: Bug 65016 - Creating a chart throws exception Added: poi/trunk/test-data/spreadsheet/65016.xlsx Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSource.java poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFChart.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSource.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSource.java?rev=1885700=1885699=1885700=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSource.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSource.java Tue Jan 19 21:33:38 2021 @@ -80,7 +80,9 @@ public interface XDDFDataSource { } } if (effectiveNumOfPoints == 0) { -cache.unsetPtCount(); +if (cache.isSetPtCount()) { +cache.unsetPtCount(); +} } else { if (cache.isSetPtCount()) { cache.getPtCount().setVal(numOfPoints); Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFChart.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFChart.java?rev=1885700=1885699=1885700=diff == --- poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFChart.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFChart.java Tue Jan 19 21:33:38 2021 @@ -23,9 +23,17 @@ import static org.junit.jupiter.api.Asse import org.apache.poi.ooxml.POIXMLFactory; import org.apache.poi.ooxml.POIXMLRelation; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xssf.XSSFTestDataSamples; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.junit.jupiter.api.Test; import org.openxmlformats.schemas.drawingml.x2006.chart.CTChartSpace; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + class TestXDDFChart { @Test void testConstruct() { @@ -48,6 +56,39 @@ class TestXDDFChart { assertEquals("rid2", ctChartSpace.getExternalData().getId()); } +@Test +public void test65016() throws IOException { +try (XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("65016.xlsx")) { +XSSFSheet splitSheet = wb.getSheet("Splits"); + +XDDFChart chart = newXDDFChart(); +XDDFChartLegend legend = chart.getOrAddLegend(); +legend.setPosition(LegendPosition.BOTTOM); + +// Use a category axis for the bottom axis. +XDDFCategoryAxis bottomAxis = chart.createCategoryAxis(AxisPosition.BOTTOM); +XDDFValueAxis leftAxis = chart.createValueAxis(AxisPosition.LEFT); +leftAxis.setCrosses(AxisCrosses.AUTO_ZERO); + +XDDFLineChartData data = (XDDFLineChartData) chart.createData(ChartTypes.LINE, bottomAxis, leftAxis); + +// starting row 1 to include description +XDDFNumericalDataSource xs = XDDFDataSourcesFactory.fromNumericCellRange(splitSheet, +new CellRangeAddress(2, 100, 0, 0)); +XDDFNumericalDataSource ys1 = XDDFDataSourcesFactory.fromNumericCellRange(splitSheet, +new CellRangeAddress(2, 100, 1, 1)); + +XDDFLineChartData.Series series = (XDDFLineChartData.Series) data.addSeries(xs, ys1); +assertEquals(series.categoryData.getPointCount(), xs.getPointCount()); + +chart.plot(data); + +try (OutputStream out = new FileOutputStream("/tmp/chart20201220.xlsx")) { +wb.write(out); +} +} +} + private XDDFChart newXDDFChart() { XDDFChart xddfChart = new XDDFChart() { @Override @@ -67,4 +108,4 @@ class TestXDDFChart { }; return xddfChart; } -} \ No newline at end of file +} Added: poi/trunk/test-data/spreadsheet/65016.xlsx URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/65016.xlsx?rev=1885700=auto == Binary files poi/trunk/test-data/spreadsheet/65016.xlsx (added) and poi/trunk/test-data/spreadsheet/65016.xlsx Tue Jan 19 21:33:38 2021 differ - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1886337 - /poi/site/src/documentation/content/xdocs/changes.xml
Author: abearez Date: Mon Feb 8 20:33:38 2021 New Revision: 1886337 URL: http://svn.apache.org/viewvc?rev=1886337=rev Log: Fix slide notes content import part from bug 57835 Modified: poi/site/src/documentation/content/xdocs/changes.xml Modified: poi/site/src/documentation/content/xdocs/changes.xml URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/changes.xml?rev=1886337=1886336=1886337=diff == --- poi/site/src/documentation/content/xdocs/changes.xml (original) +++ poi/site/src/documentation/content/xdocs/changes.xml Mon Feb 8 20:33:38 2021 @@ -86,6 +86,7 @@ Don't throw exception on empty data source Set hole size for doughnut chart XSSFDrawing - import chart from other drawing +XSLFSlide - import slide notes when importing slide content - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1886338 - in /poi/trunk/src/ooxml: java/org/apache/poi/xslf/usermodel/XSLFShape.java java/org/apache/poi/xslf/usermodel/XSLFSlide.java testcases/org/apache/poi/xslf/usermodel/TestXSLFNote
Author: abearez Date: Mon Feb 8 20:34:14 2021 New Revision: 1886338 URL: http://svn.apache.org/viewvc?rev=1886338=rev Log: Import slide notes when importing slide content Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFNotes.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java?rev=1886338=1886337=1886338=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java Mon Feb 8 20:34:14 2021 @@ -143,7 +143,10 @@ public abstract class XSLFShape implemen if (this instanceof PlaceableShape) { PlaceableShape ps = (PlaceableShape)this; -ps.setAnchor(sh.getAnchor()); +Rectangle2D anchor = sh.getAnchor(); +if (anchor != null) { +ps.setAnchor(anchor); +} } @@ -485,4 +488,4 @@ public abstract class XSLFShape implemen protected XmlObject getShapeProperties() { return getChild(CTShapeProperties.class, PML_NS, "spPr"); } -} \ No newline at end of file +} Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java?rev=1886338=1886337=1886338=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSlide.java Mon Feb 8 20:34:14 2021 @@ -295,6 +295,11 @@ implements Slidehttp://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFNotes.java?rev=1886338=1886337=1886338=diff == --- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFNotes.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFNotes.java Mon Feb 8 20:34:14 2021 @@ -103,4 +103,25 @@ class TestXSLFNotes { ppt.close(); } + +@Test +void importNotes() throws IOException { + +XMLSlideShow ppt = XSLFTestDataSamples.openSampleDocument("sample.pptx"); +XMLSlideShow newShow = new XMLSlideShow(); + +for (XSLFSlide slide : ppt.getSlides()) { +XSLFNotes slideNotes = slide.getNotes(); +assertNotNull(slideNotes); +XSLFNotes notesSlide = ppt.getNotesSlide(slide); +assertNotNull(notesSlide); +assertEquals(notesSlide, slideNotes); + +XSLFSlide newSlide = newShow.createSlide().importContent(slide); +XSLFNotes newNotes = newSlide.getNotes(); +assertNotNull(newNotes); +} + +ppt.close(); +} } - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1885886 - in /poi/trunk/src: examples/src/org/apache/poi/examples/xssf/usermodel/ examples/src/org/apache/poi/examples/xwpf/usermodel/ ooxml/testcases/org/apache/poi/xddf/usermodel/chart/
Author: abearez Date: Sun Jan 24 20:01:36 2021 New Revision: 1885886 URL: http://svn.apache.org/viewvc?rev=1885886=rev Log: Replace deprecated methods used in tests Modified: poi/trunk/src/examples/src/org/apache/poi/examples/xssf/usermodel/ExcelChartWithTargetLine.java poi/trunk/src/examples/src/org/apache/poi/examples/xwpf/usermodel/BarChartExample.java poi/trunk/src/examples/src/org/apache/poi/examples/xwpf/usermodel/ChartFromScratch.java poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFChartRemoveSeries.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFLineChartData.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/charts/TestXSSFScatterChartData.java poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFChart.java Modified: poi/trunk/src/examples/src/org/apache/poi/examples/xssf/usermodel/ExcelChartWithTargetLine.java URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/examples/xssf/usermodel/ExcelChartWithTargetLine.java?rev=1885886=1885885=1885886=diff == --- poi/trunk/src/examples/src/org/apache/poi/examples/xssf/usermodel/ExcelChartWithTargetLine.java (original) +++ poi/trunk/src/examples/src/org/apache/poi/examples/xssf/usermodel/ExcelChartWithTargetLine.java Sun Jan 24 20:01:36 2021 @@ -137,7 +137,7 @@ public final class ExcelChartWithTargetL } XDDFScatterChartData scatter = (XDDFScatterChartData) chart.createData(ChartTypes.SCATTER, scatterX, scatterY); -scatter.setVaryColors(true); +scatter.setVaryColors(false); // This only works for Excel since OpenOffice or LibreOffice Calc does not support literal numeric data series. XDDFNumericalDataSource targetDS = XDDFDataSourcesFactory.fromArray(new Double[] { target, target }); Modified: poi/trunk/src/examples/src/org/apache/poi/examples/xwpf/usermodel/BarChartExample.java URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/examples/xwpf/usermodel/BarChartExample.java?rev=1885886=1885885=1885886=diff == --- poi/trunk/src/examples/src/org/apache/poi/examples/xwpf/usermodel/BarChartExample.java (original) +++ poi/trunk/src/examples/src/org/apache/poi/examples/xwpf/usermodel/BarChartExample.java Sun Jan 24 20:01:36 2021 @@ -63,7 +63,7 @@ public final class BarChartExample { } try (FileInputStream argIS = new FileInputStream(args[0]); -BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[1]), StandardCharsets.ISO_8859_1)) { +BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[1]), StandardCharsets.UTF_8)) { String chartTitle = modelReader.readLine(); // first line is chart title String[] series = modelReader.readLine().split(","); Modified: poi/trunk/src/examples/src/org/apache/poi/examples/xwpf/usermodel/ChartFromScratch.java URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/examples/xwpf/usermodel/ChartFromScratch.java?rev=1885886=1885885=1885886=diff == --- poi/trunk/src/examples/src/org/apache/poi/examples/xwpf/usermodel/ChartFromScratch.java (original) +++ poi/trunk/src/examples/src/org/apache/poi/examples/xwpf/usermodel/ChartFromScratch.java Sun Jan 24 20:01:36 2021 @@ -67,7 +67,7 @@ public final class ChartFromScratch { return; } -try (BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[0]), StandardCharsets.ISO_8859_1)) { +try (BufferedReader modelReader = Files.newBufferedReader(Paths.get(args[0]), StandardCharsets.UTF_8)) { String chartTitle = modelReader.readLine(); // first line is chart title String[] series = modelReader.readLine().split(","); Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFChartRemoveSeries.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFChartRemoveSeries.java?rev=1885886=1885885=1885886=diff == --- poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFChartRemoveSeries.java (original) +++ poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/chart/TestXDDFChartRemoveSeries.java Sun Jan 24 20:01:36 2021 @@ -117,7 +117,7 @@ class TestXDDFChartRemoveSeries { } /** - * Remove the first series by calling chartData.getSeries().remove(0). + * Attempt to remove the first series by calling chartData.getSeries().remove(0). * * This used to corrupt the workbook but the returned L
svn commit: r1886605 - in /poi/trunk/src/ooxml: java/org/apache/poi/xddf/usermodel/chart/ java/org/apache/poi/xslf/usermodel/ java/org/apache/poi/xssf/usermodel/ testcases/org/apache/poi/xssf/ testcas
Author: abearez Date: Tue Feb 16 23:39:19 2021 New Revision: 1886605 URL: http://svn.apache.org/viewvc?rev=1886605=rev Log: [bug-63902] reference cloned sheet in cloned chart data series Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFCategoryDataSource.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSource.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataSourcesFactory.java poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFChart.java poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFChart.java poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/TestXSSFCloneSheet.java poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDrawing.java Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFCategoryDataSource.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFCategoryDataSource.java?rev=1886605=1886604=1886605=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFCategoryDataSource.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFCategoryDataSource.java Tue Feb 16 23:39:19 2021 @@ -42,9 +42,4 @@ public interface XDDFCategoryDataSource default boolean isReference() { return true; } - -@Override -default String getDataRangeReference() { -return getFormula(); -} } Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java?rev=1886605=1886604=1886605=diff == --- poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java (original) +++ poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChart.java Tue Feb 16 23:39:19 2021 @@ -124,10 +124,6 @@ public abstract class XDDFChart extends */ protected final CTChartSpace chartSpace; -/** - * Chart element in the chart space - */ -protected final CTChart chart; /** * Construct a chart. @@ -136,8 +132,7 @@ public abstract class XDDFChart extends super(); chartSpace = CTChartSpace.Factory.newInstance(); -chart = chartSpace.addNewChart(); -chart.addNewPlotArea(); +chartSpace.addNewChart().addNewPlotArea(); } /** @@ -153,7 +148,6 @@ public abstract class XDDFChart extends super(part); chartSpace = ChartSpaceDocument.Factory.parse(part.getInputStream(), DEFAULT_XML_OPTIONS).getChartSpace(); -chart = chartSpace.getChart(); } /** @@ -174,8 +168,7 @@ public abstract class XDDFChart extends */ @Internal public CTChart getCTChart() { -return chart; - +return chartSpace.getChart(); } /** @@ -185,7 +178,7 @@ public abstract class XDDFChart extends */ @Internal protected CTPlotArea getCTPlotArea() { -return chart.getPlotArea(); +return getCTChart().getPlotArea(); } /** @@ -199,8 +192,8 @@ public abstract class XDDFChart extends workbook.removeSheetAt(0); workbook.createSheet(); } -chart.set(CTChart.Factory.newInstance()); -chart.addNewPlotArea(); +getCTChart().set(CTChart.Factory.newInstance()); +getCTChart().addNewPlotArea(); } /** @@ -208,8 +201,8 @@ public abstract class XDDFChart extends * otherwise */ public boolean isPlotOnlyVisibleCells() { -if (chart.isSetPlotVisOnly()) { -return chart.getPlotVisOnly().getVal(); +if (getCTChart().isSetPlotVisOnly()) { +return getCTChart().getPlotVisOnly().getVal(); } else { return false; } @@ -221,40 +214,40 @@ public abstract class XDDFChart extends *the chart */ public void setPlotOnlyVisibleCells(boolean only) { -if (!chart.isSetPlotVisOnly()) { -chart.setPlotVisOnly(CTBoolean.Factory.newInstance()); +if (!getCTChart().isSetPlotVisOnly()) { +getCTChart().setPlotVisOnly(CTBoolean.Factory.newInstance()); } -chart.getPlotVisOnly().setVal(only); +getCTChart().getPlotVisOnly().setVal(only); } public void setFloor(int thickness) { -if (!chart.isSetFloor()) { -chart.setFloor
svn commit: r1886606 - /poi/site/src/documentation/content/xdocs/changes.xml
Author: abearez Date: Tue Feb 16 23:40:09 2021 New Revision: 1886606 URL: http://svn.apache.org/viewvc?rev=1886606=rev Log: [bug-63902] reference cloned sheet in cloned chart data series Modified: poi/site/src/documentation/content/xdocs/changes.xml Modified: poi/site/src/documentation/content/xdocs/changes.xml URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/changes.xml?rev=1886606=1886605=1886606=diff == --- poi/site/src/documentation/content/xdocs/changes.xml (original) +++ poi/site/src/documentation/content/xdocs/changes.xml Tue Feb 16 23:40:09 2021 @@ -86,6 +86,7 @@ Don't throw exception on empty data source Set hole size for doughnut chart XSSFDrawing - import chart from other drawing +XSSFWorkbook - clone sheet with chart XSLFSlide - import slide notes when importing slide content - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1886643 - /poi/site/src/documentation/content/xdocs/changes.xml
Author: abearez Date: Wed Feb 17 22:06:26 2021 New Revision: 1886643 URL: http://svn.apache.org/viewvc?rev=1886643=rev Log: [bug-54470] clone sheet with chart Modified: poi/site/src/documentation/content/xdocs/changes.xml Modified: poi/site/src/documentation/content/xdocs/changes.xml URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/changes.xml?rev=1886643=1886642=1886643=diff == --- poi/site/src/documentation/content/xdocs/changes.xml (original) +++ poi/site/src/documentation/content/xdocs/changes.xml Wed Feb 17 22:06:26 2021 @@ -86,7 +86,8 @@ Don't throw exception on empty data source Set hole size for doughnut chart XSSFDrawing - import chart from other drawing -XSSFWorkbook - clone sheet with chart +XSSFWorkbook - reference cloned sheet in cloned chart data +XSSFWorkbook - clone sheet with chart XSLFSlide - import slide notes when importing slide content - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1886644 - /poi/site/src/documentation/content/xdocs/changes.xml
Author: abearez Date: Wed Feb 17 22:06:30 2021 New Revision: 1886644 URL: http://svn.apache.org/viewvc?rev=1886644=rev Log: Manipulate individual data point properties Modified: poi/site/src/documentation/content/xdocs/changes.xml Modified: poi/site/src/documentation/content/xdocs/changes.xml URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/changes.xml?rev=1886644=1886643=1886644=diff == --- poi/site/src/documentation/content/xdocs/changes.xml (original) +++ poi/site/src/documentation/content/xdocs/changes.xml Wed Feb 17 22:06:30 2021 @@ -89,6 +89,7 @@ XSSFWorkbook - reference cloned sheet in cloned chart data XSSFWorkbook - clone sheet with chart XSLFSlide - import slide notes when importing slide content +Manipulate individual data point properties - To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org For additional commands, e-mail: commits-h...@poi.apache.org
svn commit: r1886642 - in /poi/trunk/src: examples/src/org/apache/poi/examples/xslf/ examples/src/org/apache/poi/examples/xssf/usermodel/ ooxml/java/org/apache/poi/xddf/usermodel/chart/ ooxml/testcase
Author: abearez Date: Wed Feb 17 22:05:18 2021 New Revision: 1886642 URL: http://svn.apache.org/viewvc?rev=1886642=rev Log: Manipulate individual data point properties Added: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDataPoint.java Modified: poi/trunk/src/examples/src/org/apache/poi/examples/xslf/PieChartDemo.java poi/trunk/src/examples/src/org/apache/poi/examples/xssf/usermodel/BarAndLineChart.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFArea3DChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFAreaChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBar3DChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFBarChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFDoughnutChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLine3DChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFLineChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFPie3DChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFPieChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFRadarChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFScatterChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFSurface3DChartData.java poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFSurfaceChartData.java poi/trunk/src/ooxml/testcases/org/apache/poi/xddf/usermodel/TestNecessaryOOXMLClasses.java Modified: poi/trunk/src/examples/src/org/apache/poi/examples/xslf/PieChartDemo.java URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/examples/xslf/PieChartDemo.java?rev=1886642=1886641=1886642=diff == --- poi/trunk/src/examples/src/org/apache/poi/examples/xslf/PieChartDemo.java (original) +++ poi/trunk/src/examples/src/org/apache/poi/examples/xslf/PieChartDemo.java Wed Feb 17 22:05:18 2021 @@ -110,6 +110,7 @@ public final class PieChartDemo { firstSeries.replaceData(categoriesData, valuesData); firstSeries.setTitle(chartTitle, chart.setSheetTitle(chartTitle, 0)); firstSeries.setExplosion(25L); + firstSeries.getDataPoint(1).setExplosion(35L); chart.plot(pie); // save the result Modified: poi/trunk/src/examples/src/org/apache/poi/examples/xssf/usermodel/BarAndLineChart.java URL: http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/examples/xssf/usermodel/BarAndLineChart.java?rev=1886642=1886641=1886642=diff == --- poi/trunk/src/examples/src/org/apache/poi/examples/xssf/usermodel/BarAndLineChart.java (original) +++ poi/trunk/src/examples/src/org/apache/poi/examples/xssf/usermodel/BarAndLineChart.java Wed Feb 17 22:05:18 2021 @@ -166,10 +166,15 @@ public final class BarAndLineChart { // some colors XDDFFillProperties solidChartreuse = new XDDFSolidFillProperties(XDDFColor.from(PresetColor.CHARTREUSE)); XDDFFillProperties solidTurquoise = new XDDFSolidFillProperties(XDDFColor.from(PresetColor.TURQUOISE)); -XDDFLineProperties solidLines = new XDDFLineProperties(solidTurquoise); +XDDFLineProperties linesChartreuse = new XDDFLineProperties(solidChartreuse); +XDDFLineProperties linesTurquoise = new XDDFLineProperties(solidTurquoise); series1.setFillProperties(solidChartreuse); -series1.setLineProperties(solidLines); // bar border color different from fill -series2.setLineProperties(solidLines); +series1.setLineProperties(linesTurquoise); // bar border color different from fill +series1.getDataPoint(2).setFillProperties(solidTurquoise); // this specific bar has inverted colors +series1.getDataPoint(2).setLineProperties(linesChartreuse); +series2.setLineProperties(linesTurquoise); +series2.getDataPoint(2).setMarkerStyle(MarkerStyle.STAR); +series2.getDataPoint(2).setLineProperties(linesChartreuse); // legend XDDFChartLegend legend = chart.getOrAddLegend(); Modified: poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFArea3DChartData.java URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xddf/usermodel/chart/XDDFArea3DChartData.java?rev=1886642=1886641=1886642=diff == --- poi/trunk/src/ooxml/java/org