| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Xml.Linq;
-
- namespace Xceed.Words.NET
- {
- public class XE
- {
- private XNamespace _NameSpace;
-
- public XE(XNamespace ns)
- {
- _NameSpace = ns;
- }
-
- public XName CName(string eleName)
- {
- return XName.Get(eleName, _NameSpace.NamespaceName);
- }
-
- public XElement CElement(string eleName, string value, string valName = "val")
- {
- return new XElement(CName(eleName), new XAttribute(XName.Get(valName), value));
- }
-
- public XElement CElement(string eleName, params object[] eles)
- {
- return new XElement(CName(eleName), eles);
- }
-
- public XAttribute CAttr(string arr, string value)
- {
- return new XAttribute(XName.Get(arr), value);
- }
-
- public List<XAttribute> CAttrs(string attrs)
- {
- var list = new List<XAttribute>();
- var arr = attrs.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
- foreach (var item in arr)
- {
- list.Add(CAttr(item));
- }
- return list;
- }
-
- public XAttribute CAttr(string kv)
- {
- var arr = kv.Split('=');
- return CAttr(arr[0], arr[1]);
- }
-
- public readonly static XE C = new XE(DocX.c);
-
- public readonly static XE A = new XE(DocX.a);
-
- public readonly static XE N = new XE(DocX.n);
- }
- }
|