Introduction
HWP is the document format of Hangul, the word processor from Hancom, which is the standard word processor in South Korea and is widely used by its government, schools and businesses. Hancom has published the specification of the current binary format, HWP 5.0.
Newer versions of Hangul also save HWPX, an XML-based format in a ZIP package, with
the extension .hwpx.
Structure
An HWP 5.0 file is a compound file, which starts with the signature
D0 CF 11 E0 A1 B1 1A E1 and holds named streams. The
FileHeader stream begins with the text HWP Document File and
gives the version and flags, such as whether the document is compressed or protected
by a password. DocInfo holds the fonts, styles and other shared settings,
and the BodyText storage holds one stream per section,
Section0, Section1 and so on. The streams are made of tagged
records and are usually compressed with Deflate.
The streams, header and records page gives the data types, the FileHeader, the record header and every record tag; DocInfo records the fonts, borders and fills, character and paragraph shapes, tabs, numbering, bullets and styles; paragraphs and controls the paragraph records, the control characters in the text and the control and field IDs; sections, notes and other controls the section and column definitions, page setup, headers, footers, notes, numbering and fields; tables, pictures and drawings every object and shape record; charts the chart objects and their constants; and other streams and distribution documents the summary, previews, scripts, history and the encryption of distribution documents. All follow Hancom’s published specifications. A few records are named there without a layout (memos, tracked changes, text art, forms), and password encryption is not published; the pages say where. HWPX is not covered.
cfbFileHeader signature, version and flags256 bytescfbDocInfo fonts, styles and shared settingsstreamcfbBodyText/Section0 … one stream per sectionstreamscfbBinData/ pictures and embedded filesoptionalcfbPrvText, PrvImage text and image previewsstreams
Not described
These pages follow Hancom’s own HWP 5.0 specification and its documents for distribution files and charts. The explorer has no HWP viewer, so a dropped file shows as bytes.
Known, not yet covered
- Reference: the equation script language: Hancom publishes a document for it that was not read.
- Reference: HWPX, the XML form of HWP (KS X 6101), has no page; no public text of it was read.
- Viewer: there is no HWP plugin: the compound file, streams, records and text are not read.
Unknown
- Reference: the layouts of the MEMO, track-change, form, text-art and chart-data records,
PARA_HEADERbit 31, the range-tag kinds, picture-effect flag bits and the layouts of the DocOptions streams, which Hancom’s specification does not give. - Reference: password, certificate and DRM encryption; Hancom publishes no document for them.
- Reference: the chart property byte encoding, storage order and type IDs.
- Reference: sizes and orders where the specification contradicts itself or pyhwp, such as
CHAR_SHAPEat 72 or 74 bytes; the pages note each case.
Links
Software
- Hancom Office Hangul – Hancom’s word processor, which makes the format (Windows, macOS, mobile)
Developers
- pyhwp – tools that read HWP 5.0 and convert it to other formats (Python)
Reference
- Hangul document file format 5.0, revision 1.3 – Hancom’s specification of HWP 5.0 (PDF, in Korean)
- Distribution documents, revision 1.2 – Hancom’s specification of how distribution documents are encrypted (PDF, in Korean)
- Charts, revision 1.2 – Hancom’s specification of the chart objects stored in HWP files (PDF, in Korean)
- Equations, revision 1.3 – Hancom’s specification of the equation script (PDF, in Korean)