pyhwpx: Python HWP Automation Module

1.7.2 · active · verified Thu Apr 16

pyhwpx is a Python module designed for automating Hancom HWP (Hangul Word Processor) documents. It leverages the `pywin32` package to interact with the HWP Automation API, providing a more intuitive and Pythonic interface compared to direct `win32com` usage. The library supports various document manipulation tasks such as text insertion, saving, and editing, and aims to add more shortcut methods for common HWP automation patterns. It is actively developed, with a current version of 1.7.2, and requires Python 3.9+ on a Windows operating system with Hancom HWP installed.

Common errors

Warnings

Install

Imports

Quickstart

Initializes an HWP automation object, inserts text, saves the document, and then closes HWP. Ensure Hancom HWP is installed on your Windows machine.

from pyhwpx import Hwp

# Connects to the most recently active HWP window.
# If HWP is not running, it launches a new instance.
hwp = Hwp()

# Insert text into the document
hwp.insert_text("Hello world from pyhwpx!")

# Save the document
hwp.save_as("./helloworld.hwp")

# Quit HWP
hwp.Quit()

view raw JSON →