docx

package
v0.36.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const WordsPerPage = 500

WordsPerPage is the target word count per pseudo-page when a DOCX has no explicit page breaks. Paragraphs are accumulated until this threshold is reached, then a new pseudo-page starts. This keeps each pseudo-page's keyword corpus comparable to a PDF page.

Variables

This section is empty.

Functions

This section is empty.

Types

type PageText

type PageText struct {
	PageNum int
	Text    string
}

PageText holds the raw extracted text for a single DOCX pseudo-page.

func ExtractPages

func ExtractPages(docxPath string) ([]PageText, error)

ExtractPages opens the DOCX (ZIP) archive at docxPath, parses word/document.xml, extracts paragraph text, and groups paragraphs into pseudo-pages. Explicit page breaks (<w:br w:type="page"/>) always start a new pseudo-page; otherwise paragraphs are chunked by word count (WordsPerPage).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL