document

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: 40 Imported by: 0

Documentation

Overview

Package document provides creation, reading, and writing of ECMA 376 Open Office XML documents.

Example:

doc := document.New()
para := doc.AddParagraph()
run := para.AddRun()
run.SetText("foo")
doc.SaveToFile("foo.docx")

Index

Constants

View Source
const (
	FieldCurrentPage   = "\u0050\u0041\u0047\u0045"
	FieldNumberOfPages = "\u004e\u0055\u004d\u0050\u0041\u0047\u0045\u0053"
	FieldDate          = "\u0044\u0041\u0054\u0045"
	FieldCreateDate    = "\u0043\u0052\u0045\u0041\u0054\u0045\u0044\u0041\u0054\u0045"
	FieldEditTime      = "\u0045\u0044\u0049\u0054\u0054\u0049\u004d\u0045"
	FieldPrintDate     = "\u0050R\u0049\u004e\u0054\u0044\u0041\u0054E"
	FieldSaveDate      = "\u0053\u0041\u0056\u0045\u0044\u0041\u0054\u0045"
	FieldTIme          = "\u0054\u0049\u004d\u0045"
	FieldTOC           = "\u0054\u004f\u0043"
)

Variables

View Source
var (
	FootnoteTextStyleId = "\u0046\u006f\u006ft\u006e\u006f\u0074\u0065\u0054\u0065\u0078\u0074"

	EndnoteTextStyleId = "E\u006e\u0064\u006e\u006f\u0074\u0065\u0054\u0065\u0078\u0074"
)

Functions

This section is empty.

Types

type AnchorDrawWrapOptions

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

AnchorDrawWrapOptions is options to set wrapPolygon for wrap text through and tight.

func NewAnchorDrawWrapOptions

func NewAnchorDrawWrapOptions() *AnchorDrawWrapOptions

NewAnchorDrawWrapOptions return anchor drawing options property.

func (AnchorDrawWrapOptions) GetWrapPathLineTo

func (_dbd AnchorDrawWrapOptions) GetWrapPathLineTo() []*_ff.CT_Point2D

GetWrapPathLineTo return wrapPath lineTo value.

func (AnchorDrawWrapOptions) GetWrapPathStart

func (_cgac AnchorDrawWrapOptions) GetWrapPathStart() *_ff.CT_Point2D

GetWrapPathStart return wrapPath start value.

func (AnchorDrawWrapOptions) SetFollowImageShape

func (_agbg AnchorDrawWrapOptions) SetFollowImageShape(val bool)

SetFollowImageShape sets wrapPath to follow image shape, if nil return wrapPath that follow image size.

func (AnchorDrawWrapOptions) SetWrapPathLineTo

func (_dfb AnchorDrawWrapOptions) SetWrapPathLineTo(coordinates []*_ff.CT_Point2D)

SetWrapPathLineTo sets wrapPath lineTo value.

func (AnchorDrawWrapOptions) SetWrapPathStart

func (_dbb AnchorDrawWrapOptions) SetWrapPathStart(coordinate *_ff.CT_Point2D)

SetWrapPathStart sets wrapPath start value.

type AnchoredDrawing

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

AnchoredDrawing is an absolutely positioned image within a document page.

func (AnchoredDrawing) GetImage

func (_fbc AnchoredDrawing) GetImage() (_aff.ImageRef, bool)

GetImage returns the ImageRef associated with an AnchoredDrawing.

func (AnchoredDrawing) GetSize

func (_abb AnchoredDrawing) GetSize() (_df, _aea int64)

GetSize return the size of anchor on the page.

func (AnchoredDrawing) Set3DRotationImageEffect

func (_ecc AnchoredDrawing) Set3DRotationImageEffect()

Set3DRotationImageEffect sets the 3D rotation image effect.

func (AnchoredDrawing) SetAlignment

func (_egg AnchoredDrawing) SetAlignment(h _afb.WdST_AlignH, v _afb.WdST_AlignV)

SetAlignment positions an anchored image via alignment. Offset is incompatible with SetOffset, whichever is called last is applied.

func (AnchoredDrawing) SetAllowOverlapAttr

func (_gfg AnchoredDrawing) SetAllowOverlapAttr(val bool)

SetAllowOverlapAttr sets the allowOverlap attribute of anchor.

func (AnchoredDrawing) SetBehindDoc

func (_bd AnchoredDrawing) SetBehindDoc(val bool)

SetBehindDoc sets the behindDoc attribute of anchor.

func (AnchoredDrawing) SetBevelImageEffect

func (_bge AnchoredDrawing) SetBevelImageEffect()

SetBevelImageEffect sets the glow image effect.

func (AnchoredDrawing) SetBorder

func (_dgb AnchoredDrawing) SetBorder(borderType _ff.ST_PresetLineDashVal, c _aa.Color, thickness _gf.Distance)

SetBorder sets the border of anchor.

func (AnchoredDrawing) SetGlowImageEffect

func (_aeg AnchoredDrawing) SetGlowImageEffect(radius _gf.Distance, c _aa.Color)

SetGlowImageEffect sets the glow image effect.

func (AnchoredDrawing) SetHAlignment

func (_agb AnchoredDrawing) SetHAlignment(h _afb.WdST_AlignH)

SetHAlignment sets the horizontal alignment for an anchored image.

func (AnchoredDrawing) SetId

func (_db AnchoredDrawing) SetId(id uint32)

SetId sets the id of the image.

func (AnchoredDrawing) SetInnerShadowImageEffect

func (_fg AnchoredDrawing) SetInnerShadowImageEffect(radius, offset _gf.Distance, c _aa.Color, degrees float64)

SetInnerShadowImageEffect sets the inner shadow image effect.

func (AnchoredDrawing) SetLayoutInCell

func (_aba AnchoredDrawing) SetLayoutInCell(val bool)

SetLayoutInCell sets the layoutInCell attribute of anchor.

func (AnchoredDrawing) SetName

func (_be AnchoredDrawing) SetName(name string)

SetName sets the name of the image, visible in the properties of the image within Word.

func (AnchoredDrawing) SetOffset

func (_bgd AnchoredDrawing) SetOffset(x, y _gf.Distance)

SetOffset sets the offset of the image relative to the origin, which by default this is the top-left corner of the page. Offset is incompatible with SetAlignment, whichever is called last is applied.

func (AnchoredDrawing) SetOrigin

func (_ee AnchoredDrawing) SetOrigin(h _afb.WdST_RelFromH, v _afb.WdST_RelFromV)

SetOrigin sets the origin of the image. It defaults to ST_RelFromHPage and ST_RelFromVPage

func (AnchoredDrawing) SetOuterShadowImageEffect

func (_fa AnchoredDrawing) SetOuterShadowImageEffect(radius, offset _gf.Distance, c _aa.Color, degrees float64)

SetOuterShadowImageEffect sets the outer shadow image effect.

func (AnchoredDrawing) SetReflectionImageEffect

func (_dba AnchoredDrawing) SetReflectionImageEffect(radius _gf.Distance, opacity, size float64)

SetReflectionImageEffect sets the reflection image effect.

func (AnchoredDrawing) SetSize

func (_ddd AnchoredDrawing) SetSize(w, h _gf.Distance)

SetSize sets the size of the displayed image on the page.

func (AnchoredDrawing) SetSoftEdgeImageEffect

func (_ede AnchoredDrawing) SetSoftEdgeImageEffect(radius _gf.Distance)

SetSoftEdgeImageEffect sets the soft edge image effect.

func (AnchoredDrawing) SetTextWrapBehindText

func (_gbf AnchoredDrawing) SetTextWrapBehindText()

SetTextWrapBehindText sets the text wrap to behind text.

func (AnchoredDrawing) SetTextWrapInFrontOfText

func (_dfe AnchoredDrawing) SetTextWrapInFrontOfText()

SetTextWrapInFrontOfText sets the text wrap to in front of text.

func (AnchoredDrawing) SetTextWrapNone

func (_gg AnchoredDrawing) SetTextWrapNone()

SetTextWrapNone unsets text wrapping so the image can float on top of the text. When used in conjunction with X/Y Offset relative to the page it can be used to place a logo at the top of a page at an absolute position that doesn't interfere with text.

func (AnchoredDrawing) SetTextWrapSquare

func (_afa AnchoredDrawing) SetTextWrapSquare(t _afb.WdST_WrapText)

SetTextWrapSquare sets the text wrap to square with a given wrap type.

func (AnchoredDrawing) SetTextWrapThrough

func (_ea AnchoredDrawing) SetTextWrapThrough(option *AnchorDrawWrapOptions)

SetTextWrapThrough sets the text wrap to through with a give wrap type.

func (AnchoredDrawing) SetTextWrapTight

func (_gd AnchoredDrawing) SetTextWrapTight(option *AnchorDrawWrapOptions)

SetTextWrapTight sets the text wrap to tight with a give wrap type.

func (AnchoredDrawing) SetTextWrapTopAndBottom

func (_ed AnchoredDrawing) SetTextWrapTopAndBottom()

SetTextWrapTopAndBottom sets the text wrap to top and bottom.

func (AnchoredDrawing) SetVAlignment

func (_fdg AnchoredDrawing) SetVAlignment(v _afb.WdST_AlignV)

SetVAlignment sets the vertical alignment for an anchored image.

func (AnchoredDrawing) SetXOffset

func (_bga AnchoredDrawing) SetXOffset(x _gf.Distance)

SetXOffset sets the X offset for an image relative to the origin.

func (AnchoredDrawing) SetYOffset

func (_cg AnchoredDrawing) SetYOffset(y _gf.Distance)

SetYOffset sets the Y offset for an image relative to the origin.

func (AnchoredDrawing) X

func (_cac AnchoredDrawing) X() *_afb.WdAnchor

X returns the inner wrapped XML type.

type Bookmark

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

Bookmark is a bookmarked location within a document that can be referenced with a hyperlink.

func (Bookmark) Name

func (_aacd Bookmark) Name() string

Name returns the name of the bookmark whcih is the document unique ID that identifies the bookmark.

func (Bookmark) SetName

func (_bda Bookmark) SetName(name string)

SetName sets the name of the bookmark. This is the name that is used to reference the bookmark from hyperlinks.

func (Bookmark) X

func (_afge Bookmark) X() *_afb.CT_Bookmark

X returns the inner wrapped XML type.

type Cell

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

Cell is a table cell within a document (not a spreadsheet)

func (Cell) AddParagraph

func (_cfab Cell) AddParagraph() Paragraph

AddParagraph adds a paragraph to the table cell.

func (Cell) AddTable

func (_ffa Cell) AddTable() Table

AddTable adds a table to the table cell.

func (Cell) Paragraphs

func (_afgf Cell) Paragraphs() []Paragraph

Paragraphs returns the paragraphs defined in the cell.

func (Cell) Properties

func (_ebb Cell) Properties() CellProperties

Properties returns the cell properties.

func (Cell) X

func (_dfef Cell) X() *_afb.CT_Tc

X returns the inner wrapped XML type.

type CellBorders

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

CellBorders are the borders for an individual

func (CellBorders) SetAll

func (_adg CellBorders) SetAll(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetAll sets all of the borders to a given value.

func (CellBorders) SetBottom

func (_fae CellBorders) SetBottom(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetBottom sets the bottom border to a specified type, color and thickness.

func (CellBorders) SetInsideHorizontal

func (_bgg CellBorders) SetInsideHorizontal(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetInsideHorizontal sets the interior horizontal borders to a specified type, color and thickness.

func (CellBorders) SetInsideVertical

func (_dbf CellBorders) SetInsideVertical(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetInsideVertical sets the interior vertical borders to a specified type, color and thickness.

func (CellBorders) SetLeft

func (_gdd CellBorders) SetLeft(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetLeft sets the left border to a specified type, color and thickness.

func (CellBorders) SetRight

func (_dbbd CellBorders) SetRight(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetRight sets the right border to a specified type, color and thickness.

func (CellBorders) SetTop

func (_egb CellBorders) SetTop(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetTop sets the top border to a specified type, color and thickness.

func (CellBorders) X

func (_eefd CellBorders) X() *_afb.CT_TcBorders

X returns the inner wrapped type

type CellMargins

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

CellMargins are the margins for an individual cell.

func (CellMargins) SetBottom

func (_ddda CellMargins) SetBottom(d _gf.Distance)

SetBottom sets the cell bottom margin

func (CellMargins) SetBottomPct

func (_caga CellMargins) SetBottomPct(pct float64)

SetBottomPct sets the cell bottom margin

func (CellMargins) SetLeft

func (_fda CellMargins) SetLeft(d _gf.Distance)

SetLeft sets the cell left margin

func (CellMargins) SetLeftPct

func (_gffa CellMargins) SetLeftPct(pct float64)

SetLeftPct sets the cell left margin

func (CellMargins) SetRight

func (_eeb CellMargins) SetRight(d _gf.Distance)

SetRight sets the cell right margin

func (CellMargins) SetRightPct

func (_bbe CellMargins) SetRightPct(pct float64)

SetRightPct sets the cell right margin

func (CellMargins) SetStart

func (_aecc CellMargins) SetStart(d _gf.Distance)

SetStart sets the cell start margin

func (CellMargins) SetStartPct

func (_dab CellMargins) SetStartPct(pct float64)

SetStartPct sets the cell start margin

func (CellMargins) SetTop

func (_fc CellMargins) SetTop(d _gf.Distance)

SetTop sets the cell top margin

func (CellMargins) SetTopPct

func (_fgg CellMargins) SetTopPct(pct float64)

SetTopPct sets the cell top margin

type CellProperties

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

CellProperties are a table cells properties within a document.

func (CellProperties) Borders

func (_bgfa CellProperties) Borders() CellBorders

Borders allows controlling individual cell borders.

func (CellProperties) Margins

func (_cbd CellProperties) Margins() CellMargins

Margins allows controlling individual cell margins.

func (CellProperties) SetColumnSpan

func (_egd CellProperties) SetColumnSpan(cols int)

SetColumnSpan sets the number of Grid Columns Spanned by the Cell. This is used to give the appearance of merged cells.

func (CellProperties) SetShading

func (_ccg CellProperties) SetShading(shd _afb.ST_Shd, foreground, fill _aa.Color)

SetShading controls the cell shading.

func (CellProperties) SetVerticalAlignment

func (_ddee CellProperties) SetVerticalAlignment(align _afb.ST_VerticalJc)

SetVerticalAlignment sets the vertical alignment of content within a table cell.

func (CellProperties) SetVerticalMerge

func (_add CellProperties) SetVerticalMerge(mergeVal _afb.ST_Merge)

SetVerticalMerge controls the vertical merging of cells.

func (CellProperties) SetWidth

func (_afc CellProperties) SetWidth(d _gf.Distance)

SetWidth sets the cell width to a specified width.

func (CellProperties) SetWidthAuto

func (_age CellProperties) SetWidthAuto()

SetWidthAuto sets the the cell width to automatic.

func (CellProperties) SetWidthPercent

func (_efc CellProperties) SetWidthPercent(pct float64)

SetWidthPercent sets the cell to a width percentage.

func (CellProperties) X

func (_bgb CellProperties) X() *_afb.CT_TcPr

X returns the inner wrapped XML type.

type Color

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

Color controls the run or styles color.

func (Color) SetColor

func (_cceg Color) SetColor(v _aa.Color)

SetColor sets a specific color or auto.

func (Color) SetThemeColor

func (_dfa Color) SetThemeColor(t _afb.ST_ThemeColor)

SetThemeColor sets the color from the theme.

func (Color) SetThemeShade

func (_gca Color) SetThemeShade(s uint8)

SetThemeShade sets the shade based off the theme color.

func (Color) X

func (_cgag Color) X() *_afb.CT_Color

X returns the inner wrapped XML type.

type Comment

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

Comment is run's comment component.

func (Comment) AddParagraph

func (_dca Comment) AddParagraph() Paragraph

AddParagraph adds a paragraph to the comment.

func (Comment) X

func (_gdb Comment) X() *_afb.CT_Comment

X returns the inner wrapped XML type.

type DocText

type DocText struct {
	Items []TextItem
	// contains filtered or unexported fields
}

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

func (*DocText) Text

func (_feedd *DocText) Text() string

Text returns text from the document as one string separated with line breaks.

func (*DocText) TextWithOptions

func (_dfdc *DocText) TextWithOptions(options ExtractTextOptions) string

TextWithOptions extract text with options.

type Document

type Document struct {
	_aff.DocBase

	Settings  Settings
	Numbering Numbering
	Styles    Styles
	// contains filtered or unexported fields
}

Document is a text document that can be written out in the OOXML .docx format. It can be opened from a file on disk and modified, or created from scratch.

func New

func New() *Document

New constructs an empty document that content can be added to.

func Open

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

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

func OpenTemplate

func OpenTemplate(filename string) (*Document, error)

OpenTemplate opens a document, removing all content so it can be used as a template. Since Word removes unused styles from a document upon save, to create a template in Word add a paragraph with every style of interest. When opened with OpenTemplate the document's styles will be available but the content will be gone.

func Read

func Read(r _af.ReaderAt, size int64) (*Document, error)

Read reads a document from an io.Reader.

func (*Document) AddFooter

func (_dege *Document) AddFooter() Footer

AddFooter creates a Footer associated with the document, but doesn't add it to the document for display.

func (*Document) AddHeader

func (_gbc *Document) AddHeader() Header

AddHeader creates a header associated with the document, but doesn't add it to the document for display.

func (_aadd Document) AddHyperlink(url string) _aff.Hyperlink

AddHyperlink adds a hyperlink to a document. Adding the hyperlink to a document and setting it on a cell is more efficient than setting hyperlinks directly on a cell.

func (*Document) AddImage

func (_dcga *Document) AddImage(i _aff.Image) (_aff.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 (*Document) AddParagraph

func (_dda *Document) AddParagraph() Paragraph

AddParagraph adds a new paragraph to the document body.

func (*Document) AddTable

func (_aeca *Document) AddTable() Table

AddTable adds a new table to the document body.

func (*Document) AddWatermarkPicture

func (_ffde *Document) AddWatermarkPicture(imageRef _aff.ImageRef) WatermarkPicture

AddWatermarkPicture adds new watermark picture to document.

func (*Document) AddWatermarkText

func (_bedg *Document) AddWatermarkText(text string) WatermarkText

AddWatermarkText adds new watermark text to the document.

func (*Document) Append

func (_aaad *Document) Append(d1orig *Document) error

Append appends a document d0 to a document d1. All settings, headers and footers remain the same as in the document d0 if they exist there, otherwise they are taken from the d1.

func (*Document) AppendNode

func (_deddd *Document) AppendNode(node Node)

AppendNode append node to document element.

func (*Document) BodySection

func (_bcdf *Document) BodySection() Section

BodySection returns the default body section used for all preceding paragraphs until the previous Section. If there is no previous sections, the body section applies to the entire document.

func (Document) Bookmarks

func (_abcf Document) Bookmarks() []Bookmark

Bookmarks returns all the bookmarks defined in the document.

func (*Document) Close

func (_cacg *Document) Close() error

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

func (*Document) Comment

func (_bdfe *Document) Comment(id int64) Comment

Comment returns comment associated with given id.

func (*Document) Comments

func (_cebe *Document) Comments() []Comment

Comments get list of comments in the document.

func (*Document) Copy

func (_abgg *Document) Copy() (*Document, error)

Copy makes a deep copy of the document by saving and reading it back. It can be useful to avoid sharing common data between two documents.

func (*Document) DocRels

func (_eabaa *Document) DocRels() _aff.Relationships

DocRels returns document relationship.

func (*Document) Endnote

func (_fffc *Document) Endnote(id int64) Endnote

Endnote returns the endnote based on the ID; this can be used nicely with the run.IsEndnote() functionality.

func (*Document) Endnotes

func (_eeeb *Document) Endnotes() []Endnote

Endnotes returns the endnotes defined in the document.

func (*Document) ExtractText

func (_caffe *Document) ExtractText() *DocText

ExtractText returns text from the document as a DocText object.

func (*Document) FontTable

func (_daed *Document) FontTable() *_afb.Fonts

FontTable returns document fontTable element.

func (*Document) Footers

func (_beb *Document) Footers() []Footer

Footers returns the footers defined in the document.

func (*Document) Footnote

func (_cgeda *Document) Footnote(id int64) Footnote

Footnote returns the footnote based on the ID; this can be used nicely with the run.IsFootnote() functionality.

func (*Document) Footnotes

func (_egdbc *Document) Footnotes() []Footnote

Footnotes returns the footnotes defined in the document.

func (*Document) FormFields

func (_cebfb *Document) FormFields() []FormField

FormFields extracts all the fields from a document. They can then be manipulated via the methods on the field and the document saved.

func (*Document) GetChartSpaceByRelId

func (_bcdc *Document) GetChartSpaceByRelId(relId string) *_ba.ChartSpace

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

func (*Document) GetDocRelTargetByID

func (_cegbf *Document) GetDocRelTargetByID(idAttr string) string

GetDocRelTargetByID returns TargetAttr of document relationship given its IdAttr.

func (*Document) GetFontBytesByRelId

func (_bbfc *Document) GetFontBytesByRelId(relID string) ([]byte, error)

func (*Document) GetHeaderFooterImageObjByRelId

func (_fgda *Document) GetHeaderFooterImageObjByRelId(relId string, isHeader, isFooter bool) (_aff.Image, error)

GetHeaderFooterImageObjByRelId returns a common.Image with the associated relation ID in the document, its header or footer.

func (*Document) GetImageByRelID

func (_dgfc *Document) GetImageByRelID(relID string) (_aff.ImageRef, bool)

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

func (*Document) GetImageObjByRelId

func (_cccc *Document) GetImageObjByRelId(relId string) (_aff.Image, error)

GetImageObjByRelId returns a common.Image with the associated relation ID in the document.

func (*Document) GetNumberingLevelByIds

func (_agfa *Document) GetNumberingLevelByIds(numId, levelId int64) NumberingLevel

GetNumberingLevelByIds returns a NumberingLevel by its NumId and LevelId attributes or an empty one if not found.

func (*Document) GetStyleByID

func (_cbefa *Document) GetStyleByID(id string) Style

GetStyleByID returns Style by it is IdAttr.

func (*Document) GetTargetByRelId

func (_ebdeb *Document) GetTargetByRelId(idAttr string) string

GetTargetByRelId returns a target path with the associated relation ID in the document.

func (*Document) HasComments

func (_ffdg *Document) HasComments() bool

HasComments checks if the document contains comments.

func (*Document) HasEndnotes

func (_gfcb *Document) HasEndnotes() bool

HasEndnotes returns a bool based on the presence or abscence of endnotes within the document.

func (*Document) HasFootnotes

func (_aedd *Document) HasFootnotes() bool

HasFootnotes returns a bool based on the presence or abscence of footnotes within the document.

func (*Document) Headers

func (_daa *Document) Headers() []Header

Headers returns the headers defined in the document.

func (*Document) InsertParagraphAfter

func (_faed *Document) InsertParagraphAfter(relativeTo Paragraph) Paragraph

InsertParagraphAfter adds a new empty paragraph after the relativeTo paragraph.

func (*Document) InsertParagraphBefore

func (_bedc *Document) InsertParagraphBefore(relativeTo Paragraph) Paragraph

InsertParagraphBefore adds a new empty paragraph before the relativeTo paragraph.

func (*Document) InsertTableAfter

func (_edg *Document) InsertTableAfter(relativeTo Paragraph) Table

func (*Document) InsertTableBefore

func (_ecb *Document) InsertTableBefore(relativeTo Paragraph) Table

func (*Document) MailMerge

func (_dbcb *Document) MailMerge(mergeContent map[string]string)

MailMerge finds mail merge fields and replaces them with the text provided. It also removes the mail merge source info from the document settings.

func (Document) MergeFields

func (_bcff Document) MergeFields() []string

MergeFields returns the list of all mail merge fields found in the document.

func (*Document) Nodes

func (_cgfbe *Document) Nodes() Nodes

Nodes return the document's element as nodes.

func (*Document) Paragraphs

func (_ggga *Document) Paragraphs() []Paragraph

Paragraphs returns all the paragraphs in the document body including tables.

func (*Document) PutNodeAfter

func (_cdca *Document) PutNodeAfter(relativeTo, node Node)

PutNodeAfter put node to position after relativeTo.

func (*Document) PutNodeBefore

func (_fdag *Document) PutNodeBefore(relativeTo, node Node)

PutNodeBefore put node to position before relativeTo.

func (*Document) RemoveComment

func (_ecbf *Document) RemoveComment(id int64) bool

RemoveComment will remove comment with a given id from the document.

func (*Document) RemoveParagraph

func (_beba *Document) RemoveParagraph(p Paragraph)

RemoveParagraph removes a paragraph from a document.

func (*Document) RemoveTable

func (_faa *Document) RemoveTable(tbl Table)

RemoveTable remove table element from document.

func (*Document) Save

func (_afd *Document) Save(w _af.Writer) error

Save writes the document to an io.Writer in the Zip package format.

func (*Document) SaveToFile

func (_gffae *Document) SaveToFile(path string) error

SaveToFile writes the document out to a file.

func (Document) SetConformance

func (_gbbg Document) SetConformance(conformanceAttr _dg.ST_ConformanceClass)

SetConformance sets conformance attribute of the document as one of these values from github.com/golgys0621/gooffice/schema/soo/ofc/sharedTypes: ST_ConformanceClassUnset, ST_ConformanceClassStrict or ST_ConformanceClassTransitional.

func (Document) SetStrict

func (_dbce Document) SetStrict(strict bool)

SetStrict is a shortcut for document.SetConformance, as one of these values from github.com/golgys0621/gooffice/schema/soo/ofc/sharedTypes: ST_ConformanceClassUnset, ST_ConformanceClassStrict or ST_ConformanceClassTransitional.

func (*Document) StructuredDocumentTags

func (_debf *Document) StructuredDocumentTags() []StructuredDocumentTag

StructuredDocumentTags returns the structured document tags in the document which are commonly used in document templates.

func (*Document) Tables

func (_dbe *Document) Tables() []Table

Tables returns the tables defined in the document.

func (*Document) Themes

func (_edaa *Document) Themes() []*_ff.Theme

Themes returns document's themes.

func (*Document) Validate

func (_aaea *Document) Validate() error

Validate validates the structure and in cases where it's possible, the ranges of elements within a document. A validation error doesn't mean that the document won't work in MS Word or LibreOffice, but it's worth checking into.

func (*Document) X

func (_cgfg *Document) X() *_afb.Document

X returns the inner wrapped XML type.

type DrawingInfo

type DrawingInfo struct {
	Drawing *_afb.CT_Drawing
	Width   int64
	Height  int64
}

DrawingInfo is used for keep information about a drawing wrapping a textbox where the text is located.

type Endnote

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

Endnote is an individual endnote reference within the document.

func (Endnote) AddParagraph

func (_dcaa Endnote) AddParagraph() Paragraph

AddParagraph adds a paragraph to the endnote.

func (Endnote) Paragraphs

func (_baea Endnote) Paragraphs() []Paragraph

Paragraphs returns the paragraphs defined in an endnote.

func (Endnote) RemoveParagraph

func (_cfgff Endnote) RemoveParagraph(p Paragraph)

RemoveParagraph removes a paragraph from the endnote.

func (Endnote) X

func (_bgdf Endnote) X() *_afb.CT_FtnEdn

X returns the inner wrapped XML type.

type ExtractTextOptions

type ExtractTextOptions struct {

	// WithNumbering extract numbering elements if set to `true`.
	WithNumbering bool

	// NumberingIndent default value of numbering indent.
	NumberingIndent string

	// RunsOnNewLine write each of runs text on new line if set to `true`.
	RunsOnNewLine bool
}

ExtractTextOptions extraction text options.

type Fonts

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

Fonts allows manipulating a style or run's fonts.

func (Fonts) SetASCIITheme

func (_efcgf Fonts) SetASCIITheme(t _afb.ST_Theme)

SetASCIITheme sets the font ASCII Theme.

func (Fonts) SetCSTheme

func (_gdeb Fonts) SetCSTheme(t _afb.ST_Theme)

SetCSTheme sets the font complex script theme.

func (Fonts) SetEastAsiaTheme

func (_cgfad Fonts) SetEastAsiaTheme(t _afb.ST_Theme)

SetEastAsiaTheme sets the font East Asia Theme.

func (Fonts) SetHANSITheme

func (_debd Fonts) SetHANSITheme(t _afb.ST_Theme)

SetHANSITheme sets the font H ANSI Theme.

func (Fonts) X

func (_ecbg Fonts) X() *_afb.CT_Fonts

X returns the inner wrapped XML type.

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

Footer is a footer for a document section.

func (Footer) AddImage

func (_ccdc Footer) AddImage(i _aff.Image) (_aff.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 (Footer) AddParagraph

func (_bbad Footer) AddParagraph() Paragraph

AddParagraph adds a paragraph to the footer.

func (Footer) AddTable

func (_afcggf Footer) AddTable() Table

AddTable adds a table to the footer.

func (Footer) Clear

func (_dfbe Footer) Clear()

Clear clears all content within a footer

func (Footer) Index

func (_fgecg Footer) Index() int

Index returns the index of the footer within the document. This is used to form its zip packaged filename as well as to match it with its relationship ID.

func (Footer) Paragraphs

func (_fcbdg Footer) Paragraphs() []Paragraph

Paragraphs returns the paragraphs defined in a footer.

func (Footer) RemoveParagraph

func (_gbcc Footer) RemoveParagraph(p Paragraph)

RemoveParagraph removes a paragraph from a footer.

func (Footer) Tables

func (_aeba Footer) Tables() []Table

Tables returns the tables defined in the footer.

func (Footer) X

func (_abfaa Footer) X() *_afb.Ftr

X returns the inner wrapped XML type.

type Footnote

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

Footnote is an individual footnote reference within the document.

func (Footnote) AddParagraph

func (_baeag Footnote) AddParagraph() Paragraph

AddParagraph adds a paragraph to the footnote.

func (Footnote) Paragraphs

func (_eeaec Footnote) Paragraphs() []Paragraph

Paragraphs returns the paragraphs defined in a footnote.

func (Footnote) RemoveParagraph

func (_cbdb Footnote) RemoveParagraph(p Paragraph)

RemoveParagraph removes a paragraph from the footnote.

func (Footnote) X

func (_agce Footnote) X() *_afb.CT_FtnEdn

X returns the inner wrapped XML type.

type FormField

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

FormField is a form within a document. It references the document, so changes to the form field wil be reflected in the document if it is saved.

func (FormField) IsChecked

func (_abee FormField) IsChecked() bool

IsChecked returns true if a FormFieldTypeCheckBox is checked.

func (FormField) Name

func (_dfge FormField) Name() string

Name returns the name of the field.

func (FormField) PossibleValues

func (_afaa FormField) PossibleValues() []string

PossibleValues returns the possible values for a FormFieldTypeDropDown.

func (FormField) SetCalcOnExit

func (_bcabc FormField) SetCalcOnExit(calcOnExit bool)

SetCalcOnExit marks if a FormField should be CalcOnExit or not.

func (FormField) SetChecked

func (_dcgag FormField) SetChecked(b bool)

SetChecked marks a FormFieldTypeCheckBox as checked or unchecked.

func (FormField) SetDefaultValue

func (_bfgfd FormField) SetDefaultValue(v string)

SetDefaultValue sets the default value of a FormFieldTypeDropDown. For FormFieldTypeDropDown, the value must be one of the fields possible values.

func (FormField) SetEnabled

func (_agafa FormField) SetEnabled(enabled bool)

SetEnabled marks a FormField as enabled or disabled.

func (FormField) SetName

func (_afffc FormField) SetName(name string)

SetName marks sets a name attribute for a FormField.

func (FormField) SetPossibleValues

func (_ebfe FormField) SetPossibleValues(values []string)

SetPossibleValues sets possible values for a FormFieldTypeDropDown.

func (FormField) SetSize

func (_ccfed FormField) SetSize(size uint64)

SetSize sets size attribute for a FormFieldTypeCheckBox in pt.

func (FormField) SetValue

func (_bgbe FormField) SetValue(v string)

SetValue sets the value of a FormFieldTypeText or FormFieldTypeDropDown. For FormFieldTypeDropDown, the value must be one of the fields possible values.

func (FormField) Type

func (_deeff FormField) Type() FormFieldType

Type returns the type of the field.

func (FormField) Value

func (_cebb FormField) Value() string

Value returns the string value of a FormFieldTypeText or FormFieldTypeDropDown.

type FormFieldType

type FormFieldType byte

FormFieldType is the type of the form field.

const (
	FormFieldTypeUnknown FormFieldType = iota
	FormFieldTypeText
	FormFieldTypeCheckBox
	FormFieldTypeDropDown
)

func (FormFieldType) String

func (_edegf FormFieldType) String() string
type Header struct {
	// contains filtered or unexported fields
}

Header is a header for a document section.

func (Header) AddImage

func (_bgad Header) AddImage(i _aff.Image) (_aff.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 (Header) AddImageRef

func (_bcacd Header) AddImageRef(r _aff.ImageRef) (_aff.ImageRef, error)

AddImageRef add ImageRef to header as relationship, returning ImageRef that can be used to be placed as header content.

func (Header) AddParagraph

func (_bfdaa Header) AddParagraph() Paragraph

AddParagraph adds a paragraph to the header.

func (Header) AddTable

func (_fede Header) AddTable() Table

AddTable adds a table to the header.

func (Header) Clear

func (_gba Header) Clear()

Clear clears all content within a header

func (Header) Index

func (_fggaa Header) Index() int

Index returns the index of the header within the document. This is used to form its zip packaged filename as well as to match it with its relationship ID.

func (Header) Paragraphs

func (_daeag Header) Paragraphs() []Paragraph

Paragraphs returns the paragraphs defined in a header.

func (Header) RemoveParagraph

func (_agbf Header) RemoveParagraph(p Paragraph)

RemoveParagraph removes a paragraph from a footer.

func (Header) Tables

func (_ggaeb Header) Tables() []Table

Tables returns the tables defined in the header.

func (Header) X

func (_fgbf Header) X() *_afb.Hdr

X returns the inner wrapped XML type.

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

HyperLink is a link within a document.

func (HyperLink) AddRun

func (_cbgb HyperLink) AddRun() Run

AddRun adds a run of text to a hyperlink. This is the text that will be linked.

func (HyperLink) SetTarget

func (_fffbb HyperLink) SetTarget(url string)

SetTarget sets the URL target of the hyperlink.

func (HyperLink) SetTargetBookmark

func (_daaed HyperLink) SetTargetBookmark(bm Bookmark)

SetTargetBookmark sets the bookmark target of the hyperlink.

func (HyperLink) SetTargetByRef

func (_bggce HyperLink) SetTargetByRef(link _aff.Hyperlink)

SetTargetByRef sets the URL target of the hyperlink and is more efficient if a link destination will be used many times.

func (HyperLink) SetToolTip

func (_ecae HyperLink) SetToolTip(text string)

SetToolTip sets the tooltip text for a hyperlink.

func (HyperLink) X

func (_cdfa HyperLink) X() *_afb.CT_Hyperlink

X returns the inner wrapped XML type.

type InlineDrawing

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

InlineDrawing is an inlined image within a run.

func (InlineDrawing) GetImage

func (_ebef InlineDrawing) GetImage() (_aff.ImageRef, bool)

GetImage returns the ImageRef associated with an InlineDrawing.

func (InlineDrawing) SetSize

func (_degg InlineDrawing) SetSize(w, h _gf.Distance)

SetSize sets the size of the displayed image on the page.

func (InlineDrawing) X

func (_eefg InlineDrawing) X() *_afb.WdInline

X returns the inner wrapped XML type.

type Node

type Node struct {
	Style            Style
	AnchoredDrawings []AnchoredDrawing
	InlineDrawings   []InlineDrawing
	Children         []Node
	// contains filtered or unexported fields
}

Node is document element node, contains Paragraph or Table element.

func (*Node) Clear

func (_fcdf *Node) Clear()

Clear content of node element.

func (*Node) Remove

func (_adee *Node) Remove()

func (*Node) ReplaceText

func (_gabc *Node) ReplaceText(oldText, newText string)

ReplaceText replace the text inside node.

func (*Node) ReplaceTextByRegexp

func (_acdg *Node) ReplaceTextByRegexp(rgx *_d.Regexp, newText string)

ReplaceTextByRegexp replace the text within node using regexp expression.

func (*Node) Text

func (_fbfbb *Node) Text() string

Text return node and its child text,

func (*Node) X

func (_fgde *Node) X() interface{}

X return element of Node as interface, can be either *Paragraph, *Table and Run.

type Nodes

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

Nodes contains slice of Node element.

func (*Nodes) FindNodeByCondition

func (_cfabc *Nodes) FindNodeByCondition(f func(_fbcd *Node) bool, wholeElements bool) []Node

FindNodeByCondition return node based on condition function, if wholeElements is true, its will extract children as next node elements.

func (*Nodes) FindNodeByRegexp

func (_cbge *Nodes) FindNodeByRegexp(r *_d.Regexp) []Node

FindNodeByRegexp return node based on matched text and return a slice of node.

func (*Nodes) FindNodeByStyleId

func (_dgde *Nodes) FindNodeByStyleId(styleId string) []Node

FindNodeByStyleId return slice of node base on style id.

func (*Nodes) FindNodeByStyleName

func (_fddf *Nodes) FindNodeByStyleName(styleName string) []Node

FindNodeByStyleName return slice of node base on style name.

func (*Nodes) FindNodeByText

func (_gdbab *Nodes) FindNodeByText(text string) []Node

FindNodeByText return node based on matched text and return a slice of node.

func (*Nodes) ReplaceText

func (_bagae *Nodes) ReplaceText(oldText, newText string)

ReplaceText replace text inside node.

func (*Nodes) ReplaceTextByRegexp

func (_gafe *Nodes) ReplaceTextByRegexp(expr *_d.Regexp, newText string)

ReplaceTextByRegexp replace text inside node using regexp.

func (*Nodes) X

func (_ebff *Nodes) X() []Node

X return slice of node.

type Numbering

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

Numbering is the document wide numbering styles contained in numbering.xml.

func NewNumbering

func NewNumbering() Numbering

NewNumbering constructs a new numbering.

func (Numbering) AddDefinition

func (_ggfce Numbering) AddDefinition() NumberingDefinition

AddDefinition adds a new numbering definition.

func (Numbering) Clear

func (_fecag Numbering) Clear()

Clear resets the numbering.

func (Numbering) Definitions

func (_aafcc Numbering) Definitions() []NumberingDefinition

Definitions returns the defined numbering definitions.

func (Numbering) InitializeDefault

func (_bccc Numbering) InitializeDefault()

InitializeDefault constructs a default numbering.

func (*Numbering) Restart

func (_ccee *Numbering) Restart(nd *NumberingDefinition)

Restart restarts the numbering

func (Numbering) X

func (_agdcd Numbering) X() *_afb.Numbering

X returns the inner wrapped XML type.

type NumberingDefinition

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

NumberingDefinition defines a numbering definition for a list of pragraphs.

func (NumberingDefinition) AbstractNumberID

func (_gfbgd NumberingDefinition) AbstractNumberID() int64

AbstractNumberID returns the ID that is unique within all numbering definitions that is used to assign the definition to a paragraph.

func (NumberingDefinition) AddLevel

func (_acfae NumberingDefinition) AddLevel() NumberingLevel

AddLevel adds a new numbering level to a NumberingDefinition.

func (NumberingDefinition) Levels

func (_acdcf NumberingDefinition) Levels() []NumberingLevel

Levels returns all of the numbering levels defined in the definition.

func (NumberingDefinition) MultiLevelType

func (_gfad NumberingDefinition) MultiLevelType() _afb.ST_MultiLevelType

MultiLevelType returns the multilevel type, or ST_MultiLevelTypeUnset if not set.

func (NumberingDefinition) SetMultiLevelType

func (_daffd NumberingDefinition) SetMultiLevelType(t _afb.ST_MultiLevelType)

SetMultiLevelType sets the multilevel type.

func (NumberingDefinition) X

X returns the inner wrapped XML type.

type NumberingLevel

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

NumberingLevel is the definition for numbering for a particular level within a NumberingDefinition.

func (NumberingLevel) Properties

func (_cddff NumberingLevel) Properties() ParagraphStyleProperties

Properties returns the numbering level paragraph properties.

func (NumberingLevel) RunProperties

func (_fdbd NumberingLevel) RunProperties() RunProperties

RunProperties returns the RunProperties controlling numbering level font, etc.

func (NumberingLevel) SetAlignment

func (_dddgg NumberingLevel) SetAlignment(j _afb.ST_Jc)

SetAlignment sets the paragraph alignment

func (NumberingLevel) SetFormat

func (_cgef NumberingLevel) SetFormat(f _afb.ST_NumberFormat)

SetFormat sets the numbering format.

func (NumberingLevel) SetText

func (_gadab NumberingLevel) SetText(t string)

SetText sets the text to be used in bullet mode.

func (NumberingLevel) X

func (_acba NumberingLevel) X() *_afb.CT_Lvl

X returns the inner wrapped XML type.

type OnOffValue

type OnOffValue byte

OnOffValue represents an on/off value that can also be unset

const (
	OnOffValueUnset OnOffValue = iota
	OnOffValueOff
	OnOffValueOn
)

type Paragraph

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

Paragraph is a paragraph within a document.

func (Paragraph) AddBookmark

func (_aaabc Paragraph) AddBookmark(name string) Bookmark

AddBookmark adds a bookmark to a document that can then be used from a hyperlink. Name is a document unique name that identifies the bookmark so it can be referenced from hyperlinks.

func (Paragraph) AddCheckBox

func (_deabf Paragraph) AddCheckBox(name string) FormField

AddCheckBox adds checkbox form field to the paragraph and returns it.

func (Paragraph) AddComment

func (_bgbf Paragraph) AddComment(author, commentText string) int64

AddComment add comment to the paragraph.

func (Paragraph) AddDeletedText

func (_gcab Paragraph) AddDeletedText(oldVal, revNum, author string, t _c.Time, id int64)

AddDeletedText add a text deletion to the paragraph specifying its revision number, author and id.

func (Paragraph) AddDropdownList

func (_bebgd Paragraph) AddDropdownList(name string) FormField

AddDropdownList adds dropdown list form field to the paragraph and returns it.

func (Paragraph) AddEndnote

func (_ebaac Paragraph) AddEndnote(text string) Endnote

AddEndnote will create a new endnote and attach it to the Paragraph in the location at the end of the previous run (endnotes create their own run within the paragraph. The text given to the function is simply a convenience helper, paragraphs and runs can always be added to the text of the endnote later.

func (Paragraph) AddFootnote

func (_aecad Paragraph) AddFootnote(text string) Footnote

AddFootnote will create a new footnote and attach it to the Paragraph in the location at the end of the previous run (footnotes create their own run within the paragraph). The text given to the function is simply a convenience helper, paragraphs and runs can always be added to the text of the footnote later.

func (Paragraph) AddHTML

func (_gcfb Paragraph) AddHTML(s string)

AddHTML adds a text that contains HTML tags to a paragraph.

The following tags are supported:

  • <b> or <strong> for bold text
  • <i> or <em> for italic text
  • <u> for underlined text
  • <strike> for strikethrough text
  • <mark> for highlighted text
  • <sub> for subscript text
  • <sup> for superscript text
func (_bdfef Paragraph) AddHyperLink() HyperLink

AddHyperLink adds a new hyperlink to a parapgraph.

func (Paragraph) AddInsertedText

func (_ggfec Paragraph) AddInsertedText(newVal, revNum, author string, t _c.Time, id int64)

AddInsertedText add a text insertion to the paragraph specifying its revision number, author and id.

func (Paragraph) AddRun

func (_cecd Paragraph) AddRun() Run

AddRun adds a run to a paragraph.

func (Paragraph) AddTextInput

func (_addd Paragraph) AddTextInput(name string) FormField

AddTextInput adds text input form field to the paragraph and returns it.

func (Paragraph) Borders

func (_degdf Paragraph) Borders() ParagraphBorders

Borders returns the ParagraphBorders for setting-up border on paragraph.

func (Paragraph) CloseComment

func (_cfdb Paragraph) CloseComment(commentId int64)

CloseComment will close the comment.

func (Paragraph) IgnoreSpaceBetweenParagraphOfSameStyle

func (_caeb Paragraph) IgnoreSpaceBetweenParagraphOfSameStyle()

IgnoreSpaceBetweenParagraphOfSameStyle sets contextual spacing.

func (Paragraph) InsertRunAfter

func (_deffac Paragraph) InsertRunAfter(relativeTo Run) Run

InsertRunAfter inserts a run in the paragraph after the relative run.

func (Paragraph) InsertRunBefore

func (_cfda Paragraph) InsertRunBefore(relativeTo Run) Run

InsertRunBefore inserts a run in the paragraph before the relative run.

func (Paragraph) Numbering

func (_aaaa Paragraph) Numbering() Numbering

Numbering return numbering that being use by paragraph.

func (Paragraph) Properties

func (_abfaf Paragraph) Properties() ParagraphProperties

Properties returns the paragraph properties.

func (Paragraph) RemoveEndnote

func (_acacc Paragraph) RemoveEndnote(id int64)

RemoveEndnote removes a endnote from both the paragraph and the document the requested endnote must be anchored on the paragraph being referenced.

After each removal, the rest of the endnote ids would be reordered.

func (Paragraph) RemoveFootnote

func (_gbffg Paragraph) RemoveFootnote(id int64)

RemoveFootnote removes a footnote from both the paragraph and the document the requested footnote must be anchored on the paragraph being referenced.

After each removal, the rest of the footnote ids would be reordered.

func (Paragraph) RemoveRun

func (_aabe Paragraph) RemoveRun(r Run)

RemoveRun removes a child run from a paragraph.

func (Paragraph) Runs

func (_bedd Paragraph) Runs() []Run

Runs returns all of the runs in a paragraph.

func (Paragraph) SetAfterLineSpacing

func (_gadcg Paragraph) SetAfterLineSpacing(d _gf.Distance)

SetAfterLineSpacing sets spacing below paragraph in line units.

func (Paragraph) SetAfterSpacing

func (_ddcd Paragraph) SetAfterSpacing(d _gf.Distance)

SetAfterSpacing sets spacing below paragraph.

func (Paragraph) SetAlignment

func (_faaee Paragraph) SetAlignment(alignment _afb.ST_Jc)

SetAlignment set alignment of paragraph.

func (Paragraph) SetBeforeLineSpacing

func (_aeddd Paragraph) SetBeforeLineSpacing(d _gf.Distance)

// SetBeforeLineSpacing sets spacing above paragraph in line units.

func (Paragraph) SetBeforeSpacing

func (_bgdd Paragraph) SetBeforeSpacing(d _gf.Distance)

SetBeforeSpacing sets spacing above paragraph.

func (Paragraph) SetFirstLineIndent

func (_bebga Paragraph) SetFirstLineIndent(m _gf.Distance)

SetFirstLineIndent controls the indentation of the first line in a paragraph.

func (Paragraph) SetHangingIndent

func (_gbegg Paragraph) SetHangingIndent(m _gf.Distance)

SetHangingIndent controls special indent of paragraph.

func (Paragraph) SetLeftIndent

func (_gbffa Paragraph) SetLeftIndent(m _gf.Distance)

SetLeftIndent controls left indent of paragraph.

func (Paragraph) SetLineSpacing

func (_bgecg Paragraph) SetLineSpacing(d _gf.Distance, rule _afb.ST_LineSpacingRule)

SetLineSpacing sets the spacing between lines in a paragraph.

func (Paragraph) SetNumberingDefinition

func (_cbcd Paragraph) SetNumberingDefinition(nd NumberingDefinition)

SetNumberingDefinition sets the numbering definition ID via a NumberingDefinition defined in numbering.xml

func (Paragraph) SetNumberingDefinitionByID

func (_dffaa Paragraph) SetNumberingDefinitionByID(abstractNumberID int64)

SetNumberingDefinitionByID sets the numbering definition ID directly, which must match an ID defined in numbering.xml

func (Paragraph) SetNumberingLevel

func (_cbbb Paragraph) SetNumberingLevel(listLevel int)

SetNumberingLevel sets the numbering level of a paragraph. If used, then the NumberingDefinition must also be set via SetNumberingDefinition or SetNumberingDefinitionByID.

func (Paragraph) SetOutlineLvl

func (_dgcbc Paragraph) SetOutlineLvl(lvl int64)

SetOutlineLvl sets outline level of paragraph.

func (Paragraph) SetRightIndent

func (_bgae Paragraph) SetRightIndent(m _gf.Distance)

SetRightIndent controls right indent of paragraph.

func (Paragraph) SetStyle

func (_aaeg Paragraph) SetStyle(s string)

SetStyle sets the style of a paragraph and is identical to setting it on the paragraph's Properties()

func (Paragraph) Style

func (_gcbc Paragraph) Style() string

Style returns the style for a paragraph, or an empty string if it is unset.

func (Paragraph) X

func (_aggea Paragraph) X() *_afb.CT_P

X returns the inner wrapped XML type.

type ParagraphBorders

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

ParagraphBorders allows manipulation of borders on a paragraph.

func (ParagraphBorders) SetAll

func (_egdbab ParagraphBorders) SetAll(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetAll sets all of the borders to a given value.

func (ParagraphBorders) SetBetween

func (_gfgd ParagraphBorders) SetBetween(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetBetween sets the between border to a specified type, color and thickness between paragraph.

func (ParagraphBorders) SetBottom

func (_afbaa ParagraphBorders) SetBottom(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetBottom sets the bottom border to a specified type, color and thickness.

func (ParagraphBorders) SetLeft

func (_fceea ParagraphBorders) SetLeft(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetLeft sets the left border to a specified type, color and thickness.

func (ParagraphBorders) SetRight

func (_cegbb ParagraphBorders) SetRight(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetRight sets the right border to a specified type, color and thickness.

func (ParagraphBorders) SetTop

func (_baaab ParagraphBorders) SetTop(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetTop sets the top border to a specified type, color and thickness.

func (ParagraphBorders) X

func (_gadb ParagraphBorders) X() *_afb.CT_PBdr

X returns the inner wml.CT_PBdr

type ParagraphProperties

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

ParagraphProperties are the properties for a paragraph.

func (ParagraphProperties) AddSection

func (_ddgc ParagraphProperties) AddSection(t _afb.ST_SectionMark) Section

AddSection adds a new document section with an optional section break. If t is ST_SectionMarkUnset, then no break will be inserted.

func (ParagraphProperties) AddTabStop

func (_ffbe ParagraphProperties) AddTabStop(position _gf.Distance, justificaton _afb.ST_TabJc, leader _afb.ST_TabTlc)

AddTabStop adds a tab stop to the paragraph. It controls the position of text when using Run.AddTab()

func (ParagraphProperties) Bold

func (_cfedb ParagraphProperties) Bold() bool

Bold returns true if paragraph font is bold.

func (ParagraphProperties) Caps

func (_caagd ParagraphProperties) Caps() bool

Caps returns true if paragraph font is capitalized.

func (ParagraphProperties) CharacterSpacingMeasure

func (_bbcfg ParagraphProperties) CharacterSpacingMeasure() string

CharacterSpacingMeasure returns paragraph characters spacing with its measure which can be mm, cm, in, pt, pc or pi.

func (ParagraphProperties) CharacterSpacingValue

func (_dgab ParagraphProperties) CharacterSpacingValue() int64

CharacterSpacingValue returns the value of characters spacing in twips (1/20 of point).

func (ParagraphProperties) ComplexSizeMeasure

func (_ebga ParagraphProperties) ComplexSizeMeasure() string

ComplexSizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.

func (ParagraphProperties) ComplexSizeValue

func (_affgd ParagraphProperties) ComplexSizeValue() float64

ComplexSizeValue returns the value of paragraph font size for complex fonts in points.

func (ParagraphProperties) DoubleStrike

func (_bgefd ParagraphProperties) DoubleStrike() bool

DoubleStrike returns true if paragraph is double striked.

func (ParagraphProperties) EastAsiaFont

func (_dgad ParagraphProperties) EastAsiaFont() string

EastAsiaFont returns the name of paragraph font family for East Asia.

func (ParagraphProperties) Emboss

func (_agbc ParagraphProperties) Emboss() bool

Emboss returns true if paragraph emboss is on.

func (ParagraphProperties) Font

func (_bgbd ParagraphProperties) Font() string

Font returns the name of paragraph font family.

func (ParagraphProperties) GetColor

func (_aaac ParagraphProperties) GetColor() _aa.Color

GetColor returns the color.Color object representing the run color.

func (ParagraphProperties) Italic

func (_cbedc ParagraphProperties) Italic() bool

Italic returns true if paragraph font is italic.

func (ParagraphProperties) Outline

func (_gdfg ParagraphProperties) Outline() bool

Outline returns true if paragraph outline is on.

func (ParagraphProperties) RStyle

func (_bbegd ParagraphProperties) RStyle() string

RStyle returns the name of character style. It is defined here http://officeopenxml.com/WPstyleCharStyles.php

func (ParagraphProperties) RightToLeft

func (_cefbd ParagraphProperties) RightToLeft() bool

RightToLeft returns true if paragraph text goes from right to left.

func (ParagraphProperties) Section

func (_egddf ParagraphProperties) Section() (Section, bool)

Section return paragraph properties section value.

func (ParagraphProperties) SetAlignment

func (_gbbbe ParagraphProperties) SetAlignment(align _afb.ST_Jc)

SetAlignment controls the paragraph alignment

func (ParagraphProperties) SetEndIndent

func (_fefd ParagraphProperties) SetEndIndent(m _gf.Distance)

SetEndIndent controls the end indentation.

func (ParagraphProperties) SetFirstLineIndent

func (_efbfc ParagraphProperties) SetFirstLineIndent(m _gf.Distance)

SetFirstLineIndent controls the indentation of the first line in a paragraph.

func (ParagraphProperties) SetHangingIndent

func (_ccef ParagraphProperties) SetHangingIndent(m _gf.Distance)

SetHangingIndent controls the indentation of the non-first lines in a paragraph.

func (ParagraphProperties) SetHeadingLevel

func (_adac ParagraphProperties) SetHeadingLevel(idx int)

SetHeadingLevel sets a heading level and style based on the level to a paragraph. The default styles for a new gooffice document support headings from level 1 to 8.

func (ParagraphProperties) SetKeepOnOnePage

func (_babb ParagraphProperties) SetKeepOnOnePage(b bool)

SetKeepOnOnePage controls if all lines in a paragraph are kept on the same page.

func (ParagraphProperties) SetKeepWithNext

func (_abcadf ParagraphProperties) SetKeepWithNext(b bool)

SetKeepWithNext controls if this paragraph should be kept with the next.

func (ParagraphProperties) SetPageBreakBefore

func (_agbd ParagraphProperties) SetPageBreakBefore(b bool)

SetPageBreakBefore controls if there is a page break before this paragraph.

func (ParagraphProperties) SetSpacing

func (_bdad ParagraphProperties) SetSpacing(before, after _gf.Distance)

SetSpacing sets the spacing that comes before and after the paragraph. Deprecated: See Spacing() instead which allows finer control.

func (ParagraphProperties) SetStartIndent

func (_ggagc ParagraphProperties) SetStartIndent(m _gf.Distance)

SetStartIndent controls the start indentation.

func (ParagraphProperties) SetStyle

func (_bddd ParagraphProperties) SetStyle(s string)

SetStyle sets the style of a paragraph.

func (ParagraphProperties) SetWindowControl

func (_ggcde ParagraphProperties) SetWindowControl(b bool)

SetWindowControl controls if the first or last line of the paragraph is allowed to display on a separate page.

func (ParagraphProperties) Shadow

func (_gecca ParagraphProperties) Shadow() bool

Shadow returns true if paragraph shadow is on.

func (ParagraphProperties) SizeMeasure

func (_fcag ParagraphProperties) SizeMeasure() string

SizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.

func (ParagraphProperties) SizeValue

func (_acdfb ParagraphProperties) SizeValue() float64

SizeValue returns the value of paragraph font size in points.

func (ParagraphProperties) Spacing

func (_ebcc ParagraphProperties) Spacing() ParagraphSpacing

Spacing returns the paragraph spacing settings.

func (ParagraphProperties) Strike

func (_afaag ParagraphProperties) Strike() bool

Strike returns true if paragraph is striked.

func (ParagraphProperties) Style

func (_geddd ParagraphProperties) Style() string

Style returns the style for a paragraph, or an empty string if it is unset.

func (ParagraphProperties) Underline

func (_gdbc ParagraphProperties) Underline() _afb.ST_Underline

Underline returns the type of paragraph underline.

func (ParagraphProperties) UnderlineColor

func (_cdbcb ParagraphProperties) UnderlineColor() string

UnderlineColor returns the hex color value of paragraph underline.

func (ParagraphProperties) VerticalAlignment

func (_gabbf ParagraphProperties) VerticalAlignment() _dg.ST_VerticalAlignRun

VerticalAlign returns the value of paragraph vertical align.

func (ParagraphProperties) X

func (_degcc ParagraphProperties) X() *_afb.CT_PPr

X returns the inner wrapped XML type.

type ParagraphSpacing

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

ParagraphSpacing controls the spacing for a paragraph and its lines.

func (ParagraphSpacing) SetAfter

func (_cdggf ParagraphSpacing) SetAfter(after _gf.Distance)

SetAfter sets the spacing that comes after the paragraph.

func (ParagraphSpacing) SetAfterAuto

func (_baggb ParagraphSpacing) SetAfterAuto(b bool)

SetAfterAuto controls if spacing after a paragraph is automatically determined.

func (ParagraphSpacing) SetBefore

func (_cfff ParagraphSpacing) SetBefore(before _gf.Distance)

SetBefore sets the spacing that comes before the paragraph.

func (ParagraphSpacing) SetBeforeAuto

func (_egbd ParagraphSpacing) SetBeforeAuto(b bool)

SetBeforeAuto controls if spacing before a paragraph is automatically determined.

func (ParagraphSpacing) SetLineSpacing

func (_ddga ParagraphSpacing) SetLineSpacing(d _gf.Distance, rule _afb.ST_LineSpacingRule)

SetLineSpacing sets the spacing between lines in a paragraph.

type ParagraphStyleProperties

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

ParagraphStyleProperties is the styling information for a paragraph.

func (ParagraphStyleProperties) AddTabStop

func (_baffb ParagraphStyleProperties) AddTabStop(position _gf.Distance, justificaton _afb.ST_TabJc, leader _afb.ST_TabTlc)

AddTabStop adds a tab stop to the paragraph.

func (ParagraphStyleProperties) NumId

func (_cgggf ParagraphStyleProperties) NumId() int64

NumId return numbering numId that being use by style properties.

func (ParagraphStyleProperties) SetAlignment

func (_fcdge ParagraphStyleProperties) SetAlignment(align _afb.ST_Jc)

SetAlignment controls the paragraph alignment

func (ParagraphStyleProperties) SetContextualSpacing

func (_ddddg ParagraphStyleProperties) SetContextualSpacing(b bool)

SetContextualSpacing controls whether to Ignore Spacing Above and Below When Using Identical Styles

func (ParagraphStyleProperties) SetFirstLineIndent

func (_ddbc ParagraphStyleProperties) SetFirstLineIndent(m _gf.Distance)

SetFirstLineIndent controls the first line indent of the paragraph.

func (ParagraphStyleProperties) SetHangingIndent

func (_aedf ParagraphStyleProperties) SetHangingIndent(m _gf.Distance)

SetHangingIndent controls the hanging indent of the paragraph.

func (ParagraphStyleProperties) SetKeepNext

func (_bcafe ParagraphStyleProperties) SetKeepNext(b bool)

SetKeepNext controls if the paragraph is kept with the next paragraph.

func (ParagraphStyleProperties) SetKeepOnOnePage

func (_baaac ParagraphStyleProperties) SetKeepOnOnePage(b bool)

SetKeepOnOnePage controls if all lines in a paragraph are kept on the same page.

func (ParagraphStyleProperties) SetLeftIndent

func (_bfdf ParagraphStyleProperties) SetLeftIndent(m _gf.Distance)

SetLeftIndent controls the left indent of the paragraph.

func (ParagraphStyleProperties) SetLineSpacing

func (_cafb ParagraphStyleProperties) SetLineSpacing(m _gf.Distance, rule _afb.ST_LineSpacingRule)

SetLineSpacing controls the line spacing of the paragraph.

func (ParagraphStyleProperties) SetOutlineLevel

func (_eadg ParagraphStyleProperties) SetOutlineLevel(lvl int)

SetOutlineLevel sets the outline level of this style.

func (ParagraphStyleProperties) SetSpacing

func (_dbecf ParagraphStyleProperties) SetSpacing(before, after _gf.Distance)

SetSpacing sets the spacing that comes before and after the paragraph.

func (ParagraphStyleProperties) SetStartIndent

func (_ccge ParagraphStyleProperties) SetStartIndent(m _gf.Distance)

SetStartIndent controls the start indent of the paragraph.

func (ParagraphStyleProperties) X

X returns the inner wrapped XML type.

type Row

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

Row is a row within a table within a document.

func (Row) AddCell

func (_acdgc Row) AddCell() Cell

AddCell adds a cell to a row and returns it

func (Row) Cells

func (_cfeba Row) Cells() []Cell

Cells returns the cells defined in the table.

func (Row) Properties

func (_cfag Row) Properties() RowProperties

Properties returns the row properties.

func (Row) X

func (_defg Row) X() *_afb.CT_Row

X returns the inner wrapped XML type.

type RowProperties

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

RowProperties are the properties for a row within a table

func (RowProperties) SetCantSplit

func (_aeac RowProperties) SetCantSplit(val bool)

SetCantSplit set row properties for Can't Split value.

func (RowProperties) SetHeight

func (_cdfbe RowProperties) SetHeight(ht _gf.Distance, rule _afb.ST_HeightRule)

SetHeight allows controlling the height of a row within a table.

func (RowProperties) SetTblHeader

func (_ggdec RowProperties) SetTblHeader(val bool)

SetTblHeader set row properties for repeat table row on every new page value.

type Run

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

Run is a run of text within a paragraph that shares the same formatting.

func (Run) AddAnnotationReference

func (_dacb Run) AddAnnotationReference()

AddAnnotationReference adds annotation reference to a run.

func (Run) AddBreak

func (_gadcgd Run) AddBreak()

AddBreak adds a line break to a run.

func (Run) AddCommentReference

func (_bdfg Run) AddCommentReference(id int64)

AddCommentReference adds comment reference to a run.

func (Run) AddDrawingAnchored

func (_gfefc Run) AddDrawingAnchored(img _aff.ImageRef) (AnchoredDrawing, error)

AddDrawingAnchored adds an anchored (floating) drawing from an ImageRef.

func (Run) AddDrawingInline

func (_ggbg Run) AddDrawingInline(img _aff.ImageRef) (InlineDrawing, error)

AddDrawingInline adds an inline drawing from an ImageRef.

func (Run) AddEndnoteReference

func (_bfbd Run) AddEndnoteReference()

AddEndnoteReference adds a footnote reference to a run.

func (Run) AddField

func (_cbcfa Run) AddField(code string)

AddField adds a field (automatically computed text) to the document.

func (Run) AddFieldWithFormatting

func (_bfee Run) AddFieldWithFormatting(code string, fmt string, isDirty bool)

AddFieldWithFormatting adds a field (automatically computed text) to the document with field specifc formatting.

func (Run) AddFootnoteReference

func (_fdgbe Run) AddFootnoteReference()

AddFootnoteReference adds a footnote reference to a run.

func (Run) AddHTML

func (_edeed Run) AddHTML(s string)

AddHTML adds HTML text to a run.

func (Run) AddPageBreak

func (_bdfcf Run) AddPageBreak()

AddPageBreak adds a page break to a run.

func (Run) AddTOC

func (_fagg Run) AddTOC(options *TOCOptions)

AddTOC adds a table of contents to the document and customize it according to TOCOptions if necessary.

func (Run) AddTab

func (_cbedbg Run) AddTab()

AddTab adds tab to a run and can be used with the the Paragraph's tab stops.

func (Run) AddText

func (_eeec Run) AddText(s string)

AddText adds text to a run.

func (Run) Clear

func (_agfgg Run) Clear()

Clear removes all the content from within a run.

func (Run) ClearContent

func (_bdbg Run) ClearContent()

ClearContent clears any content in the run (text, tabs, breaks, etc.)

func (Run) Control

func (_acfg Run) Control() *_ag.Control

Control returns an *axcontrol.Control object contained in the run or the nil value in case of no controls.

func (Run) Copy

func (_aegc Run) Copy() Run

Copy returns a copy of the run.

func (Run) DrawingAnchored

func (_ebdee Run) DrawingAnchored() []AnchoredDrawing

DrawingAnchored returns a slice of AnchoredDrawings.

func (Run) DrawingInline

func (_edbd Run) DrawingInline() []InlineDrawing

DrawingInline return a slice of InlineDrawings.

func (Run) IsEndnote

func (_cbcg Run) IsEndnote() (bool, int64)

IsEndnote returns a bool based on whether the run has a footnote or not. Returns both a bool as to whether it has a footnote as well as the ID of the footnote.

func (Run) IsFootnote

func (_bggd Run) IsFootnote() (bool, int64)

IsFootnote returns a bool based on whether the run has a footnote or not. Returns both a bool as to whether it has a footnote as well as the ID of the footnote.

func (Run) Properties

func (_adgbe Run) Properties() RunProperties

Properties returns the run properties.

func (Run) SetProperties

func (_aadba Run) SetProperties(rp RunProperties)

SetProperties sets the `RunProperties` to the `Run` element

func (Run) Text

func (_ededg Run) Text() string

Text returns the underlying text in the run.

func (Run) X

func (_babad Run) X() *_afb.CT_R

X returns the inner wrapped XML type.

type RunProperties

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

RunProperties controls run styling properties.

func (RunProperties) Bold

func (_dfdcc RunProperties) Bold() bool

Bold returns true if run font is bold.

func (RunProperties) BoldValue

func (_fefad RunProperties) BoldValue() OnOffValue

BoldValue returns the precise nature of the bold setting (unset, off or on).

func (RunProperties) Caps

func (_addad RunProperties) Caps() bool

Caps returns true if run font is capitalized.

func (RunProperties) CharacterSpacingMeasure

func (_baceg RunProperties) CharacterSpacingMeasure() string

CharacterSpacingMeasure returns paragraph characters spacing with its measure which can be mm, cm, in, pt, pc or pi.

func (RunProperties) CharacterSpacingValue

func (_aeafd RunProperties) CharacterSpacingValue() int64

CharacterSpacingValue returns the value of run's characters spacing in twips (1/20 of point).

func (RunProperties) ClearColor

func (_eafeb RunProperties) ClearColor()

ClearColor clears the text color.

func (RunProperties) Color

func (_fefbf RunProperties) Color() Color

Color returns the style's Color.

func (RunProperties) ComplexSizeMeasure

func (_gdeg RunProperties) ComplexSizeMeasure() string

ComplexSizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.

func (RunProperties) ComplexSizeValue

func (_gaga RunProperties) ComplexSizeValue() float64

ComplexSizeValue returns the value of run font size for complex fonts in points.

func (RunProperties) DoubleStrike

func (_facdg RunProperties) DoubleStrike() bool

DoubleStrike returns true if run is double striked.

func (RunProperties) EastAsiaFont

func (_aegd RunProperties) EastAsiaFont() string

EastAsiaFont returns the name of run font family for East Asia.

func (RunProperties) Emboss

func (_fegd RunProperties) Emboss() bool

Emboss returns true if run emboss is on.

func (RunProperties) Font

func (_aegagc RunProperties) Font() string

Font returns the name of run font family.

func (RunProperties) Fonts

func (_ceeec RunProperties) Fonts() Fonts

Fonts returns the style's Fonts.

func (RunProperties) GetColor

func (_dfffg RunProperties) GetColor() _aa.Color

GetColor returns the color.Color object representing the run color.

func (RunProperties) GetEffect

func (_dcagc RunProperties) GetEffect() _afb.ST_TextEffect

GetEffect returns the effect of the run.

func (RunProperties) GetHighlight

func (_egbabg RunProperties) GetHighlight() _afb.ST_HighlightColor

GetHighlight returns the HighlightColor.

func (RunProperties) GetKerning

func (_bgaed RunProperties) GetKerning() _gf.Distance

GetKerning returns the kerning (character spacing) of a run

func (RunProperties) GetRightToLeft

func (_gebfd RunProperties) GetRightToLeft() bool

GetRightToLeft returns true if the run text is displayed from right to left.

func (RunProperties) Imprint

func (_egae RunProperties) Imprint() bool

Imprint returns true if run imprint is on.

func (RunProperties) IsBold

func (_feded RunProperties) IsBold() bool

IsBold returns true if the run has been set to bold.

func (RunProperties) IsItalic

func (_ccbf RunProperties) IsItalic() bool

IsItalic returns true if the run has been set to italics.

func (RunProperties) Italic

func (_fgged RunProperties) Italic() bool

Italic returns true if run font is italic.

func (RunProperties) ItalicValue

func (_fbfg RunProperties) ItalicValue() OnOffValue

ItalicValue returns the precise nature of the italic setting (unset, off or on).

func (RunProperties) Outline

func (_acafa RunProperties) Outline() bool

Outline returns true if run outline is on.

func (RunProperties) RStyle

func (_aaccg RunProperties) RStyle() string

RStyle returns the name of character style. It is defined here http://officeopenxml.com/WPstyleCharStyles.php

func (RunProperties) RightToLeft

func (_fbdge RunProperties) RightToLeft() bool

RightToLeft returns true if run text goes from right to left.

func (RunProperties) SetAllCaps

func (_dbbg RunProperties) SetAllCaps(b bool)

SetAllCaps sets the run to all caps.

func (RunProperties) SetBold

func (_cbfgg RunProperties) SetBold(b bool)

SetBold sets the run to bold.

func (RunProperties) SetCharacterSpacing

func (_aabb RunProperties) SetCharacterSpacing(size _gf.Distance)

SetCharacterSpacing sets the run's Character Spacing Adjustment.

func (RunProperties) SetColor

func (_dbbe RunProperties) SetColor(c _aa.Color)

SetColor sets the text color.

func (RunProperties) SetDoubleStrikeThrough

func (_gedf RunProperties) SetDoubleStrikeThrough(b bool)

SetDoubleStrikeThrough sets the run to double strike-through.

func (RunProperties) SetEffect

func (_bgeg RunProperties) SetEffect(e _afb.ST_TextEffect)

SetEffect sets a text effect on the run.

func (RunProperties) SetEmboss

func (_bcgcd RunProperties) SetEmboss(b bool)

SetEmboss sets the run to embossed text.

func (RunProperties) SetFontFamily

func (_cafbe RunProperties) SetFontFamily(family string)

SetFontFamily sets the Ascii & HAnsi fonly family for a run.

func (RunProperties) SetHighlight

func (_acfbc RunProperties) SetHighlight(c _afb.ST_HighlightColor)

SetHighlight highlights text in a specified color.

func (RunProperties) SetImprint

func (_bcgddb RunProperties) SetImprint(b bool)

SetImprint sets the run to imprinted text.

func (RunProperties) SetItalic

func (_dcea RunProperties) SetItalic(b bool)

SetItalic sets the run to italic.

func (RunProperties) SetKerning

func (_bedaa RunProperties) SetKerning(size _gf.Distance)

SetKerning sets the run's font kerning.

func (RunProperties) SetOutline

func (_gacba RunProperties) SetOutline(b bool)

SetOutline sets the run to outlined text.

func (RunProperties) SetRightToLeft

func (_ccgf RunProperties) SetRightToLeft(b bool)

SetRightToLeft sets the run text goes from right to left.

func (RunProperties) SetShadow

func (_bggegd RunProperties) SetShadow(b bool)

SetShadow sets the run to shadowed text.

func (RunProperties) SetSize

func (_bedcg RunProperties) SetSize(size _gf.Distance)

SetSize sets the font size for a run.

func (RunProperties) SetSmallCaps

func (_eeafb RunProperties) SetSmallCaps(b bool)

SetSmallCaps sets the run to small caps.

func (RunProperties) SetStrikeThrough

func (_bccbf RunProperties) SetStrikeThrough(b bool)

SetStrikeThrough sets the run to strike-through.

func (RunProperties) SetStyle

func (_edgg RunProperties) SetStyle(style string)

SetStyle sets the font size.

func (RunProperties) SetUnderline

func (_eaeg RunProperties) SetUnderline(style _afb.ST_Underline, c _aa.Color)

SetUnderline controls underline for a run style.

func (RunProperties) SetVerticalAlignment

func (_dacc RunProperties) SetVerticalAlignment(v _dg.ST_VerticalAlignRun)

SetVerticalAlignment controls the vertical alignment of the run, this is used to control if text is superscript/subscript.

func (RunProperties) Shadow

func (_aefd RunProperties) Shadow() bool

Shadow returns true if run shadow is on.

func (RunProperties) SizeMeasure

func (_gabefc RunProperties) SizeMeasure() string

SizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.

func (RunProperties) SizeValue

func (_cedef RunProperties) SizeValue() float64

SizeValue returns the value of run font size in points.

func (RunProperties) Strike

func (_egafb RunProperties) Strike() bool

Strike returns true if run is striked.

func (RunProperties) Underline

func (_ddea RunProperties) Underline() _afb.ST_Underline

Underline returns the type of run underline.

func (RunProperties) UnderlineColor

func (_dgdg RunProperties) UnderlineColor() string

UnderlineColor returns the hex color value of run underline.

func (RunProperties) VerticalAlignment

func (_ccfb RunProperties) VerticalAlignment() _dg.ST_VerticalAlignRun

VerticalAlign returns the value of run vertical align.

func (RunProperties) X

func (_bceg RunProperties) X() *_afb.CT_RPr

X returns the inner wrapped XML type.

type Section

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

Section is the beginning of a new section.

func (Section) GetFooter

func (_dbfb Section) GetFooter(t _afb.ST_HdrFtr) (Footer, bool)

GetFooter gets a section Footer for given type

func (Section) GetHeader

func (_cbadb Section) GetHeader(t _afb.ST_HdrFtr) (Header, bool)

GetHeader gets a section Header for given type t [ST_HdrFtrDefault, ST_HdrFtrEven, ST_HdrFtrFirst]

func (Section) SetFooter

func (_adeef Section) SetFooter(f Footer, t _afb.ST_HdrFtr)

SetFooter sets a section footer.

func (Section) SetHeader

func (_cdef Section) SetHeader(h Header, t _afb.ST_HdrFtr)

SetHeader sets a section header.

func (Section) SetPageMargins

func (_bcgdc Section) SetPageMargins(top, right, bottom, left, header, footer, gutter _gf.Distance)

SetPageMargins sets the page margins for a section

func (Section) SetPageSizeAndOrientation

func (_edbag Section) SetPageSizeAndOrientation(w, h _gf.Distance, orientation _afb.ST_PageOrientation)

SetPageSizeAndOrientation sets the page size and orientation for a section.

func (Section) X

func (_cbgg Section) X() *_afb.CT_SectPr

X returns the internally wrapped *wml.CT_SectPr.

type Settings

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

Settings controls the document settings.

func NewSettings

func NewSettings() Settings

NewSettings constructs a new empty Settings

func (Settings) RemoveMailMerge

func (_ccag Settings) RemoveMailMerge()

RemoveMailMerge removes any mail merge settings

func (Settings) SetUpdateFieldsOnOpen

func (_cdbb Settings) SetUpdateFieldsOnOpen(b bool)

SetUpdateFieldsOnOpen controls if fields are recalculated upon opening the document. This is useful for things like a table of contents as the library only adds the field code and relies on Word/LibreOffice to actually compute the content.

func (Settings) X

func (_ddfg Settings) X() *_afb.Settings

X returns the inner wrapped XML type.

type StructuredDocumentTag

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

StructuredDocumentTag are a tagged bit of content in a document.

func (StructuredDocumentTag) Alias

func (_gdded StructuredDocumentTag) Alias() string

Alias returns the alias (friendly name) of the structured document tag or empty string if not set.

func (StructuredDocumentTag) Paragraphs

func (_bcdff StructuredDocumentTag) Paragraphs() []Paragraph

Paragraphs returns the paragraphs within a structured document tag.

func (StructuredDocumentTag) Tag

func (_fdbg StructuredDocumentTag) Tag() string

Tag returns the tag (programmatic identifier) of the structured document tag or empty string if not set.

type Style

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

Style is a style within the styles.xml file.

func (Style) Name

func (_gdedg Style) Name() string

Name returns the name of the style if set.

func (Style) ParagraphProperties

func (_acdbg Style) ParagraphProperties() ParagraphStyleProperties

ParagraphProperties returns the paragraph style properties.

func (Style) RunProperties

func (_efae Style) RunProperties() RunProperties

RunProperties returns the run style properties.

func (Style) SetBasedOn

func (_egefc Style) SetBasedOn(name string)

SetBasedOn sets the style that this style is based on.

func (Style) SetLinkedStyle

func (_adcfd Style) SetLinkedStyle(name string)

SetLinkedStyle sets the style that this style is linked to.

func (Style) SetName

func (_fefeb Style) SetName(name string)

SetName sets the name of the style.

func (Style) SetNextStyle

func (_gagbd Style) SetNextStyle(name string)

SetNextStyle sets the style that the next paragraph will use.

func (Style) SetPrimaryStyle

func (_dfabf Style) SetPrimaryStyle(b bool)

SetPrimaryStyle marks the style as a primary style.

func (Style) SetSemiHidden

func (_bfbfc Style) SetSemiHidden(b bool)

SetSemiHidden controls if the style is hidden in the UI.

func (Style) SetUISortOrder

func (_gedba Style) SetUISortOrder(order int)

SetUISortOrder controls the order the style is displayed in the UI.

func (Style) SetUnhideWhenUsed

func (_fdcga Style) SetUnhideWhenUsed(b bool)

SetUnhideWhenUsed controls if a semi hidden style becomes visible when used.

func (Style) StyleID

func (_gdbde Style) StyleID() string

StyleID returns the style ID.

func (Style) TableConditionalFormatting

func (_bcdba Style) TableConditionalFormatting(typ _afb.ST_TblStyleOverrideType) TableConditionalFormatting

TableConditionalFormatting returns a conditional formatting object of a given type. Calling this method repeatedly will return the same object.

func (Style) TableProperties

func (_gbdcd Style) TableProperties() TableStyleProperties

TableProperties returns the table style properties.

func (Style) Type

func (_cdcb Style) Type() _afb.ST_StyleType

Type returns the type of the style.

func (Style) X

func (_fbbb Style) X() *_afb.CT_Style

X returns the inner wrapped XML type.

type Styles

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

Styles is the document wide styles contained in styles.xml.

func NewStyles

func NewStyles() Styles

NewStyles constructs a new empty Styles

func (Styles) AddStyle

func (_bfdfb Styles) AddStyle(styleID string, t _afb.ST_StyleType, isDefault bool) Style

AddStyle adds a new empty style, if styleID is already exists, it will return the style.

func (Styles) Clear

func (_aabga Styles) Clear()

Clear clears the styes.

func (Styles) InitializeDefault

func (_fefc Styles) InitializeDefault()

InitializeDefault constructs the default styles.

func (Styles) InsertStyle

func (_agdg Styles) InsertStyle(ss Style)

InsertStyle insert style to styles.

func (Styles) ParagraphStyles

func (_dggbd Styles) ParagraphStyles() []Style

ParagraphStyles returns only the paragraph styles.

func (Styles) SearchStyleById

func (_cfffe Styles) SearchStyleById(id string) (Style, bool)

SearchStylesById returns style by its id.

func (Styles) SearchStyleByName

func (_gaae Styles) SearchStyleByName(name string) (Style, bool)

SearchStyleByName return style by its name.

func (Styles) Styles

func (_feaed Styles) Styles() []Style

Styles returns all styles.

func (Styles) X

func (_dcedf Styles) X() *_afb.Styles

X returns the inner wrapped XML type.

type TOCOptions

type TOCOptions struct {

	// UseHyperlinks makes the table of contents entries hyperlinks.
	UseHyperlinks bool

	// OmitPageNumbers allows omitting page numbers from the table of contents.
	OmitPageNumbers bool

	// HeadingLevel uses paragraphs formatted with all of the specified range of built-in heading styles.
	// "3-3" is to show only third heading level, for instance.
	HeadingLevel string
}

TOCOptions specify options for table of contents customization.

type Table

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

Table is a table within a document.

func (Table) AddRow

func (_fcdbf Table) AddRow() Row

AddRow adds a row to a table.

func (Table) EnsureGridColumns

func (_bbdg Table) EnsureGridColumns()

EnsureGridColumns ensures that the table has proper TblGrid elements populated. This fixes corruption issues when cells use SetColumnSpan (gridSpan in OOXML). Word requires properly defined TblGrid when any cell uses gridSpan, especially when combined with nested tables. Without this, documents show "Styles 1" errors.

func (Table) InsertRowAfter

func (_ccdgf Table) InsertRowAfter(r Row) Row

InsertRowAfter inserts a row after another row

func (Table) InsertRowBefore

func (_debfe Table) InsertRowBefore(r Row) Row

InsertRowBefore inserts a row before another row

func (Table) Properties

func (_ecab Table) Properties() TableProperties

Properties returns the table properties.

func (Table) Rows

func (_dfad Table) Rows() []Row

Rows returns the rows defined in the table.

func (Table) Style

func (_fgcdef Table) Style() string

Style return the table style.

func (Table) X

func (_dcgab Table) X() *_afb.CT_Tbl

X returns the inner wrapped XML type.

type TableBorders

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

TableBorders allows manipulation of borders on a table.

func (TableBorders) SetAll

func (_bgbca TableBorders) SetAll(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetAll sets all of the borders to a given value.

func (TableBorders) SetBottom

func (_cabg TableBorders) SetBottom(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetBottom sets the bottom border to a specified type, color and thickness.

func (TableBorders) SetInsideHorizontal

func (_acca TableBorders) SetInsideHorizontal(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetInsideHorizontal sets the interior horizontal borders to a specified type, color and thickness.

func (TableBorders) SetInsideVertical

func (_ebgca TableBorders) SetInsideVertical(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetInsideVertical sets the interior vertical borders to a specified type, color and thickness.

func (TableBorders) SetLeft

func (_dfgfa TableBorders) SetLeft(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetLeft sets the left border to a specified type, color and thickness.

func (TableBorders) SetRight

func (_gggb TableBorders) SetRight(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetRight sets the right border to a specified type, color and thickness.

func (TableBorders) SetTop

func (_debad TableBorders) SetTop(t _afb.ST_Border, c _aa.Color, thickness _gf.Distance)

SetTop sets the top border to a specified type, color and thickness.

func (TableBorders) X

func (_aaeag TableBorders) X() *_afb.CT_TblBorders

X returns the inner wml.CT_TblBorders

type TableConditionalFormatting

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

TableConditionalFormatting controls the conditional formatting within a table style.

func (TableConditionalFormatting) CellProperties

func (_bfbdg TableConditionalFormatting) CellProperties() CellProperties

CellProperties returns the cell properties.

func (TableConditionalFormatting) ParagraphProperties

func (_bebda TableConditionalFormatting) ParagraphProperties() ParagraphStyleProperties

ParagraphProperties returns the paragraph properties controlling text formatting within the table.

func (TableConditionalFormatting) RunProperties

func (_deac TableConditionalFormatting) RunProperties() RunProperties

RunProperties returns the run properties controlling text formatting within the table.

func (TableConditionalFormatting) X

X returns the inner wrapped XML type.

type TableInfo

type TableInfo struct {
	Table    *_afb.CT_Tbl
	Row      *_afb.CT_Row
	Cell     *_afb.CT_Tc
	RowIndex int
	ColIndex int
}

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

type TableLook

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

TableLook is the conditional formatting associated with a table style that has been assigned to a table.

func (TableLook) SetFirstColumn

func (_bdegd TableLook) SetFirstColumn(on bool)

SetFirstColumn controls the conditional formatting for the first column in a table.

func (TableLook) SetFirstRow

func (_ddbb TableLook) SetFirstRow(on bool)

SetFirstRow controls the conditional formatting for the first row in a table.

func (TableLook) SetHorizontalBanding

func (_gbad TableLook) SetHorizontalBanding(on bool)

SetHorizontalBanding controls the conditional formatting for horizontal banding.

func (TableLook) SetLastColumn

func (_gggee TableLook) SetLastColumn(on bool)

SetLastColumn controls the conditional formatting for the last column in a table.

func (TableLook) SetLastRow

func (_cbcbc TableLook) SetLastRow(on bool)

SetLastRow controls the conditional formatting for the last row in a table. This is called the 'Total' row within Word.

func (TableLook) SetVerticalBanding

func (_bfgd TableLook) SetVerticalBanding(on bool)

SetVerticalBanding controls the conditional formatting for vertical banding.

func (TableLook) X

func (_aaegf TableLook) X() *_afb.CT_TblLook

X returns the inner wrapped XML type.

type TableProperties

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

TableProperties are the properties for a table within a document

func (TableProperties) Borders

func (_ddbe TableProperties) Borders() TableBorders

Borders allows manipulation of the table borders.

func (TableProperties) SetAlignment

func (_adea TableProperties) SetAlignment(align _afb.ST_JcTable)

SetAlignment sets the alignment of a table within the page.

func (TableProperties) SetCellSpacing

func (_fcdc TableProperties) SetCellSpacing(m _gf.Distance)

SetCellSpacing sets the cell spacing within a table.

func (TableProperties) SetCellSpacingAuto

func (_eeeaf TableProperties) SetCellSpacingAuto()

SetCellSpacingAuto sets the cell spacing within a table to automatic.

func (TableProperties) SetCellSpacingPercent

func (_gcfab TableProperties) SetCellSpacingPercent(pct float64)

SetCellSpacingPercent sets the cell spacing within a table to a percent width.

func (TableProperties) SetLayout

func (_baadb TableProperties) SetLayout(l _afb.ST_TblLayoutType)

SetLayout controls the table layout. wml.ST_TblLayoutTypeAutofit corresponds to "Automatically resize to fit contents" being checked, while wml.ST_TblLayoutTypeFixed corresponds to it being unchecked.

func (TableProperties) SetStyle

func (_ggbc TableProperties) SetStyle(name string)

SetStyle sets the table style name.

func (TableProperties) SetWidth

func (_dfdaa TableProperties) SetWidth(d _gf.Distance)

SetWidth sets the table with to a specified width.

func (TableProperties) SetWidthAuto

func (_edddg TableProperties) SetWidthAuto()

SetWidthAuto sets the the table width to automatic.

func (TableProperties) SetWidthPercent

func (_aadbf TableProperties) SetWidthPercent(pct float64)

SetWidthPercent sets the table to a width percentage.

func (TableProperties) TableLook

func (_bdeeg TableProperties) TableLook() TableLook

TableLook returns the table look, or conditional formatting applied to a table style.

func (TableProperties) X

func (_ggad TableProperties) X() *_afb.CT_TblPr

X returns the inner wrapped XML type.

type TableStyleProperties

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

TableStyleProperties are table properties as defined in a style.

func (TableStyleProperties) Borders

func (_ecbce TableStyleProperties) Borders() TableBorders

Borders allows manipulation of the table borders.

func (TableStyleProperties) SetCellSpacingAuto

func (_gcabe TableStyleProperties) SetCellSpacingAuto()

SetCellSpacingAuto sets the cell spacing within a table to automatic.

func (TableStyleProperties) SetCellSpacingPercent

func (_gbae TableStyleProperties) SetCellSpacingPercent(pct float64)

SetCellSpacingPercent sets the cell spacing within a table to a percent width.

func (TableStyleProperties) SetColumnBandSize

func (_edfd TableStyleProperties) SetColumnBandSize(cols int64)

SetColumnBandSize sets the number of Columns in the column band

func (TableStyleProperties) SetRowBandSize

func (_gfggb TableStyleProperties) SetRowBandSize(rows int64)

SetRowBandSize sets the number of Rows in the row band

func (TableStyleProperties) SetTableIndent

func (_gedga TableStyleProperties) SetTableIndent(ind _gf.Distance)

SetTableIndent sets the Table Indent from the Leading Margin

func (TableStyleProperties) X

X returns the inner wrapped XML type.

type TableWidth

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

TableWidth controls width values in table settings.

func NewTableWidth

func NewTableWidth() TableWidth

NewTableWidth returns a newly intialized TableWidth

func (TableWidth) SetValue

func (_fcce TableWidth) SetValue(m _gf.Distance)

SetValue sets the width value.

func (TableWidth) X

func (_gcadb TableWidth) X() *_afb.CT_TblWidth

X returns the inner wrapped XML type.

type TextItem

type TextItem struct {
	Text        string
	DrawingInfo *DrawingInfo
	Paragraph   *_afb.CT_P
	Hyperlink   *_afb.CT_Hyperlink
	Run         *_afb.CT_R
	TableInfo   *TableInfo
}

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

func ExtractFromFooter

func ExtractFromFooter(footer *_afb.Ftr) []TextItem

ExtractFromFooter returns text from the document footer as an array of TextItems.

func ExtractFromHeader

func ExtractFromHeader(header *_afb.Hdr) []TextItem

ExtractFromHeader returns text from the document header as an array of TextItems.

type WatermarkPicture

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

WatermarkPicture is watermark picture within document.

func NewWatermarkPicture

func NewWatermarkPicture() WatermarkPicture

NewWatermarkPicture generates new WatermarkPicture.

func (*WatermarkPicture) GetShapeStyle

func (_dfeg *WatermarkPicture) GetShapeStyle() _de.ShapeStyle

GetShapeStyle returns string style of the shape in watermark and format it to ShapeStyle.

func (*WatermarkPicture) Pict

func (_efdce *WatermarkPicture) Pict() *_afb.CT_Picture

Pict returns the pict object.

func (*WatermarkPicture) SetPicture

func (_aabgg *WatermarkPicture) SetPicture(imageRef _aff.ImageRef)

SetPicture sets the watermark picture.

func (*WatermarkPicture) SetPictureSize

func (_gdag *WatermarkPicture) SetPictureSize(width, height int64)

SetPictureSize set watermark picture size with given width and height.

func (*WatermarkPicture) SetPictureWashout

func (_dgeb *WatermarkPicture) SetPictureWashout(isWashout bool)

SetPictureWashout set washout to watermark picture.

func (*WatermarkPicture) SetShapeStyle

func (_gdbce *WatermarkPicture) SetShapeStyle(shapeStyle _de.ShapeStyle)

SetShapeStyle sets style to the element v:shape in watermark.

type WatermarkText

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

WatermarkText is watermark text within the document.

func NewWatermarkText

func NewWatermarkText() WatermarkText

NewWatermarkText generates a new WatermarkText.

func (*WatermarkText) EnableDiagonalLayout

func (_bgadc *WatermarkText) EnableDiagonalLayout(value bool)

SetDiagonalLayout enables or disables diagonal layout. By default, diagonal layout is disabled and we have horizontal layout.

func (*WatermarkText) GetStyle

func (_badec *WatermarkText) GetStyle() _de.TextpathStyle

GetStyle returns string style of the text in watermark and format it to TextpathStyle.

func (*WatermarkText) GetText

func (_afgfa *WatermarkText) GetText() string

GetText returns text in the watermark.

func (*WatermarkText) Pict

func (_acgg *WatermarkText) Pict() *_afb.CT_Picture

Pict returns the pict object.

func (*WatermarkText) SetColor

func (_afggb *WatermarkText) SetColor(value string)

SetColor sets color of watermark text.

func (*WatermarkText) SetFontFamily

func (_befd *WatermarkText) SetFontFamily(value string)

SetFontFamily sets font family of watermark text.

func (*WatermarkText) SetFontSize

func (_gbcfd *WatermarkText) SetFontSize(value int64)

SetFontSize sets font size of watermark text.

func (*WatermarkText) SetOpacity

func (_egfbd *WatermarkText) SetOpacity(value float64)

SetOpacity sets opacity of watermark text in range 0.0 - 1.0, where is 1.0 is the default value.

func (*WatermarkText) SetStyle

func (_faeeb *WatermarkText) SetStyle(style _de.TextpathStyle)

SetStyle sets style to the text in watermark.

func (*WatermarkText) SetText

func (_aacga *WatermarkText) SetText(text string)

SetText sets the watermark text.

func (*WatermarkText) SetTextStyleBold

func (_fafe *WatermarkText) SetTextStyleBold(value bool)

SetTextStyleBold sets text style of watermark to bold.

func (*WatermarkText) SetTextStyleItalic

func (_egbda *WatermarkText) SetTextStyleItalic(value bool)

SetTextStyleItalic sets text style of watermark to italic.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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