Untangle Row Bookmarks in Python

Aspose.Words - Untangle Row Bookmarks

Python Code

 # Load a document.
doc = self.Document(self.dataDir + "TestDefect1352.doc")
\# This perform the custom task of putting the row bookmark ends into the same row with the bookmark starts.
self.untangleRowBookmarks(doc)
\# Now we can easily delete rows by a bookmark without damaging any other row's bookmarks.
self.deleteRowByBookmark(doc, "ROW2")
\# This is just to check that the other bookmark was not damaged.
if doc.getRange().getBookmarks().get("ROW1").getBookmarkEnd() is None:
    raise ValueError('Wrong, the end of the bookmark was deleted.')
\# Save the finished document.
doc.save(self.dataDir + "TestDefect1352 Out.doc")

Download Running Code

Download Untangle Row Bookmarks (Aspose.Words) from any of the below mentioned social coding sites: