예제 #1
0
        internal ElementAction GetElementAction(OpenXmlElement element, FileFormatVersions format)
        {
            if (format == (FileFormatVersions.Office2010 | FileFormatVersions.Office2007) || format.All())
            {
                return(ElementAction.Normal);
            }

            if (element is AlternateContent)
            {
                return(ElementAction.ACBlock);
            }

            if (element.IsInVersion(format))
            {
                return(ElementAction.Normal);
            }

            if (IsIgnorableNs(element.NamespaceUri))
            {
                if (IsPreservedElement(element.NamespaceUri, element.LocalName))
                {
                    return(ElementAction.Normal);
                }

                if (IsProcessContent(element.NamespaceUri, element.LocalName))
                {
                    return(ElementAction.ProcessContent);
                }

                return(ElementAction.Ignore);
            }

            return(ElementAction.Normal);
        }
예제 #2
0
 public void CheckAll(FileFormatVersions version, bool expected)
 {
     Assert.Equal(expected, version.All());
 }
예제 #3
0
        internal AttributeAction GetAttributeAction(string ns, string localName, FileFormatVersions format)
        {
            if (format == (FileFormatVersions.Office2010 | FileFormatVersions.Office2007) || format.All())
            {
                return(AttributeAction.Normal);
            }

            if (string.IsNullOrEmpty(ns))
            {
                return(AttributeAction.Normal);
            }

            if (NamespaceIdMap.IsInFileFormat(ns, format))
            {
                return(AttributeAction.Normal);
            }

            if (!IsIgnorableNs(ns))
            {
                return(AttributeAction.Normal);
            }

            if (IsPreservedAttribute(ns, localName))
            {
                return(AttributeAction.Normal);
            }

            return(AttributeAction.Ignore);
        }