Documentation
¶
Overview ¶
Package pptx contains Puppt-owned Open XML package reading, writing, relationships, and content-type handling for modern .pptx files.
Index ¶
- Constants
- func RelationshipsPartFor(partName string) string
- func ResolveTargetPart(sourcePart string, target string) string
- func Write(ctx context.Context, pkg *Package, outputPath string) error
- type ContentTypes
- type ErrorKind
- type Package
- func FromParts(ctx context.Context, parts map[string][]byte, filePath string) (*Package, error)
- func Open(ctx context.Context, filePath string) (*Package, error)
- func OpenForSlide(ctx context.Context, filePath string, slideNumber int) (*Package, error)
- func OpenReader(ctx context.Context, input io.Reader) (*Package, error)
- type PackageError
- type Relationship
Constants ¶
const ( CorePropertiesRelType = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" SlideLayoutRelType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" SlideMasterRelType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" NotesSlideRelType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide" ImageRelType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" VideoRelType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/video" AudioRelType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio" OLEObjectRelType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject" )
Variables ¶
This section is empty.
Functions ¶
func RelationshipsPartFor ¶
RelationshipsPartFor returns the package relationships item name for a part.
func ResolveTargetPart ¶
ResolveTargetPart resolves an internal relationship target relative to its source part.
Types ¶
type ContentTypes ¶
ContentTypes contains parsed package content-type declarations.
func (ContentTypes) ForPart ¶
func (c ContentTypes) ForPart(partName string) string
ForPart returns the best known content type for a package part.
type ErrorKind ¶
type ErrorKind string
ErrorKind classifies package-reader failures for CLI/API reporting.
type Package ¶
type Package struct {
Path string
Parts map[string][]byte
ContentTypes ContentTypes
RootRelationships []Relationship
PresentationPath string
PresentationRelationships []Relationship
SlideParts []string
}
Package is the initial structural view of a .pptx package.
func FromParts ¶ added in v0.3.0
FromParts validates package relationships and exposes the canonical slide order.
func Open ¶
Open reads enough of a .pptx package to validate core structure and expose presentation slide order. It does not mutate or normalize the package.
func OpenForSlide ¶
OpenForSlide reads the package structure and the parts reachable from one slide's render inheritance chain. It preserves slide order metadata but avoids inflating unrelated slide media.
func OpenReader ¶ added in v0.3.0
OpenReader reads a bounded, in-memory PPTX package without a temporary file.
func (*Package) RelationshipsForPart ¶
func (p *Package) RelationshipsForPart(partName string) ([]Relationship, error)
RelationshipsForPart returns explicit relationships for a package part. A part without a relationships item returns an empty slice.
type PackageError ¶
PackageError is an explicit, actionable error from .pptx package handling.
func (*PackageError) Error ¶
func (e *PackageError) Error() string
func (*PackageError) Unwrap ¶
func (e *PackageError) Unwrap() error