python-hwpx 2.8.2__tar.gz → 2.9.0__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.
- {python_hwpx-2.8.2/src/python_hwpx.egg-info → python_hwpx-2.9.0}/PKG-INFO +21 -39
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/README.md +18 -4
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/pyproject.toml +5 -4
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/__init__.py +5 -1
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/document.py +32 -1
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/tools/__init__.py +24 -0
- python_hwpx-2.9.0/src/hwpx/tools/table_navigation.py +457 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0/src/python_hwpx.egg-info}/PKG-INFO +21 -39
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/python_hwpx.egg-info/SOURCES.txt +3 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/python_hwpx.egg-info/requires.txt +1 -0
- python_hwpx-2.9.0/tests/test_packaging_license_metadata.py +63 -0
- python_hwpx-2.9.0/tests/test_table_navigation.py +183 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/LICENSE +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/setup.cfg +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/data/Skeleton.hwpx +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/opc/package.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/opc/relationships.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/opc/xml_utils.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/oxml/__init__.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/oxml/body.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/oxml/common.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/oxml/document.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/oxml/header.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/oxml/header_part.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/oxml/memo.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/oxml/namespaces.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/oxml/paragraph.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/oxml/parser.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/oxml/schema.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/oxml/section.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/oxml/table.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/oxml/utils.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/package.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/py.typed +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/templates.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/tools/_schemas/header.xsd +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/tools/_schemas/section.xsd +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/tools/archive_cli.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/tools/exporter.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/tools/object_finder.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/tools/package_validator.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/tools/page_guard.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/tools/template_analyzer.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/tools/text_extract_cli.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/tools/text_extractor.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/hwpx/tools/validator.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/python_hwpx.egg-info/dependency_links.txt +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/python_hwpx.egg-info/entry_points.txt +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/src/python_hwpx.egg-info/top_level.txt +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_coverage_targets.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_document_context_manager.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_document_formatting.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_document_save_api.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_gap_closure_tools.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_inline_models.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_integration_hwpx_compatibility.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_integration_roundtrip.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_memo_and_style_editing.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_new_features.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_opc_package.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_oxml_parsing.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_packaging_py_typed.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_paragraph_section_management.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_repr_snapshots.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_section_headers.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_split_merged_cell.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_tables_default_border.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_text_extractor_annotations.py +0 -0
- {python_hwpx-2.8.2 → python_hwpx-2.9.0}/tests/test_version_metadata.py +0 -0
|
@@ -1,48 +1,15 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-hwpx
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.9.0
|
|
4
4
|
Summary: Hancom HWPX 패키지를 로드하고 편집하기 위한 Python 유틸리티 모음
|
|
5
5
|
Author: python-hwpx Maintainers
|
|
6
|
-
License:
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2024 python-hwpx Maintainers
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to use,
|
|
12
|
-
copy, modify, merge, publish, distribute, and sublicense the Software only for
|
|
13
|
-
non-commercial purposes, subject to the following conditions:
|
|
14
|
-
|
|
15
|
-
1. Non-Commercial Use Only. The Software may be used, copied, modified,
|
|
16
|
-
merged, published, distributed, and sublicensed only for non-commercial
|
|
17
|
-
purposes. "Non-Commercial" means use that is not primarily intended for or
|
|
18
|
-
directed toward commercial advantage, monetary compensation, or any form of
|
|
19
|
-
direct or indirect commercial exploitation.
|
|
20
|
-
|
|
21
|
-
2. Attribution. The above copyright notice and this permission notice shall be
|
|
22
|
-
included in all copies or substantial portions of the Software.
|
|
23
|
-
|
|
24
|
-
3. No Warranty of Commercial Support. The maintainers are not obligated to
|
|
25
|
-
provide commercial support, maintenance, or updates.
|
|
26
|
-
|
|
27
|
-
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
-
FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
30
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
31
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
|
-
SOFTWARE.
|
|
34
|
-
|
|
35
|
-
If you require permissions to use this Software for commercial purposes,
|
|
36
|
-
please contact the copyright holders to negotiate an alternative licensing
|
|
37
|
-
arrangement.
|
|
38
|
-
|
|
6
|
+
License-Expression: LicenseRef-python-hwpx-NonCommercial
|
|
39
7
|
Project-URL: Homepage, https://github.com/airmang/python-hwpx
|
|
40
8
|
Project-URL: Documentation, https://github.com/airmang/python-hwpx/tree/main/docs
|
|
41
9
|
Project-URL: Issues, https://github.com/airmang/python-hwpx/issues
|
|
42
10
|
Keywords: hwp,hwpx,hancom,opc,xml
|
|
43
11
|
Classifier: Development Status :: 3 - Alpha
|
|
44
12
|
Classifier: Intended Audience :: Developers
|
|
45
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
46
13
|
Classifier: Programming Language :: Python :: 3
|
|
47
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
48
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -58,6 +25,7 @@ Requires-Dist: build>=1.0; extra == "dev"
|
|
|
58
25
|
Requires-Dist: twine>=4.0; extra == "dev"
|
|
59
26
|
Requires-Dist: pytest>=7.4; extra == "dev"
|
|
60
27
|
Provides-Extra: test
|
|
28
|
+
Requires-Dist: build>=1.0; extra == "test"
|
|
61
29
|
Requires-Dist: pytest>=7.4; extra == "test"
|
|
62
30
|
Requires-Dist: pytest-cov>=5.0; extra == "test"
|
|
63
31
|
Provides-Extra: typecheck
|
|
@@ -73,7 +41,7 @@ Dynamic: license-file
|
|
|
73
41
|
<p align="center">
|
|
74
42
|
<a href="https://pypi.org/project/python-hwpx/"><img src="https://img.shields.io/pypi/v/python-hwpx?color=blue&label=PyPI" alt="PyPI"></a>
|
|
75
43
|
<a href="https://pypi.org/project/python-hwpx/"><img src="https://img.shields.io/pypi/pyversions/python-hwpx" alt="Python"></a>
|
|
76
|
-
<a href="https://github.com/airmang/python-hwpx/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-
|
|
44
|
+
<a href="https://github.com/airmang/python-hwpx/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Custom%20Noncommercial-orange" alt="License: Custom Non-Commercial"></a>
|
|
77
45
|
<a href="https://airmang.github.io/python-hwpx/"><img src="https://img.shields.io/badge/docs-Sphinx-8CA1AF" alt="Docs"></a>
|
|
78
46
|
</p>
|
|
79
47
|
</p>
|
|
@@ -153,6 +121,7 @@ doc.save_to_path("결과물.hwpx")
|
|
|
153
121
|
| 📝 **단락** | 추가/삭제/편집/서식 | 텍스트 설정, 단락 삭제(`remove_paragraph`), 스타일 참조 |
|
|
154
122
|
| ✏️ **Run** | 텍스트 조각 | 추가, 교체, 볼드/이탤릭/밑줄/색상 서식 |
|
|
155
123
|
| 📊 **표(Table)** | 생성/편집/병합 | N×M 표 생성, 셀 텍스트, 셀 병합/분할, 중첩 테이블 |
|
|
124
|
+
| 🧭 **표 자동화** | 탐색/채우기 | 테이블 맵, 라벨 기반 셀 탐색, 경로 기반 배치 채우기 |
|
|
156
125
|
| 📑 **섹션** | 추가/삭제 | `add_section(after=)`, `remove_section()`, manifest 자동 관리 |
|
|
157
126
|
| 🖼️ **이미지** | 임베드/삭제 | 바이너리 데이터 관리, manifest 자동 등록 |
|
|
158
127
|
| ✏️ **도형** | 선/사각형/타원 | OWPML 명세 준수 도형 삽입 |
|
|
@@ -193,6 +162,17 @@ doc.set_footer_text("1 / 10", page_type="BOTH")
|
|
|
193
162
|
# 표 셀 병합·분할
|
|
194
163
|
table.merge_cells(0, 0, 1, 1) # (0,0)~(1,1) 병합
|
|
195
164
|
table.set_cell_text(0, 0, "병합된 셀", logical=True, split_merged=True)
|
|
165
|
+
|
|
166
|
+
# 양식형 표 자동 채우기
|
|
167
|
+
form = doc.add_table(2, 2)
|
|
168
|
+
form.cell(0, 0).text = "성명:"
|
|
169
|
+
form.cell(1, 0).text = "소속"
|
|
170
|
+
|
|
171
|
+
doc.find_cell_by_label("성명") # {"matches": [...], "count": 1}
|
|
172
|
+
doc.fill_by_path({
|
|
173
|
+
"성명 > right": "홍길동",
|
|
174
|
+
"소속 > right": "플랫폼팀",
|
|
175
|
+
})
|
|
196
176
|
```
|
|
197
177
|
|
|
198
178
|
### 🔍 텍스트 추출 & 검색
|
|
@@ -353,13 +333,15 @@ pytest
|
|
|
353
333
|
|
|
354
334
|
## License
|
|
355
335
|
|
|
356
|
-
[
|
|
336
|
+
[Custom Non-Commercial License](LICENSE) © python-hwpx Maintainers
|
|
337
|
+
|
|
338
|
+
Commercial use requires separate permission from the copyright holders.
|
|
357
339
|
|
|
358
340
|
<br>
|
|
359
341
|
|
|
360
|
-
##
|
|
342
|
+
## Maintainer
|
|
361
343
|
|
|
362
|
-
**고규현** — 광교고등학교 정보·컴퓨터 교사
|
|
344
|
+
Primary maintainer/contact: **고규현** — 광교고등학교 정보·컴퓨터 교사
|
|
363
345
|
|
|
364
346
|
- ✉️ [kokyuhyun@hotmail.com](mailto:kokyuhyun@hotmail.com)
|
|
365
347
|
- 🐙 [@airmang](https://github.com/airmang)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<p align="center">
|
|
7
7
|
<a href="https://pypi.org/project/python-hwpx/"><img src="https://img.shields.io/pypi/v/python-hwpx?color=blue&label=PyPI" alt="PyPI"></a>
|
|
8
8
|
<a href="https://pypi.org/project/python-hwpx/"><img src="https://img.shields.io/pypi/pyversions/python-hwpx" alt="Python"></a>
|
|
9
|
-
<a href="https://github.com/airmang/python-hwpx/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-
|
|
9
|
+
<a href="https://github.com/airmang/python-hwpx/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Custom%20Noncommercial-orange" alt="License: Custom Non-Commercial"></a>
|
|
10
10
|
<a href="https://airmang.github.io/python-hwpx/"><img src="https://img.shields.io/badge/docs-Sphinx-8CA1AF" alt="Docs"></a>
|
|
11
11
|
</p>
|
|
12
12
|
</p>
|
|
@@ -86,6 +86,7 @@ doc.save_to_path("결과물.hwpx")
|
|
|
86
86
|
| 📝 **단락** | 추가/삭제/편집/서식 | 텍스트 설정, 단락 삭제(`remove_paragraph`), 스타일 참조 |
|
|
87
87
|
| ✏️ **Run** | 텍스트 조각 | 추가, 교체, 볼드/이탤릭/밑줄/색상 서식 |
|
|
88
88
|
| 📊 **표(Table)** | 생성/편집/병합 | N×M 표 생성, 셀 텍스트, 셀 병합/분할, 중첩 테이블 |
|
|
89
|
+
| 🧭 **표 자동화** | 탐색/채우기 | 테이블 맵, 라벨 기반 셀 탐색, 경로 기반 배치 채우기 |
|
|
89
90
|
| 📑 **섹션** | 추가/삭제 | `add_section(after=)`, `remove_section()`, manifest 자동 관리 |
|
|
90
91
|
| 🖼️ **이미지** | 임베드/삭제 | 바이너리 데이터 관리, manifest 자동 등록 |
|
|
91
92
|
| ✏️ **도형** | 선/사각형/타원 | OWPML 명세 준수 도형 삽입 |
|
|
@@ -126,6 +127,17 @@ doc.set_footer_text("1 / 10", page_type="BOTH")
|
|
|
126
127
|
# 표 셀 병합·분할
|
|
127
128
|
table.merge_cells(0, 0, 1, 1) # (0,0)~(1,1) 병합
|
|
128
129
|
table.set_cell_text(0, 0, "병합된 셀", logical=True, split_merged=True)
|
|
130
|
+
|
|
131
|
+
# 양식형 표 자동 채우기
|
|
132
|
+
form = doc.add_table(2, 2)
|
|
133
|
+
form.cell(0, 0).text = "성명:"
|
|
134
|
+
form.cell(1, 0).text = "소속"
|
|
135
|
+
|
|
136
|
+
doc.find_cell_by_label("성명") # {"matches": [...], "count": 1}
|
|
137
|
+
doc.fill_by_path({
|
|
138
|
+
"성명 > right": "홍길동",
|
|
139
|
+
"소속 > right": "플랫폼팀",
|
|
140
|
+
})
|
|
129
141
|
```
|
|
130
142
|
|
|
131
143
|
### 🔍 텍스트 추출 & 검색
|
|
@@ -286,13 +298,15 @@ pytest
|
|
|
286
298
|
|
|
287
299
|
## License
|
|
288
300
|
|
|
289
|
-
[
|
|
301
|
+
[Custom Non-Commercial License](LICENSE) © python-hwpx Maintainers
|
|
302
|
+
|
|
303
|
+
Commercial use requires separate permission from the copyright holders.
|
|
290
304
|
|
|
291
305
|
<br>
|
|
292
306
|
|
|
293
|
-
##
|
|
307
|
+
## Maintainer
|
|
294
308
|
|
|
295
|
-
**고규현** — 광교고등학교 정보·컴퓨터 교사
|
|
309
|
+
Primary maintainer/contact: **고규현** — 광교고등학교 정보·컴퓨터 교사
|
|
296
310
|
|
|
297
311
|
- ✉️ [kokyuhyun@hotmail.com](mailto:kokyuhyun@hotmail.com)
|
|
298
312
|
- 🐙 [@airmang](https://github.com/airmang)
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools", "wheel"]
|
|
2
|
+
requires = ["setuptools>=77.0.0", "wheel"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "python-hwpx"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.9.0"
|
|
8
8
|
description = "Hancom HWPX 패키지를 로드하고 편집하기 위한 Python 유틸리티 모음"
|
|
9
9
|
readme = { file = "README.md", content-type = "text/markdown" }
|
|
10
|
-
license =
|
|
10
|
+
license = "LicenseRef-python-hwpx-NonCommercial"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
11
12
|
requires-python = ">=3.10"
|
|
12
13
|
authors = [
|
|
13
14
|
{ name = "python-hwpx Maintainers" },
|
|
@@ -16,7 +17,6 @@ keywords = ["hwp", "hwpx", "hancom", "opc", "xml"]
|
|
|
16
17
|
classifiers = [
|
|
17
18
|
"Development Status :: 3 - Alpha",
|
|
18
19
|
"Intended Audience :: Developers",
|
|
19
|
-
"License :: OSI Approved :: MIT License",
|
|
20
20
|
"Programming Language :: Python :: 3",
|
|
21
21
|
"Programming Language :: Python :: 3.10",
|
|
22
22
|
"Programming Language :: Python :: 3.11",
|
|
@@ -35,6 +35,7 @@ dev = [
|
|
|
35
35
|
"pytest>=7.4",
|
|
36
36
|
]
|
|
37
37
|
test = [
|
|
38
|
+
"build>=1.0",
|
|
38
39
|
"pytest>=7.4",
|
|
39
40
|
"pytest-cov>=5.0",
|
|
40
41
|
]
|
|
@@ -10,8 +10,12 @@ def _resolve_version() -> str:
|
|
|
10
10
|
except PackageNotFoundError:
|
|
11
11
|
return "0+unknown"
|
|
12
12
|
|
|
13
|
+
def __getattr__(name: str) -> object:
|
|
14
|
+
"""Resolve dynamic module attributes."""
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
if name == "__version__":
|
|
17
|
+
return _resolve_version()
|
|
18
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
15
19
|
|
|
16
20
|
from .tools.text_extractor import (
|
|
17
21
|
DEFAULT_NAMESPACES,
|
|
@@ -10,7 +10,7 @@ import logging
|
|
|
10
10
|
import uuid
|
|
11
11
|
|
|
12
12
|
from os import PathLike
|
|
13
|
-
from typing import Any, BinaryIO, Iterator, Sequence, overload
|
|
13
|
+
from typing import TYPE_CHECKING, Any, BinaryIO, Iterator, Mapping, Sequence, overload
|
|
14
14
|
|
|
15
15
|
from lxml import etree
|
|
16
16
|
|
|
@@ -53,6 +53,9 @@ _HH = f"{{{_HH_NS}}}"
|
|
|
53
53
|
|
|
54
54
|
logger = logging.getLogger(__name__)
|
|
55
55
|
|
|
56
|
+
if TYPE_CHECKING:
|
|
57
|
+
from .tools.table_navigation import TableFillResult, TableLabelSearchResult, TableMapResult
|
|
58
|
+
|
|
56
59
|
|
|
57
60
|
def _append_element(
|
|
58
61
|
parent: Any,
|
|
@@ -741,6 +744,34 @@ class HwpxDocument:
|
|
|
741
744
|
char_pr_id_ref=char_pr_id_ref,
|
|
742
745
|
)
|
|
743
746
|
|
|
747
|
+
def get_table_map(self) -> TableMapResult:
|
|
748
|
+
"""Return compact metadata for every table in document order."""
|
|
749
|
+
|
|
750
|
+
from .tools.table_navigation import get_table_map
|
|
751
|
+
|
|
752
|
+
return get_table_map(self)
|
|
753
|
+
|
|
754
|
+
def find_cell_by_label(
|
|
755
|
+
self,
|
|
756
|
+
label_text: str,
|
|
757
|
+
direction: str = "right",
|
|
758
|
+
) -> TableLabelSearchResult:
|
|
759
|
+
"""Return every label/target cell pair that matches *label_text*."""
|
|
760
|
+
|
|
761
|
+
from .tools.table_navigation import find_cell_by_label
|
|
762
|
+
|
|
763
|
+
return find_cell_by_label(self, label_text, direction=direction)
|
|
764
|
+
|
|
765
|
+
def fill_by_path(
|
|
766
|
+
self,
|
|
767
|
+
mappings: Mapping[str, str],
|
|
768
|
+
) -> TableFillResult:
|
|
769
|
+
"""Fill table cells using ``label > direction > ...`` navigation paths."""
|
|
770
|
+
|
|
771
|
+
from .tools.table_navigation import fill_by_path
|
|
772
|
+
|
|
773
|
+
return fill_by_path(self, mappings)
|
|
774
|
+
|
|
744
775
|
def add_shape(
|
|
745
776
|
self,
|
|
746
777
|
shape_type: str,
|
|
@@ -25,6 +25,19 @@ from .text_extractor import (
|
|
|
25
25
|
describe_element_path,
|
|
26
26
|
strip_namespace,
|
|
27
27
|
)
|
|
28
|
+
from .table_navigation import (
|
|
29
|
+
TableCellReference,
|
|
30
|
+
TableFillApplied,
|
|
31
|
+
TableFillFailed,
|
|
32
|
+
TableFillResult,
|
|
33
|
+
TableLabelMatch,
|
|
34
|
+
TableLabelSearchResult,
|
|
35
|
+
TableMapEntry,
|
|
36
|
+
TableMapResult,
|
|
37
|
+
fill_by_path,
|
|
38
|
+
find_cell_by_label,
|
|
39
|
+
get_table_map,
|
|
40
|
+
)
|
|
28
41
|
from .validator import (
|
|
29
42
|
DocumentSchemas,
|
|
30
43
|
ValidationIssue,
|
|
@@ -41,6 +54,17 @@ __all__ = [
|
|
|
41
54
|
"build_parent_map",
|
|
42
55
|
"describe_element_path",
|
|
43
56
|
"strip_namespace",
|
|
57
|
+
"TableCellReference",
|
|
58
|
+
"TableFillApplied",
|
|
59
|
+
"TableFillFailed",
|
|
60
|
+
"TableFillResult",
|
|
61
|
+
"TableLabelMatch",
|
|
62
|
+
"TableLabelSearchResult",
|
|
63
|
+
"TableMapEntry",
|
|
64
|
+
"TableMapResult",
|
|
65
|
+
"fill_by_path",
|
|
66
|
+
"find_cell_by_label",
|
|
67
|
+
"get_table_map",
|
|
44
68
|
"FoundElement",
|
|
45
69
|
"ObjectFinder",
|
|
46
70
|
"PackageValidationIssue",
|