docx

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package docx is an Extractor for Word .docx files. A .docx is a zip of OOXML parts; the document text lives in word/document.xml as <w:t> runs grouped in <w:p> paragraphs. This extractor reads only that part, concatenating run text and turning paragraph boundaries into newlines — no dependency beyond stdlib. Formatting, tables, headers/footers, and footnotes are not preserved.

Index

Constants

View Source
const ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"

ContentType is the OOXML WordprocessingML media type for .docx files.

Variables

This section is empty.

Functions

This section is empty.

Types

type Extractor

type Extractor struct{}

Extractor extracts plain text from .docx content. Its zero value is ready.

func New

func New() Extractor

New returns a docx Extractor.

func (Extractor) Extract

func (e Extractor) Extract(contentType string, raw []byte) (string, error)

Extract returns the document's text, with paragraphs separated by "\n".

func (Extractor) Supports

func (Extractor) Supports(contentType string) bool

Supports reports whether the content type is a .docx document.

Jump to

Keyboard shortcuts

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