presentation

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SlideScreenSize16x9 = SlideScreenSize{12192000, 6858000}
	SlideScreenSize4x3  = SlideScreenSize{9144000, 6858000}
	SlideScreenSizeA4   = SlideScreenSize{9906000, 6858000}
)

Functions

This section is empty.

Types

type Image

type Image struct {
	// contains filtered or unexported fields
}

Image is an image within a slide.

func (Image) Properties

func (_bdc Image) Properties() _dea.ShapeProperties

Properties returns the properties of the TextBox.

type PlaceHolder

type PlaceHolder struct {
	// contains filtered or unexported fields
}

PlaceHolder is a place holder from a slide.

func (PlaceHolder) AddParagraph

func (_bfa PlaceHolder) AddParagraph() _dea.Paragraph

AddParagraph adds a new paragraph to a placeholder.

func (PlaceHolder) AddTable

func (_bfb PlaceHolder) AddTable() *_ae.Table

AddTable adds a new table to a placeholder.

func (PlaceHolder) Clear

func (_cfg PlaceHolder) Clear()

Clear clears the placeholder contents and adds a single empty paragraph. The empty paragrah is required by PowerPoint or it will report the file as being invalid.

func (PlaceHolder) ClearAll

func (_fgd PlaceHolder) ClearAll()

ClearAll completely clears a placeholder. To be useable, at least one paragraph must be added after ClearAll via AddParagraph.

func (PlaceHolder) Index

func (_dcg PlaceHolder) Index() uint32

Index returns the placeholder index

func (PlaceHolder) Paragraphs

func (_bg PlaceHolder) Paragraphs() []_dea.Paragraph

Paragraphs returns the paragraphs defined in the placeholder.

func (PlaceHolder) Remove

func (_cgcf PlaceHolder) Remove() error

Remove removes a placeholder from a presentation.

func (PlaceHolder) SetText

func (_fff PlaceHolder) SetText(text string)

SetText sets the text of a placeholder for the initial paragraph. This is a shortcut method that is useful for things like titles which only contain a single paragraph.

func (PlaceHolder) Type

func (_eb PlaceHolder) Type() _gf.ST_PlaceholderType

Type returns the placeholder type

func (PlaceHolder) X

func (_dagb PlaceHolder) X() *_gf.CT_Shape

X returns the inner wrapped XML type.

type Presentation

type Presentation struct {
	_ae.DocBase
	// contains filtered or unexported fields
}

Presentation is the a presentation base document.

func New

func New() *Presentation

New initializes and returns a new presentation

func Open

func Open(filename string) (*Presentation, error)

Open opens and reads a document from a file (.pptx).

func OpenTemplate

func OpenTemplate(fn string) (*Presentation, error)

OpenTemplate opens a template file.

func Read

func Read(r _ff.ReaderAt, size int64) (*Presentation, error)

Read reads a document from an io.Reader.

func (*Presentation) AddDefaultSlideWithLayout

func (_cee *Presentation) AddDefaultSlideWithLayout(l SlideLayout) (Slide, error)

AddDefaultSlideWithLayout tries to replicate what PowerPoint does when inserting a slide with a new style by clearing placeholder content and removing some placeholders. Use AddSlideWithLayout if you need more control.

func (*Presentation) AddImage

func (_dafde *Presentation) AddImage(i _ae.Image) (_ae.ImageRef, error)

AddImage adds an image to the document package, returning a reference that can be used to add the image to a run and place it in the document contents.

func (*Presentation) AddSlide

func (_caed *Presentation) AddSlide() Slide

AddSlide adds a new slide to the presentation.

func (*Presentation) AddSlideWithLayout

func (_ecf *Presentation) AddSlideWithLayout(l SlideLayout) (Slide, error)

AddSlideWithLayout adds a new slide with content copied from a layout. Normally you should use AddDefaultSlideWithLayout as it will do some post processing similar to PowerPoint to clear place holder text, etc.

func (*Presentation) Charts

func (_aafg *Presentation) Charts() []_b.ChartSpace

Charts return the array of presentation charts.

func (*Presentation) Close

func (_deff *Presentation) Close() error

Close closes the presentation, removing any temporary files that might have been created when opening a document.

func (*Presentation) CopySlide

func (_cedb *Presentation) CopySlide(s Slide) (Slide, error)

CopySlide copies existing slide from another presentation and inserts it as a last one.

func (*Presentation) ExtractText

func (_aaf *Presentation) ExtractText() *PresentationText

ExtractText returns text from a presentation as a PresentationText object.

func (*Presentation) GetColorBySchemeColor

func (_dcca *Presentation) GetColorBySchemeColor(schClr _gbg.ST_SchemeColorVal) *_gbg.CT_Color

GetColorBySchemeColor returns *dml.CT_Color mapped to scheme colors like dk1, lt1 etc. depending on what theme is used in the presentation.

func (*Presentation) GetImageByRelID

func (_ecee *Presentation) GetImageByRelID(relID string) (_ae.ImageRef, bool)

GetImageByRelID returns an ImageRef with the associated relation ID in the document.

func (*Presentation) GetImageByTarget

func (_beda *Presentation) GetImageByTarget(target string) (_ae.ImageRef, bool)

GetImageByTarget returns an ImageRef with the given target in the document.

func (*Presentation) GetLayoutByName

func (_eca *Presentation) GetLayoutByName(name string) (SlideLayout, error)

GetLayoutByName retrieves a slide layout given a layout name.

func (*Presentation) GetTableStyleById

func (_faba *Presentation) GetTableStyleById(id string) *_gbg.CT_TableStyle

GetTableStyleById returns *dml.CT_TableStyle by its style id.

func (*Presentation) MoveSlide

func (_abg *Presentation) MoveSlide(slideNumber, targetPos int) error

MoveSlide moves a slide with given number to position targetPos within a presentation.

func (*Presentation) RemoveSlide

func (_cacd *Presentation) RemoveSlide(s Slide) error

RemoveSlide removes a slide from a presentation.

func (*Presentation) Save

func (_efa *Presentation) Save(w _ff.Writer) error

Save writes the presentation out to a writer in the Zip package format

func (*Presentation) SaveAsTemplate

func (_cedf *Presentation) SaveAsTemplate(w _ff.Writer) error

SaveAsTemplate writes the presentation out to a writer in the Zip package format as a template

func (*Presentation) SaveToFile

func (_gdea *Presentation) SaveToFile(path string) error

SaveToFile writes the Presentation out to a file.

func (*Presentation) SaveToFileAsTemplate

func (_fcfd *Presentation) SaveToFileAsTemplate(path string) error

SaveToFileAsTemplate writes the Presentation out to a file as a template.

func (*Presentation) SlideLayouts

func (_gbac *Presentation) SlideLayouts() []SlideLayout

SlideLayouts returns the slide layouts defined in the presentation.

func (*Presentation) SlideMasters

func (_cde *Presentation) SlideMasters() []SlideMaster

SlideMasters returns the slide masters defined in the presentation.

func (*Presentation) SlideSize

func (_bdddf *Presentation) SlideSize() SlideSize

SlideSize returns presentation slide size.

func (*Presentation) Slides

func (_ffbge *Presentation) Slides() []Slide

Slides returns the slides in the presentation.

func (*Presentation) Themes

func (_afbd *Presentation) Themes() []*_gbg.Theme

Themes returns an array of presentation themes.

func (*Presentation) Validate

func (_caea *Presentation) Validate() error

func (*Presentation) X

func (_abc *Presentation) X() *_gf.Presentation

X returns the inner wrapped XML type.

type PresentationProperties

type PresentationProperties struct {
	// contains filtered or unexported fields
}

PresentationProperties contains document specific properties.

func NewPresentationProperties

func NewPresentationProperties() PresentationProperties

NewPresentationProperties constructs a new PresentationProperties.

func (PresentationProperties) ClrMru

func (_ccg PresentationProperties) ClrMru() *_gbg.CT_ColorMRU

ClrMru returns the ClrMru property.

func (PresentationProperties) ExtLst

ExtLst returns the ExtLst property.

func (PresentationProperties) HtmlPubPr

HtmlPubPr returns the HtmlPubPr property.

func (PresentationProperties) PrnPr

PrnPr returns the PrnPr property.

func (PresentationProperties) ShowPr

ShowPr returns the ShowPr property.

func (PresentationProperties) WebPr

WebPr returns the WebPr property.

func (PresentationProperties) X

X returns the inner wrapped XML type.

type PresentationText

type PresentationText struct{ Slides []*SlideText }

PresentationText is an array of extracted text items which has some methods for representing extracted text.

func (*PresentationText) Text

func (_ge *PresentationText) Text() string

Text returns text from a presentation as one string separated with line breaks.

type Slide

type Slide struct {
	// contains filtered or unexported fields
}

Slide represents a slide of a presentation.

func (Slide) AddImage

func (_dfee Slide) AddImage(img _ae.ImageRef) Image

AddImage adds an image textbox to a slide.

func (Slide) AddImageToRels

func (_ecad Slide) AddImageToRels(img _ae.ImageRef) string

AddImageToRels adds an image relationship to a slide without putting image on the slide.

func (Slide) AddTable

func (_ggdb Slide) AddTable() *_ae.Table

AddTable adds an empty table to a slide.

func (Slide) AddTextBox

func (_ccce Slide) AddTextBox() TextBox

AddTextBox adds an empty textbox to a slide.

func (*Slide) ExtractText

func (_dga *Slide) ExtractText() *SlideText

ExtractText returns text from a slide as a SlideText object.

func (*Slide) GetChartSpaceByRelId

func (_gdbe *Slide) GetChartSpaceByRelId(relId string) *_b.ChartSpace

GetChartSpaceByRelId returns a *crt.ChartSpace with the associated relation ID in the slide.

func (*Slide) GetColorBySchemeColor

func (_fgaf *Slide) GetColorBySchemeColor(schClr _gbg.ST_SchemeColorVal) *_gbg.CT_Color

GetColorBySchemeColor returns *dml.CT_Color mapped to scheme colors like dk1, lt1 etc. depending on what theme is used in the presentation.

func (*Slide) GetImageByRelID

func (_abf *Slide) GetImageByRelID(relID string) (_ae.ImageRef, bool)

GetImageByRelID returns an ImageRef with the associated relation ID in the slide.

func (*Slide) GetLayoutImageByRelID

func (_fda *Slide) GetLayoutImageByRelID(relID string) (_ae.ImageRef, bool)

GetLayoutImageByRelID returns an ImageRef with the associated relation ID in the slide layout.

func (Slide) GetPlaceholder

func (_cggb Slide) GetPlaceholder(t _gf.ST_PlaceholderType) (PlaceHolder, error)

GetPlaceholder returns a placeholder given its type. If there are multiplace placeholders of the same type, this method returns the first one. You must use the PlaceHolders() method to access the others.

func (Slide) GetPlaceholderByIndex

func (_bgccc Slide) GetPlaceholderByIndex(idx uint32) (PlaceHolder, error)

GetPlaceholderByIndex returns a placeholder given its index. If there are multiplace placeholders of the same index, this method returns the first one. You must use the PlaceHolders() method to access the others.

func (*Slide) GetSlideLayout

func (_aea *Slide) GetSlideLayout() *_gf.SldLayout

GetSlideLayout returns a slide layout related to the slide.

func (Slide) GetTextBoxes

func (_gbba Slide) GetTextBoxes() []*TextBox

GetTextBoxes returns a list of all text boxes from a slide.

func (Slide) PlaceHolders

func (_cege Slide) PlaceHolders() []PlaceHolder

PlaceHolders returns all of the content place holders within a given slide.

func (Slide) Presentation

func (_edb Slide) Presentation() *Presentation

Presentation returns a slide's presentation.

func (Slide) Sid

func (_agc Slide) Sid() *_gf.CT_SlideIdListEntry

Sid returns the sid of slide

func (Slide) Tables

func (_gdaa Slide) Tables() []*_ae.Table

Tables returns all of the tables within a given slide.

func (Slide) ValidateWithPath

func (_fcfba Slide) ValidateWithPath(path string) error

ValidateWithPath validates the slide passing path informaton for a better error message.

func (Slide) X

func (_dafdg Slide) X() *_gf.Sld

X returns the inner wrapped XML type.

type SlideLayout

type SlideLayout struct {
	// contains filtered or unexported fields
}

SlideLayout is a layout from which slides can be created.

func (SlideLayout) Name

func (_aga SlideLayout) Name() string

Name returns the name of the slide layout.

func (SlideLayout) Type

func (_ceea SlideLayout) Type() _gf.ST_SlideLayoutType

Type returns the type of the slide layout.

func (SlideLayout) X

func (_cec SlideLayout) X() *_gf.SldLayout

X returns the inner wrapped XML type.

type SlideMaster

type SlideMaster struct {
	// contains filtered or unexported fields
}

SlideMaster is the slide master for a presentation.

func (SlideMaster) SlideLayouts

func (_cfcg SlideMaster) SlideLayouts() []SlideLayout

SlideLayouts returns a slice of all layouts in SlideMaster.

func (SlideMaster) X

func (_ccbd SlideMaster) X() *_gf.SldMaster

X returns the inner wrapped XML type.

type SlideScreenSize

type SlideScreenSize [2]int32

SlideScreenSize represents the slide screen size as a 2 element array representing the width and height in EMU units.

func NewSlideScreenSize

func NewSlideScreenSize() SlideScreenSize

NewSlideScreenSize returns slide screen size with default MS PowerPoint slide screen size 16x9.

func NewSlideScreenSizeWithValue

func NewSlideScreenSizeWithValue(width, height int32) SlideScreenSize

NewSlideScreenSizeWithValue returns slide screen size with given width and height. Width and Height value is in EMU units, use our measurement.ToEMU to convert the - width and height value.

func (*SlideScreenSize) Height

func (_bedb *SlideScreenSize) Height() int32

Height returns slide screen size height in EMU units.

func (*SlideScreenSize) SetHeight

func (_cbbg *SlideScreenSize) SetHeight(val int32)

SetHeight sets height of slide screen size with given value in EMU units.

func (*SlideScreenSize) SetWidth

func (_fgdad *SlideScreenSize) SetWidth(val int32)

SetWidth sets width of slide screen size with given value in EMU units.

func (*SlideScreenSize) Width

func (_aadc *SlideScreenSize) Width() int32

Width returns slide screen size width in EMU units.

type SlideSize

type SlideSize struct {
	// contains filtered or unexported fields
}

SlideSize represents a slide size of a presentation.

func (*SlideSize) SetSize

func (_bbdcc *SlideSize) SetSize(sz SlideScreenSize)

SetSize sets the slide size, take argument of SlideScreenSize.

func (*SlideSize) Size

func (_gece *SlideSize) Size() SlideScreenSize

Size returns slide size value as SlideScreenSize.

func (*SlideSize) X

func (_aff *SlideSize) X() *_gf.CT_SlideSize

X returns the inner wrapped XML type.

type SlideText

type SlideText struct{ Items []*TextItem }

SlideText is an array of extracted text items which has some methods for representing extracted text from a slide.

func (*SlideText) Text

func (_dag *SlideText) Text() string

Text returns text from a slide as one string separated with line breaks.

type TableInfo

type TableInfo struct {
	Table    *_gbg.CT_Table
	Row      *_gbg.CT_TableRow
	Cell     *_gbg.CT_TableCell
	RowIndex int
	ColIndex int
}

TableInfo is used for keep information about a table, a row and a cell where the text is located.

type TextBox

type TextBox struct {
	// contains filtered or unexported fields
}

TextBox is a text box within a slide.

func (TextBox) AddParagraph

func (_cebe TextBox) AddParagraph() _dea.Paragraph

AddParagraph adds a paragraph to the text box

func (TextBox) Properties

func (_gdge TextBox) Properties() _dea.ShapeProperties

Properties returns the properties of the TextBox.

func (TextBox) SetOffsetX

func (_dgac TextBox) SetOffsetX(offX float64)

SetOffsetX sets horizontal offset of text box in distance units (see measurement package).

func (TextBox) SetOffsetY

func (_gdff TextBox) SetOffsetY(offY float64)

SetOffsetY sets vertical offset of text box in distance units (see measurement package).

func (TextBox) SetTextAnchor

func (_cbcb TextBox) SetTextAnchor(a _gbg.ST_TextAnchoringType)

SetTextAnchor controls the text anchoring

func (TextBox) X

func (_ggf TextBox) X() *_gf.CT_Shape

X returns TextBox's underlying *pml.CT_Shape.

type TextItem

type TextItem struct {
	Text         string
	Presentation *Presentation
	Shape        *_gf.CT_Shape
	GraphicFrame *_gf.CT_GraphicalObjectFrame
	Paragraph    *_gbg.CT_TextParagraph
	Run          *_gbg.CT_RegularTextRun
	TableInfo    *TableInfo
	// contains filtered or unexported fields
}

TextItem is used for keeping text with references to a paragraph and run, a shape or a table, a row and a cell where it is located.

type ViewProperties

type ViewProperties struct {
	// contains filtered or unexported fields
}

ViewProperties contains presentation specific properties.

func NewViewProperties

func NewViewProperties() ViewProperties

NewViewProperties constructs a new ViewProperties.

func (ViewProperties) ExtLst

func (_eefc ViewProperties) ExtLst() *_gf.CT_ExtensionList

ExtLst returns the ExtLst property.

func (ViewProperties) GridSpacing

func (_cdf ViewProperties) GridSpacing() *_gbg.CT_PositiveSize2D

GridSpacing returns the GridSpacing property.

func (ViewProperties) LastViewAttr

func (_cgf ViewProperties) LastViewAttr() _gf.ST_ViewType

LastViewAttr returns the LastViewAttr property.

func (ViewProperties) NormalViewPr

func (_gbad ViewProperties) NormalViewPr() *_gf.CT_NormalViewProperties

NormalViewPr returns the NormalViewPr property.

func (ViewProperties) NotesTextViewPr

func (_cecb ViewProperties) NotesTextViewPr() *_gf.CT_NotesTextViewProperties

NotesTextViewPr returns the NotesTextViewPr property.

func (ViewProperties) NotesViewPr

func (_eccg ViewProperties) NotesViewPr() *_gf.CT_NotesViewProperties

NotesViewPr returns the NotesViewPr property.

func (ViewProperties) OutlineViewPr

func (_dfbf ViewProperties) OutlineViewPr() *_gf.CT_OutlineViewProperties

OutlineViewPr returns the OutlineViewPr property.

func (ViewProperties) ShowCommentsAttr

func (_gfcf ViewProperties) ShowCommentsAttr() *bool

ShowCommentsAttr returns the WebPr property.

func (ViewProperties) SlideViewPr

func (_ccdcd ViewProperties) SlideViewPr() *_gf.CT_SlideViewProperties

SlideViewPr returns the SlideViewPr property.

func (ViewProperties) SorterViewPr

func (_acg ViewProperties) SorterViewPr() *_gf.CT_SlideSorterViewProperties

SorterViewPr returns the SorterViewPr property.

func (ViewProperties) X

func (_ddga ViewProperties) X() *_gf.ViewPr

X returns the inner wrapped XML type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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