git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1909994 13f79535-47bb-0310-9956-ffa450edef68tags/REL_5_2_4
); | ); | ||||
public static final XSSFRelation MACRO_SHEET_BIN = new XSSFRelation( | 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", | "http://schemas.microsoft.com/office/2006/relationships/xlMacrosheet", | ||||
"/xl/macroSheets/sheet#.bin" | "/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( | 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", | "http://schemas.microsoft.com/office/2006/relationships/xlIntlMacrosheet", | ||||
"/xl/macroSheets/sheet#.bin" | "/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( | public static final XSSFRelation DIALOG_SHEET_BIN = new XSSFRelation( | ||||
null,//TODO: figure out what this should be? | null,//TODO: figure out what this should be? | ||||
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet", | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/dialogsheet", |
import org.apache.poi.openxml4j.opc.PackageAccess; | import org.apache.poi.openxml4j.opc.PackageAccess; | ||||
import org.apache.poi.openxml4j.opc.PackagePart; | import org.apache.poi.openxml4j.opc.PackagePart; | ||||
import org.apache.poi.openxml4j.opc.PackageRelationship; | 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.opc.PackagingURIHelper; | ||||
import org.apache.poi.openxml4j.util.ZipSecureFile; | import org.apache.poi.openxml4j.util.ZipSecureFile; | ||||
import org.apache.poi.poifs.crypt.Decryptor; | import org.apache.poi.poifs.crypt.Decryptor; | ||||
readByCommonsCompress(temp_excel_poi_decrypt); | 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 { | private static void readByCommonsCompress(File temp_excel_poi) throws IOException { | ||||
/* read by commons-compress*/ | /* read by commons-compress*/ | ||||
try (ZipFile zipFile = new ZipFile(temp_excel_poi)) { | try (ZipFile zipFile = new ZipFile(temp_excel_poi)) { |