Пример #1
0
        public static OpenXmlElement SetProcessContent(this OpenXmlElement element, string qualified)
        {
            if (element is null)
            {
                throw new ArgumentNullException(nameof(element));
            }

            var mc = element.MCAttributes;

            if (mc is null)
            {
                mc = new MarkupCompatibilityAttributes();
            }

            if (mc.ProcessContent is null)
            {
                mc.ProcessContent = qualified;
            }
            else
            {
                mc.ProcessContent = string.Join(" ", new string[] { mc.ProcessContent, qualified });
            }

            element.MCAttributes = mc;
            return(element);
        }
Пример #2
0
        public static OpenXmlElement SetMustUnderstand(this OpenXmlElement element, string prefix)
        {
            if (element is null)
            {
                throw new ArgumentNullException(nameof(element));
            }

            var mc = element.MCAttributes;

            if (mc is null)
            {
                mc = new MarkupCompatibilityAttributes();
            }

            if (mc.MustUnderstand is null)
            {
                mc.MustUnderstand = prefix;
            }
            else
            {
                mc.MustUnderstand = string.Join(" ", new string[] { mc.MustUnderstand, prefix });
            }

            element.MCAttributes = mc;
            return(element);
        }
Пример #3
0
        public static OpenXmlElement SetIgnorable(this OpenXmlElement element, string prefix)
        {
            if (element == null)
            {
                throw new ArgumentNullException(nameof(element));
            }

            var mc = element.MCAttributes;

            if (mc == null)
            {
                mc = new MarkupCompatibilityAttributes();
            }

            if (mc.Ignorable == null)
            {
                mc.Ignorable = prefix;
            }
            else
            {
                mc.Ignorable = string.Join(" ", new string[] { mc.Ignorable, prefix });
            }

            element.MCAttributes = mc;
            return(element);
        }
Пример #4
0
        public static OpenXmlElement SetPreserveElements(this OpenXmlElement element, string qualified)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            var mc = element.MCAttributes;

            if (mc == null)
            {
                mc = new MarkupCompatibilityAttributes();
            }
            if (mc.PreserveElements == null)
            {
                mc.PreserveElements = qualified;
            }
            else
            {
                mc.PreserveElements = string.Join(" ", new string[] { mc.PreserveElements, qualified });
            }
            element.MCAttributes = mc;
            return(element);
        }