unioffice

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: OSL-3.0 Imports: 25 Imported by: 0

README

UniOffice

Library for creating and processing Office Word (.docx) documents

https://github.com/unidoc/unioffice-examples/blob/master/document/merge-documents/main.go

Documentation

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

This section is empty.

Functions

This section is empty.

Types

type AnchoredDrawing

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

AnchoredDrawing is an absolutely positioned image within a document page.

func (AnchoredDrawing) GetImage

func (_cfg AnchoredDrawing) GetImage() (common.ImageRef, bool)

GetImage returns the ImageRef associated with an AnchoredDrawing.

func (AnchoredDrawing) SetAlignment

func (_ggf AnchoredDrawing) SetAlignment(h wml.WdST_AlignH, v wml.WdST_AlignV)

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

func (AnchoredDrawing) SetHAlignment

func (_gcb AnchoredDrawing) SetHAlignment(h wml.WdST_AlignH)

SetHAlignment sets the horizontal alignment for an anchored image.

func (AnchoredDrawing) SetName

func (_fe AnchoredDrawing) SetName(name string)

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

func (AnchoredDrawing) SetOffset

func (_fg AnchoredDrawing) SetOffset(x, y measurement.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 (_ed AnchoredDrawing) SetOrigin(h wml.WdST_RelFromH, v wml.WdST_RelFromV)

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

func (AnchoredDrawing) SetSize

func (_fgd AnchoredDrawing) SetSize(w, h measurement.Distance)

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

func (AnchoredDrawing) SetTextWrapNone

func (_gaa 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 (_cfa AnchoredDrawing) SetTextWrapSquare(t wml.WdST_WrapText)

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

func (AnchoredDrawing) SetVAlignment

func (_cgc AnchoredDrawing) SetVAlignment(v wml.WdST_AlignV)

SetVAlignment sets the vertical alignment for an anchored image.

func (AnchoredDrawing) SetXOffset

func (_ef AnchoredDrawing) SetXOffset(x measurement.Distance)

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

func (AnchoredDrawing) SetYOffset

func (_da AnchoredDrawing) SetYOffset(y measurement.Distance)

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

func (AnchoredDrawing) X

func (_gcg AnchoredDrawing) X() *wml.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 (_bge Bookmark) Name() string

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

func (Bookmark) SetName

func (_ee 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 (_ae Bookmark) X() *wml.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 (_af Cell) AddParagraph() Paragraph

AddParagraph adds a paragraph to the table cell.

func (Cell) AddTable

func (_efc Cell) AddTable() Table

AddTable adds a table to the table cell.

func (Cell) Paragraphs

func (_de Cell) Paragraphs() []Paragraph

Paragraphs returns the paragraphs defined in the cell.

func (Cell) Properties

func (_ec Cell) Properties() CellProperties

Properties returns the cell properties.

func (Cell) X

func (_gab Cell) X() *wml.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 (_aea CellBorders) SetAll(t wml.ST_Border, c color.Color, thickness measurement.Distance)

SetAll sets all of the borders to a given value.

func (CellBorders) SetBottom

func (_beeb CellBorders) SetBottom(t wml.ST_Border, c color.Color, thickness measurement.Distance)

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

func (CellBorders) SetInsideHorizontal

func (_bbcf CellBorders) SetInsideHorizontal(t wml.ST_Border, c color.Color, thickness measurement.Distance)

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

func (CellBorders) SetInsideVertical

func (_eg CellBorders) SetInsideVertical(t wml.ST_Border, c color.Color, thickness measurement.Distance)

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

func (CellBorders) SetLeft

func (_fa CellBorders) SetLeft(t wml.ST_Border, c color.Color, thickness measurement.Distance)

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

func (CellBorders) SetRight

func (_gbc CellBorders) SetRight(t wml.ST_Border, c color.Color, thickness measurement.Distance)

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

func (CellBorders) SetTop

func (_bbc CellBorders) SetTop(t wml.ST_Border, c color.Color, thickness measurement.Distance)

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

func (CellBorders) X

func (_bee CellBorders) X() *wml.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 (_cff CellMargins) SetBottom(d measurement.Distance)

SetBottom sets the cell bottom margin

func (CellMargins) SetBottomPct

func (_eb CellMargins) SetBottomPct(pct float64)

SetBottomPct sets the cell bottom margin

func (CellMargins) SetLeft

func (_cfd CellMargins) SetLeft(d measurement.Distance)

SetLeft sets the cell left margin

func (CellMargins) SetLeftPct

func (_bef CellMargins) SetLeftPct(pct float64)

SetLeftPct sets the cell left margin

func (CellMargins) SetRight

func (_ccc CellMargins) SetRight(d measurement.Distance)

SetRight sets the cell right margin

func (CellMargins) SetRightPct

func (_fcc CellMargins) SetRightPct(pct float64)

SetRightPct sets the cell right margin

func (CellMargins) SetStart

func (_efcd CellMargins) SetStart(d measurement.Distance)

SetStart sets the cell start margin

func (CellMargins) SetStartPct

func (_db CellMargins) SetStartPct(pct float64)

SetStartPct sets the cell start margin

func (CellMargins) SetTop

func (_fec CellMargins) SetTop(d measurement.Distance)

SetTop sets the cell top margin

func (CellMargins) SetTopPct

func (_bae 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 (_ede CellProperties) Borders() CellBorders

Borders allows controlling individual cell borders.

func (CellProperties) Margins

func (_cgb CellProperties) Margins() CellMargins

Margins allows controlling individual cell margins.

func (CellProperties) SetColumnSpan

func (_dgb 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 (_afd CellProperties) SetShading(shd wml.ST_Shd, foreground, fill color.Color)

SetShading controls the cell shading.

func (CellProperties) SetVerticalAlignment

func (_beb CellProperties) SetVerticalAlignment(align wml.ST_VerticalJc)

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

func (CellProperties) SetVerticalMerge

func (_ad CellProperties) SetVerticalMerge(mergeVal wml.ST_Merge)

SetVerticalMerge controls the vertical merging of cells.

func (CellProperties) SetWidth

func (_cd CellProperties) SetWidth(d measurement.Distance)

SetWidth sets the cell width to a specified width.

func (CellProperties) SetWidthAuto

func (_gbb CellProperties) SetWidthAuto()

SetWidthAuto sets the the cell width to automatic.

func (CellProperties) SetWidthPercent

func (_add CellProperties) SetWidthPercent(pct float64)

SetWidthPercent sets the cell to a width percentage.

func (CellProperties) X

func (_feg CellProperties) X() *wml.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 (_bad Color) SetColor(v color.Color)

SetColor sets a specific color or auto.

func (Color) SetThemeColor

func (_bed Color) SetThemeColor(t wml.ST_ThemeColor)

SetThemeColor sets the color from the theme.

func (Color) SetThemeShade

func (_bged Color) SetThemeShade(s uint8)

SetThemeShade sets the shade based off the theme color.

func (Color) X

func (_cdf Color) X() *wml.CT_Color

X returns the inner wrapped XML type.

type DocText

type DocText struct{ Items []TextItem }

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

func (*DocText) Text

func (_afbfb *DocText) Text() string

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

type Document

type Document struct {
	common.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 io.ReaderAt, size int64) (*Document, error)

read reads a document from an io.Reader.

func (*Document) AddFooter

func (_fee *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 (_dag *Document) AddHeader() Header

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

func (_edd Document) AddHyperlink(url string) common.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 (_bdab *Document) AddImage(i common.Image) (common.ImageRef, error)

AddImage adds an image to the document package, returning a reference that can be used to add the image to a run and place it in the document contents.

func (*Document) AddParagraph

func (_bbec *Document) AddParagraph() Paragraph

AddParagraph adds a new paragraph to the document body.

func (*Document) AddTable

func (_bdc *Document) AddTable() Table

AddTable adds a new table to the document body.

func (*Document) Append

func (_ecf *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) BodySection

func (_acgg *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 (_ebea Document) Bookmarks() []Bookmark

Bookmarks returns all of the bookmarks defined in the document.

func (*Document) Close

func (_agaa *Document) Close() error

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

func (*Document) Copy

func (_cfge *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) Endnote

func (_ead *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 (_geaf *Document) Endnotes() []Endnote

Endnotes returns the endnotes defined in the document.

func (*Document) ExtractText

func (_bgbb *Document) ExtractText() *DocText

ExtractText returns text from the document as a DocText object.

func (*Document) Footers

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

Footers returns the footers defined in the document.

func (*Document) Footnote

func (_adeg *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 (_egab *Document) Footnotes() []Footnote

Footnotes returns the footnotes defined in the document.

func (*Document) FormFields

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

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

func (*Document) GetDocRelTargetByID

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

GetDocRelTargetByID returns TargetAttr of document relationship given its IdAttr.

func (*Document) GetImageByRelID

func (_bgea *Document) GetImageByRelID(relID string) (common.ImageRef, bool)

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

func (*Document) GetImageObjByRelId

func (_ecbc *Document) GetImageObjByRelId(relId string) (common.Image, error)

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

func (*Document) GetStyleByID

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

GetStyleByID returns Style by it's IdAttr.

func (*Document) GetTargetByRelId

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

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

func (*Document) HasEndnotes

func (_ddbd *Document) HasEndnotes() bool

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

func (*Document) HasFootnotes

func (_gcdb *Document) HasFootnotes() bool

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

func (*Document) Headers

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

Headers returns the headers defined in the document.

func (*Document) InsertParagraphAfter

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

InsertParagraphAfter adds a new empty paragraph after the relativeTo paragraph.

func (*Document) InsertParagraphBefore

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

InsertParagraphBefore adds a new empty paragraph before the relativeTo paragraph.

func (*Document) InsertTableAfter

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

func (*Document) InsertTableBefore

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

func (*Document) MailMerge

func (_deac *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 (_gbgeb Document) MergeFields() []string

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

func (*Document) Paragraphs

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

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

func (*Document) RemoveParagraph

func (_fbff *Document) RemoveParagraph(p Paragraph)

RemoveParagraph removes a paragraph from a document.

func (*Document) Save

func (_gce *Document) Save(w io.Writer) error

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

func (*Document) SaveToFile

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

SaveToFile writes the document out to a file.

func (Document) SetConformance

func (_ded Document) SetConformance(conformanceAttr sharedTypes.ST_ConformanceClass)

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

func (Document) SetStrict

func (_ddeg Document) SetStrict(strict bool)

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

func (*Document) StructuredDocumentTags

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

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

func (*Document) Tables

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

Tables returns the tables defined in the document.

func (*Document) Validate

func (_bfd *Document) Validate() error

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

func (*Document) X

func (_faf *Document) X() *wml.Document

X returns the inner wrapped XML type.

type DrawingInfo

type DrawingInfo struct {
	Drawing *wml.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 (_efa Endnote) AddParagraph() Paragraph

AddParagraph adds a paragraph to the endnote.

func (Endnote) Paragraphs

func (_abec Endnote) Paragraphs() []Paragraph

Paragraphs returns the paragraphs defined in an endnote.

func (Endnote) RemoveParagraph

func (_cccb Endnote) RemoveParagraph(p Paragraph)

RemoveParagraph removes a paragraph from the endnote.

func (Endnote) X

func (_baed Endnote) X() *wml.CT_FtnEdn

X returns the inner wrapped XML type.

type Fonts

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

Fonts allows manipulating a style or run's fonts.

func (Fonts) SetASCIITheme

func (_eccag Fonts) SetASCIITheme(t wml.ST_Theme)

SetASCIITheme sets the font ASCII Theme.

func (Fonts) SetCSTheme

func (_bdgdd Fonts) SetCSTheme(t wml.ST_Theme)

SetCSTheme sets the font complex script theme.

func (Fonts) SetEastAsiaTheme

func (_dadd Fonts) SetEastAsiaTheme(t wml.ST_Theme)

SetEastAsiaTheme sets the font East Asia Theme.

func (Fonts) SetHANSITheme

func (_ffg Fonts) SetHANSITheme(t wml.ST_Theme)

SetHANSITheme sets the font H ANSI Theme.

func (Fonts) X

func (_gfe Fonts) X() *wml.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 (_ebae Footer) AddImage(i common.Image) (common.ImageRef, error)

AddImage adds an image to the document package, returning a reference that can be used to add the image to a run and place it in the document contents.

func (Footer) AddParagraph

func (_acda Footer) AddParagraph() Paragraph

AddParagraph adds a paragraph to the footer.

func (Footer) Clear

func (_aged Footer) Clear()

Clear clears all content within a footer

func (Footer) Index

func (_bggb 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 (_fgdd Footer) Paragraphs() []Paragraph

Paragraphs returns the paragraphs defined in a footer.

func (Footer) RemoveParagraph

func (_ecfb Footer) RemoveParagraph(p Paragraph)

RemoveParagraph removes a paragraph from a footer.

func (Footer) Tables

func (_egfd Footer) Tables() []Table

Tables returns the tables defined in the footer.

func (Footer) X

func (_bbab Footer) X() *wml.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 (_afab Footnote) AddParagraph() Paragraph

AddParagraph adds a paragraph to the footnote.

func (Footnote) Paragraphs

func (_cgde Footnote) Paragraphs() []Paragraph

Paragraphs returns the paragraphs defined in a footnote.

func (Footnote) RemoveParagraph

func (_bgcg Footnote) RemoveParagraph(p Paragraph)

RemoveParagraph removes a paragraph from the footnote.

func (Footnote) X

func (_ffb Footnote) X() *wml.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 (_eagf FormField) IsChecked() bool

IsChecked returns true if a FormFieldTypeCheckBox is checked.

func (FormField) Name

func (_cgff FormField) Name() string

Name returns the name of the field.

func (FormField) PossibleValues

func (_bbeg FormField) PossibleValues() []string

PossibleValues returns the possible values for a FormFieldTypeDropDown.

func (FormField) SetCalcOnExit

func (_bcgg FormField) SetCalcOnExit(calcOnExit bool)

SetCalcOnExit marks if a FormField should be CalcOnExit or not.

func (FormField) SetChecked

func (_cefb FormField) SetChecked(b bool)

SetChecked marks a FormFieldTypeCheckBox as checked or unchecked.

func (FormField) SetDefaultValue

func (_gefgd 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 (_beee FormField) SetEnabled(enabled bool)

SetEnabled marks a FormField as enabled or disabled.

func (FormField) SetName

func (_bbaf FormField) SetName(name string)

SetName marks sets a name attribute for a FormField.

func (FormField) SetPossibleValues

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

SetPossibleValues sets possible values for a FormFieldTypeDropDown.

func (FormField) SetSize

func (_efb FormField) SetSize(size uint64)

SetSize sets size attribute for a FormFieldTypeCheckBox in pt.

func (FormField) SetValue

func (_ebbd 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 (_geef FormField) Type() FormFieldType

Type returns the type of the field.

func (FormField) Value

func (_cdgd FormField) Value() string

Value returns the tring 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 (_gaee FormFieldType) String() string
type Header struct {
	// contains filtered or unexported fields
}

Header is a header for a document section.

func (Header) AddImage

func (_cbbc Header) AddImage(i common.Image) (common.ImageRef, error)

AddImage adds an image to the document package, returning a reference that can be used to add the image to a run and place it in the document contents.

func (Header) AddParagraph

func (_gcbe Header) AddParagraph() Paragraph

AddParagraph adds a paragraph to the header.

func (Header) Clear

func (_cbeg Header) Clear()

Clear clears all content within a header

func (Header) Index

func (_adeb 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 (_aefcf Header) Paragraphs() []Paragraph

Paragraphs returns the paragraphs defined in a header.

func (Header) RemoveParagraph

func (_fbdf Header) RemoveParagraph(p Paragraph)

RemoveParagraph removes a paragraph from a footer.

func (Header) Tables

func (_fdgd Header) Tables() []Table

Tables returns the tables defined in the header.

func (Header) X

func (_decg Header) X() *wml.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 (_fgga HyperLink) AddRun() Run

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

func (HyperLink) SetTarget

func (_gcf HyperLink) SetTarget(url string)

SetTarget sets the URL target of the hyperlink.

func (HyperLink) SetTargetBookmark

func (_edbf HyperLink) SetTargetBookmark(bm Bookmark)

SetTargetBookmark sets the bookmark target of the hyperlink.

func (HyperLink) SetTargetByRef

func (_edae HyperLink) SetTargetByRef(link common.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 (_cfcd HyperLink) SetToolTip(text string)

SetToolTip sets the tooltip text for a hyperlink.

func (HyperLink) X

func (_cbce HyperLink) X() *wml.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 (_cfbd InlineDrawing) GetImage() (common.ImageRef, bool)

GetImage returns the ImageRef associated with an InlineDrawing.

func (InlineDrawing) SetSize

func (_bafd InlineDrawing) SetSize(w, h measurement.Distance)

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

func (InlineDrawing) X

func (_cggg InlineDrawing) X() *wml.WdInline

X returns the inner wrapped XML type.

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 (_aec Numbering) AddDefinition() NumberingDefinition

AddDefinition adds a new numbering definition.

func (Numbering) Clear

func (_aabe Numbering) Clear()

Clear resets the numbering.

func (Numbering) Definitions

func (_cadg Numbering) Definitions() []NumberingDefinition

Definitions returns the defined numbering definitions.

func (Numbering) InitializeDefault

func (_gaed Numbering) InitializeDefault()

InitializeDefault constructs a default numbering.

func (Numbering) X

func (_bdda Numbering) X() *wml.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 (_feag 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 (_gcfc NumberingDefinition) AddLevel() NumberingLevel

AddLevel adds a new numbering level to a NumberingDefinition.

func (NumberingDefinition) Levels

func (_babf NumberingDefinition) Levels() []NumberingLevel

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

func (NumberingDefinition) MultiLevelType

func (_afcf NumberingDefinition) MultiLevelType() wml.ST_MultiLevelType

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

func (NumberingDefinition) SetMultiLevelType

func (_abbd NumberingDefinition) SetMultiLevelType(t wml.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 (_cbbaa NumberingLevel) Properties() ParagraphStyleProperties

Properties returns the numbering level paragraph properties.

func (NumberingLevel) RunProperties

func (_affg NumberingLevel) RunProperties() RunProperties

RunProperties returns the RunProperties controlling numbering level font, etc.

func (NumberingLevel) SetAlignment

func (_dgba NumberingLevel) SetAlignment(j wml.ST_Jc)

SetAlignment sets the paragraph alignment

func (NumberingLevel) SetFormat

func (_gagca NumberingLevel) SetFormat(f wml.ST_NumberFormat)

SetFormat sets the numbering format.

func (NumberingLevel) SetText

func (_abae NumberingLevel) SetText(t string)

SetText sets the text to be used in bullet mode.

func (NumberingLevel) X

func (_bfbd NumberingLevel) X() *wml.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 (_acadb 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 (_eeee Paragraph) AddCheckBox(name string) FormField

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

func (Paragraph) AddDropdownList

func (_cdaa Paragraph) AddDropdownList(name string) FormField

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

func (Paragraph) AddEndnote

func (_bebd 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 (_ebag 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 (_affa Paragraph) AddHyperLink() HyperLink

AddHyperLink adds a new hyperlink to a parapgraph.

func (Paragraph) AddRun

func (_dfbe Paragraph) AddRun() Run

AddRun adds a run to a paragraph.

func (Paragraph) AddTextInput

func (_eedfa Paragraph) AddTextInput(name string) FormField

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

func (Paragraph) InsertRunAfter

func (_ddbb Paragraph) InsertRunAfter(relativeTo Run) Run

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

func (Paragraph) InsertRunBefore

func (_ddda Paragraph) InsertRunBefore(relativeTo Run) Run

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

func (Paragraph) Properties

func (_aadf Paragraph) Properties() ParagraphProperties

Properties returns the paragraph properties.

func (Paragraph) RemoveEndnote

func (_faeaf 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.

func (Paragraph) RemoveFootnote

func (_ageag 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.

func (Paragraph) RemoveRun

func (_beac Paragraph) RemoveRun(r Run)

RemoveRun removes a child run from a paragraph.

func (Paragraph) Runs

func (_bbee Paragraph) Runs() []Run

Runs returns all of the runs in a paragraph.

func (Paragraph) SetFirstLineIndent

func (_gbafb Paragraph) SetFirstLineIndent(m measurement.Distance)

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

func (Paragraph) SetLineSpacing

func (_feb Paragraph) SetLineSpacing(d measurement.Distance, rule wml.ST_LineSpacingRule)

SetLineSpacing sets the spacing between lines in a paragraph.

func (Paragraph) SetNumberingDefinition

func (_gdbf Paragraph) SetNumberingDefinition(nd NumberingDefinition)

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

func (Paragraph) SetNumberingDefinitionByID

func (_cfce Paragraph) SetNumberingDefinitionByID(abstractNumberID int64)

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

func (Paragraph) SetNumberingLevel

func (_ggff 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) SetStyle

func (_fbge 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 (_gacg Paragraph) Style() string

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

func (Paragraph) X

func (_acgf Paragraph) X() *wml.CT_P

X returns the inner wrapped XML type.

type ParagraphProperties

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

ParagraphProperties are the properties for a paragraph.

func (ParagraphProperties) AddSection

func (_aadag ParagraphProperties) AddSection(t wml.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 (_bccg ParagraphProperties) AddTabStop(position measurement.Distance, justificaton wml.ST_TabJc, leader wml.ST_TabTlc)

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

func (ParagraphProperties) Bold

func (_febd ParagraphProperties) Bold() bool

Bold returns true if paragraph font is bold.

func (ParagraphProperties) Caps

func (_ebbg ParagraphProperties) Caps() bool

Caps returns true if paragraph font is capitalized.

func (ParagraphProperties) CharacterSpacingMeasure

func (_dgcbe 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 (_bcdb ParagraphProperties) CharacterSpacingValue() int64

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

func (ParagraphProperties) ComplexSizeMeasure

func (_ebfaa ParagraphProperties) ComplexSizeMeasure() string

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

func (ParagraphProperties) ComplexSizeValue

func (_bbfg ParagraphProperties) ComplexSizeValue() float64

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

func (ParagraphProperties) DoubleStrike

func (_edba ParagraphProperties) DoubleStrike() bool

DoubleStrike returns true if paragraph is double striked.

func (ParagraphProperties) EastAsiaFont

func (_gfdd ParagraphProperties) EastAsiaFont() string

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

func (ParagraphProperties) Emboss

func (_ebaeb ParagraphProperties) Emboss() bool

Emboss returns true if paragraph emboss is on.

func (ParagraphProperties) Font

func (_edbc ParagraphProperties) Font() string

Font returns the name of paragraph font family.

func (ParagraphProperties) GetColor

func (_dgag ParagraphProperties) GetColor() color.Color

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

func (ParagraphProperties) Italic

func (_ggfg ParagraphProperties) Italic() bool

Italic returns true if paragraph font is italic.

func (ParagraphProperties) Outline

func (_dgdc ParagraphProperties) Outline() bool

Outline returns true if paragraph outline is on.

func (ParagraphProperties) RStyle

func (_ggcc ParagraphProperties) RStyle() string

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

func (ParagraphProperties) RightToLeft

func (_bdec ParagraphProperties) RightToLeft() bool

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

func (ParagraphProperties) SetAlignment

func (_aeffc ParagraphProperties) SetAlignment(align wml.ST_Jc)

SetAlignment controls the paragraph alignment

func (ParagraphProperties) SetEndIndent

func (_egea ParagraphProperties) SetEndIndent(m measurement.Distance)

SetEndIndent controls the end indentation.

func (ParagraphProperties) SetFirstLineIndent

func (_gcbab ParagraphProperties) SetFirstLineIndent(m measurement.Distance)

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

func (ParagraphProperties) SetHangingIndent

func (_dgfc ParagraphProperties) SetHangingIndent(m measurement.Distance)

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

func (ParagraphProperties) SetHeadingLevel

func (_cfbe ParagraphProperties) SetHeadingLevel(idx int)

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

func (ParagraphProperties) SetKeepOnOnePage

func (_ceagg ParagraphProperties) SetKeepOnOnePage(b bool)

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

func (ParagraphProperties) SetKeepWithNext

func (_fegb ParagraphProperties) SetKeepWithNext(b bool)

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

func (ParagraphProperties) SetPageBreakBefore

func (_fdbe ParagraphProperties) SetPageBreakBefore(b bool)

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

func (ParagraphProperties) SetSpacing

func (_gdcg ParagraphProperties) SetSpacing(before, after measurement.Distance)

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

func (ParagraphProperties) SetStartIndent

func (_cbcg ParagraphProperties) SetStartIndent(m measurement.Distance)

SetStartIndent controls the start indentation.

func (ParagraphProperties) SetStyle

func (_ecea ParagraphProperties) SetStyle(s string)

SetStyle sets the style of a paragraph.

func (ParagraphProperties) SetWindowControl

func (_ffeg ParagraphProperties) SetWindowControl(b bool)

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

func (ParagraphProperties) Shadow

func (_baafg ParagraphProperties) Shadow() bool

Shadow returns true if paragraph shadow is on.

func (ParagraphProperties) SizeMeasure

func (_ffafa ParagraphProperties) SizeMeasure() string

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

func (ParagraphProperties) SizeValue

func (_dfcd ParagraphProperties) SizeValue() float64

SizeValue returns the value of paragraph font size in points.

func (ParagraphProperties) Spacing

func (_gafa ParagraphProperties) Spacing() ParagraphSpacing

Spacing returns the paragraph spacing settings.

func (ParagraphProperties) Strike

func (_bfcb ParagraphProperties) Strike() bool

Strike returns true if paragraph is striked.

func (ParagraphProperties) Style

func (_gdeg ParagraphProperties) Style() string

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

func (ParagraphProperties) Underline

func (_bcae ParagraphProperties) Underline() wml.ST_Underline

Underline returns the type of paragraph underline.

func (ParagraphProperties) UnderlineColor

func (_eega ParagraphProperties) UnderlineColor() string

UnderlineColor returns the hex color value of paragraph underline.

func (ParagraphProperties) VerticalAlignment

func (_ccac ParagraphProperties) VerticalAlignment() sharedTypes.ST_VerticalAlignRun

VerticalAlign returns the value of paragraph vertical align.

func (ParagraphProperties) X

func (_feaaf ParagraphProperties) X() *wml.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 (_cfaf ParagraphSpacing) SetAfter(after measurement.Distance)

SetAfter sets the spacing that comes after the paragraph.

func (ParagraphSpacing) SetAfterAuto

func (_dbff ParagraphSpacing) SetAfterAuto(b bool)

SetAfterAuto controls if spacing after a paragraph is automatically determined.

func (ParagraphSpacing) SetBefore

func (_ggfe ParagraphSpacing) SetBefore(before measurement.Distance)

SetBefore sets the spacing that comes before the paragraph.

func (ParagraphSpacing) SetBeforeAuto

func (_becg ParagraphSpacing) SetBeforeAuto(b bool)

SetBeforeAuto controls if spacing before a paragraph is automatically determined.

func (ParagraphSpacing) SetLineSpacing

func (_dce ParagraphSpacing) SetLineSpacing(d measurement.Distance, rule wml.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 (_aggf ParagraphStyleProperties) AddTabStop(position measurement.Distance, justificaton wml.ST_TabJc, leader wml.ST_TabTlc)

AddTabStop adds a tab stop to the paragraph.

func (ParagraphStyleProperties) SetAlignment

func (_gdbb ParagraphStyleProperties) SetAlignment(align wml.ST_Jc)

SetAlignment controls the paragraph alignment

func (ParagraphStyleProperties) SetContextualSpacing

func (_fabf ParagraphStyleProperties) SetContextualSpacing(b bool)

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

func (ParagraphStyleProperties) SetHangingIndent

func (_bcgc ParagraphStyleProperties) SetHangingIndent(m measurement.Distance)

SetHangingIndent controls the hanging indent of the paragraph.

func (ParagraphStyleProperties) SetKeepNext

func (_ebce ParagraphStyleProperties) SetKeepNext(b bool)

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

func (ParagraphStyleProperties) SetKeepOnOnePage

func (_feac ParagraphStyleProperties) SetKeepOnOnePage(b bool)

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

func (ParagraphStyleProperties) SetLeftIndent

func (_bdgad ParagraphStyleProperties) SetLeftIndent(m measurement.Distance)

SetLeftIndent controls the left indent of the paragraph.

func (ParagraphStyleProperties) SetOutlineLevel

func (_afbgb ParagraphStyleProperties) SetOutlineLevel(lvl int)

SetOutlineLevel sets the outline level of this style.

func (ParagraphStyleProperties) SetSpacing

func (_dcagb ParagraphStyleProperties) SetSpacing(before, after measurement.Distance)

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

func (ParagraphStyleProperties) SetStartIndent

func (_abfe ParagraphStyleProperties) SetStartIndent(m measurement.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 (_debd Row) AddCell() Cell

AddCell adds a cell to a row and returns it

func (Row) Cells

func (_bggc Row) Cells() []Cell

Cells returns the cells defined in the table.

func (Row) Properties

func (_fegga Row) Properties() RowProperties

Properties returns the row properties.

func (Row) X

func (_eabf Row) X() *wml.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) SetHeight

func (_bdeb RowProperties) SetHeight(ht measurement.Distance, rule wml.ST_HeightRule)

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

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

func (_fdebg Run) AddBreak()

AddBreak adds a line break to a run.

func (Run) AddDrawingAnchored

func (_cgca Run) AddDrawingAnchored(img common.ImageRef) (AnchoredDrawing, error)

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

func (Run) AddDrawingInline

func (_gebga Run) AddDrawingInline(img common.ImageRef) (InlineDrawing, error)

AddDrawingInline adds an inline drawing from an ImageRef.

func (Run) AddField

func (_fcgf Run) AddField(code string)

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

func (Run) AddFieldWithFormatting

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

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

func (Run) AddPageBreak

func (_bbda Run) AddPageBreak()

AddPageBreak adds a page break to a run.

func (Run) AddTab

func (_fcdb Run) AddTab()

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

func (Run) AddText

func (_afcc Run) AddText(s string)

AddText adds tet to a run.

func (Run) Clear

func (_dgce Run) Clear()

Clear removes all of the content from within a run.

func (Run) ClearContent

func (_beab Run) ClearContent()

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

func (Run) DrawingAnchored

func (_ffdc Run) DrawingAnchored() []AnchoredDrawing

DrawingAnchored returns a slice of AnchoredDrawings.

func (Run) IsEndnote

func (_efbe 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 (_dgg 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 (_dbcaa Run) Properties() RunProperties

Properties returns the run properties.

func (Run) Text

func (_fffd Run) Text() string

Text returns the underlying tet in the run.

func (Run) X

func (_ddgdf Run) X() *wml.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 (_bgecg RunProperties) Bold() bool

Bold returns true if run font is bold.

func (RunProperties) BoldValue

func (_dded RunProperties) BoldValue() OnOffValue

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

func (RunProperties) Caps

func (_cbcf RunProperties) Caps() bool

Caps returns true if run font is capitalized.

func (RunProperties) CharacterSpacingMeasure

func (_cadc 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 (_ggg RunProperties) CharacterSpacingValue() int64

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

func (RunProperties) ClearColor

func (_ebfb RunProperties) ClearColor()

ClearColor clears the text color.

func (RunProperties) Color

func (_dgbbc RunProperties) Color() Color

Color returns the style's Color.

func (RunProperties) ComplexSizeMeasure

func (_gcec RunProperties) ComplexSizeMeasure() string

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

func (RunProperties) ComplexSizeValue

func (_eagff RunProperties) ComplexSizeValue() float64

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

func (RunProperties) DoubleStrike

func (_aaada RunProperties) DoubleStrike() bool

DoubleStrike returns true if run is double striked.

func (RunProperties) EastAsiaFont

func (_ffgg RunProperties) EastAsiaFont() string

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

func (RunProperties) Emboss

func (_ebgcg RunProperties) Emboss() bool

Emboss returns true if run emboss is on.

func (RunProperties) Font

func (_dgfd RunProperties) Font() string

Font returns the name of run font family.

func (RunProperties) Fonts

func (_cafc RunProperties) Fonts() Fonts

Fonts returns the style's Fonts.

func (RunProperties) GetColor

func (_aadfa RunProperties) GetColor() color.Color

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

func (RunProperties) IsBold

func (_cdbc RunProperties) IsBold() bool

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

func (RunProperties) IsItalic

func (_facd RunProperties) IsItalic() bool

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

func (RunProperties) Italic

func (_cbee RunProperties) Italic() bool

Italic returns true if run font is italic.

func (RunProperties) ItalicValue

func (_aeag RunProperties) ItalicValue() OnOffValue

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

func (RunProperties) Outline

func (_ebaag RunProperties) Outline() bool

Outline returns true if run outline is on.

func (RunProperties) RStyle

func (_fade RunProperties) RStyle() string

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

func (RunProperties) RightToLeft

func (_addbc RunProperties) RightToLeft() bool

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

func (RunProperties) SetAllCaps

func (_fdfb RunProperties) SetAllCaps(b bool)

SetAllCaps sets the run to all caps.

func (RunProperties) SetBold

func (_cbbaf RunProperties) SetBold(b bool)

SetBold sets the run to bold.

func (RunProperties) SetCharacterSpacing

func (_fedg RunProperties) SetCharacterSpacing(size measurement.Distance)

SetCharacterSpacing sets the run's Character Spacing Adjustment.

func (RunProperties) SetColor

func (_ebfab RunProperties) SetColor(c color.Color)

SetColor sets the text color.

func (RunProperties) SetDoubleStrikeThrough

func (_afge RunProperties) SetDoubleStrikeThrough(b bool)

SetDoubleStrikeThrough sets the run to double strike-through.

func (RunProperties) SetEffect

func (_fcfa RunProperties) SetEffect(e wml.ST_TextEffect)

SetEffect sets a text effect on the run.

func (RunProperties) SetEmboss

func (_adbc RunProperties) SetEmboss(b bool)

SetEmboss sets the run to embossed text.

func (RunProperties) SetFontFamily

func (_aebe RunProperties) SetFontFamily(family string)

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

func (RunProperties) SetHighlight

func (_edea RunProperties) SetHighlight(c wml.ST_HighlightColor)

SetHighlight highlights text in a specified color.

func (RunProperties) SetImprint

func (_faed RunProperties) SetImprint(b bool)

SetImprint sets the run to imprinted text.

func (RunProperties) SetItalic

func (_aabc RunProperties) SetItalic(b bool)

SetItalic sets the run to italic.

func (RunProperties) SetKerning

func (_ffea RunProperties) SetKerning(size measurement.Distance)

SetKerning sets the run's font kerning.

func (RunProperties) SetOutline

func (_bcba RunProperties) SetOutline(b bool)

SetOutline sets the run to outlined text.

func (RunProperties) SetShadow

func (_aaab RunProperties) SetShadow(b bool)

SetShadow sets the run to shadowed text.

func (RunProperties) SetSize

func (_fgfa RunProperties) SetSize(size measurement.Distance)

SetSize sets the font size for a run.

func (RunProperties) SetSmallCaps

func (_fcdac RunProperties) SetSmallCaps(b bool)

SetSmallCaps sets the run to small caps.

func (RunProperties) SetStrikeThrough

func (_ccge RunProperties) SetStrikeThrough(b bool)

SetStrikeThrough sets the run to strike-through.

func (RunProperties) SetStyle

func (_gffa RunProperties) SetStyle(style string)

SetStyle sets the font size.

func (RunProperties) SetUnderline

func (_gfdbe RunProperties) SetUnderline(style wml.ST_Underline, c color.Color)

SetUnderline controls underline for a run style.

func (RunProperties) SetVerticalAlignment

func (_eeae RunProperties) SetVerticalAlignment(v sharedTypes.ST_VerticalAlignRun)

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

func (RunProperties) Shadow

func (_aefad RunProperties) Shadow() bool

Shadow returns true if run shadow is on.

func (RunProperties) SizeMeasure

func (_dbfcd RunProperties) SizeMeasure() string

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

func (RunProperties) SizeValue

func (_cdcg RunProperties) SizeValue() float64

SizeValue returns the value of run font size in points.

func (RunProperties) Strike

func (_gaeea RunProperties) Strike() bool

Strike returns true if run is striked.

func (RunProperties) Underline

func (_cgfg RunProperties) Underline() wml.ST_Underline

Underline returns the type of run underline.

func (RunProperties) UnderlineColor

func (_dffaf RunProperties) UnderlineColor() string

UnderlineColor returns the hex color value of run underline.

func (RunProperties) VerticalAlignment

func (_gffbf RunProperties) VerticalAlignment() sharedTypes.ST_VerticalAlignRun

VerticalAlign returns the value of run vertical align.

func (RunProperties) X

func (_dfbc RunProperties) X() *wml.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 (_dbbe Section) GetFooter(t wml.ST_HdrFtr) (Footer, bool)

GetFooter gets a section Footer for given type

func (Section) GetHeader

func (_bcbg Section) GetHeader(t wml.ST_HdrFtr) (Header, bool)

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

func (Section) SetFooter

func (_efefa Section) SetFooter(f Footer, t wml.ST_HdrFtr)

SetFooter sets a section footer.

func (Section) SetHeader

func (_agde Section) SetHeader(h Header, t wml.ST_HdrFtr)

SetHeader sets a section header.

func (Section) SetPageMargins

func (_gbbf Section) SetPageMargins(top, right, bottom, left, header, footer, gutter measurement.Distance)

SetPageMargins sets the page margins for a section

func (Section) X

func (_fdgb Section) X() *wml.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 (_ffde Settings) RemoveMailMerge()

RemoveMailMerge removes any mail merge settings

func (Settings) SetUpdateFieldsOnOpen

func (_ccaa 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 (_fbga Settings) X() *wml.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) Paragraphs

func (_eebf StructuredDocumentTag) Paragraphs() []Paragraph

Paragraphs returns the paragraphs within a structured document tag.

type Style

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

Style is a style within the styles.xml file.

func (Style) Name

func (_agfbc Style) Name() string

Name returns the name of the style if set.

func (Style) ParagraphProperties

func (_aabdd Style) ParagraphProperties() ParagraphStyleProperties

ParagraphProperties returns the paragraph style properties.

func (Style) RunProperties

func (_dggc Style) RunProperties() RunProperties

RunProperties returns the run style properties.

func (Style) SetBasedOn

func (_gbcd Style) SetBasedOn(name string)

SetBasedOn sets the style that this style is based on.

func (Style) SetLinkedStyle

func (_ddee Style) SetLinkedStyle(name string)

SetLinkedStyle sets the style that this style is linked to.

func (Style) SetName

func (_gdadf Style) SetName(name string)

SetName sets the name of the style.

func (Style) SetNextStyle

func (_aacef Style) SetNextStyle(name string)

SetNextStyle sets the style that the next paragraph will use.

func (Style) SetPrimaryStyle

func (_cedee Style) SetPrimaryStyle(b bool)

SetPrimaryStyle marks the style as a primary style.

func (Style) SetSemiHidden

func (_faeg Style) SetSemiHidden(b bool)

SetSemiHidden controls if the style is hidden in the UI.

func (Style) SetUISortOrder

func (_baade Style) SetUISortOrder(order int)

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

func (Style) SetUnhideWhenUsed

func (_ceee Style) SetUnhideWhenUsed(b bool)

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

func (Style) StyleID

func (_ddcac Style) StyleID() string

StyleID returns the style ID.

func (Style) TableConditionalFormatting

func (_abgbb Style) TableConditionalFormatting(typ wml.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 (_aeca Style) TableProperties() TableStyleProperties

TableProperties returns the table style properties.

func (Style) Type

func (_cacae Style) Type() wml.ST_StyleType

Type returns the type of the style.

func (Style) X

func (_efcg Style) X() *wml.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 (_adbb Styles) AddStyle(styleID string, t wml.ST_StyleType, isDefault bool) Style

AddStyle adds a new empty style.

func (Styles) Clear

func (_cccae Styles) Clear()

Clear clears the styes.

func (Styles) InitializeDefault

func (_fddd Styles) InitializeDefault()

InitializeDefault constructs the default styles.

func (Styles) ParagraphStyles

func (_bgfgg Styles) ParagraphStyles() []Style

ParagraphStyles returns only the paragraph styles.

func (Styles) Styles

func (_ebbaa Styles) Styles() []Style

Styles returns all styles.

func (Styles) X

func (_gdgc Styles) X() *wml.Styles

X returns the inner wrapped XML type.

type Table

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

Table is a table within a document.

func (Table) AddRow

func (_eege Table) AddRow() Row

AddRow adds a row to a table.

func (Table) InsertRowAfter

func (_gadgd Table) InsertRowAfter(r Row) Row

InsertRowAfter inserts a row after another row

func (Table) InsertRowBefore

func (_fbfc Table) InsertRowBefore(r Row) Row

InsertRowBefore inserts a row before another row

func (Table) Properties

func (_ddaf Table) Properties() TableProperties

Properties returns the table properties.

func (Table) Rows

func (_gccee Table) Rows() []Row

Rows returns the rows defined in the table.

func (Table) X

func (_eced Table) X() *wml.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 (_bdad TableBorders) SetAll(t wml.ST_Border, c color.Color, thickness measurement.Distance)

SetAll sets all of the borders to a given value.

func (TableBorders) SetBottom

func (_dgage TableBorders) SetBottom(t wml.ST_Border, c color.Color, thickness measurement.Distance)

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

func (TableBorders) SetInsideHorizontal

func (_egegd TableBorders) SetInsideHorizontal(t wml.ST_Border, c color.Color, thickness measurement.Distance)

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

func (TableBorders) SetInsideVertical

func (_beacf TableBorders) SetInsideVertical(t wml.ST_Border, c color.Color, thickness measurement.Distance)

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

func (TableBorders) SetLeft

func (_gafaf TableBorders) SetLeft(t wml.ST_Border, c color.Color, thickness measurement.Distance)

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

func (TableBorders) SetRight

func (_dgaga TableBorders) SetRight(t wml.ST_Border, c color.Color, thickness measurement.Distance)

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

func (TableBorders) SetTop

func (_dgdde TableBorders) SetTop(t wml.ST_Border, c color.Color, thickness measurement.Distance)

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

func (TableBorders) X

func (_fdbc TableBorders) X() *wml.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 (_eeaeb TableConditionalFormatting) CellProperties() CellProperties

CellProperties returns the cell properties.

func (TableConditionalFormatting) ParagraphProperties

func (_eagc TableConditionalFormatting) ParagraphProperties() ParagraphStyleProperties

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

func (TableConditionalFormatting) RunProperties

func (_cfga 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    *wml.CT_Tbl
	Row      *wml.CT_Row
	Cell     *wml.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 (_gaede TableLook) SetFirstColumn(on bool)

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

func (TableLook) SetFirstRow

func (_dead TableLook) SetFirstRow(on bool)

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

func (TableLook) SetHorizontalBanding

func (_deedc TableLook) SetHorizontalBanding(on bool)

SetHorizontalBanding controls the conditional formatting for horizontal banding.

func (TableLook) SetLastColumn

func (_cffec TableLook) SetLastColumn(on bool)

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

func (TableLook) SetLastRow

func (_adfag 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 (_abdc TableLook) SetVerticalBanding(on bool)

SetVerticalBanding controls the conditional formatting for vertical banding.

func (TableLook) X

func (_deabd TableLook) X() *wml.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 (_eaddc TableProperties) Borders() TableBorders

Borders allows manipulation of the table borders.

func (TableProperties) SetAlignment

func (_gagg TableProperties) SetAlignment(align wml.ST_JcTable)

SetAlignment sets the alignment of a table within the page.

func (TableProperties) SetCellSpacing

func (_ccdb TableProperties) SetCellSpacing(m measurement.Distance)

SetCellSpacing sets the cell spacing within a table.

func (TableProperties) SetCellSpacingAuto

func (_bafa TableProperties) SetCellSpacingAuto()

SetCellSpacingAuto sets the cell spacing within a table to automatic.

func (TableProperties) SetCellSpacingPercent

func (_cffc TableProperties) SetCellSpacingPercent(pct float64)

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

func (TableProperties) SetLayout

func (_eaecf TableProperties) SetLayout(l wml.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 (_ddgf TableProperties) SetStyle(name string)

SetStyle sets the table style name.

func (TableProperties) SetWidth

func (_adbbd TableProperties) SetWidth(d measurement.Distance)

SetWidth sets the table with to a specified width.

func (TableProperties) SetWidthAuto

func (_ebbab TableProperties) SetWidthAuto()

SetWidthAuto sets the the table width to automatic.

func (TableProperties) SetWidthPercent

func (_abeed TableProperties) SetWidthPercent(pct float64)

SetWidthPercent sets the table to a width percentage.

func (TableProperties) TableLook

func (_dfbb TableProperties) TableLook() TableLook

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

func (TableProperties) X

func (_cgbg TableProperties) X() *wml.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 (_fedbf TableStyleProperties) Borders() TableBorders

Borders allows manipulation of the table borders.

func (TableStyleProperties) SetCellSpacingAuto

func (_gfade TableStyleProperties) SetCellSpacingAuto()

SetCellSpacingAuto sets the cell spacing within a table to automatic.

func (TableStyleProperties) SetCellSpacingPercent

func (_ebee TableStyleProperties) SetCellSpacingPercent(pct float64)

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

func (TableStyleProperties) SetColumnBandSize

func (_edffa TableStyleProperties) SetColumnBandSize(cols int64)

SetColumnBandSize sets the number of Columns in the column band

func (TableStyleProperties) SetRowBandSize

func (_fafcf TableStyleProperties) SetRowBandSize(rows int64)

SetRowBandSize sets the number of Rows in the row band

func (TableStyleProperties) SetTableIndent

func (_fddcfb TableStyleProperties) SetTableIndent(ind measurement.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 (_dcabd TableWidth) SetValue(m measurement.Distance)

SetValue sets the width value.

func (TableWidth) X

func (_bagbg TableWidth) X() *wml.CT_TblWidth

X returns the inner wrapped XML type.

type TextItem

type TextItem struct {
	Text        string
	DrawingInfo *DrawingInfo
	Paragraph   *wml.CT_P
	Hyperlink   *wml.CT_Hyperlink
	Run         *wml.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 *wml.Ftr) []TextItem

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

func ExtractFromHeader

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

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

Jump to

Keyboard shortcuts

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