示例#1
0
        public static void Compile(OdfTemplate template)
        {
            var xml = new XmlDocument();
            template.ReadMainContentXml(xml);
            var nsmanager = new OdfNamespaceManager(xml.NameTable);
            nsmanager.LoadOpenDocumentNamespaces();

            //第1遍,先处理简单的Tag 替换
            PreprocessElements(xml, nsmanager);

            //第2遍,处理表格循环
            ProcessTableRows(xml, nsmanager);

            template.WriteXmlContent(xml);
        }
        private void Init()
        {
            this.nsmanager = new OdfNamespaceManager (this.NameTable);
            this.nsmanager.LoadOpenDocumentNamespaces ();

            this.manifestElement = (XmlElement)this.SelectSingleNode (@"/manifest:manifest", nsmanager);

            if (this.manifestElement == null) {
                throw new TemplateException ("Invalid OpenDocument manifest");
            }
        }