Example #1
0
        /// <summary>
        /// 静态方法:创建新的样式文件
        /// </summary>
        public static StyleXmlDocument CreatNewStyleDocument(StyleType type, string fileName)
        {
            StyleXmlDocument doc    = new StyleXmlDocument();
            string           strXml = @"<?xml version=""1.0"" encoding=""utf-8"" ?><root></root>";

            doc.LoadXml(strXml);
            doc.StyleType           = type;
            doc.StyleFilePath       = GetPath(type, fileName);
            doc.StyleElement.Width  = "500px";
            doc.StyleElement.Height = "400px";
            doc.Save(doc.StyleFilePath);
            return(doc);
        }
Example #2
0
        /// <summary>
        /// 静态方法:获取样式文件
        /// </summary>
        public static StyleXmlDocument GetStyleDocument(StyleType type, string fileName)
        {
            StyleXmlDocument doc  = new StyleXmlDocument();
            string           path = GetPath(type, fileName);

            if (!File.Exists(path))
            {
                return(CreatNewStyleDocument(type, fileName));
            }
            doc.Load(path);
            doc.StyleFilePath = path;
            return(doc);
        }