/// <summary> /// Check if current part is reflectable (with xml content). /// </summary> /// <param name="part">Current part</param> /// <returns>return true if it has non-null root element, otherwise rturn false.</returns> public static bool IsReflectable(this OpenXmlPart part) { if (null == part) { throw new ArgumentNullException(nameof(part)); } if (part.IsBibliographyPart() || part.IsAdditionalCharacteristicsPart() || part.IsInkPart()) { return(true); } var flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.FlattenHierarchy; var property = part.GetType().GetProperties(flag) .Where(p => p.PropertyType.IsSubclassOf(typeof(OpenXmlPartRootElement))) .FirstOrDefault(); return(null != property); }