Bug 60512: Add missing XSSFRelation.CUSTOM_PROPERTY

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1776606 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2016-12-30 16:55:19 +00:00
parent 397a6d6761
commit 2d7f4100bd
3 changed files with 40 additions and 2 deletions

View File

@ -351,7 +351,14 @@ public final class XSSFRelation extends POIXMLRelation {
"/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 POIXMLRelation {
* <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);
}
}

View File

@ -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 BaseTestCloneSheet {
}
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();
}
}

Binary file not shown.