Aspose.Words.Examples.CSharp.Programming_Documents.Bookmarks.UntangleRowBookmarks.Untangle C# (CSharp) Метод

Untangle() приватный статический Метод

private static Untangle ( Document doc ) : void
doc Document
Результат void
        private static void Untangle(Document doc)
        {
            foreach (Bookmark bookmark in doc.Range.Bookmarks)
            {
                // Get the parent row of both the bookmark and bookmark end node.
                Row row1 = (Row)bookmark.BookmarkStart.GetAncestor(typeof(Row));
                Row row2 = (Row)bookmark.BookmarkEnd.GetAncestor(typeof(Row));

                // If both rows are found okay and the bookmark start and end are contained
                // In adjacent rows, then just move the bookmark end node to the end
                // Of the last paragraph in the last cell of the top row.
                if ((row1 != null) && (row2 != null) && (row1.NextSibling == row2))
                    row1.LastCell.LastParagraph.AppendChild(bookmark.BookmarkEnd);
            }
        }