is_column property

Bookmark.is_column property

Returns True if this bookmark is a table column bookmark.

@property
def is_column(self) -> bool:
    ...

Examples

Shows how to get information about table column bookmarks.

doc = aw.Document(MY_DIR + 'Table column bookmarks.doc')
for bookmark in doc.range.bookmarks:
    # If a bookmark encloses columns of a table, it is a table column bookmark, and its "is_column" flag set to True.
    print(f"Bookmark: {bookmark.name}{(' (Column)' if bookmark.is_column else '')}")
    if bookmark.is_column:
        row = bookmark.bookmark_start.get_ancestor(aw.NodeType.ROW)
        if row is aw.tables.Row and bookmark.first_column < row.cells.count:
            # Print the contents of the first and last columns enclosed by the bookmark.
            print(row.cells[bookmark.first_column].get_text().rstrip(aw.ControlChar.CELL_CHAR))
            print(row.cells[bookmark.last_column].get_text().rstrip(aw.ControlChar.CELL_CHAR))

See Also