---
Product: Aspose.Words
Platform: python
Page Type: reference
Canonical URL: https://reference.aspose.org/words/python/bookmarkstate
---

# BookmarkState

## Overview

`BookmarkState` is a class in Aspose.Words FOSS for Python.

Hands out monotonically increasing bookmark ids and pairs

    starts/ends across paragraphs.

This class declares 5 methods for BookmarkState objects in Python programs.
Available methods include: `__init__`, `close`, `drain_open`, `next_id`, `open`.
Public members are accessible to any Python application after installing the Aspose.Words FOSS for Python package.

## Methods

| Signature | Description |
|-----------|-------------|
| `__init__()` | Calls __init__ on this BookmarkState instance. |
| `next_id()` → `int` | ` returns a monotonically increasing integer used as a bookmark identifier |
| `open(name: str)` → `int` | Calls open(name) on this BookmarkState instance. |
| `close(name: str)` → `int \| None` | Return the id paired with ``name``'s open marker, or None when no start is currently open under that name. |
| `drain_open()` → `list[tuple[str, int]]` | Return the currently-open ``(name, id)`` pairs and clear them. |

## See Also

- [Aspose.Words for Python — Enterprise API Reference](https://reference.aspose.com/words/python-net/)