Exemplo n.º 1
0
        /**
         * @return the list of Single Xml Cells that provide a map rule to this mapping.
         */
        public List <XSSFSingleXmlCell> GetRelatedSingleXMLCell()
        {
            List <XSSFSingleXmlCell> relatedSimpleXmlCells = new List <XSSFSingleXmlCell>();

            int sheetNumber = mapInfo.Workbook.NumberOfSheets;

            for (int i = 0; i < sheetNumber; i++)
            {
                XSSFSheet sheet = (XSSFSheet)mapInfo.Workbook.GetSheetAt(i);
                foreach (POIXMLDocumentPart p in sheet.GetRelations())
                {
                    if (p is SingleXmlCells)
                    {
                        SingleXmlCells SingleXMLCells = (SingleXmlCells)p;
                        foreach (XSSFSingleXmlCell cell in SingleXMLCells.GetAllSimpleXmlCell())
                        {
                            if (cell.GetMapId() == ctMap.ID)
                            {
                                relatedSimpleXmlCells.Add(cell);
                            }
                        }
                    }
                }
            }
            return(relatedSimpleXmlCells);
        }
Exemplo n.º 2
0
        public void TestMapInfoExists()
        {
            XSSFWorkbook wb = XSSFTestDataSamples.OpenSampleWorkbook("CustomXMLMappings.xlsx");

            MapInfo        mapInfo        = null;
            SingleXmlCells SingleXMLCells = null;

            foreach (POIXMLDocumentPart p in wb.GetRelations())
            {
                if (p is MapInfo)
                {
                    mapInfo = (MapInfo)p;


                    CT_MapInfo ctMapInfo = mapInfo.GetCTMapInfo();

                    Assert.IsNotNull(ctMapInfo);

                    Assert.AreEqual(1, ctMapInfo.Schema.Count);

                    foreach (XSSFMap map in mapInfo.GetAllXSSFMaps())
                    {
                        string xmlSchema = map.GetSchema();
                        Assert.IsNotNull(xmlSchema);
                    }
                }
            }

            XSSFSheet sheet1 = (XSSFSheet)wb.GetSheetAt(0);

            foreach (POIXMLDocumentPart p in sheet1.GetRelations())
            {
                if (p is SingleXmlCells)
                {
                    SingleXMLCells = (SingleXmlCells)p;
                }
            }
            Assert.IsNotNull(mapInfo);
            Assert.IsNotNull(SingleXMLCells);
        }
Exemplo n.º 3
0
 public XSSFSingleXmlCell(CT_SingleXmlCell SingleXmlCell, SingleXmlCells parent)
 {
     this.SingleXmlCell = SingleXmlCell;
     this.parent        = parent;
 }