Documentation
¶
Index ¶
- Constants
- type Background
- type BackgroundType
- type DrawableElement
- type Image
- type ODPGenerator
- func (g *ODPGenerator) AddBlankSlide() *Slide
- func (g *ODPGenerator) AddImage(slide *Slide, imageData []byte, extension string, x, y, width, height float64, ...) error
- func (g *ODPGenerator) AddSlide(title string, content string) *Slide
- func (g *ODPGenerator) AddTextBox(slide *Slide, content string, x, y, width, height float64, ...)
- func (g *ODPGenerator) Save(filename string) error
- func (g *ODPGenerator) SaveStream() ([]byte, error)
- func (g *ODPGenerator) SetBackgroundColor(color string)
- func (g *ODPGenerator) SetBackgroundImage(imageData []byte, extension string) error
- func (g *ODPGenerator) SetCustomSlideSize(width, height float64)
- func (g *ODPGenerator) SetSlideBackground(slide *Slide, imageData []byte, extension string) error
- func (g *ODPGenerator) SetSlideBackgroundColor(slide *Slide, color string) error
- func (g *ODPGenerator) SetSlideSize(aspectRatio string)
- func (g *ODPGenerator) SetTextStyle(slide *Slide, fontSize float64, fontFamily, color string, bold, italic bool)
- type Slide
- type SlideSize
- type TextBox
- type TextProperties
- type TextStyle
Constants ¶
const ( AspectRatio169 = "16:9" AspectRatio43 = "4:3" )
TODO Refactor this to use a list of sizes and override with a custom size Constantes para los tipos de diapositivas comunes
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Background ¶
type Background struct {
Type BackgroundType
Data []byte // Para imágenes
Name string // Para imágenes
Color string // Para colores sólidos
}
type BackgroundType ¶
type BackgroundType int
Modificar la estructura BackgroundImage para soportar diferentes tipos de fondo
const ( BackgroundImage BackgroundType = iota BackgroundColor )
type DrawableElement ¶ added in v0.0.8
type DrawableElement struct {
Type string // "textbox" o "image"
ZIndex int
Data interface{} // TextBox o Image
}
Añadir esta nueva estructura para manejar elementos ordenables
type ODPGenerator ¶
type ODPGenerator struct {
Slides []Slide
SlideSize SlideSize
Background *Background
}
func New ¶
func New() *ODPGenerator
New crea una nueva instancia de ODPGenerator con tamaño 16:9 por defecto
func (*ODPGenerator) AddBlankSlide ¶
func (g *ODPGenerator) AddBlankSlide() *Slide
AddBlankSlide añade una diapositiva en blanco a la presentación y devuelve un puntero a ella
func (*ODPGenerator) AddImage ¶
func (g *ODPGenerator) AddImage(slide *Slide, imageData []byte, extension string, x, y, width, height float64, zIndex ...int) error
AddImage añade una imagen a la diapositiva especificada. El parámetro extension debe incluir el punto (por ejemplo: ".jpg", ".png")
func (*ODPGenerator) AddSlide ¶
func (g *ODPGenerator) AddSlide(title string, content string) *Slide
AddSlide añade una nueva diapositiva a la presentación y devuelve un puntero a ella
func (*ODPGenerator) AddTextBox ¶
func (g *ODPGenerator) AddTextBox(slide *Slide, content string, x, y, width, height float64, props *TextProperties, zIndex ...int)
Modificar AddTextBox para inicializar props si es nil
func (*ODPGenerator) Save ¶
func (g *ODPGenerator) Save(filename string) error
Modificar Save para usar SaveStream
func (*ODPGenerator) SaveStream ¶
func (g *ODPGenerator) SaveStream() ([]byte, error)
SaveStream genera y devuelve los bytes del archivo ODP
func (*ODPGenerator) SetBackgroundColor ¶
func (g *ODPGenerator) SetBackgroundColor(color string)
SetBackgroundColor establece un fondo de color para la presentación
func (*ODPGenerator) SetBackgroundImage ¶
func (g *ODPGenerator) SetBackgroundImage(imageData []byte, extension string) error
SetBackgroundImage establece una imagen de fondo para todas las diapositivas
func (*ODPGenerator) SetCustomSlideSize ¶
func (g *ODPGenerator) SetCustomSlideSize(width, height float64)
SetCustomSlideSize establece un tamaño personalizado para las diapositivas
func (*ODPGenerator) SetSlideBackground ¶
func (g *ODPGenerator) SetSlideBackground(slide *Slide, imageData []byte, extension string) error
SetSlideBackground establece una imagen de fondo para la diapositiva especificada. El parámetro extension debe incluir el punto (por ejemplo: ".jpg", ".png")
func (*ODPGenerator) SetSlideBackgroundColor ¶
func (g *ODPGenerator) SetSlideBackgroundColor(slide *Slide, color string) error
SetSlideBackgroundColor establece un color de fondo para la diapositiva especificada. El color debe estar en formato hexadecimal (#RRGGBB) o ser un nombre de color válido.
func (*ODPGenerator) SetSlideSize ¶
func (g *ODPGenerator) SetSlideSize(aspectRatio string)
SetSlideSize establece el tamaño de las diapositivas
func (*ODPGenerator) SetTextStyle ¶
func (g *ODPGenerator) SetTextStyle(slide *Slide, fontSize float64, fontFamily, color string, bold, italic bool)
SetTextStyle establece el estilo para el próximo texto que se añada
type Slide ¶
type Slide struct {
TextBoxes []TextBox
Images []Image
Background *Background
// contains filtered or unexported fields
}
func (*Slide) SortedElements ¶ added in v0.0.8
func (s *Slide) SortedElements() []DrawableElement
Añadir este método a la estructura Slide
type TextProperties ¶ added in v0.0.4
type TextProperties struct {
HorizontalAlign string // "left", "center", "right", "justify"
VerticalAlign string // "top", "middle", "bottom"
LeftIndent float64 // Sangría izquierda en cm
RightIndent float64 // Sangría derecha en cm
FirstLineIndent float64 // Sangría de primera línea en cm
}
func NewDefaultTextProperties ¶ added in v0.1.2
func NewDefaultTextProperties() *TextProperties
Añadir esta función para crear TextProperties con valores por defecto