public static BlockCollection GetBlockCollection(FrameworkContentElement elem)
        {
            if (elem == null) return null;
            var propInfo = elem.GetType().GetProperty("Blocks");
            if (propInfo == null) return null;
            if (propInfo.CanRead && propInfo.PropertyType==typeof(BlockCollection))
            {
                return propInfo.GetValue(elem, null) as BlockCollection;
            }

            if (elem is FlowDocument) return ((FlowDocument)elem).Blocks;
            if (elem is Section) return ((Section)elem).Blocks;
            if (elem is ListItem) return ((ListItem)elem).Blocks;
            if (elem is TableCell) return ((TableCell)elem).Blocks;
            return null;
        }