DocxDocument
classin packageklyn.io.docx
public class DocxDocument implements AutoClosable
DocxDocument
All Implemented Interfaces: AutoClosable

Reads an OpenXML Word document (.docx) using Klyn's native ZIP archiver and XML DOM parser.

Extracts document elements including headings, body paragraphs, bullet lists, and tables, formatting them into clean Markdown text or structured paragraph and table objects. Implements AutoClosable to automatically release staging files upon exit.

Example
import klyn.io.docx

try document = DocxDocument("report.docx"):
    print(document.getText())
Properties
Modifier and Type Member Description
public readonly property blockCount
blockCount as Int
Returns the total number of structural blocks (paragraphs and tables) in the document.
public readonly property blocks
blocks as IList<String>
Returns the list of structural Markdown text blocks extracted from the document.
public readonly property closed
closed as Boolean
Indicates whether the document has been closed and its staging files cleaned up.
public readonly property paragraphs
paragraphs as IList<DocxParagraph>
Returns the structured paragraphs extracted from the document.
public readonly property tables
tables as IList<DocxTable>
Returns the structured tables extracted from the document.
Constructors
Modifier and Type Member Description
public DocxDocument
DocxDocument(filename as String)
Opens a Word document (.docx) from a filename string.
public DocxDocument Opens a Word document (.docx) from a Path object.
Methods
Modifier and Type Member Description
public override close
close() as Void
Closes the document and removes temporary uncompressed OpenXML files.
public getText
getText(startBlock as Int = 1, maxBlocks as Int = 0) as String throws DocxException, IOException
Extracts and returns document text formatted in Markdown, optionally bounded to a range of paragraphs or blocks.
Inherited Methods
methodInherited Methods from AutoClosable: close