Author: fanningpj
Date: Mon May 22 16:00:10 2023
New Revision: 1909994

URL: http://svn.apache.org/viewvc?rev=1909994&view=rev
Log:
[bug-66612] get macrosheet xml (test)

Added:
    poi/trunk/test-data/spreadsheet/xlmmacro.xlsm   (with props)
Modified:
    
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRelation.java
    
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

Modified: 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRelation.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRelation.java?rev=1909994&r1=1909993&r2=1909994&view=diff
==============================================================================
--- 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRelation.java
 (original)
+++ 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRelation.java
 Mon May 22 16:00:10 2023
@@ -286,17 +286,29 @@ public final class XSSFRelation extends
     );
 
     public static final XSSFRelation MACRO_SHEET_BIN = new XSSFRelation(
-        "application/vnd.ms-excel.macrosheet+xml",
+        "application/vnd.ms-excel.macrosheet",
         "http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet";,
         "/xl/macroSheets/sheet#.bin"
     );
 
+    public static final XSSFRelation MACRO_SHEET_XML = new XSSFRelation(
+            "application/vnd.ms-excel.macrosheet+xml",
+            
"http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet";,
+            "/xl/macroSheets/sheet#.xml"
+    );
+
     public static final XSSFRelation INTL_MACRO_SHEET_BIN = new XSSFRelation(
-        "application/vnd.ms-excel.intlmacrosheet+xml",
+        "application/vnd.ms-excel.intlmacrosheet",
         
"http://schemas.microsoft.com/office/2006/relationships/xlIntlMacrosheet";,
         "/xl/macroSheets/sheet#.bin"
     );
 
+    public static final XSSFRelation INTL_MACRO_SHEET_XML = new XSSFRelation(
+            "application/vnd.ms-excel.intlmacrosheet+xml",
+            
"http://schemas.microsoft.com/office/2006/relationships/xlIntlMacrosheet";,
+            "/xl/macroSheets/sheet#.xml"
+    );
+
     public static final XSSFRelation DIALOG_SHEET_BIN = new XSSFRelation(
         null,//TODO: figure out what this should be?
         
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet";,

Modified: 
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java?rev=1909994&r1=1909993&r2=1909994&view=diff
==============================================================================
--- 
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
 (original)
+++ 
poi/trunk/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFBugs.java
 Mon May 22 16:00:10 2023
@@ -68,6 +68,7 @@ import org.apache.poi.openxml4j.opc.OPCP
 import org.apache.poi.openxml4j.opc.PackageAccess;
 import org.apache.poi.openxml4j.opc.PackagePart;
 import org.apache.poi.openxml4j.opc.PackageRelationship;
+import org.apache.poi.openxml4j.opc.PackageRelationshipCollection;
 import org.apache.poi.openxml4j.opc.PackagingURIHelper;
 import org.apache.poi.openxml4j.util.ZipSecureFile;
 import org.apache.poi.poifs.crypt.Decryptor;
@@ -3841,6 +3842,18 @@ public final class TestXSSFBugs extends
         readByCommonsCompress(temp_excel_poi_decrypt);
     }
 
+    @Test
+    void getMacrosheet() throws IOException, InvalidFormatException {
+        try (XSSFWorkbook wb = openSampleWorkbook("xlmmacro.xlsm")) {
+            PackageRelationshipCollection prc = 
wb.getPackagePart().getRelationships();
+            assertNotNull(prc);
+            assertEquals(6, prc.size());
+            PackageRelationshipCollection prc2 = 
prc.getRelationships(XSSFRelation.MACRO_SHEET_XML.getRelation());
+            assertNotNull(prc2);
+            assertEquals(1, prc2.size());
+        }
+    }
+
     private static void readByCommonsCompress(File temp_excel_poi) throws 
IOException {
         /* read by commons-compress*/
         try (ZipFile zipFile = new ZipFile(temp_excel_poi)) {

Added: poi/trunk/test-data/spreadsheet/xlmmacro.xlsm
URL: 
http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/xlmmacro.xlsm?rev=1909994&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/spreadsheet/xlmmacro.xlsm
------------------------------------------------------------------------------
    svn:mime-type = application/vnd.ms-excel.sheet.macroEnabled.12



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to