hwpapi
================
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
This file will become your README and also the index of your
documentation.
## Install
``` sh
pip install hwpapi
```
## How to use
Fill me in please! Don’t forget code examples:
## 왜 hwpapi를 만들었나요?
가장 큰 이유는 스스로 사용하기 위해서 입니다. 직장인으로 많은 한글
문서를 편집하고 작성하곤 하는데 단순 반복업무가 너무 많다는 것이
불만이었습니다. 이런 문제를 해결하는 방법으로 한글 자동화에 대한
이야기를 파이콘에서 보게 되었습니다. 특히 ‘회사원 코딩’ 님의 블로그와
영상이 많은 참조가 되었습니다.
다만 그 과정에서 설명자료가 부족하기도 하고 예전에 작성했던 코드들을
자꾸 찾아보게 되면서 아래아 한글 용 파이썬 패키지가 있으면 좋겠다는
생각을 했습니다. 특히 업무를 하면서 엑셀 자동화를 위해 xlwings를 사용해
보면서 파이썬으로 사용하기 쉽게 만든 라이브러리가 코딩 작업 효율을 엄청
올린다는 것을 깨닫게 되었습니다.
제출 마감까지 해야 할 일들을 빠르게 하기 위해서 빠르게 한글 자동화가
된다면 좋겠다는 생각으로 만들게 되었습니다.
기본적인 철학은 xlwings을 따라하고 있습니다. 기본적으로는 자주 쓰이는
항목들을 사용하기 쉽게 정리한 메소드 등으로 구현하고, 부족한 부분은
`App.api`형태로 `win32com`으로 하는 것과 동일한 작업이 가능하게 하여
한글 api의 모든 기능을 사용할 수 있도록 구현하였습니다.
메소드로 만드는 것에는 아직 고민이 있습니다. chain과 같은 형태로
여러가지 콤비네이션을 사전에 세팅을 해야 하나 싶은 부분도 있고 실제로
유용하게 사용할 수 있는 여러가지 아이템 등도 있어서 어떤 부분까지 이
패키지에 구현할지는 고민하고 있습니다.
다만 이런 형태의 작업을 통해서 어쩌면 hwp api wrapper가 활성화 되어서
단순 작업을 자동화 할 수 있기를 바라고 있습니다.
## 기존 코드와 연동성 비교하기
[회사원 코딩](https://employeecoding.tistory.com/72)에 가보시면 아래와
같이 자동화 코드가 있습니다.
``` python
import win32com.client as win32
hwp = win32.gencache.EnsureDispatch("HWPFrame.HwpObject")
hwp.XHwpWindows.Item(0).Visible = True
act = hwp.CreateAction("InsertText")
pset = act.CreateSet()
pset.SetItem("Text", "Hello\r\nWorld!")
act.Execute(pset)
```
이 코드는 기본적으로 verbose라고 볼 만한 상황입니다. 이 코드를
`HwpApi`를 사용하면 아래와 같이 간결하게 정리가 됨을 볼 수 있습니다.
``` python
from hwpapi.core import App
app = App()
action = app.actions.InsertText()
p = action.pset
p.Text = "Hello\r\nWorld!"
action.run()
```
True
Raw data
{
"_id": null,
"home_page": "https://github.com/JunDamin/hwpapi",
"name": "hwpapi",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "nbdev jupyter notebook python",
"author": "JunDamin",
"author_email": "freedomgod@gmail.com",
"download_url": "",
"platform": null,
"description": "hwpapi\r\n================\r\n\r\n<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\r\n\r\nThis file will become your README and also the index of your\r\ndocumentation.\r\n\r\n## Install\r\n\r\n``` sh\r\npip install hwpapi\r\n```\r\n\r\n## How to use\r\n\r\nFill me in please! Don\u2019t forget code examples:\r\n\r\n## \uc65c hwpapi\ub97c \ub9cc\ub4e4\uc5c8\ub098\uc694?\r\n\r\n\uac00\uc7a5 \ud070 \uc774\uc720\ub294 \uc2a4\uc2a4\ub85c \uc0ac\uc6a9\ud558\uae30 \uc704\ud574\uc11c \uc785\ub2c8\ub2e4. \uc9c1\uc7a5\uc778\uc73c\ub85c \ub9ce\uc740 \ud55c\uae00\r\n\ubb38\uc11c\ub97c \ud3b8\uc9d1\ud558\uace0 \uc791\uc131\ud558\uace4 \ud558\ub294\ub370 \ub2e8\uc21c \ubc18\ubcf5\uc5c5\ubb34\uac00 \ub108\ubb34 \ub9ce\ub2e4\ub294 \uac83\uc774\r\n\ubd88\ub9cc\uc774\uc5c8\uc2b5\ub2c8\ub2e4. \uc774\ub7f0 \ubb38\uc81c\ub97c \ud574\uacb0\ud558\ub294 \ubc29\ubc95\uc73c\ub85c \ud55c\uae00 \uc790\ub3d9\ud654\uc5d0 \ub300\ud55c\r\n\uc774\uc57c\uae30\ub97c \ud30c\uc774\ucf58\uc5d0\uc11c \ubcf4\uac8c \ub418\uc5c8\uc2b5\ub2c8\ub2e4. \ud2b9\ud788 \u2018\ud68c\uc0ac\uc6d0 \ucf54\ub529\u2019 \ub2d8\uc758 \ube14\ub85c\uadf8\uc640\r\n\uc601\uc0c1\uc774 \ub9ce\uc740 \ucc38\uc870\uac00 \ub418\uc5c8\uc2b5\ub2c8\ub2e4.\r\n\r\n\ub2e4\ub9cc \uadf8 \uacfc\uc815\uc5d0\uc11c \uc124\uba85\uc790\ub8cc\uac00 \ubd80\uc871\ud558\uae30\ub3c4 \ud558\uace0 \uc608\uc804\uc5d0 \uc791\uc131\ud588\ub358 \ucf54\ub4dc\ub4e4\uc744\r\n\uc790\uafb8 \ucc3e\uc544\ubcf4\uac8c \ub418\uba74\uc11c \uc544\ub798\uc544 \ud55c\uae00 \uc6a9 \ud30c\uc774\uc36c \ud328\ud0a4\uc9c0\uac00 \uc788\uc73c\uba74 \uc88b\uaca0\ub2e4\ub294\r\n\uc0dd\uac01\uc744 \ud588\uc2b5\ub2c8\ub2e4. \ud2b9\ud788 \uc5c5\ubb34\ub97c \ud558\uba74\uc11c \uc5d1\uc140 \uc790\ub3d9\ud654\ub97c \uc704\ud574 xlwings\ub97c \uc0ac\uc6a9\ud574\r\n\ubcf4\uba74\uc11c \ud30c\uc774\uc36c\uc73c\ub85c \uc0ac\uc6a9\ud558\uae30 \uc27d\uac8c \ub9cc\ub4e0 \ub77c\uc774\ube0c\ub7ec\ub9ac\uac00 \ucf54\ub529 \uc791\uc5c5 \ud6a8\uc728\uc744 \uc5c4\uccad\r\n\uc62c\ub9b0\ub2e4\ub294 \uac83\uc744 \uae68\ub2eb\uac8c \ub418\uc5c8\uc2b5\ub2c8\ub2e4.\r\n\r\n\uc81c\ucd9c \ub9c8\uac10\uae4c\uc9c0 \ud574\uc57c \ud560 \uc77c\ub4e4\uc744 \ube60\ub974\uac8c \ud558\uae30 \uc704\ud574\uc11c \ube60\ub974\uac8c \ud55c\uae00 \uc790\ub3d9\ud654\uac00\r\n\ub41c\ub2e4\uba74 \uc88b\uaca0\ub2e4\ub294 \uc0dd\uac01\uc73c\ub85c \ub9cc\ub4e4\uac8c \ub418\uc5c8\uc2b5\ub2c8\ub2e4.\r\n\r\n\uae30\ubcf8\uc801\uc778 \ucca0\ud559\uc740 xlwings\uc744 \ub530\ub77c\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4. \uae30\ubcf8\uc801\uc73c\ub85c\ub294 \uc790\uc8fc \uc4f0\uc774\ub294\r\n\ud56d\ubaa9\ub4e4\uc744 \uc0ac\uc6a9\ud558\uae30 \uc27d\uac8c \uc815\ub9ac\ud55c \uba54\uc18c\ub4dc \ub4f1\uc73c\ub85c \uad6c\ud604\ud558\uace0, \ubd80\uc871\ud55c \ubd80\ubd84\uc740\r\n`App.api`\ud615\ud0dc\ub85c `win32com`\uc73c\ub85c \ud558\ub294 \uac83\uacfc \ub3d9\uc77c\ud55c \uc791\uc5c5\uc774 \uac00\ub2a5\ud558\uac8c \ud558\uc5ec\r\n\ud55c\uae00 api\uc758 \ubaa8\ub4e0 \uae30\ub2a5\uc744 \uc0ac\uc6a9\ud560 \uc218 \uc788\ub3c4\ub85d \uad6c\ud604\ud558\uc600\uc2b5\ub2c8\ub2e4.\r\n\r\n\uba54\uc18c\ub4dc\ub85c \ub9cc\ub4dc\ub294 \uac83\uc5d0\ub294 \uc544\uc9c1 \uace0\ubbfc\uc774 \uc788\uc2b5\ub2c8\ub2e4. chain\uacfc \uac19\uc740 \ud615\ud0dc\ub85c\r\n\uc5ec\ub7ec\uac00\uc9c0 \ucf64\ube44\ub124\uc774\uc158\uc744 \uc0ac\uc804\uc5d0 \uc138\ud305\uc744 \ud574\uc57c \ud558\ub098 \uc2f6\uc740 \ubd80\ubd84\ub3c4 \uc788\uace0 \uc2e4\uc81c\ub85c\r\n\uc720\uc6a9\ud558\uac8c \uc0ac\uc6a9\ud560 \uc218 \uc788\ub294 \uc5ec\ub7ec\uac00\uc9c0 \uc544\uc774\ud15c \ub4f1\ub3c4 \uc788\uc5b4\uc11c \uc5b4\ub5a4 \ubd80\ubd84\uae4c\uc9c0 \uc774\r\n\ud328\ud0a4\uc9c0\uc5d0 \uad6c\ud604\ud560\uc9c0\ub294 \uace0\ubbfc\ud558\uace0 \uc788\uc2b5\ub2c8\ub2e4.\r\n\r\n\ub2e4\ub9cc \uc774\ub7f0 \ud615\ud0dc\uc758 \uc791\uc5c5\uc744 \ud1b5\ud574\uc11c \uc5b4\uca4c\uba74 hwp api wrapper\uac00 \ud65c\uc131\ud654 \ub418\uc5b4\uc11c\r\n\ub2e8\uc21c \uc791\uc5c5\uc744 \uc790\ub3d9\ud654 \ud560 \uc218 \uc788\uae30\ub97c \ubc14\ub77c\uace0 \uc788\uc2b5\ub2c8\ub2e4.\r\n\r\n## \uae30\uc874 \ucf54\ub4dc\uc640 \uc5f0\ub3d9\uc131 \ube44\uad50\ud558\uae30\r\n\r\n[\ud68c\uc0ac\uc6d0 \ucf54\ub529](https://employeecoding.tistory.com/72)\uc5d0 \uac00\ubcf4\uc2dc\uba74 \uc544\ub798\uc640\r\n\uac19\uc774 \uc790\ub3d9\ud654 \ucf54\ub4dc\uac00 \uc788\uc2b5\ub2c8\ub2e4.\r\n\r\n``` python\r\nimport win32com.client as win32\r\nhwp = win32.gencache.EnsureDispatch(\"HWPFrame.HwpObject\")\r\nhwp.XHwpWindows.Item(0).Visible = True\r\n\r\nact = hwp.CreateAction(\"InsertText\")\r\npset = act.CreateSet()\r\npset.SetItem(\"Text\", \"Hello\\r\\nWorld!\")\r\nact.Execute(pset)\r\n```\r\n\r\n\uc774 \ucf54\ub4dc\ub294 \uae30\ubcf8\uc801\uc73c\ub85c verbose\ub77c\uace0 \ubcfc \ub9cc\ud55c \uc0c1\ud669\uc785\ub2c8\ub2e4. \uc774 \ucf54\ub4dc\ub97c\r\n`HwpApi`\ub97c \uc0ac\uc6a9\ud558\uba74 \uc544\ub798\uc640 \uac19\uc774 \uac04\uacb0\ud558\uac8c \uc815\ub9ac\uac00 \ub428\uc744 \ubcfc \uc218 \uc788\uc2b5\ub2c8\ub2e4.\r\n\r\n``` python\r\nfrom hwpapi.core import App\r\n\r\napp = App()\r\naction = app.actions.InsertText()\r\np = action.pset\r\np.Text = \"Hello\\r\\nWorld!\"\r\naction.run()\r\n```\r\n\r\n True\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "python wrapper for HWPFrame.HwpObject using win32com",
"version": "0.0.2",
"project_urls": {
"Homepage": "https://github.com/JunDamin/hwpapi"
},
"split_keywords": [
"nbdev",
"jupyter",
"notebook",
"python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "68feb615edd1456a3dfaea789301d3d75b70f6b5f79146191ddb6b2f4c86ee1f",
"md5": "51752a3d9e0fbdc01e8d9b012bca7125",
"sha256": "ce1a8225150350799c1d14b7c508d8c75ea38db273b229007906793f90b49f3c"
},
"downloads": -1,
"filename": "hwpapi-0.0.2-py3-none-win_amd64.whl",
"has_sig": false,
"md5_digest": "51752a3d9e0fbdc01e8d9b012bca7125",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 125043,
"upload_time": "2023-07-19T08:21:19",
"upload_time_iso_8601": "2023-07-19T08:21:19.327066Z",
"url": "https://files.pythonhosted.org/packages/68/fe/b615edd1456a3dfaea789301d3d75b70f6b5f79146191ddb6b2f4c86ee1f/hwpapi-0.0.2-py3-none-win_amd64.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-19 08:21:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "JunDamin",
"github_project": "hwpapi",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "hwpapi"
}