Documentation ¶
Index ¶
- type Image
- type PlaceHolder
- func (s PlaceHolder) AddParagraph() drawing.Paragraph
- func (s PlaceHolder) Clear()
- func (s PlaceHolder) ClearAll()
- func (s PlaceHolder) Index() uint32
- func (s PlaceHolder) Paragraphs() []drawing.Paragraph
- func (s PlaceHolder) Remove() error
- func (s PlaceHolder) SetText(text string)
- func (s PlaceHolder) Type() pml.ST_PlaceholderType
- func (s PlaceHolder) X() *pml.CT_Shape
- type Presentation
- func (p *Presentation) AddDefaultSlideWithLayout(l SlideLayout) (Slide, error)
- func (p *Presentation) AddImage(i common.Image) (common.ImageRef, error)
- func (p *Presentation) AddSlide() Slide
- func (p *Presentation) AddSlideWithLayout(l SlideLayout) (Slide, error)
- func (p *Presentation) GetImageByRelID(relID string) (common.ImageRef, bool)
- func (p *Presentation) GetLayoutByName(name string) (SlideLayout, error)
- func (p *Presentation) RemoveSlide(s Slide) error
- func (p *Presentation) Save(w io.Writer) error
- func (p *Presentation) SaveToFile(path string) error
- func (p *Presentation) SlideLayouts() []SlideLayout
- func (p *Presentation) SlideMasters() []SlideMaster
- func (p *Presentation) Slides() []Slide
- func (p *Presentation) Validate() error
- func (p *Presentation) X() *pml.Presentation
- type Slide
- func (s Slide) AddImage(img common.ImageRef) Image
- func (s Slide) AddTextBox() TextBox
- func (s Slide) GetPlaceholder(t pml.ST_PlaceholderType) (PlaceHolder, error)
- func (s Slide) GetPlaceholderByIndex(idx uint32) (PlaceHolder, error)
- func (s Slide) PlaceHolders() []PlaceHolder
- func (s Slide) ValidateWithPath(path string) error
- func (s Slide) X() *pml.Sld
- type SlideLayout
- type SlideMaster
- type TextBox
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Image ¶ added in v0.6.0
type Image struct {
// contains filtered or unexported fields
}
Image is an image within a slide.
func (Image) Properties ¶ added in v0.6.0
func (i Image) Properties() drawing.ShapeProperties
Properties returns the properties of the TextBox.
type PlaceHolder ¶ added in v0.6.0
type PlaceHolder struct {
// contains filtered or unexported fields
}
PlaceHolder is a place holder from a slide.
func (PlaceHolder) AddParagraph ¶ added in v0.6.0
func (s PlaceHolder) AddParagraph() drawing.Paragraph
AddParagraph adds a new paragraph to a placeholder.
func (PlaceHolder) Clear ¶ added in v0.6.0
func (s 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 ¶ added in v0.6.0
func (s PlaceHolder) ClearAll()
ClearAll completely clears a placeholder. To be useable, at least one paragraph must be added after ClearAll via AddParagraph.
func (PlaceHolder) Index ¶ added in v0.6.0
func (s PlaceHolder) Index() uint32
Index returns the placeholder index
func (PlaceHolder) Paragraphs ¶ added in v0.6.0
func (s PlaceHolder) Paragraphs() []drawing.Paragraph
Paragraphs returns the paragraphs defined in the placeholder.
func (PlaceHolder) Remove ¶ added in v0.6.0
func (s PlaceHolder) Remove() error
func (PlaceHolder) SetText ¶ added in v0.6.0
func (s 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 ¶ added in v0.6.0
func (s PlaceHolder) Type() pml.ST_PlaceholderType
Type returns the placeholder type
func (PlaceHolder) X ¶ added in v0.6.0
func (s PlaceHolder) X() *pml.CT_Shape
X returns the inner wrapped XML type.
type Presentation ¶
Presentation is the a presentation base document.
func Open ¶ added in v0.6.0
func Open(filename string) (*Presentation, error)
Open opens and reads a document from a file (.docx).
func OpenTemplate ¶ added in v0.6.0
func OpenTemplate(fn string) (*Presentation, error)
func Read ¶ added in v0.6.0
func Read(r io.ReaderAt, size int64) (*Presentation, error)
Read reads a document from an io.Reader.
func (*Presentation) AddDefaultSlideWithLayout ¶ added in v0.6.0
func (p *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 ¶ added in v0.6.0
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 (p *Presentation) AddSlide() Slide
AddSlide adds a new slide to the presentation.
func (*Presentation) AddSlideWithLayout ¶ added in v0.6.0
func (p *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) GetImageByRelID ¶ added in v0.6.0
func (p *Presentation) GetImageByRelID(relID string) (common.ImageRef, bool)
GetImageByRelID returns an ImageRef with the associated relation ID in the document.
func (*Presentation) GetLayoutByName ¶ added in v0.6.0
func (p *Presentation) GetLayoutByName(name string) (SlideLayout, error)
GetLayoutByName retrieves a slide layout given a layout name.
func (*Presentation) RemoveSlide ¶ added in v0.6.0
func (p *Presentation) RemoveSlide(s Slide) error
RemoveSlide removes a slide from a presentation.
func (*Presentation) Save ¶
func (p *Presentation) Save(w io.Writer) error
Save writes the presentation out to a writer in the Zip package format
func (*Presentation) SaveToFile ¶
func (p *Presentation) SaveToFile(path string) error
SaveToFile writes the Presentation out to a file.
func (*Presentation) SlideLayouts ¶ added in v0.6.0
func (p *Presentation) SlideLayouts() []SlideLayout
SlideLayouts returns the slide layouts defined in the presentation.
func (*Presentation) SlideMasters ¶ added in v0.6.0
func (p *Presentation) SlideMasters() []SlideMaster
SlideMasters returns the slide masters defined in the presentation.
func (*Presentation) Slides ¶ added in v0.6.0
func (p *Presentation) Slides() []Slide
Slides returns the slides in the presentation.
func (*Presentation) Validate ¶
func (p *Presentation) Validate() error
func (*Presentation) X ¶
func (p *Presentation) X() *pml.Presentation
X returns the inner wrapped XML type.
type Slide ¶
type Slide struct {
// contains filtered or unexported fields
}
func (Slide) AddTextBox ¶ added in v0.6.0
AddTextBox adds an empty textbox to a slide.
func (Slide) GetPlaceholder ¶ added in v0.6.0
func (s Slide) GetPlaceholder(t pml.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 ¶ added in v0.6.0
func (s 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) PlaceHolders ¶ added in v0.6.0
func (s Slide) PlaceHolders() []PlaceHolder
PlaceHolders returns all of the content place holders within a given slide.
func (Slide) ValidateWithPath ¶ added in v0.6.0
ValidateWithPath validates the slide passing path informaton for a better error message
type SlideLayout ¶ added in v0.6.0
type SlideLayout struct {
// contains filtered or unexported fields
}
SlideLayout
func (SlideLayout) Name ¶ added in v0.6.0
func (s SlideLayout) Name() string
Name returns the name of the slide layout.
func (SlideLayout) Type ¶ added in v0.6.0
func (s SlideLayout) Type() pml.ST_SlideLayoutType
Type returns the type of the slide layout.
func (SlideLayout) X ¶ added in v0.6.0
func (s SlideLayout) X() *pml.SldLayout
X returns the inner wrapped XML type.
type SlideMaster ¶ added in v0.6.0
type SlideMaster struct {
// contains filtered or unexported fields
}
SlideMaster is the slide master for a presentation.
func (SlideMaster) SlideLayouts ¶ added in v0.6.0
func (s SlideMaster) SlideLayouts() []SlideLayout
func (SlideMaster) X ¶ added in v0.6.0
func (s SlideMaster) X() *pml.SldMaster
X returns the inner wrapped XML type.
type TextBox ¶ added in v0.6.0
type TextBox struct {
// contains filtered or unexported fields
}
TextBox is a text box within a slide.
func (TextBox) AddParagraph ¶ added in v0.6.0
AddParagraph adds a paragraph to the text box
func (TextBox) Properties ¶ added in v0.6.0
func (t TextBox) Properties() drawing.ShapeProperties
Properties returns the properties of the TextBox.
func (TextBox) SetTextAnchor ¶ added in v0.6.0
func (t TextBox) SetTextAnchor(a dml.ST_TextAnchoringType)
SetTextAnchor controls the text anchoring