Documentation
¶
Overview ¶
Package reader provides low-level helpers for loading DOCX archives into raw OOXML parts that can later be mapped to domain models.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReconstructDocument ¶
func ReconstructDocument(parsed *ParsedPackage) (domain.Document, error)
ReconstructDocument converts a ParsedPackage into a domain.Document. This performs a minimal hydration pass that focuses on paragraph content and spacing so consumers can round-trip spacing metadata.
Types ¶
type Package ¶
type Package struct {
// ContentTypes mirrors [Content_Types].xml.
ContentTypes *xmlstructs.ContentTypes
// RawParts keeps every part in the archive keyed by its canonical name.
RawParts map[string][]byte
// Core Word parts
MainDocument []byte
DocumentRelationships []byte
RootRelationships []byte
Styles []byte
Numbering []byte
FontTable []byte
Settings []byte
WebSettings []byte
ThemeParts map[string][]byte
CoreProperties []byte
AppProperties []byte
CustomProperties []byte
// Header/Footer content indexed by file name (e.g. "word/header1.xml").
Headers map[string][]byte
// Media assets keyed by archive path (e.g. "word/media/image1.png").
Media map[string]*MediaPart
// AdditionalParts captures any payload we do not process yet.
AdditionalParts map[string][]byte
// PackageSize is the total size of the original DOCX archive in bytes.
PackageSize int64
// contains filtered or unexported fields
}
Package represents the low-level parts that make up a DOCX archive. It focuses on raw OOXML payloads so higher layers can hydrate domain models without worrying about ZIP details.
func LoadPackage ¶
LoadPackage loads a DOCX archive from an io.ReaderAt / size pair.
func LoadPackageFromBytes ¶
LoadPackageFromBytes reads a DOCX archive from an in-memory byte slice.
func LoadPackageFromPath ¶
LoadPackageFromPath reads a DOCX archive from disk and returns its raw parts.
type ParsedPackage ¶
type ParsedPackage struct {
Package *Package
DocumentTree *Element
StylesTree *Element
HeaderTrees map[string]*Element
RootRelationships *xmlstructs.Relationships
DocumentRelationships *xmlstructs.Relationships
CorePropertiesTree *Element
AppPropertiesTree *Element
CustomProperties []byte
ThemeParts map[string][]byte
Numbering []byte
FontTable []byte
Settings []byte
WebSettings []byte
}
ParsedPackage holds strongly typed OOXML structures extracted from a Package.
func ParsePackage ¶
func ParsePackage(pkg *Package) (*ParsedPackage, error)
ParsePackage converts the raw byte-oriented Package into typed OOXML structures.