Search in sources :

Example 1 with CTMapInfo

use of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTMapInfo in project poi by apache.

the class TestMapInfo method testMapInfoExists.

public void testMapInfoExists() {
    XSSFWorkbook wb = XSSFTestDataSamples.openSampleWorkbook("CustomXMLMappings.xlsx");
    MapInfo mapInfo = null;
    SingleXmlCells singleXMLCells = null;
    for (POIXMLDocumentPart p : wb.getRelations()) {
        if (p instanceof MapInfo) {
            mapInfo = (MapInfo) p;
            CTMapInfo ctMapInfo = mapInfo.getCTMapInfo();
            assertNotNull(ctMapInfo);
            assertEquals(1, ctMapInfo.sizeOfSchemaArray());
            for (XSSFMap map : mapInfo.getAllXSSFMaps()) {
                Node xmlSchema = map.getSchema();
                assertNotNull(xmlSchema);
            }
        }
    }
    XSSFSheet sheet1 = wb.getSheetAt(0);
    for (POIXMLDocumentPart p : sheet1.getRelations()) {
        if (p instanceof SingleXmlCells) {
            singleXMLCells = (SingleXmlCells) p;
        }
    }
    assertNotNull(mapInfo);
    assertNotNull(singleXMLCells);
}
Also used : XSSFSheet(org.apache.poi.xssf.usermodel.XSSFSheet) POIXMLDocumentPart(org.apache.poi.POIXMLDocumentPart) CTMapInfo(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTMapInfo) XSSFMap(org.apache.poi.xssf.usermodel.XSSFMap) Node(org.w3c.dom.Node) XSSFWorkbook(org.apache.poi.xssf.usermodel.XSSFWorkbook) CTMapInfo(org.openxmlformats.schemas.spreadsheetml.x2006.main.CTMapInfo)

Aggregations

POIXMLDocumentPart (org.apache.poi.POIXMLDocumentPart)1 XSSFMap (org.apache.poi.xssf.usermodel.XSSFMap)1 XSSFSheet (org.apache.poi.xssf.usermodel.XSSFSheet)1 XSSFWorkbook (org.apache.poi.xssf.usermodel.XSSFWorkbook)1 CTMapInfo (org.openxmlformats.schemas.spreadsheetml.x2006.main.CTMapInfo)1 Node (org.w3c.dom.Node)1