Get the next available comment ID.
(self)
| 886 | # ==================== Private: Initialization ==================== |
| 887 | |
| 888 | def _get_next_comment_id(self): |
| 889 | """Get the next available comment ID.""" |
| 890 | if not self.comments_path.exists(): |
| 891 | return 0 |
| 892 | |
| 893 | editor = self["word/comments.xml"] |
| 894 | max_id = -1 |
| 895 | for comment_elem in editor.dom.getElementsByTagName("w:comment"): |
| 896 | comment_id = comment_elem.getAttribute("w:id") |
| 897 | if comment_id: |
| 898 | try: |
| 899 | max_id = max(max_id, int(comment_id)) |
| 900 | except ValueError: |
| 901 | pass |
| 902 | return max_id + 1 |
| 903 | |
| 904 | def _load_existing_comments(self): |
| 905 | """Load existing comments from files to enable replies.""" |