python-hwpx 1.2__tar.gz → 1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. python-hwpx-1.3/PKG-INFO +113 -0
  2. python-hwpx-1.3/README.md +83 -0
  3. {python-hwpx-1.2 → python-hwpx-1.3}/pyproject.toml +1 -1
  4. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/document.py +146 -1
  5. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/oxml/__init__.py +71 -1
  6. python-hwpx-1.3/src/hwpx/oxml/body.py +432 -0
  7. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/oxml/common.py +2 -0
  8. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/oxml/document.py +624 -36
  9. python-hwpx-1.3/src/hwpx/oxml/header.py +1366 -0
  10. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/oxml/parser.py +7 -0
  11. python-hwpx-1.3/src/python_hwpx.egg-info/PKG-INFO +113 -0
  12. {python-hwpx-1.2 → python-hwpx-1.3}/src/python_hwpx.egg-info/SOURCES.txt +2 -0
  13. {python-hwpx-1.2 → python-hwpx-1.3}/tests/test_document_formatting.py +99 -0
  14. python-hwpx-1.3/tests/test_inline_models.py +113 -0
  15. python-hwpx-1.3/tests/test_oxml_parsing.py +385 -0
  16. python-hwpx-1.3/tests/test_section_headers.py +143 -0
  17. python-hwpx-1.2/PKG-INFO +0 -196
  18. python-hwpx-1.2/README.md +0 -166
  19. python-hwpx-1.2/src/hwpx/oxml/body.py +0 -151
  20. python-hwpx-1.2/src/hwpx/oxml/header.py +0 -543
  21. python-hwpx-1.2/src/python_hwpx.egg-info/PKG-INFO +0 -196
  22. python-hwpx-1.2/tests/test_oxml_parsing.py +0 -159
  23. {python-hwpx-1.2 → python-hwpx-1.3}/LICENSE +0 -0
  24. {python-hwpx-1.2 → python-hwpx-1.3}/setup.cfg +0 -0
  25. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/__init__.py +0 -0
  26. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/data/Skeleton.hwpx +0 -0
  27. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/opc/package.py +0 -0
  28. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/oxml/schema.py +0 -0
  29. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/oxml/utils.py +0 -0
  30. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/package.py +0 -0
  31. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/templates.py +0 -0
  32. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/tools/__init__.py +0 -0
  33. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/tools/_schemas/header.xsd +0 -0
  34. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/tools/_schemas/section.xsd +0 -0
  35. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/tools/object_finder.py +0 -0
  36. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/tools/text_extractor.py +0 -0
  37. {python-hwpx-1.2 → python-hwpx-1.3}/src/hwpx/tools/validator.py +0 -0
  38. {python-hwpx-1.2 → python-hwpx-1.3}/src/python_hwpx.egg-info/dependency_links.txt +0 -0
  39. {python-hwpx-1.2 → python-hwpx-1.3}/src/python_hwpx.egg-info/entry_points.txt +0 -0
  40. {python-hwpx-1.2 → python-hwpx-1.3}/src/python_hwpx.egg-info/requires.txt +0 -0
  41. {python-hwpx-1.2 → python-hwpx-1.3}/src/python_hwpx.egg-info/top_level.txt +0 -0
  42. {python-hwpx-1.2 → python-hwpx-1.3}/tests/test_integration_hwpx_compatibility.py +0 -0
  43. {python-hwpx-1.2 → python-hwpx-1.3}/tests/test_memo_and_style_editing.py +0 -0
  44. {python-hwpx-1.2 → python-hwpx-1.3}/tests/test_text_extractor_annotations.py +0 -0
@@ -0,0 +1,113 @@
1
+ Metadata-Version: 2.1
2
+ Name: python-hwpx
3
+ Version: 1.3
4
+ Summary: Hancom HWPX 패키지를 로드하고 편집하기 위한 Python 유틸리티 모음
5
+ Author: python-hwpx Maintainers
6
+ License: Non-Commercial License
7
+ Project-URL: Homepage, https://github.com/airmang/python-hwpx
8
+ Project-URL: Documentation, https://github.com/airmang/python-hwpx/tree/main/docs
9
+ Project-URL: Issues, https://github.com/airmang/python-hwpx/issues
10
+ Keywords: hwp,hwpx,hancom,opc,xml
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Classifier: Topic :: Text Processing :: Markup :: XML
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: lxml<6,>=4.9
24
+ Provides-Extra: dev
25
+ Requires-Dist: build>=1.0; extra == "dev"
26
+ Requires-Dist: twine>=4.0; extra == "dev"
27
+ Requires-Dist: pytest>=7.4; extra == "dev"
28
+ Provides-Extra: test
29
+ Requires-Dist: pytest>=7.4; extra == "test"
30
+
31
+ # python-hwpx
32
+
33
+ `python-hwpx`는 Hancom HWPX 문서를 읽고, 편집하고, 자동화 스크립트로 재가공하기 위한 파이썬 도구 모음입니다. Open Packaging Convention(OPC) 컨테이너를 검사하는 저수준 도구부터 문단·표·메모를 쉽게 다루는 고수준 API, 텍스트 추출과 객체 검색 유틸리티까지 하나로 제공합니다.
34
+
35
+ ## 특징 요약
36
+
37
+ - **패키지 로딩과 검증** – `hwpx.opc.package.HwpxPackage`로 `mimetype`, `container.xml`, `version.xml`을 확인하며 모든 파트를 메모리에 적재합니다.
38
+ - **문서 편집 API** – `hwpx.document.HwpxDocument`는 문단과 표, 메모, 헤더 속성을 파이썬 객체로 노출하고 새 콘텐츠를 손쉽게 추가합니다. 섹션 머리말·꼬리말을 수정하면 `<hp:headerApply>`/`<hp:footerApply>`와 마스터 페이지 링크도 함께 갱신합니다.
39
+ - **타입이 지정된 본문 모델** – `hwpx.oxml.body`는 표·컨트롤·인라인 도형·변경 추적 태그를 데이터 클래스에 매핑하고, `HwpxOxmlParagraph.model`/`HwpxOxmlRun.model`로 이를 조회·수정한 뒤 XML로 되돌릴 수 있도록 지원합니다.
40
+ - **메모와 필드 앵커** – `add_memo_with_anchor()`로 메모를 생성하면서 MEMO 필드 컨트롤을 자동 삽입해 한/글에서 바로 표시되도록 합니다.
41
+ - **헤더 참조 목록 탐색** – 글머리표, 문단 속성, 스타일, 변경 추적 항목, 작성자 정보를 데이터클래스로 파싱하고 `document.bullets`·`document.styles` 같은 조회 헬퍼로 ID 기반 검색을 단순화했습니다.
42
+ - **스타일 기반 텍스트 치환** – 런 서식(색상, 밑줄, `charPrIDRef`)으로 필터링해 텍스트를 선택적으로 교체하거나 삭제합니다. 하이라이트
43
+ 마커나 태그로 분리된 문자열도 서식을 유지한 채 치환합니다.
44
+ - **텍스트 추출 파이프라인** – `hwpx.tools.text_extractor.TextExtractor`는 하이라이트, 각주, 컨트롤을 원하는 방식으로 표현하며 문단 텍스트를 반환합니다.
45
+ - **풍부한 문서** – 빠른 시작, 50개의 사용 패턴, 설치/FAQ/스키마 개요를 Sphinx 기반 웹 문서로 제공합니다.
46
+
47
+ ## 설치
48
+
49
+ PyPI에서 최신 버전을 바로 설치할 수 있습니다.
50
+
51
+ ```bash
52
+ python -m pip install python-hwpx
53
+ ```
54
+
55
+ 개발 버전이나 문서 빌드를 직접 수정하려면 저장소를 클론한 뒤 편집 가능한 설치를 사용하세요.
56
+
57
+ ```bash
58
+ git clone https://github.com/<your-org>/python-hwpx.git
59
+ cd python-hwpx
60
+ python -m pip install -e .[dev]
61
+ ```
62
+
63
+ Sphinx 문서는 `docs/` 아래에 있으며, `python -m pip install -r docs/requirements.txt` 후 `make -C docs html`로 로컬 미리보기가 가능합니다.
64
+
65
+ ## 5분 안에 맛보기
66
+
67
+ ```python
68
+ from io import BytesIO
69
+
70
+ from hwpx.document import HwpxDocument
71
+ from hwpx.templates import blank_document_bytes
72
+
73
+ # 1) 빈 템플릿으로 문서 열기
74
+ source = BytesIO(blank_document_bytes())
75
+ document = HwpxDocument.open(source)
76
+ print("sections:", len(document.sections))
77
+
78
+ # 2) 문단과 표, 메모 추가
79
+ section = document.sections[0]
80
+ paragraph = document.add_paragraph("자동 생성한 문단", section=section)
81
+ table = document.add_table(rows=2, cols=2, section=section)
82
+ table.set_cell_text(0, 0, "항목")
83
+ table.set_cell_text(0, 1, "값")
84
+ table.set_cell_text(1, 0, "문단 수")
85
+ table.set_cell_text(1, 1, str(len(document.paragraphs)))
86
+ document.add_memo_with_anchor("배포 전 검토", paragraph=paragraph, memo_shape_id_ref="0")
87
+
88
+ # 3) 다른 이름으로 저장
89
+ document.save("output/example.hwpx")
90
+ ```
91
+
92
+ 더 많은 실전 패턴은 [빠른 시작](docs/quickstart.md)과 [사용 가이드](docs/usage.md)의 "빠른 예제 모음"에서 확인할 수 있습니다.
93
+
94
+ ## 문서
95
+ [사용법](https://airmang.github.io/python-hwpx/)
96
+
97
+ ## 예제와 도구
98
+
99
+ - `examples/` 디렉터리는 텍스트 추출, 객체 검색, QA 체크리스트 생성 예제를 제공합니다. PyPI 패키지에는 포함되지 않으므로 필요하면 저장소를 클론하거나 웹 문서의 코드 스니펫을 활용하세요.
100
+ - `hwpx.templates.blank_document_bytes()`는 추가 리소스 없이 빈 HWPX 문서를 만들 수 있는 내장 템플릿을 제공합니다.
101
+
102
+ ## 알려진 제약
103
+
104
+ - `add_shape()`/`add_control()`은 한/글이 요구하는 모든 하위 요소를 생성하지 않으므로, 복잡한 개체를 추가할 때는 편집기에서 열어 검증해 주세요.
105
+
106
+ ## 기여하기
107
+
108
+ 버그 리포트와 개선 제안은 언제나 환영합니다. 개발 환경 설정과 테스트 방법은 [CONTRIBUTING.md](CONTRIBUTING.md)를 참고하세요.
109
+
110
+ ## 라이선스와 연락처
111
+
112
+ - 라이선스: [LICENSE](LICENSE)
113
+ - 문의: 이슈 트래커 또는 kokyuhyun@hotmail.com
@@ -0,0 +1,83 @@
1
+ # python-hwpx
2
+
3
+ `python-hwpx`는 Hancom HWPX 문서를 읽고, 편집하고, 자동화 스크립트로 재가공하기 위한 파이썬 도구 모음입니다. Open Packaging Convention(OPC) 컨테이너를 검사하는 저수준 도구부터 문단·표·메모를 쉽게 다루는 고수준 API, 텍스트 추출과 객체 검색 유틸리티까지 하나로 제공합니다.
4
+
5
+ ## 특징 요약
6
+
7
+ - **패키지 로딩과 검증** – `hwpx.opc.package.HwpxPackage`로 `mimetype`, `container.xml`, `version.xml`을 확인하며 모든 파트를 메모리에 적재합니다.
8
+ - **문서 편집 API** – `hwpx.document.HwpxDocument`는 문단과 표, 메모, 헤더 속성을 파이썬 객체로 노출하고 새 콘텐츠를 손쉽게 추가합니다. 섹션 머리말·꼬리말을 수정하면 `<hp:headerApply>`/`<hp:footerApply>`와 마스터 페이지 링크도 함께 갱신합니다.
9
+ - **타입이 지정된 본문 모델** – `hwpx.oxml.body`는 표·컨트롤·인라인 도형·변경 추적 태그를 데이터 클래스에 매핑하고, `HwpxOxmlParagraph.model`/`HwpxOxmlRun.model`로 이를 조회·수정한 뒤 XML로 되돌릴 수 있도록 지원합니다.
10
+ - **메모와 필드 앵커** – `add_memo_with_anchor()`로 메모를 생성하면서 MEMO 필드 컨트롤을 자동 삽입해 한/글에서 바로 표시되도록 합니다.
11
+ - **헤더 참조 목록 탐색** – 글머리표, 문단 속성, 스타일, 변경 추적 항목, 작성자 정보를 데이터클래스로 파싱하고 `document.bullets`·`document.styles` 같은 조회 헬퍼로 ID 기반 검색을 단순화했습니다.
12
+ - **스타일 기반 텍스트 치환** – 런 서식(색상, 밑줄, `charPrIDRef`)으로 필터링해 텍스트를 선택적으로 교체하거나 삭제합니다. 하이라이트
13
+ 마커나 태그로 분리된 문자열도 서식을 유지한 채 치환합니다.
14
+ - **텍스트 추출 파이프라인** – `hwpx.tools.text_extractor.TextExtractor`는 하이라이트, 각주, 컨트롤을 원하는 방식으로 표현하며 문단 텍스트를 반환합니다.
15
+ - **풍부한 문서** – 빠른 시작, 50개의 사용 패턴, 설치/FAQ/스키마 개요를 Sphinx 기반 웹 문서로 제공합니다.
16
+
17
+ ## 설치
18
+
19
+ PyPI에서 최신 버전을 바로 설치할 수 있습니다.
20
+
21
+ ```bash
22
+ python -m pip install python-hwpx
23
+ ```
24
+
25
+ 개발 버전이나 문서 빌드를 직접 수정하려면 저장소를 클론한 뒤 편집 가능한 설치를 사용하세요.
26
+
27
+ ```bash
28
+ git clone https://github.com/<your-org>/python-hwpx.git
29
+ cd python-hwpx
30
+ python -m pip install -e .[dev]
31
+ ```
32
+
33
+ Sphinx 문서는 `docs/` 아래에 있으며, `python -m pip install -r docs/requirements.txt` 후 `make -C docs html`로 로컬 미리보기가 가능합니다.
34
+
35
+ ## 5분 안에 맛보기
36
+
37
+ ```python
38
+ from io import BytesIO
39
+
40
+ from hwpx.document import HwpxDocument
41
+ from hwpx.templates import blank_document_bytes
42
+
43
+ # 1) 빈 템플릿으로 문서 열기
44
+ source = BytesIO(blank_document_bytes())
45
+ document = HwpxDocument.open(source)
46
+ print("sections:", len(document.sections))
47
+
48
+ # 2) 문단과 표, 메모 추가
49
+ section = document.sections[0]
50
+ paragraph = document.add_paragraph("자동 생성한 문단", section=section)
51
+ table = document.add_table(rows=2, cols=2, section=section)
52
+ table.set_cell_text(0, 0, "항목")
53
+ table.set_cell_text(0, 1, "값")
54
+ table.set_cell_text(1, 0, "문단 수")
55
+ table.set_cell_text(1, 1, str(len(document.paragraphs)))
56
+ document.add_memo_with_anchor("배포 전 검토", paragraph=paragraph, memo_shape_id_ref="0")
57
+
58
+ # 3) 다른 이름으로 저장
59
+ document.save("output/example.hwpx")
60
+ ```
61
+
62
+ 더 많은 실전 패턴은 [빠른 시작](docs/quickstart.md)과 [사용 가이드](docs/usage.md)의 "빠른 예제 모음"에서 확인할 수 있습니다.
63
+
64
+ ## 문서
65
+ [사용법](https://airmang.github.io/python-hwpx/)
66
+
67
+ ## 예제와 도구
68
+
69
+ - `examples/` 디렉터리는 텍스트 추출, 객체 검색, QA 체크리스트 생성 예제를 제공합니다. PyPI 패키지에는 포함되지 않으므로 필요하면 저장소를 클론하거나 웹 문서의 코드 스니펫을 활용하세요.
70
+ - `hwpx.templates.blank_document_bytes()`는 추가 리소스 없이 빈 HWPX 문서를 만들 수 있는 내장 템플릿을 제공합니다.
71
+
72
+ ## 알려진 제약
73
+
74
+ - `add_shape()`/`add_control()`은 한/글이 요구하는 모든 하위 요소를 생성하지 않으므로, 복잡한 개체를 추가할 때는 편집기에서 열어 검증해 주세요.
75
+
76
+ ## 기여하기
77
+
78
+ 버그 리포트와 개선 제안은 언제나 환영합니다. 개발 환경 설정과 테스트 방법은 [CONTRIBUTING.md](CONTRIBUTING.md)를 참고하세요.
79
+
80
+ ## 라이선스와 연락처
81
+
82
+ - 라이선스: [LICENSE](LICENSE)
83
+ - 문의: 이슈 트래커 또는 kokyuhyun@hotmail.com
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python-hwpx"
7
- version = "1.2"
7
+ version = "1.3"
8
8
  description = "Hancom HWPX 패키지를 로드하고 편집하기 위한 Python 유틸리티 모음"
9
9
  readme = { file = "README.md", content-type = "text/markdown" }
10
10
  license = { text = "Non-Commercial License" }
@@ -10,6 +10,7 @@ from os import PathLike
10
10
  from typing import BinaryIO, Iterator, List, Tuple
11
11
 
12
12
  from .oxml import (
13
+ Bullet,
13
14
  HwpxOxmlDocument,
14
15
  HwpxOxmlHeader,
15
16
  HwpxOxmlInlineObject,
@@ -17,9 +18,14 @@ from .oxml import (
17
18
  HwpxOxmlParagraph,
18
19
  HwpxOxmlRun,
19
20
  HwpxOxmlSection,
21
+ HwpxOxmlSectionHeaderFooter,
20
22
  HwpxOxmlTable,
21
23
  MemoShape,
24
+ ParagraphProperty,
22
25
  RunStyle,
26
+ Style,
27
+ TrackChange,
28
+ TrackChangeAuthor,
23
29
  )
24
30
  from .package import HwpxPackage
25
31
  from .templates import blank_document_bytes
@@ -94,6 +100,65 @@ class HwpxDocument:
94
100
 
95
101
  return self._root.memo_shape(memo_shape_id_ref)
96
102
 
103
+ @property
104
+ def bullets(self) -> dict[str, Bullet]:
105
+ """Return bullet definitions declared in header reference lists."""
106
+
107
+ return self._root.bullets
108
+
109
+ def bullet(self, bullet_id_ref: int | str | None) -> Bullet | None:
110
+ """Return the bullet definition referenced by *bullet_id_ref*."""
111
+
112
+ return self._root.bullet(bullet_id_ref)
113
+
114
+ @property
115
+ def paragraph_properties(self) -> dict[str, ParagraphProperty]:
116
+ """Return paragraph property definitions declared in headers."""
117
+
118
+ return self._root.paragraph_properties
119
+
120
+ def paragraph_property(
121
+ self, para_pr_id_ref: int | str | None
122
+ ) -> ParagraphProperty | None:
123
+ """Return the paragraph property referenced by *para_pr_id_ref*."""
124
+
125
+ return self._root.paragraph_property(para_pr_id_ref)
126
+
127
+ @property
128
+ def styles(self) -> dict[str, Style]:
129
+ """Return style definitions available in the document."""
130
+
131
+ return self._root.styles
132
+
133
+ def style(self, style_id_ref: int | str | None) -> Style | None:
134
+ """Return the style definition referenced by *style_id_ref*."""
135
+
136
+ return self._root.style(style_id_ref)
137
+
138
+ @property
139
+ def track_changes(self) -> dict[str, TrackChange]:
140
+ """Return tracked change metadata declared in the headers."""
141
+
142
+ return self._root.track_changes
143
+
144
+ def track_change(self, change_id_ref: int | str | None) -> TrackChange | None:
145
+ """Return tracked change metadata referenced by *change_id_ref*."""
146
+
147
+ return self._root.track_change(change_id_ref)
148
+
149
+ @property
150
+ def track_change_authors(self) -> dict[str, TrackChangeAuthor]:
151
+ """Return tracked change author metadata declared in the headers."""
152
+
153
+ return self._root.track_change_authors
154
+
155
+ def track_change_author(
156
+ self, author_id_ref: int | str | None
157
+ ) -> TrackChangeAuthor | None:
158
+ """Return tracked change author details referenced by *author_id_ref*."""
159
+
160
+ return self._root.track_change_author(author_id_ref)
161
+
97
162
  @property
98
163
  def memos(self) -> List[HwpxOxmlMemo]:
99
164
  """Return all memo entries declared in every section."""
@@ -389,11 +454,17 @@ class HwpxDocument:
389
454
  remaining = limit - replacements
390
455
  if remaining <= 0:
391
456
  break
392
- replacements += run.replace_text(
457
+ original_char_pr = run.char_pr_id_ref
458
+ replaced_here = run.replace_text(
393
459
  search,
394
460
  replacement,
395
461
  count=remaining,
396
462
  )
463
+ if replaced_here and original_char_pr is not None:
464
+ # Ensure the run retains its original formatting reference even
465
+ # if XML nodes were rewritten during substitution.
466
+ run.char_pr_id_ref = original_char_pr
467
+ replacements += replaced_here
397
468
  if limit is not None and replacements >= limit:
398
469
  break
399
470
  return replacements
@@ -533,6 +604,80 @@ class HwpxDocument:
533
604
  char_pr_id_ref=char_pr_id_ref,
534
605
  )
535
606
 
607
+ def set_header_text(
608
+ self,
609
+ text: str,
610
+ *,
611
+ section: HwpxOxmlSection | None = None,
612
+ section_index: int | None = None,
613
+ page_type: str = "BOTH",
614
+ ) -> HwpxOxmlSectionHeaderFooter:
615
+ """Ensure the requested section contains a header for *page_type* and set its text."""
616
+
617
+ target_section = section
618
+ if target_section is None and section_index is not None:
619
+ target_section = self._root.sections[section_index]
620
+ if target_section is None:
621
+ if not self._root.sections:
622
+ raise ValueError("document does not contain any sections")
623
+ target_section = self._root.sections[-1]
624
+ return target_section.properties.set_header_text(text, page_type=page_type)
625
+
626
+ def set_footer_text(
627
+ self,
628
+ text: str,
629
+ *,
630
+ section: HwpxOxmlSection | None = None,
631
+ section_index: int | None = None,
632
+ page_type: str = "BOTH",
633
+ ) -> HwpxOxmlSectionHeaderFooter:
634
+ """Ensure the requested section contains a footer for *page_type* and set its text."""
635
+
636
+ target_section = section
637
+ if target_section is None and section_index is not None:
638
+ target_section = self._root.sections[section_index]
639
+ if target_section is None:
640
+ if not self._root.sections:
641
+ raise ValueError("document does not contain any sections")
642
+ target_section = self._root.sections[-1]
643
+ return target_section.properties.set_footer_text(text, page_type=page_type)
644
+
645
+ def remove_header(
646
+ self,
647
+ *,
648
+ section: HwpxOxmlSection | None = None,
649
+ section_index: int | None = None,
650
+ page_type: str = "BOTH",
651
+ ) -> None:
652
+ """Remove the header linked to *page_type* from the requested section if present."""
653
+
654
+ target_section = section
655
+ if target_section is None and section_index is not None:
656
+ target_section = self._root.sections[section_index]
657
+ if target_section is None:
658
+ if not self._root.sections:
659
+ return
660
+ target_section = self._root.sections[-1]
661
+ target_section.properties.remove_header(page_type=page_type)
662
+
663
+ def remove_footer(
664
+ self,
665
+ *,
666
+ section: HwpxOxmlSection | None = None,
667
+ section_index: int | None = None,
668
+ page_type: str = "BOTH",
669
+ ) -> None:
670
+ """Remove the footer linked to *page_type* from the requested section if present."""
671
+
672
+ target_section = section
673
+ if target_section is None and section_index is not None:
674
+ target_section = self._root.sections[section_index]
675
+ if target_section is None:
676
+ if not self._root.sections:
677
+ return
678
+ target_section = self._root.sections[-1]
679
+ target_section.properties.remove_footer(page_type=page_type)
680
+
536
681
  def save(
537
682
  self,
538
683
  path_or_stream: str | PathLike[str] | BinaryIO | None = None,
@@ -39,6 +39,9 @@ from .document import (
39
39
  from .header import (
40
40
  BeginNum,
41
41
  BorderFillList,
42
+ Bullet,
43
+ BulletList,
44
+ BulletParaHead,
42
45
  CharProperty,
43
46
  CharPropertyList,
44
47
  DocOption,
@@ -56,16 +59,48 @@ from .header import (
56
59
  MemoProperties,
57
60
  MemoShape,
58
61
  NumberingList,
62
+ ParagraphAlignment,
63
+ ParagraphAutoSpacing,
64
+ ParagraphBreakSetting,
65
+ ParagraphBorder,
66
+ ParagraphHeading,
67
+ ParagraphLineSpacing,
68
+ ParagraphMargin,
69
+ ParagraphProperty,
70
+ ParagraphPropertyList,
59
71
  RefList,
72
+ Style,
73
+ StyleList,
60
74
  TabProperties,
75
+ TrackChange,
76
+ TrackChangeAuthor,
77
+ TrackChangeAuthorList,
61
78
  TrackChangeConfig,
79
+ TrackChangeList,
62
80
  memo_shape_from_attributes,
63
81
  parse_begin_num,
82
+ parse_bullet,
83
+ parse_bullet_para_head,
84
+ parse_bullets,
64
85
  parse_doc_option,
65
86
  parse_header_element,
66
87
  parse_memo_properties,
67
88
  parse_memo_shape,
89
+ parse_paragraph_alignment,
90
+ parse_paragraph_auto_spacing,
91
+ parse_paragraph_border,
92
+ parse_paragraph_break_setting,
93
+ parse_paragraph_line_spacing,
94
+ parse_paragraph_margin,
95
+ parse_paragraph_property,
96
+ parse_paragraph_properties,
68
97
  parse_ref_list,
98
+ parse_style,
99
+ parse_styles,
100
+ parse_track_change,
101
+ parse_track_change_author,
102
+ parse_track_change_authors,
103
+ parse_track_changes,
69
104
  )
70
105
  from .parser import element_to_model, parse_header_xml, parse_section_xml
71
106
  from .schema import load_schema
@@ -74,6 +109,9 @@ from .utils import XmlSource
74
109
  __all__ = [
75
110
  "BeginNum",
76
111
  "BorderFillList",
112
+ "Bullet",
113
+ "BulletList",
114
+ "BulletParaHead",
77
115
  "CharProperty",
78
116
  "CharPropertyList",
79
117
  "DocOption",
@@ -106,6 +144,15 @@ __all__ = [
106
144
  "MemoProperties",
107
145
  "MemoShape",
108
146
  "NumberingList",
147
+ "ParagraphAlignment",
148
+ "ParagraphAutoSpacing",
149
+ "ParagraphBreakSetting",
150
+ "ParagraphBorder",
151
+ "ParagraphHeading",
152
+ "ParagraphLineSpacing",
153
+ "ParagraphMargin",
154
+ "ParagraphProperty",
155
+ "ParagraphPropertyList",
109
156
  "Paragraph",
110
157
  "PageMargins",
111
158
  "PageSize",
@@ -115,22 +162,45 @@ __all__ = [
115
162
  "Run",
116
163
  "Section",
117
164
  "SectionStartNumbering",
165
+ "Style",
166
+ "StyleList",
118
167
  "TabProperties",
119
- "TextSpan",
168
+ "TrackChange",
169
+ "TrackChangeAuthor",
170
+ "TrackChangeAuthorList",
120
171
  "TrackChangeConfig",
172
+ "TrackChangeList",
173
+ "TextSpan",
121
174
  "XmlSource",
122
175
  "element_to_model",
123
176
  "load_schema",
124
177
  "parse_begin_num",
178
+ "parse_bullet",
179
+ "parse_bullet_para_head",
180
+ "parse_bullets",
125
181
  "parse_doc_option",
126
182
  "parse_generic_element",
127
183
  "parse_header_element",
128
184
  "parse_memo_properties",
129
185
  "parse_memo_shape",
186
+ "parse_paragraph_alignment",
187
+ "parse_paragraph_auto_spacing",
188
+ "parse_paragraph_border",
189
+ "parse_paragraph_break_setting",
190
+ "parse_paragraph_line_spacing",
191
+ "parse_paragraph_margin",
192
+ "parse_paragraph_property",
193
+ "parse_paragraph_properties",
130
194
  "parse_header_xml",
131
195
  "parse_paragraph_element",
132
196
  "parse_ref_list",
133
197
  "parse_run_element",
198
+ "parse_style",
199
+ "parse_styles",
200
+ "parse_track_change",
201
+ "parse_track_change_author",
202
+ "parse_track_change_authors",
203
+ "parse_track_changes",
134
204
  "parse_section_element",
135
205
  "parse_section_xml",
136
206
  "parse_text_span",