private static IEnumerable<BookmarkStart> GetAllBookmarks(OpenXmlPartRootElement rootElement) { var allBookmarks = rootElement.Descendants<BookmarkStart>(); if (allBookmarks == null) { throw new InvalidOperationException("There were no bookmarks found in the source document."); } return allBookmarks; }
private List<OpenXmlElement> GetDescendatsFilteredByType(OpenXmlPartRootElement rootElement) { return rootElement.Descendants().Where(x => x.IsAnyOfType<Paragraph, Table>()).ToList(); }