poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1776606 - in /poi/trunk: src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java src/ooxml/testcases/org/apache/poi/xssf/TestXSSFCloneSheet.java test-data/spreadsheet/60512.xlsm
Date Fri, 30 Dec 2016 16:55:20 GMT
Author: centic
Date: Fri Dec 30 16:55:19 2016
New Revision: 1776606

URL: http://svn.apache.org/viewvc?rev=1776606&view=rev
Log:
Bug 60512: Add missing XSSFRelation.CUSTOM_PROPERTY

Added:
    poi/trunk/test-data/spreadsheet/60512.xlsm
Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/TestXSSFCloneSheet.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java?rev=1776606&r1=1776605&r2=1776606&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRelation.java Fri Dec 30 16:55:19
2016
@@ -351,7 +351,14 @@ public final class XSSFRelation extends
             "/xl/ctrlProps/ctrlProp#.xml",
             null
     );
-    
+
+    public static final XSSFRelation CUSTOM_PROPERTIES = new XSSFRelation(
+            "application/vnd.openxmlformats-officedocument.spreadsheetml.customProperty",
+            "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customProperty",
+            "/xl/customProperty#.bin",
+            null
+    );
+
     public static final String NS_SPREADSHEETML = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
     public static final String NS_DRAWINGML = "http://schemas.openxmlformats.org/drawingml/2006/main";
     public static final String NS_CHART = "http://schemas.openxmlformats.org/drawingml/2006/chart";
@@ -387,7 +394,7 @@ public final class XSSFRelation extends
      *    <code>http://schemas.openxmlformats.org/officeDocument/2006/relationships/image</code>
      * @return registered POIXMLRelation or null if not found
      */
-    public static XSSFRelation getInstance(String rel){
+    public static XSSFRelation getInstance(String rel) {
         return _table.get(rel);
     }
 }

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/TestXSSFCloneSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/TestXSSFCloneSheet.java?rev=1776606&r1=1776605&r2=1776606&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/TestXSSFCloneSheet.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/TestXSSFCloneSheet.java Fri Dec 30 16:55:19
2016
@@ -18,15 +18,22 @@
 package org.apache.poi.xssf;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
 import org.apache.poi.hssf.HSSFITestDataProvider;
 import org.apache.poi.ss.usermodel.BaseTestCloneSheet;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.junit.Before;
 import org.junit.Test;
 
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
 public class TestXSSFCloneSheet  extends BaseTestCloneSheet {
     public TestXSSFCloneSheet() {
         super(HSSFITestDataProvider.instance);
@@ -59,4 +66,28 @@ public class TestXSSFCloneSheet  extends
         }
         assertEquals(1, wb.getNumberOfSheets());
     }
+
+    @Test
+    public void test60512() throws IOException {
+        XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("60512.xlsm");
+
+        assertEquals(1, wb.getNumberOfSheets());
+        Sheet sheet = wb.cloneSheet(0);
+        assertNotNull(sheet);
+        assertEquals(2, wb.getNumberOfSheets());
+
+
+        Workbook wbBack = XSSFTestDataSamples.writeOutAndReadBack(wb);
+        assertNotNull(wbBack);
+        wbBack.close();
+
+        OutputStream str = new FileOutputStream("/tmp/60512.xlsx");
+        try {
+            wb.write(str);
+        } finally {
+            str.close();
+        }
+
+        wb.close();
+    }
 }

Added: poi/trunk/test-data/spreadsheet/60512.xlsm
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/60512.xlsm?rev=1776606&view=auto
==============================================================================
Binary files poi/trunk/test-data/spreadsheet/60512.xlsm (added) and poi/trunk/test-data/spreadsheet/60512.xlsm
Fri Dec 30 16:55:19 2016 differ



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message