HomeUniDoc
HomeUniDoc
...

Package presentation

Overview ▾

Index ▾

Variables
type Image
    func (i Image) Properties() drawing.ShapeProperties
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 New() *Presentation
    func Open(filename string) (*Presentation, error)
    func OpenTemplate(fn string) (*Presentation, error)
    func Read(r io.ReaderAt, size int64) (*Presentation, error)
    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) Close() error
    func (p *Presentation) ExtractText() *PresentationText
    func (p *Presentation) GetColorBySchemeColor(schClr dml.ST_SchemeColorVal) *dml.CT_Color
    func (p *Presentation) GetImageByRelID(relID string) (common.ImageRef, bool)
    func (p *Presentation) GetLayoutByName(name string) (SlideLayout, error)
    func (p *Presentation) GetTableStyleById(id string) *dml.CT_TableStyle
    func (p *Presentation) RemoveSlide(s Slide) error
    func (p *Presentation) Save(w io.Writer) error
    func (p *Presentation) SaveAsTemplate(w io.Writer) error
    func (p *Presentation) SaveToFile(path string) error
    func (p *Presentation) SaveToFileAsTemplate(path string) error
    func (p *Presentation) SlideLayouts() []SlideLayout
    func (p *Presentation) SlideMasters() []SlideMaster
    func (p *Presentation) SlideSize() SlideSize
    func (p *Presentation) Slides() []Slide
    func (p *Presentation) Themes() []*dml.Theme
    func (p *Presentation) Validate() error
    func (p *Presentation) X() *pml.Presentation
type PresentationProperties
    func NewPresentationProperties() PresentationProperties
    func (p PresentationProperties) ClrMru() *dml.CT_ColorMRU
    func (p PresentationProperties) ExtLst() *pml.CT_ExtensionList
    func (p PresentationProperties) HtmlPubPr() *pml.CT_HtmlPublishProperties
    func (p PresentationProperties) PrnPr() *pml.CT_PrintProperties
    func (p PresentationProperties) ShowPr() *pml.CT_ShowProperties
    func (p PresentationProperties) WebPr() *pml.CT_WebProperties
    func (p PresentationProperties) X() *pml.PresentationPr
type PresentationText
    func (pt *PresentationText) Text() string
type Slide
    func (s Slide) AddImage(img common.ImageRef) Image
    func (s Slide) AddImageToRels(img common.ImageRef) string
    func (s Slide) AddTable() *common.Table
    func (s Slide) AddTextBox() TextBox
    func (s *Slide) ExtractText() *SlideText
    func (s *Slide) GetChartSpaceByRelId(relId string) *crt.ChartSpace
    func (s *Slide) GetColorBySchemeColor(schClr dml.ST_SchemeColorVal) *dml.CT_Color
    func (s *Slide) GetImageByRelID(relID string) (common.ImageRef, bool)
    func (s Slide) GetPlaceholder(t pml.ST_PlaceholderType) (PlaceHolder, error)
    func (s Slide) GetPlaceholderByIndex(idx uint32) (PlaceHolder, error)
    func (s *Slide) GetSlideLayout() *pml.SldLayout
    func (s Slide) GetTextBoxes() []*TextBox
    func (s Slide) PlaceHolders() []PlaceHolder
    func (s Slide) Presentation() *Presentation
    func (s Slide) ValidateWithPath(path string) error
    func (s Slide) X() *pml.Sld
type SlideLayout
    func (s SlideLayout) Name() string
    func (s SlideLayout) Type() pml.ST_SlideLayoutType
    func (s SlideLayout) X() *pml.SldLayout
type SlideMaster
    func (s SlideMaster) SlideLayouts() []SlideLayout
    func (s SlideMaster) X() *pml.SldMaster
type SlideScreenSize
    func NewSlideScreenSize() SlideScreenSize
    func NewSlideScreenSizeWithValue(width, height int32) SlideScreenSize
    func (scSz *SlideScreenSize) Height() int32
    func (scSz *SlideScreenSize) SetHeight(val int32)
    func (scSz *SlideScreenSize) SetWidth(val int32)
    func (scSz *SlideScreenSize) Width() int32
type SlideSize
    func (ss *SlideSize) SetSize(sz SlideScreenSize)
    func (ss *SlideSize) Size() SlideScreenSize
    func (ss *SlideSize) X() *pml.CT_SlideSize
type SlideText
    func (st *SlideText) Text() string
type TableInfo
type TextBox
    func (t TextBox) AddParagraph() drawing.Paragraph
    func (t TextBox) Properties() drawing.ShapeProperties
    func (t TextBox) SetOffsetX(offX float64)
    func (t TextBox) SetOffsetY(offY float64)
    func (t TextBox) SetTextAnchor(a dml.ST_TextAnchoringType)
    func (t TextBox) X() *pml.CT_Shape
type TextItem
type ViewProperties
    func NewViewProperties() ViewProperties
    func (p ViewProperties) ExtLst() *pml.CT_ExtensionList
    func (p ViewProperties) GridSpacing() *dml.CT_PositiveSize2D
    func (p ViewProperties) LastViewAttr() pml.ST_ViewType
    func (p ViewProperties) NormalViewPr() *pml.CT_NormalViewProperties
    func (p ViewProperties) NotesTextViewPr() *pml.CT_NotesTextViewProperties
    func (p ViewProperties) NotesViewPr() *pml.CT_NotesViewProperties
    func (p ViewProperties) OutlineViewPr() *pml.CT_OutlineViewProperties
    func (p ViewProperties) ShowCommentsAttr() *bool
    func (p ViewProperties) SlideViewPr() *pml.CT_SlideViewProperties
    func (p ViewProperties) SorterViewPr() *pml.CT_SlideSorterViewProperties
    func (p ViewProperties) X() *pml.ViewPr

Package files

chart.go extract.go image.go open.go placeholder.go pres_props.go presentation.go read.go slide.go slide_screen_size.go slide_size.go slidelayout.go slidemaster.go textbox.go view_props.go

Variables

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

type Image

Image is an image within a slide.

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

func (Image) Properties

func (i Image) Properties() drawing.ShapeProperties

Properties returns the properties of the TextBox.

type PlaceHolder

PlaceHolder is a place holder from a slide.

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

func (PlaceHolder) AddParagraph

func (s PlaceHolder) AddParagraph() drawing.Paragraph

AddParagraph adds a new paragraph to a placeholder.

func (PlaceHolder) Clear

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

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

func (s PlaceHolder) Index() uint32

Index returns the placeholder index

func (PlaceHolder) Paragraphs

func (s PlaceHolder) Paragraphs() []drawing.Paragraph

Paragraphs returns the paragraphs defined in the placeholder.

func (PlaceHolder) Remove

func (s PlaceHolder) Remove() error

Remove removes a placeholder from a presentation.

func (PlaceHolder) SetText

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

func (s PlaceHolder) Type() pml.ST_PlaceholderType

Type returns the placeholder type

func (PlaceHolder) X

func (s PlaceHolder) X() *pml.CT_Shape

X returns the inner wrapped XML type.

type Presentation

Presentation is the a presentation base document.

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

func New

func New() *Presentation

New initializes and reurns 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 io.ReaderAt, size int64) (*Presentation, error)

Read reads a document from an io.Reader.

func (*Presentation) AddDefaultSlideWithLayout

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

func (p *Presentation) AddImage(i common.Image) (common.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 (p *Presentation) AddSlide() Slide

AddSlide adds a new slide to the presentation.

func (*Presentation) AddSlideWithLayout

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) Close

func (p *Presentation) Close() error

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

func (*Presentation) ExtractText

func (p *Presentation) ExtractText() *PresentationText

ExtractText returns text from a presentation as a PresentationText object.

func (*Presentation) GetColorBySchemeColor

func (p *Presentation) GetColorBySchemeColor(schClr dml.ST_SchemeColorVal) *dml.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 (p *Presentation) GetImageByRelID(relID string) (common.ImageRef, bool)

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

func (*Presentation) GetLayoutByName

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

GetLayoutByName retrieves a slide layout given a layout name.

func (*Presentation) GetTableStyleById

func (p *Presentation) GetTableStyleById(id string) *dml.CT_TableStyle

GetTableStyleById returns *dml.CT_TableStyle by its style id.

func (*Presentation) RemoveSlide

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) SaveAsTemplate

func (p *Presentation) SaveAsTemplate(w io.Writer) error

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

func (*Presentation) SaveToFile

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

SaveToFile writes the Presentation out to a file.

func (*Presentation) SaveToFileAsTemplate

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

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

func (*Presentation) SlideLayouts

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

SlideLayouts returns the slide layouts defined in the presentation.

func (*Presentation) SlideMasters

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

SlideMasters returns the slide masters defined in the presentation.

func (*Presentation) SlideSize

func (p *Presentation) SlideSize() SlideSize

SlideSize returns presentation slide size.

func (*Presentation) Slides

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

Slides returns the slides in the presentation.

func (*Presentation) Themes

func (p *Presentation) Themes() []*dml.Theme

Themes returns an array of presentation themes.

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 PresentationProperties

PresentationProperties contains document specific properties.

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

func NewPresentationProperties

func NewPresentationProperties() PresentationProperties

NewPresentationProperties constructs a new PresentationProperties.

func (PresentationProperties) ClrMru

func (p PresentationProperties) ClrMru() *dml.CT_ColorMRU

ClrMru returns the ClrMru property.

func (PresentationProperties) ExtLst

func (p PresentationProperties) ExtLst() *pml.CT_ExtensionList

ExtLst returns the ExtLst property.

func (PresentationProperties) HtmlPubPr

func (p PresentationProperties) HtmlPubPr() *pml.CT_HtmlPublishProperties

HtmlPubPr returns the HtmlPubPr property.

func (PresentationProperties) PrnPr

func (p PresentationProperties) PrnPr() *pml.CT_PrintProperties

PrnPr returns the PrnPr property.

func (PresentationProperties) ShowPr

func (p PresentationProperties) ShowPr() *pml.CT_ShowProperties

ShowPr returns the ShowPr property.

func (PresentationProperties) WebPr

func (p PresentationProperties) WebPr() *pml.CT_WebProperties

WebPr returns the WebPr property.

func (PresentationProperties) X

func (p PresentationProperties) X() *pml.PresentationPr

X returns the inner wrapped XML type.

type PresentationText

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

type PresentationText struct {
    Slides []*SlideText
}

func (*PresentationText) Text

func (pt *PresentationText) Text() string

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

type Slide

Slide represents a slide of a presentation.

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

func (Slide) AddImage

func (s Slide) AddImage(img common.ImageRef) Image

AddImage adds an image textbox to a slide.

func (Slide) AddImageToRels

func (s Slide) AddImageToRels(img common.ImageRef) string

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

func (Slide) AddTable

func (s Slide) AddTable() *common.Table

AddTable adds an empty table to a slide.

func (Slide) AddTextBox

func (s Slide) AddTextBox() TextBox

AddTextBox adds an empty textbox to a slide.

func (*Slide) ExtractText

func (s *Slide) ExtractText() *SlideText

ExtractText returns text from a slide as a SlideText object.

func (*Slide) GetChartSpaceByRelId

func (s *Slide) GetChartSpaceByRelId(relId string) *crt.ChartSpace

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

func (*Slide) GetColorBySchemeColor

func (s *Slide) GetColorBySchemeColor(schClr dml.ST_SchemeColorVal) *dml.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 (s *Slide) GetImageByRelID(relID string) (common.ImageRef, bool)

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

func (Slide) GetPlaceholder

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

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) GetSlideLayout

func (s *Slide) GetSlideLayout() *pml.SldLayout

GetSlideLayout returns a slide layout related to the slide.

func (Slide) GetTextBoxes

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

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

func (Slide) PlaceHolders

func (s Slide) PlaceHolders() []PlaceHolder

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

func (Slide) Presentation

func (s Slide) Presentation() *Presentation

Presentation returns a slide's presentation.

func (Slide) ValidateWithPath

func (s Slide) ValidateWithPath(path string) error

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

func (Slide) X

func (s Slide) X() *pml.Sld

X returns the inner wrapped XML type.

type SlideLayout

SlideLayout is a layout from which slides can be created.

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

func (SlideLayout) Name

func (s SlideLayout) Name() string

Name returns the name of the slide layout.

func (SlideLayout) Type

func (s SlideLayout) Type() pml.ST_SlideLayoutType

Type returns the type of the slide layout.

func (SlideLayout) X

func (s SlideLayout) X() *pml.SldLayout

X returns the inner wrapped XML type.

type SlideMaster

SlideMaster is the slide master for a presentation.

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

func (SlideMaster) SlideLayouts

func (s SlideMaster) SlideLayouts() []SlideLayout

SlideLayouts returns a slice of all layouts in SlideMaster.

func (SlideMaster) X

func (s SlideMaster) X() *pml.SldMaster

X returns the inner wrapped XML type.

type SlideScreenSize

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

type SlideScreenSize [2]int32

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 (scSz *SlideScreenSize) Height() int32

Height returns slide screen size height in EMU units.

func (*SlideScreenSize) SetHeight

func (scSz *SlideScreenSize) SetHeight(val int32)

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

func (*SlideScreenSize) SetWidth

func (scSz *SlideScreenSize) SetWidth(val int32)

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

func (*SlideScreenSize) Width

func (scSz *SlideScreenSize) Width() int32

Width returns slide screen size width in EMU units.

type SlideSize

SlideSize represents a slide size of a presentation.

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

func (*SlideSize) SetSize

func (ss *SlideSize) SetSize(sz SlideScreenSize)

SetSize sets the slide size, take argument of SlideScreenSize.

func (*SlideSize) Size

func (ss *SlideSize) Size() SlideScreenSize

Size returns slide size value as SlideScreenSize.

func (*SlideSize) X

func (ss *SlideSize) X() *pml.CT_SlideSize

X returns the inner wrapped XML type.

type SlideText

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

type SlideText struct {
    Items []*TextItem
}

func (*SlideText) Text

func (st *SlideText) Text() string

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

type TableInfo

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

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

type TextBox

TextBox is a text box within a slide.

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

func (TextBox) AddParagraph

func (t TextBox) AddParagraph() drawing.Paragraph

AddParagraph adds a paragraph to the text box

func (TextBox) Properties

func (t TextBox) Properties() drawing.ShapeProperties

Properties returns the properties of the TextBox.

func (TextBox) SetOffsetX

func (t TextBox) SetOffsetX(offX float64)

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

func (TextBox) SetOffsetY

func (t TextBox) SetOffsetY(offY float64)

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

func (TextBox) SetTextAnchor

func (t TextBox) SetTextAnchor(a dml.ST_TextAnchoringType)

SetTextAnchor controls the text anchoring

func (TextBox) X

func (t TextBox) X() *pml.CT_Shape

X returns TextBox's underlying *pml.CT_Shape.

type TextItem

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 TextItem struct {
    Text         string
    Presentation *Presentation
    Shape        *pml.CT_Shape
    GraphicFrame *pml.CT_GraphicalObjectFrame
    Paragraph    *dml.CT_TextParagraph
    Run          *dml.CT_RegularTextRun
    TableInfo    *TableInfo
    // contains filtered or unexported fields
}

type ViewProperties

ViewProperties contains presentation specific properties.

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

func NewViewProperties

func NewViewProperties() ViewProperties

NewViewProperties constructs a new ViewProperties.

func (ViewProperties) ExtLst

func (p ViewProperties) ExtLst() *pml.CT_ExtensionList

ExtLst returns the ExtLst property.

func (ViewProperties) GridSpacing

func (p ViewProperties) GridSpacing() *dml.CT_PositiveSize2D

GridSpacing returns the GridSpacing property.

func (ViewProperties) LastViewAttr

func (p ViewProperties) LastViewAttr() pml.ST_ViewType

LastViewAttr returns the LastViewAttr property.

func (ViewProperties) NormalViewPr

func (p ViewProperties) NormalViewPr() *pml.CT_NormalViewProperties

NormalViewPr returns the NormalViewPr property.

func (ViewProperties) NotesTextViewPr

func (p ViewProperties) NotesTextViewPr() *pml.CT_NotesTextViewProperties

NotesTextViewPr returns the NotesTextViewPr property.

func (ViewProperties) NotesViewPr

func (p ViewProperties) NotesViewPr() *pml.CT_NotesViewProperties

NotesViewPr returns the NotesViewPr property.

func (ViewProperties) OutlineViewPr

func (p ViewProperties) OutlineViewPr() *pml.CT_OutlineViewProperties

OutlineViewPr returns the OutlineViewPr property.

func (ViewProperties) ShowCommentsAttr

func (p ViewProperties) ShowCommentsAttr() *bool

ShowCommentsAttr returns the WebPr property.

func (ViewProperties) SlideViewPr

func (p ViewProperties) SlideViewPr() *pml.CT_SlideViewProperties

SlideViewPr returns the SlideViewPr property.

func (ViewProperties) SorterViewPr

func (p ViewProperties) SorterViewPr() *pml.CT_SlideSorterViewProperties

SorterViewPr returns the SorterViewPr property.

func (ViewProperties) X

func (p ViewProperties) X() *pml.ViewPr

X returns the inner wrapped XML type.

Subdirectories

Name Synopsis
..
convert