Пример #1
0
        protected override XElement ExportNewTOC()
        {
            List <XElement> list = new List <XElement>();

            foreach (Node item in Model.Nodes)
            {
                XElement navPoint = ConvertToXElement(item);
                if (navPoint != null)
                {
                    list.Add(navPoint);
                }
            }
            IEnumerable <XAttribute> spine = TOC.Attributes();
            XElement navMap = null;

            if (spine.Count() > 0)
            {
                navMap = new XElement(ns + "spine", spine, list);
            }
            else
            {
                //There is no spine elements
                OpfDocument doc    = new OpfDocument();
                XAttribute  TocRef = new XAttribute("toc", doc.GetNCXid());

                navMap = new XElement(ns + "spine", TocRef, list);
            }


            OnSave(new ExportTocEventArgs(navMap));

            //_NewTOC = navMap;
            return(navMap);
        }