<changes>
<release version="3.8-beta3" date="2011-??-??">
+ <action dev="poi-developers" type="fix">51061 - Correct target URI for new XSSF Tables</action>
<action dev="poi-developers" type="add">Initial support for XSSF Charts. Provides easy access to the underlying CTChart object via the Sheet Drawing, but no high level interface onto the chart contents as yet.</action>
<action dev="poi-developers" type="fix">50884 - XSSF and HSSF freeze panes now behave the same</action>
<action dev="poi-developers" type="add">Support for adding a table to a XSSFSheet</action>
public static final XSSFRelation SINGLE_XML_CELLS = new XSSFRelation(
"application/vnd.openxmlformats-officedocument.spreadsheetml.tableSingleCells+xml",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableSingleCells",
- "/tables/tableSingleCells#.xml",
+ "/xl/tables/tableSingleCells#.xml",
SingleXmlCells.class
);
public static final XSSFRelation TABLE = new XSSFRelation(
"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",
- "/tables/table#.xml",
+ "/xl/tables/table#.xml",
Table.class
);
"/xl/calcChain.xml",
CalculationChain.class
);
+ public static final XSSFRelation PRINTER_SETTINGS = new XSSFRelation(
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.printerSettings",
+ "http://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings",
+ "/xl/printerSettings/printerSettings#.bin",
+ null
+ );
private XSSFRelation(String type, String rel, String defaultName, Class<? extends POIXMLDocumentPart> cls) {
CTTableParts tblParts = worksheet.getTableParts();
CTTablePart tbl = tblParts.addNewTablePart();
- Table table = (Table)createRelationship(XSSFRelation.TABLE, XSSFFactory.getInstance(), tblParts.sizeOfTablePartArray());
+ // Table numbers need to be unique in the file, not just
+ // unique within the sheet. Find the next one
+ int tableNumber = getPackagePart().getPackage().getPartsByContentType(XSSFRelation.TABLE.getContentType()).size() + 1;
+ Table table = (Table)createRelationship(XSSFRelation.TABLE, XSSFFactory.getInstance(), tableNumber);
tbl.setId(table.getPackageRelationship().getId());
tables.put(tbl.getId(), table);
t = s3.getTables().get(0);
assertEquals("New 3", t.getName());
assertEquals("New 3", t.getDisplayName());
+
+ // Check the relationships
+ assertEquals(0, s1.getRelations().size());
+ assertEquals(3, s2.getRelations().size());
+ assertEquals(1, s3.getRelations().size());
+ assertEquals(0, s4.getRelations().size());
+
+ assertEquals(
+ XSSFRelation.PRINTER_SETTINGS.getContentType(),
+ s2.getRelations().get(0).getPackagePart().getContentType()
+ );
+ assertEquals(
+ XSSFRelation.TABLE.getContentType(),
+ s2.getRelations().get(1).getPackagePart().getContentType()
+ );
+ assertEquals(
+ XSSFRelation.TABLE.getContentType(),
+ s2.getRelations().get(2).getPackagePart().getContentType()
+ );
+ assertEquals(
+ XSSFRelation.TABLE.getContentType(),
+ s3.getRelations().get(0).getPackagePart().getContentType()
+ );
+ assertEquals(
+ "/xl/tables/table3.xml",
+ s3.getRelations().get(0).getPackagePart().getPartName().toString()
+ );
}
/**