diff options
author | PJ Fanning <fanningpj@apache.org> | 2021-07-24 08:57:27 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2021-07-24 08:57:27 +0000 |
commit | ca93275431d44aeba818a9cb576b9b7cb9384fee (patch) | |
tree | 90e63d6775469b1a974f7622df6faa3397366577 /poi-ooxml | |
parent | dcf0f3d870f5e1be7833b758f815911a74fab120 (diff) | |
download | poi-ca93275431d44aeba818a9cb576b9b7cb9384fee.tar.gz poi-ca93275431d44aeba818a9cb576b9b7cb9384fee.zip |
fix spelling
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1891768 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
3 files changed, 99 insertions, 2 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFCell.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFCell.java index 7cee29bb9c..6f44c8e524 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFCell.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFCell.java @@ -548,7 +548,7 @@ public class SXSSFCell extends CellBase { } /** - * <p>Set the style for the cell. The style should be an CellStyle created/retreived from + * <p>Set the style for the cell. The style should be an CellStyle created/retrieved from * the Workbook.</p> * * <p>To change the style of a cell without affecting other cells that use the same style, diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java index 5929a4cad3..4a07e068b5 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFCell.java @@ -606,7 +606,7 @@ public final class XSSFCell extends CellBase { } /** - * <p>Set the style for the cell. The style should be an XSSFCellStyle created/retreived from + * <p>Set the style for the cell. The style should be an XSSFCellStyle created/retrieved from * the XSSFWorkbook.</p> * * <p>To change the style of a cell without affecting other cells that use the same style, diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFRow.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFRow.java index 4e6899dfc2..973909ffcf 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFRow.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFRow.java @@ -23,6 +23,7 @@ import static org.junit.jupiter.api.Assertions.assertSame; import java.io.IOException; +import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.tests.usermodel.BaseTestXRow; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellCopyPolicy; @@ -154,6 +155,102 @@ public final class TestXSSFRow extends BaseTestXRow { } @Test + void testCopyRowFromHssfExternalSheet() throws IOException { + final XSSFWorkbook xssfWorkbook = new XSSFWorkbook(); + final HSSFWorkbook hssfWorkbook = new HSSFWorkbook(); + final Sheet srcSheet = hssfWorkbook.createSheet("src"); + final XSSFSheet destSheet = xssfWorkbook.createSheet("dest"); + xssfWorkbook.createSheet("other"); + + final Row srcRow = srcSheet.createRow(0); + int col = 0; + //Test 2D and 3D Ref Ptgs (Pxg for OOXML Workbooks) + srcRow.createCell(col++).setCellFormula("B5"); + srcRow.createCell(col++).setCellFormula("src!B5"); + srcRow.createCell(col++).setCellFormula("dest!B5"); + srcRow.createCell(col++).setCellFormula("other!B5"); + + //Test 2D and 3D Ref Ptgs with absolute row + srcRow.createCell(col++).setCellFormula("B$5"); + srcRow.createCell(col++).setCellFormula("src!B$5"); + srcRow.createCell(col++).setCellFormula("dest!B$5"); + srcRow.createCell(col++).setCellFormula("other!B$5"); + + //Test 2D and 3D Area Ptgs (Pxg for OOXML Workbooks) + srcRow.createCell(col++).setCellFormula("SUM(B5:D$5)"); + srcRow.createCell(col++).setCellFormula("SUM(src!B5:D$5)"); + srcRow.createCell(col++).setCellFormula("SUM(dest!B5:D$5)"); + srcRow.createCell(col++).setCellFormula("SUM(other!B5:D$5)"); + + ////////////////// + + final XSSFRow destRow = destSheet.createRow(1); + destRow.copyRowFrom(srcRow, new CellCopyPolicy()); + + ////////////////// + + //Test 2D and 3D Ref Ptgs (Pxg for OOXML Workbooks) + col = 0; + Cell cell = destRow.getCell(col++); + assertNotNull(cell); + assertEquals("B6", cell.getCellFormula(), "RefPtg"); + + cell = destRow.getCell(col++); + assertNotNull(cell); + assertEquals("src!B6", cell.getCellFormula(), "Ref3DPtg"); + + cell = destRow.getCell(col++); + assertNotNull(cell); + assertEquals("dest!B6", cell.getCellFormula(), "Ref3DPtg"); + + cell = destRow.getCell(col++); + assertNotNull(cell); + assertEquals("other!B6", cell.getCellFormula(), "Ref3DPtg"); + + ///////////////////////////////////////////// + + //Test 2D and 3D Ref Ptgs with absolute row (Ptg row number shouldn't change) + cell = destRow.getCell(col++); + assertNotNull(cell); + assertEquals("B$5", cell.getCellFormula(), "RefPtg"); + + cell = destRow.getCell(col++); + assertNotNull(cell); + assertEquals("src!B$5", cell.getCellFormula(), "Ref3DPtg"); + + cell = destRow.getCell(col++); + assertNotNull(cell); + assertEquals("dest!B$5", cell.getCellFormula(), "Ref3DPtg"); + + cell = destRow.getCell(col++); + assertNotNull(cell); + assertEquals("other!B$5", cell.getCellFormula(), "Ref3DPtg"); + + ////////////////////////////////////////// + + //Test 2D and 3D Area Ptgs (Pxg for OOXML Workbooks) + // Note: absolute row changes from last cell to first cell in order + // to maintain topLeft:bottomRight order + cell = destRow.getCell(col++); + assertNotNull(cell); + assertEquals("SUM(B$5:D6)", cell.getCellFormula(), "Area2DPtg"); + + cell = destRow.getCell(col++); + assertNotNull(cell); + assertEquals("SUM(src!B$5:D6)", cell.getCellFormula(), "Area3DPtg"); + + cell = destRow.getCell(col++); + assertNotNull(destRow.getCell(6)); + assertEquals("SUM(dest!B$5:D6)", cell.getCellFormula(), "Area3DPtg"); + + cell = destRow.getCell(col++); + assertNotNull(destRow.getCell(7)); + assertEquals("SUM(other!B$5:D6)", cell.getCellFormula(), "Area3DPtg"); + + xssfWorkbook.close(); + } + + @Test void testCopyRowOverwritesExistingRow() throws IOException { final XSSFWorkbook workbook = new XSSFWorkbook(); final XSSFSheet sheet1 = workbook.createSheet("Sheet1"); |