elements

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

File: elements/hyperlink.go

elements/image.go

File: elements/paragraph.go

File: elements/run.go

elements/table.go

Index

Constants

View Source
const (
	HyperlinkTypeExternal = "external"
	HyperlinkTypeInternal = "internal"
	HyperlinkTypeEmail    = "email"
	HyperlinkTypeBookmark = "bookmark"
)

HyperlinkType constants

View Source
const (
	// EMUs per inch
	EmusPerInch = 914400
	// EMUs per centimeter
	EmusPerCm = 360000
	// EMUs per pixel at 96 DPI
	EmusPerPixel = 9525
)
View Source
const (
	ContentTypeJPEG = "image/jpeg"
	ContentTypePNG  = "image/png"
	ContentTypeGIF  = "image/gif"
	ContentTypeBMP  = "image/bmp"
	ContentTypeTIFF = "image/tiff"
	ContentTypeSVG  = "image/svg+xml"
)

Image content types

Variables

This section is empty.

Functions

func CreateHyperlinkWithRelationship

func CreateHyperlinkWithRelationship(text, url string) (*Hyperlink, *HyperlinkRelationship)

CreateHyperlinkWithRelationship creates a hyperlink and its relationship

Types

type BorderStyle

type BorderStyle struct {
	Value string // single, double, dotted, dashed, thick, none
	Size  string
	Space string
	Color string
}

BorderStyle represents a border style

type Hyperlink struct {
	ID          string                    // Relationship ID
	URL         string                    // Target URL or anchor
	Tooltip     string                    // Tooltip text
	Children    []ParagraphChild          // Child elements (usually runs)
	Properties  *properties.RunProperties // Default properties for children
	Typ         string                    // Type: "external" or "internal"
	Anchor      string                    // Anchor for internal links
	DocLocation string                    // Document location for internal links
	TargetFrame string                    // Target frame
	History     bool                      // Add to history
	ScreenTip   string                    // Extended tooltip
}

Hyperlink represents a hyperlink element

func NewBookmarkHyperlink(text, bookmarkName string) *Hyperlink

NewBookmarkHyperlink creates a hyperlink to a bookmark

func NewEmailHyperlink(text, email string) *Hyperlink

NewEmailHyperlink creates an email hyperlink

func NewHyperlink(text, url string) *Hyperlink

NewHyperlink creates a new external hyperlink

func NewInternalHyperlink(text, anchor string) *Hyperlink

NewInternalHyperlink creates a hyperlink to a bookmark

func (*Hyperlink) AddFormattedText

func (h *Hyperlink) AddFormattedText(text string, format func(*Run)) *Run

AddFormattedText adds text with additional formatting

func (*Hyperlink) AddRun

func (h *Hyperlink) AddRun() *Run

AddRun adds a run to the hyperlink

func (*Hyperlink) AddText

func (h *Hyperlink) AddText(text string) *Run

AddText adds text to the hyperlink

func (*Hyperlink) Clone

func (h *Hyperlink) Clone() *Hyperlink

Clone creates a deep copy of the hyperlink

func (*Hyperlink) RemoveUnderline

func (h *Hyperlink) RemoveUnderline() *Hyperlink

RemoveUnderline removes the default underline

func (*Hyperlink) SetColor

func (h *Hyperlink) SetColor(color string) *Hyperlink

SetColor sets the hyperlink color

func (*Hyperlink) SetDocLocation

func (h *Hyperlink) SetDocLocation(location string) *Hyperlink

SetDocLocation sets document location for internal links

func (*Hyperlink) SetHistory

func (h *Hyperlink) SetHistory(history bool) *Hyperlink

SetHistory sets whether to add to history

func (*Hyperlink) SetScreenTip

func (h *Hyperlink) SetScreenTip(tip string) *Hyperlink

SetScreenTip sets extended tooltip text

func (*Hyperlink) SetStyle

func (h *Hyperlink) SetStyle(styleID string) *Hyperlink

SetStyle sets the hyperlink style

func (*Hyperlink) SetTargetFrame

func (h *Hyperlink) SetTargetFrame(frame string) *Hyperlink

SetTargetFrame sets the target frame

func (*Hyperlink) SetTooltip

func (h *Hyperlink) SetTooltip(tooltip string) *Hyperlink

SetTooltip sets the hyperlink tooltip

func (*Hyperlink) Type

func (h *Hyperlink) Type() string

Type returns the element type

func (*Hyperlink) Validate

func (h *Hyperlink) Validate() error

Validate validates the hyperlink

func (*Hyperlink) XML

func (h *Hyperlink) XML() ([]byte, error)

XML generates the XML representation of the hyperlink

type HyperlinkRelationship

type HyperlinkRelationship struct {
	ID         string
	Type       string
	Target     string
	TargetMode string
}

HyperlinkRelationship represents a hyperlink relationship for the document

func NewHyperlinkRelationship

func NewHyperlinkRelationship(id, target string) *HyperlinkRelationship

NewHyperlinkRelationship creates a new hyperlink relationship

type Image

type Image struct {
	RelationshipID string
	Width          int64 // Width in EMUs (English Metric Units)
	Height         int64 // Height in EMUs
	Name           string
	Description    string
	Data           []byte
	ContentType    string
	Extension      string
	// contains filtered or unexported fields
}

Image represents an image element in a Word document

func NewImage

func NewImage(document types.Document, filePath string) (*Image, error)

NewImage creates a new image from file path

func NewImageFromBytes

func NewImageFromBytes(document types.Document, data []byte, name string, contentType string) (*Image, error)

NewImageFromBytes creates a new image from byte data

func NewImageFromReader

func NewImageFromReader(document types.Document, reader io.Reader, name string) (*Image, error)

NewImageFromReader creates a new image from an io.Reader

func (*Image) Clone

func (img *Image) Clone() *Image

Clone creates a deep copy of the image

func (*Image) FileName

func (img *Image) FileName() string

FileName returns the file name

func (*Image) FitToBox

func (img *Image) FitToBox(maxWidthInches, maxHeightInches float64) *Image

FitToBox scales the image to fit within a bounding box while maintaining aspect ratio

func (*Image) FitToHeight

func (img *Image) FitToHeight(maxHeightInches float64) *Image

FitToHeight scales the image to fit within a maximum height while maintaining aspect ratio

func (*Image) FitToWidth

func (img *Image) FitToWidth(maxWidthInches float64) *Image

FitToWidth scales the image to fit within a maximum width while maintaining aspect ratio

func (*Image) GetAspectRatio

func (img *Image) GetAspectRatio() float64

GetAspectRatio returns the aspect ratio of the image

func (*Image) GetBase64Data

func (img *Image) GetBase64Data() string

GetBase64Data returns the image data as base64 encoded string

func (*Image) GetDimensionsInCm

func (img *Image) GetDimensionsInCm() (width, height float64)

GetDimensionsInCm returns the image dimensions in centimeters

func (*Image) GetDimensionsInInches

func (img *Image) GetDimensionsInInches() (width, height float64)

GetDimensionsInInches returns the image dimensions in inches

func (*Image) GetDimensionsInPixels

func (img *Image) GetDimensionsInPixels() (width, height int)

GetDimensionsInPixels returns the image dimensions in pixels (at 96 DPI)

func (*Image) RawContent

func (img *Image) RawContent() []byte

RawContent returns the raw image data

func (*Image) RelID

func (img *Image) RelID() string

RelID returns the relationship ID

func (*Image) RelType

func (img *Image) RelType() string

RelType returns the relationship type

func (*Image) SaveToFile

func (img *Image) SaveToFile(path string) error

SaveToFile saves the image data to a file

func (*Image) Scale

func (img *Image) Scale(factor float64) *Image

Scale scales the image by a percentage (e.g., 0.5 for 50%)

func (*Image) ScaleToHeight

func (img *Image) ScaleToHeight(heightInches float64) *Image

ScaleToHeight scales the image to a specific height while maintaining aspect ratio

func (*Image) ScaleToWidth

func (img *Image) ScaleToWidth(widthInches float64) *Image

ScaleToWidth scales the image to a specific width while maintaining aspect ratio

func (*Image) SetAlignment

func (img *Image) SetAlignment(align properties.ImageAlignment) *Image

SetAlignment sets the horizontal alignment for inline images

func (*Image) SetAltText

func (img *Image) SetAltText(text string) *Image

SetAltText sets the alternative text for accessibility

func (*Image) SetBorder

func (img *Image) SetBorder(width int, color string) *Image

SetBorder adds a border to the image

func (*Image) SetCropping

func (img *Image) SetCropping(top, bottom, left, right float64) *Image

SetCropping sets the crop percentages for each side

func (*Image) SetFloating

func (img *Image) SetFloating(hAnchor properties.HorizontalAnchor, vAnchor properties.VerticalAnchor) *Image

SetFloating makes the image float with specified anchoring

func (*Image) SetOffset

func (img *Image) SetOffset(horizontal, vertical int64) *Image

SetOffset sets the offset for floating images in EMUs

func (*Image) SetOffsetInches

func (img *Image) SetOffsetInches(horizontal, vertical float64) *Image

SetOffsetInches sets the offset for floating images in inches

func (*Image) SetProperties

func (img *Image) SetProperties(props properties.ImageProperties) *Image

SetProperties sets the image properties

func (*Image) SetRotation

func (img *Image) SetRotation(degrees int) *Image

SetRotation sets the rotation angle in degrees

func (*Image) SetShadow

func (img *Image) SetShadow(enabled bool) *Image

SetShadow adds a shadow effect to the image

func (*Image) SetSize

func (img *Image) SetSize(widthInches, heightInches float64) *Image

SetSize sets the image size in inches

func (*Image) SetSizeInCm

func (img *Image) SetSizeInCm(widthCm, heightCm float64) *Image

SetSizeInCm sets the image size in centimeters

func (*Image) SetSizeInPixels

func (img *Image) SetSizeInPixels(widthPx, heightPx int) *Image

SetSizeInPixels sets the image size in pixels (at 96 DPI)

func (*Image) SetTransparency

func (img *Image) SetTransparency(transparency float64) *Image

SetTransparency sets the image transparency (0 to 100)

func (*Image) SetWrapStyle

func (img *Image) SetWrapStyle(wrap properties.WrapStyle) *Image

SetWrapStyle sets how text wraps around the image

func (*Image) TargetPath

func (img *Image) TargetPath() string

TargetPath returns the target path for the image

func (*Image) Type

func (img *Image) Type() string

Type returns the element type

func (*Image) XML

func (img *Image) XML() ([]byte, error)

XML generates the XML representation of the image

type LineBreak

type LineBreak struct {
	Typ   string // Type of break: "textWrapping" (default), "page", "column", "textWrapping"
	Clear string // Clear type for text wrapping: "none", "left", "right", "all"
}

LineBreak represents a line break within a run

func NewColumnBreak

func NewColumnBreak() *LineBreak

NewColumnBreak creates a new column break

func NewLineBreak

func NewLineBreak() *LineBreak

NewLineBreak creates a new line break

func NewTextWrappingBreak

func NewTextWrappingBreak(clear string) *LineBreak

NewTextWrappingBreak creates a line break that clears floating objects

func (*LineBreak) Type

func (lb *LineBreak) Type() string

Type returns the element type

func (*LineBreak) XML

func (lb *LineBreak) XML() ([]byte, error)

XML generates the XML representation

type ListType

type ListType string
const (
	ListTypeBullet  ListType = "Bullet"
	ListTypeDecimal ListType = "Decimal numbering"
	ListTypeLegal   ListType = "Legal numbering"
	ListTypeRoman   ListType = "Roman numerals"
	ListTypeCustom  ListType = "Custom symbols"
)

type MarginValue

type MarginValue struct {
	Width string
	Type  string // dxa, auto
}

MarginValue represents a margin value

type PageBreak

type PageBreak struct{}

PageBreak represents a page break element

func NewPageBreak

func NewPageBreak() *PageBreak

NewPageBreak creates a new page break

func (*PageBreak) Type

func (pb *PageBreak) Type() string

Type returns the element type

func (*PageBreak) XML

func (pb *PageBreak) XML() ([]byte, error)

XML generates the XML representation

type Paragraph

type Paragraph struct {
	Properties *properties.ParagraphProperties
	Children   []ParagraphChild
	// contains filtered or unexported fields
}

Paragraph represents a paragraph element

func NewParagraph

func NewParagraph(document types.Document) *Paragraph

NewParagraph creates a new paragraph

func NewTableCellParagraph

func NewTableCellParagraph(document types.Document) *Paragraph

func (*Paragraph) AddChildren

func (p *Paragraph) AddChildren(child ParagraphChild)

AddChildren

func (*Paragraph) AddFormattedText

func (p *Paragraph) AddFormattedText(text string, format func(*Run)) *Run

AddFormattedText adds text with specific formatting

func (pb *Paragraph) AddHyperlink(text, url string) *Paragraph

AddHyperlink

func (*Paragraph) AddLineBreak

func (p *Paragraph) AddLineBreak() *Paragraph

AddLineBreak adds a paragraph

func (*Paragraph) AddPageBreak

func (p *Paragraph) AddPageBreak() *Paragraph

AddPageBreak adds a page break to the paragraph

func (*Paragraph) AddRun

func (p *Paragraph) AddRun() *Run

AddRun adds a new run to the paragraph

func (*Paragraph) AddText

func (p *Paragraph) AddText(text string) *Run

AddText is a convenience method to add a text run

func (*Paragraph) Clear

func (p *Paragraph) Clear()

Clear removes all content from the paragraph

func (*Paragraph) Clone

func (p *Paragraph) Clone() *Paragraph

Clone creates a deep copy of the paragraph

func (*Paragraph) SetAlignment

func (p *Paragraph) SetAlignment(alignment string) *Paragraph

SetAlignment sets the paragraph alignment

func (*Paragraph) SetBorders

func (p *Paragraph) SetBorders(borders *properties.ParagraphBorders) *Paragraph

SetBorders sets paragraph borders

func (*Paragraph) SetHangingIndent

func (p *Paragraph) SetHangingIndent(hanging float64) *Paragraph

SetHangingIndent sets a hanging indent

func (*Paragraph) SetIndentation

func (p *Paragraph) SetIndentation(left, right, firstLine float64) *Paragraph

SetIndentation sets paragraph indentation

func (*Paragraph) SetKeepLines

func (p *Paragraph) SetKeepLines(keep bool) *Paragraph

SetKeepLines sets whether to keep all lines together

func (*Paragraph) SetKeepNext

func (p *Paragraph) SetKeepNext(keep bool) *Paragraph

SetKeepNext sets whether to keep this paragraph with the next one

func (*Paragraph) SetLineSpacing

func (p *Paragraph) SetLineSpacing(spacing float64, rule string) *Paragraph

SetLineSpacing sets the line spacing

func (*Paragraph) SetNumbering

func (p *Paragraph) SetNumbering(listType ListType, level int) *Paragraph

SetNumbering sets numbering properties

ID: 1 -> Bullet list
ID: 2 -> Decimal numbering
ID: 3 -> Legal numbering
ID: 4 -> Roman numerals
ID: 5 -> Custom symbols

func (*Paragraph) SetOutlineLevel

func (p *Paragraph) SetOutlineLevel(level int) *Paragraph

SetOutlineLevel sets the outline level for TOC

func (*Paragraph) SetPageBreakBefore

func (p *Paragraph) SetPageBreakBefore(pageBreak bool) *Paragraph

SetPageBreakBefore sets whether to insert a page break before

func (*Paragraph) SetShading

func (p *Paragraph) SetShading(shading *properties.ParagraphShading) *Paragraph

SetShading sets paragraph shading

func (*Paragraph) SetSpacing

func (p *Paragraph) SetSpacing(before, after float64) *Paragraph

SetSpacing sets spacing before and after the paragraph

func (*Paragraph) SetStyle

func (p *Paragraph) SetStyle(styleID string) *Paragraph

SetStyle sets the paragraph style

func (*Paragraph) SetTabs

func (p *Paragraph) SetTabs(tabs []properties.TabStop) *Paragraph

SetTabs sets custom tab stops

func (*Paragraph) SetWidowControl

func (p *Paragraph) SetWidowControl(control bool) *Paragraph

SetWidowControl sets widow/orphan control

func (*Paragraph) Type

func (p *Paragraph) Type() string

Type returns the element type

func (*Paragraph) Validate

func (p *Paragraph) Validate() error

Validate checks if the paragraph is valid

func (*Paragraph) XML

func (p *Paragraph) XML() ([]byte, error)

XML generates the XML representation of the paragraph

type ParagraphChild

type ParagraphChild interface {
	Type() string
	XML() ([]byte, error)
}

ParagraphChild interface for elements that can be children of a paragraph

type Run

type Run struct {
	Properties *properties.RunProperties
	Children   []RunChild
}

Run represents a run of text with consistent formatting

func NewRun

func NewRun() *Run

NewRun creates a new run

func (*Run) AddBreak

func (r *Run) AddBreak() *Run

AddBreak adds a line break

func (*Run) AddPageBreak

func (r *Run) AddPageBreak() *Run

AddPageBreak

func (*Run) AddSpace

func (r *Run) AddSpace(count int) *Run

AddSpace adds exactly N space characters (preserved)

func (*Run) AddTab

func (r *Run) AddTab() *Run

AddTab adds a tab character

func (*Run) AddText

func (r *Run) AddText(text string) *Run

AddText adds text to the run

func (*Run) Clone

func (r *Run) Clone() *Run

Clone creates a deep copy of the run

func (*Run) HasFormatting

func (r *Run) HasFormatting() bool

HasFormatting returns true if the run has any formatting applied

func (*Run) SetAllCaps

func (r *Run) SetAllCaps(allCaps bool) *Run

SetAllCaps sets the all caps property

func (*Run) SetBold

func (r *Run) SetBold(bold bool) *Run

SetBold sets the bold property

func (*Run) SetColor

func (r *Run) SetColor(color string) *Run

SetColor sets the text color (hex format, e.g., "FF0000" for red)

func (*Run) SetDoubleStrike

func (r *Run) SetDoubleStrike(doubleStrike bool) *Run

SetDoubleStrike sets the double strikethrough property

func (*Run) SetEmboss

func (r *Run) SetEmboss(emboss bool) *Run

SetEmboss sets the emboss property

func (*Run) SetFontFamily

func (r *Run) SetFontFamily(font string) *Run

SetFontFamily sets the font family

func (*Run) SetFontSize

func (r *Run) SetFontSize(size float64) *Run

SetFontSize sets the font size in points

func (*Run) SetHighlight

func (r *Run) SetHighlight(color string) *Run

SetHighlight sets the highlight color Values: "yellow", "green", "cyan", "magenta", "blue", "red", "darkBlue",

"darkCyan", "darkGreen", "darkMagenta", "darkRed", "darkYellow",
"darkGray", "lightGray", "black", "none"

func (*Run) SetImprint

func (r *Run) SetImprint(imprint bool) *Run

SetImprint sets the imprint/engrave property

func (*Run) SetItalic

func (r *Run) SetItalic(italic bool) *Run

SetItalic sets the italic property

func (*Run) SetKerning

func (r *Run) SetKerning(kerning float64) *Run

SetKerning sets the kerning in points

func (*Run) SetOutline

func (r *Run) SetOutline(outline bool) *Run

SetOutline sets the outline property

func (*Run) SetShadow

func (r *Run) SetShadow(shadow bool) *Run

SetShadow sets the shadow property

func (*Run) SetSmallCaps

func (r *Run) SetSmallCaps(smallCaps bool) *Run

SetSmallCaps sets the small caps property

func (*Run) SetSpacing

func (r *Run) SetSpacing(spacing int) *Run

SetSpacing sets the character spacing in twips (1/20th of a point)

func (*Run) SetStrike

func (r *Run) SetStrike(strike bool) *Run

SetStrike sets the strikethrough property

func (*Run) SetStyle

func (r *Run) SetStyle(styleID string) *Run

SetStyle sets the character style

func (*Run) SetUnderline

func (r *Run) SetUnderline(underline string) *Run

SetUnderline sets the underline property Values: "single", "double", "thick", "dotted", "dash", "dotDash", "dotDotDash", "wave"

func (*Run) SetVanish

func (r *Run) SetVanish(vanish bool) *Run

SetVanish sets the vanish/hidden property

func (*Run) SetVerticalAlign

func (r *Run) SetVerticalAlign(align string) *Run

SetVerticalAlign sets the vertical alignment Values: "baseline", "superscript", "subscript"

func (*Run) Type

func (r *Run) Type() string

Type returns the element type

func (*Run) Validate

func (r *Run) Validate() error

Validate checks if the run is valid

func (*Run) XML

func (r *Run) XML() ([]byte, error)

XML generates the XML representation of the run

type RunChild

type RunChild interface {
	Type() string
	XML() ([]byte, error)
}

RunChild interface for elements that can be children of a run

type Tab

type Tab struct {
	Position  int    // Position in twips (optional, for positional tabs)
	Alignment string // Alignment: "left", "center", "right", "decimal", "bar"
	Leader    string // Leader character: "dot", "hyphen", "underscore", "heavy", "middleDot"
}

Tab represents a tab character

func NewPositionalTab

func NewPositionalTab(position int, alignment string) *Tab

NewPositionalTab creates a tab at a specific position

func NewTab

func NewTab() *Tab

NewTab creates a new tab

func (*Tab) SetAlignment

func (t *Tab) SetAlignment(alignment string) *Tab

SetAlignment sets the tab alignment

func (*Tab) SetLeader

func (t *Tab) SetLeader(leader string) *Tab

SetLeader sets the tab leader character

func (*Tab) SetPosition

func (t *Tab) SetPosition(position int) *Tab

SetPosition sets the tab position in twips

func (*Tab) Type

func (t *Tab) Type() string

Type returns the element type

func (*Tab) XML

func (t *Tab) XML() ([]byte, error)

XML generates the XML representation

type Table

type Table struct {
	Properties *TableProperties
	Grid       *TableGrid
	Rows       []*TableRow
	// contains filtered or unexported fields
}

Table represents a table element in a Word document

func NewTable

func NewTable(document types.Document, rows, cols int) *Table

NewTable creates a new table with specified rows and columns

func (*Table) AddRow

func (t *Table) AddRow() *TableRow

AddRow adds a new row to the table

func (*Table) MergeCells

func (t *Table) MergeCells(row, startCol, endCol int) error

MergeCells merges cells horizontally

func (*Table) SetCellFormattedText

func (t *Table) SetCellFormattedText(row, col int, text string, format func(*Run)) error

SetCellFormattedText sets formatted text in a specific cell

func (*Table) SetCellShading

func (t *Table) SetCellShading(row, col int, color string) error

SetCellShading sets background color for a cell

func (*Table) SetCellText

func (t *Table) SetCellText(row, col int, text string) error

SetCellText sets text in a specific cell

func (*Table) SetCellVerticalAlignment

func (t *Table) SetCellVerticalAlignment(row, col int, alignment VerticalAlign) error

SetCellVerticalAlignment sets vertical alignment for a cell

func (*Table) SetColumnWidth

func (t *Table) SetColumnWidth(col int, width string) error

SetColumnWidth sets the width of a specific column

func (*Table) SetHeaderRow

func (t *Table) SetHeaderRow(row int) error

SetHeaderRow marks a row as a header row

func (*Table) SetRowHeight

func (t *Table) SetRowHeight(row int, height string, rule string) error

SetRowHeight sets the height of a specific row

func (*Table) SetTableAlignment

func (t *Table) SetTableAlignment(alignment TableAlign)

SetTableAlignment sets table alignment (left, center, right)

func (*Table) SetTableWidth

func (t *Table) SetTableWidth(widthType, value string)

SetTableWidth sets the overall table width

func (*Table) Type

func (t *Table) Type() string

Type returns the element type

func (*Table) XML

func (t *Table) XML() ([]byte, error)

XML generates the XML representation of the table

type TableAlign

type TableAlign string

Horizontal alignment options

const (
	AlignLeft    TableAlign = "left" // not shown in Word UI, but valid
	AlignCenterH TableAlign = "center"
	AlignRight   TableAlign = "right"
	AlignJustify TableAlign = "both"
)

type TableAlignment

type TableAlignment struct {
	Value TableAlign // left, center, right
}

TableAlignment represents table alignment

type TableBorders

type TableBorders struct {
	Top     *BorderStyle
	Left    *BorderStyle
	Bottom  *BorderStyle
	Right   *BorderStyle
	InsideH *BorderStyle
	InsideV *BorderStyle
}

TableBorders represents table borders

func DefaultTableBorders

func DefaultTableBorders() *TableBorders

DefaultTableBorders returns default table borders

type TableCell

type TableCell struct {
	Properties *TableCellProperties
	Paragraphs []*Paragraph
}

TableCell represents a table cell

type TableCellBorders

type TableCellBorders struct {
	Top    *BorderStyle
	Left   *BorderStyle
	Bottom *BorderStyle
	Right  *BorderStyle
}

TableCellBorders represents cell borders

type TableCellMargin

type TableCellMargin struct {
	Top    *MarginValue
	Left   *MarginValue
	Bottom *MarginValue
	Right  *MarginValue
}

TableCellMargin represents table cell margins

type TableCellMargins

type TableCellMargins struct {
	Top    *MarginValue
	Left   *MarginValue
	Bottom *MarginValue
	Right  *MarginValue
}

TableCellMargins represents individual cell margins

type TableCellProperties

type TableCellProperties struct {
	Width         *TableCellWidth
	GridSpan      int
	VerticalMerge *VerticalMerge
	Borders       *TableCellBorders
	Shading       *TableCellShading
	Margins       *TableCellMargins
	VerticalAlign VerticalAlign // top, center, bottom
}

TableCellProperties represents table cell properties

type TableCellShading

type TableCellShading struct {
	Value string // clear, solid
	Color string
	Fill  string
}

TableCellShading represents cell shading

type TableCellSpacing

type TableCellSpacing struct {
	Width string
	Type  string
}

TableCellSpacing represents cell spacing

type TableCellWidth

type TableCellWidth struct {
	Type  string // auto, dxa, pct
	Value string
}

TableCellWidth represents cell width

type TableGrid

type TableGrid struct {
	Columns []*TableGridCol
}

TableGrid represents table grid

type TableGridCol

type TableGridCol struct {
	Width string
}

TableGridCol represents a table grid column

type TableIndent

type TableIndent struct {
	Width string
	Type  string
}

TableIndent represents table indentation

type TableLook

type TableLook struct {
	FirstRow    string
	LastRow     string
	FirstColumn string
	LastColumn  string
	NoHBand     string
	NoVBand     string
}

TableLook represents table look properties

type TableProperties

type TableProperties struct {
	Width       *TableWidth
	Alignment   *TableAlignment
	Borders     *TableBorders
	CellMargin  *TableCellMargin
	Style       *TableStyle
	Look        *TableLook
	CellSpacing *TableCellSpacing
	Indent      *TableIndent
}

TableProperties represents table properties

type TableRow

type TableRow struct {
	Properties *TableRowProperties
	Cells      []*TableCell
}

TableRow represents a table row

type TableRowHeight

type TableRowHeight struct {
	Value string
	Rule  string // auto, exact, atLeast
}

TableRowHeight represents row height

type TableRowProperties

type TableRowProperties struct {
	Height      *TableRowHeight
	CantSplit   bool
	TableHeader bool
}

TableRowProperties represents table row properties

type TableStyle

type TableStyle struct {
	Value string
}

TableStyle represents table style reference

type TableWidth

type TableWidth struct {
	Type  string // auto, dxa, pct
	Value string
}

TableWidth represents table width

type Text

type Text struct {
	Value         string
	PreserveSpace bool
}

Text represents text content

func NewText

func NewText(value string) *Text

NewText creates a new text element

func (*Text) Type

func (t *Text) Type() string

Type returns the element type

func (*Text) XML

func (t *Text) XML() ([]byte, error)

XML generates the XML representation of the text

type VerticalAlign

type VerticalAlign string

Vertical alignment options

const (
	AlignTop    VerticalAlign = "top"
	AlignCenter VerticalAlign = "center"
	AlignBottom VerticalAlign = "bottom"
)

type VerticalMerge

type VerticalMerge struct {
	Value string // restart, continue
}

VerticalMerge represents vertical cell merge

Jump to

Keyboard shortcuts

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