mirror of https://github.com/apache/poi.git
[bug-66612] get macrosheet xml (test)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1909994 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2712abf00b
commit
b5153f1395
|
@ -286,17 +286,29 @@ public final class XSSFRelation extends POIXMLRelation {
|
|||
);
|
||||
|
||||
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",
|
||||
|
|
|
@ -68,6 +68,7 @@ import org.apache.poi.openxml4j.opc.OPCPackage;
|
|||
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 BaseTestBugzillaIssues {
|
|||
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)) {
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue