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
- type AnchoredDrawing
- func (a AnchoredDrawing) GetImage() (ImageRef, bool)
- func (a AnchoredDrawing) SetAlignment(h wd.ST_AlignH, v wd.ST_AlignV)
- func (a AnchoredDrawing) SetHAlignment(h wd.ST_AlignH)
- func (a AnchoredDrawing) SetName(name string)
- func (a AnchoredDrawing) SetOffset(x, y measurement.Distance)
- func (a AnchoredDrawing) SetOrigin(h wd.ST_RelFromH, v wd.ST_RelFromV)
- func (a AnchoredDrawing) SetSize(w, h measurement.Distance)
- func (a AnchoredDrawing) SetTextWrapNone()
- func (a AnchoredDrawing) SetTextWrapSquare(t wd.ST_WrapText)
- func (a AnchoredDrawing) SetVAlignment(v wd.ST_AlignV)
- func (a AnchoredDrawing) SetXOffset(x measurement.Distance)
- func (a AnchoredDrawing) SetYOffset(y measurement.Distance)
- func (a AnchoredDrawing) X() *wd.Anchor
- type Cell
- type CellProperties
- type Color
- type Document
- func (d *Document) AddFooter() Footer
- func (d *Document) AddHeader() Header
- func (d *Document) AddImage(i Image) (ImageRef, error)
- func (d *Document) AddParagraph() Paragraph
- func (d *Document) AddTable() Table
- func (d *Document) BodySection() Section
- func (d *Document) FormFields() []FormField
- func (d *Document) GetImageByRelID(relID string) (ImageRef, bool)
- func (d *Document) Images() []ImageRef
- func (d *Document) Paragraphs() []Paragraph
- func (d *Document) Save(w io.Writer) error
- func (d *Document) SaveToFile(path string) error
- func (d *Document) Validate() error
- func (d *Document) X() *wml.Document
- type Fonts
- type Footer
- type FormField
- type FormFieldType
- type Header
- type Image
- type ImageRef
- type Numbering
- type Paragraph
- type ParagraphProperties
- func (p ParagraphProperties) AddSection(t wml.ST_SectionMark) Section
- func (p ParagraphProperties) AddTabStop(position measurement.Distance, justificaton wml.ST_TabJc, leader wml.ST_TabTlc)
- func (p ParagraphProperties) SetHeadingLevel(idx int)
- func (p ParagraphProperties) SetKeepOnOnePage(b bool)
- func (p ParagraphProperties) SetKeepWithNext(b bool)
- func (p ParagraphProperties) SetPageBreakBefore(b bool)
- func (p ParagraphProperties) SetSpacing(before, after measurement.Distance)
- func (p ParagraphProperties) SetStyle(s string)
- func (p ParagraphProperties) SetWindowControl(b bool)
- func (p ParagraphProperties) Style() string
- func (p ParagraphProperties) X() *wml.CT_PPr
- type ParagraphStyleProperties
- func (p ParagraphStyleProperties) AddTabStop(position measurement.Distance, justificaton wml.ST_TabJc, leader wml.ST_TabTlc)
- func (p ParagraphStyleProperties) SetContextualSpacing(b bool)
- func (p ParagraphStyleProperties) SetKeepNext(b bool)
- func (p ParagraphStyleProperties) SetKeepOnOnePage(b bool)
- func (p ParagraphStyleProperties) SetOutlineLevel(lvl int)
- func (p ParagraphStyleProperties) SetSpacing(before, after measurement.Distance)
- func (p ParagraphStyleProperties) X() *wml.CT_PPrGeneral
- type Row
- type Run
- func (r Run) AddBreak()
- func (r Run) AddDrawingAnchored(img ImageRef) (AnchoredDrawing, error)
- func (r Run) AddField(code string)
- func (r Run) AddFieldWithFormatting(code string, fmt string)
- func (r Run) AddTab()
- func (r Run) AddText(s string)
- func (r Run) ClearColor()
- func (r Run) DrawingAnchored() []AnchoredDrawing
- func (r Run) IsBold() bool
- func (r Run) IsItalic() bool
- func (r Run) SetAllCaps(b bool)
- func (r Run) SetBold(b bool)
- func (r Run) SetColor(c color.Color)
- func (r Run) SetDoubleStrikeThrough(b bool)
- func (r Run) SetEffect(e wml.ST_TextEffect)
- func (r Run) SetEmboss(b bool)
- func (r Run) SetFontFamily(family string)
- func (r Run) SetFontSize(sz measurement.Distance)
- func (r Run) SetHighlight(c wml.ST_HighlightColor)
- func (r Run) SetImprint(b bool)
- func (r Run) SetItalic(b bool)
- func (r Run) SetOutline(b bool)
- func (r Run) SetShadow(b bool)
- func (r Run) SetSmallCaps(b bool)
- func (r Run) SetStrikeThrough(b bool)
- func (r Run) SetUnderline(style wml.ST_Underline, c color.Color)
- func (r Run) Text() string
- func (r Run) X() *wml.CT_R
- type RunStyleProperties
- func (r RunStyleProperties) Color() Color
- func (r RunStyleProperties) Fonts() Fonts
- func (r RunStyleProperties) SetCharacterSpacing(size measurement.Distance)
- func (r RunStyleProperties) SetKerning(size measurement.Distance)
- func (r RunStyleProperties) SetSize(size measurement.Distance)
- func (r RunStyleProperties) X() *wml.CT_RPr
- type Section
- type Settings
- type Style
- func (s Style) Name() string
- func (s Style) ParagraphProperties() ParagraphStyleProperties
- func (s Style) RunProperties() RunStyleProperties
- func (s Style) SetBasedOn(name string)
- func (s Style) SetLinkedStyle(name string)
- func (s Style) SetName(name string)
- func (s Style) SetNextStyle(name string)
- func (s Style) SetPrimaryStyle(b bool)
- func (s Style) SetSemiHidden(b bool)
- func (s Style) SetUISortOrder(order int)
- func (s Style) SetUnhideWhenUsed(b bool)
- func (s Style) StyleID() string
- func (s Style) Type() wml.ST_StyleType
- func (s Style) X() *wml.CT_Style
- type Styles
- type Table
- type TableBorders
- func (b TableBorders) SetAll(t wml.ST_Border, c color.Color, thickness measurement.Distance)
- func (b TableBorders) SetBottom(t wml.ST_Border, c color.Color, thickness measurement.Distance)
- func (b TableBorders) SetInsideHorizontal(t wml.ST_Border, c color.Color, thickness measurement.Distance)
- func (b TableBorders) SetInsideVertical(t wml.ST_Border, c color.Color, thickness measurement.Distance)
- func (b TableBorders) SetLeft(t wml.ST_Border, c color.Color, thickness measurement.Distance)
- func (b TableBorders) SetRight(t wml.ST_Border, c color.Color, thickness measurement.Distance)
- func (b TableBorders) SetTop(t wml.ST_Border, c color.Color, thickness measurement.Distance)
- func (b TableBorders) X() *wml.CT_TblBorders
- type TableProperties
- func (t TableProperties) Borders() TableBorders
- func (t TableProperties) SetCellSpacing(m measurement.Distance)
- func (t TableProperties) SetCellSpacingAuto()
- func (t TableProperties) SetCellSpacingPercent(pct float64)
- func (t TableProperties) SetWidth(d measurement.Distance)
- func (t TableProperties) SetWidthAuto()
- func (t TableProperties) SetWidthPercent(pct float64)
- func (t TableProperties) X() *wml.CT_TblPr
- type TableWidth
Examples ¶
Constants ¶
const ( FieldCurrentPage = "PAGE" FieldNumberOfPages = "NUMPAGES" FieldDate = "DATE" FieldCreateDate = "CREATEDATE" FieldEditTime = "EDITTIME" FieldPrintDate = "PRINTDATE" FieldSaveDate = "SAVEDATE" FieldTIme = "TIME" FieldTOC = "TOC" )
Field constants
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 (a AnchoredDrawing) GetImage() (ImageRef, bool)
GetImage returns the ImageRef associated with an AnchoredDrawing.
func (AnchoredDrawing) SetAlignment ¶
func (a AnchoredDrawing) SetAlignment(h wd.ST_AlignH, v wd.ST_AlignV)
SetAlignment positions an anchored image via alignment. Offset is incompatible with SetOffset, whichever is called last is applied.
func (AnchoredDrawing) SetHAlignment ¶
func (a AnchoredDrawing) SetHAlignment(h wd.ST_AlignH)
SetHAlignment sets the horizontal alignment for an anchored image.
func (AnchoredDrawing) SetName ¶
func (a AnchoredDrawing) SetName(name string)
SetName sets the name of the image, visible in the properties of the image within Word.
func (AnchoredDrawing) SetOffset ¶
func (a 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 (a AnchoredDrawing) SetOrigin(h wd.ST_RelFromH, v wd.ST_RelFromV)
SetOrigin sets the origin of the image. It defaults to ST_RelFromHPage and ST_RelFromVPage
func (AnchoredDrawing) SetSize ¶
func (a AnchoredDrawing) SetSize(w, h measurement.Distance)
SetSize sets the size of the displayed image on the page.
func (AnchoredDrawing) SetTextWrapNone ¶
func (a 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 (a AnchoredDrawing) SetTextWrapSquare(t wd.ST_WrapText)
SetTextWrapSquare sets the text wrap to square with a given wrap type.
func (AnchoredDrawing) SetVAlignment ¶
func (a AnchoredDrawing) SetVAlignment(v wd.ST_AlignV)
SetVAlignment sets the vertical alignment for an anchored image.
func (AnchoredDrawing) SetXOffset ¶
func (a AnchoredDrawing) SetXOffset(x measurement.Distance)
SetXOffset sets the X offset for an image relative to the origin.
func (AnchoredDrawing) SetYOffset ¶
func (a AnchoredDrawing) SetYOffset(y measurement.Distance)
SetYOffset sets the Y offset for an image relative to the origin.
func (AnchoredDrawing) X ¶
func (a AnchoredDrawing) X() *wd.Anchor
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 ¶
AddParagraph adds a paragraph to the table cell.
func (Cell) Properties ¶
func (c Cell) Properties() CellProperties
Properties returns the cell properties.
type CellProperties ¶
type CellProperties struct {
// contains filtered or unexported fields
}
CellProperties are a table cells properties within a document.
func (CellProperties) SetColumnSpan ¶
func (c CellProperties) SetColumnSpan(cols int)
SetColumnSpan sets the number of Grid Columns Spanned by the Cell
func (CellProperties) X ¶
func (c 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) SetThemeColor ¶
func (c Color) SetThemeColor(t wml.ST_ThemeColor)
SetThemeColor sets the color from the theme.
func (Color) SetThemeShade ¶
SetThemeShade sets the shade based off the theme color.
type Document ¶
type Document struct { common.DocBase Settings Settings // document settings Numbering Numbering // numbering styles within the doucment Styles Styles // styles that are use and can be used within the document // 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.
Example ¶
package main import ( "baliance.com/gooxml/document" ) func main() { doc := document.New() doc.AddParagraph().AddRun().AddText("Hello World!") doc.SaveToFile("document.docx") }
Output:
func Open ¶
Open opens and reads a document from a file (.docx).
Example ¶
package main import ( "fmt" "log" "baliance.com/gooxml/document" ) func main() { doc, err := document.Open("existing.docx") if err != nil { log.Fatalf("error opening document: %s", err) } for _, para := range doc.Paragraphs() { for _, run := range para.Runs() { fmt.Print(run.Text()) } fmt.Println() } }
Output:
func OpenTemplate ¶
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.
Example ¶
package main import ( "log" "baliance.com/gooxml/document" ) func main() { doc, err := document.OpenTemplate("existing.docx") if err != nil { log.Fatalf("error opening document template: %s", err) } para := doc.AddParagraph() para.SetStyle("Title") para.AddRun().AddText("My Document Title") para = doc.AddParagraph() para.SetStyle("Subtitle") para.AddRun().AddText("Document Subtitle") para = doc.AddParagraph() para.SetStyle("Heading1") para.AddRun().AddText("Major Section") doc.SaveToFile("ouput.docx") }
Output:
func (*Document) AddFooter ¶
AddFooter creates a Footer associated with the document, but doesn't add it to the document for display.
func (*Document) AddHeader ¶
AddHeader creates a header associated with the document, but doesn't add it to the document for display.
func (*Document) AddImage ¶
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 ¶
AddParagraph adds a new paragraph to the document body.
func (*Document) BodySection ¶
BodySection returns the default body section used for all preceeding paragraphs until the previous Section. If there is no previous sections, the body section applies to the entire document.
func (*Document) FormFields ¶
FormFields extracts all of the fields from a document. They can then be manipulated via the methods on the field and the document saved.
Example ¶
package main import ( "log" "baliance.com/gooxml/document" ) func main() { doc, err := document.Open("invitation.docx") if err != nil { log.Fatalf("error opening document form: %s", err) } for _, field := range doc.FormFields() { switch field.Name() { case "attendingEvent": if field.Type() == document.FormFieldTypeCheckBox { field.SetChecked(true) } case "name": if field.Type() == document.FormFieldTypeText { field.SetValue("John Smith") } } } doc.SaveToFile("invitation-respoonse.docx") }
Output:
func (*Document) GetImageByRelID ¶
GetImageByRelID returns an ImageRef with the associated relation ID in the document.
func (*Document) Paragraphs ¶
Paragraphs returns all of the paragraphs in the document body.
func (*Document) SaveToFile ¶
SaveToFile writes the document out to a file.
type Fonts ¶
type Fonts struct {
// contains filtered or unexported fields
}
Fonts allows manipulating a style or run's fonts.
func (Fonts) SetASCIITheme ¶
SetASCIITheme sets the font ASCII Theme.
func (Fonts) SetCSTheme ¶
SetCSTheme sets the font complex script theme.
func (Fonts) SetEastAsiaTheme ¶
SetEastAsiaTheme sets the font East Asia Theme.
func (Fonts) SetHANSITheme ¶
SetHANSITheme sets the font H ANSI Theme.
type Footer ¶
type Footer struct {
// contains filtered or unexported fields
}
Footer is a footer for a document section.
func (Footer) AddParagraph ¶
AddParagraph adds a paragraph to the footer.
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) PossibleValues ¶
PossibleValues returns the possible values for a FormFieldTypeDropDown.
func (FormField) SetChecked ¶
SetChecked marks a FormFieldTypeCheckBox as checked or unchecked.
type FormFieldType ¶
type FormFieldType byte
FormFieldType is the type of the form field.
const ( FormFieldTypeUnknown FormFieldType = iota FormFieldTypeText FormFieldTypeCheckBox FormFieldTypeDropDown )
Form Field Type constants
func (FormFieldType) String ¶
func (i FormFieldType) String() string
type Header ¶
type Header struct {
// contains filtered or unexported fields
}
Header is a header for a document section.
func (Header) AddParagraph ¶
AddParagraph adds a paragraph to the header.
type Image ¶
Image is a container for image information.
func ImageFromFile ¶
ImageFromFile reads an image from a file on disk. It doesn't keep the image in memory and only reads it to determine the format and size. You can also construct an Image directly if the file and size are known.
type ImageRef ¶
type ImageRef struct {
// contains filtered or unexported fields
}
ImageRef is a reference to an image in a document.
type Numbering ¶
type Numbering struct {
// contains filtered or unexported fields
}
Numbering is the document wide numbering styles contained in numbering.xml.
func (Numbering) InitializeDefault ¶
func (n Numbering) InitializeDefault()
InitializeDefault constructs a default numbering.
type Paragraph ¶
type Paragraph struct {
// contains filtered or unexported fields
}
Paragraph is a paragraph within a document.
func (Paragraph) Properties ¶
func (p Paragraph) Properties() ParagraphProperties
Properties returns the paragraph properties.
func (Paragraph) SetStyle ¶
SetStyle sets the style of a paragraph and is identical to setting it on the paragraph's Properties()
type ParagraphProperties ¶
type ParagraphProperties struct {
// contains filtered or unexported fields
}
ParagraphProperties are the properties for a paragraph.
func (ParagraphProperties) AddSection ¶
func (p 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 (p 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) SetHeadingLevel ¶
func (p ParagraphProperties) SetHeadingLevel(idx int)
SetHeadingLevel sets a heading level and style based on the level to a paragraph. The default styles for a new gooxml document support headings from level 1 to 8.
func (ParagraphProperties) SetKeepOnOnePage ¶
func (p ParagraphProperties) SetKeepOnOnePage(b bool)
SetKeepOnOnePage controls if all lines in a paragraph are kept on the same page.
func (ParagraphProperties) SetKeepWithNext ¶
func (p ParagraphProperties) SetKeepWithNext(b bool)
SetKeepWithNext controls if this paragraph should be kept with the next.
func (ParagraphProperties) SetPageBreakBefore ¶
func (p ParagraphProperties) SetPageBreakBefore(b bool)
SetPageBreakBefore controls if there is a page break before this paragraph.
func (ParagraphProperties) SetSpacing ¶
func (p ParagraphProperties) SetSpacing(before, after measurement.Distance)
SetSpacing sets the spacing that comes before and after the paragraph.
func (ParagraphProperties) SetStyle ¶
func (p ParagraphProperties) SetStyle(s string)
SetStyle sets the style of a paragraph.
func (ParagraphProperties) SetWindowControl ¶
func (p 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) Style ¶
func (p ParagraphProperties) Style() string
Style returns the style for a paragraph, or an empty string if it is unset.
func (ParagraphProperties) X ¶
func (p ParagraphProperties) X() *wml.CT_PPr
X returns the inner wrapped XML type.
type ParagraphStyleProperties ¶
type ParagraphStyleProperties struct {
// contains filtered or unexported fields
}
ParagraphStyleProperties is the styling information for a paragraph.
func (ParagraphStyleProperties) AddTabStop ¶
func (p ParagraphStyleProperties) AddTabStop(position measurement.Distance, justificaton wml.ST_TabJc, leader wml.ST_TabTlc)
AddTabStop adds a tab stop to the paragraph.
func (ParagraphStyleProperties) SetContextualSpacing ¶
func (p ParagraphStyleProperties) SetContextualSpacing(b bool)
SetContextualSpacing controls whether to Ignore Spacing Above and Below When Using Identical Styles
func (ParagraphStyleProperties) SetKeepNext ¶
func (p ParagraphStyleProperties) SetKeepNext(b bool)
SetKeepNext controls if the paragraph is kept with the next paragraph.
func (ParagraphStyleProperties) SetKeepOnOnePage ¶
func (p ParagraphStyleProperties) SetKeepOnOnePage(b bool)
SetKeepOnOnePage controls if all lines in a paragraph are kept on the same page.
func (ParagraphStyleProperties) SetOutlineLevel ¶
func (p ParagraphStyleProperties) SetOutlineLevel(lvl int)
SetOutlineLevel sets the outline level of this style.
func (ParagraphStyleProperties) SetSpacing ¶
func (p ParagraphStyleProperties) SetSpacing(before, after measurement.Distance)
SetSpacing sets the spacing that comes before and after the paragraph.
func (ParagraphStyleProperties) X ¶
func (p ParagraphStyleProperties) X() *wml.CT_PPrGeneral
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.
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) AddDrawingAnchored ¶
func (r Run) AddDrawingAnchored(img ImageRef) (AnchoredDrawing, error)
AddDrawingAnchored adds an anchored (floating) drawing from an ImageRef.
func (Run) AddFieldWithFormatting ¶
AddFieldWithFormatting adds a field (automatically computed text) to the document with field specifc formatting.
func (Run) AddTab ¶
func (r Run) AddTab()
AddTab adds tab to a run and can be used with the the Paragraph's tab stops.
func (Run) DrawingAnchored ¶
func (r Run) DrawingAnchored() []AnchoredDrawing
DrawingAnchored returns a slice of AnchoredDrawings.
func (Run) SetDoubleStrikeThrough ¶
SetDoubleStrikeThrough sets the run to double strike-through.
func (Run) SetEffect ¶
func (r Run) SetEffect(e wml.ST_TextEffect)
SetEffect sets a text effect on the run.
func (Run) SetFontFamily ¶
SetFontFamily sets the Ascii & HAnsi fonly family for a run.
func (Run) SetFontSize ¶
func (r Run) SetFontSize(sz measurement.Distance)
SetFontSize sets the font size.
func (Run) SetHighlight ¶
func (r Run) SetHighlight(c wml.ST_HighlightColor)
SetHighlight highlights text in a specified color.
func (Run) SetSmallCaps ¶
SetSmallCaps sets the run to small caps.
func (Run) SetStrikeThrough ¶
SetStrikeThrough sets the run to strike-through.
func (Run) SetUnderline ¶
func (r Run) SetUnderline(style wml.ST_Underline, c color.Color)
SetUnderline sets the run to underline with a particular style and color.
type RunStyleProperties ¶
type RunStyleProperties struct {
// contains filtered or unexported fields
}
RunStyleProperties controls run styling properties
func (RunStyleProperties) Color ¶
func (r RunStyleProperties) Color() Color
Color returns the style's Color.
func (RunStyleProperties) Fonts ¶
func (r RunStyleProperties) Fonts() Fonts
Fonts returns the style's Fonts.
func (RunStyleProperties) SetCharacterSpacing ¶
func (r RunStyleProperties) SetCharacterSpacing(size measurement.Distance)
SetCharacterSpacing sets the run's Character Spacing Adjustment.
func (RunStyleProperties) SetKerning ¶
func (r RunStyleProperties) SetKerning(size measurement.Distance)
SetKerning sets the run's font kerning.
func (RunStyleProperties) SetSize ¶
func (r RunStyleProperties) SetSize(size measurement.Distance)
SetSize sets the font size for a run.
func (RunStyleProperties) X ¶
func (r RunStyleProperties) X() *wml.CT_RPr
X returns the inner wrapped XML type.
type Section ¶
type Section struct {
// contains filtered or unexported fields
}
Section is the begining of a new section.
type Settings ¶
type Settings struct {
// contains filtered or unexported fields
}
Settings controls the document settings.
func (Settings) SetUpdateFieldsOnOpen ¶
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.
type Style ¶
type Style struct {
// contains filtered or unexported fields
}
Style is a style within the styles.xml file.
func (Style) ParagraphProperties ¶
func (s Style) ParagraphProperties() ParagraphStyleProperties
ParagraphProperties returns the paragraph style properties.
func (Style) RunProperties ¶
func (s Style) RunProperties() RunStyleProperties
RunProperties returns the run style.
func (Style) SetBasedOn ¶
SetBasedOn sets the style that this style is based on.
func (Style) SetLinkedStyle ¶
SetLinkedStyle sets the style that this style is linked to.
func (Style) SetNextStyle ¶
SetNextStyle sets the style that the next paragraph will use.
func (Style) SetPrimaryStyle ¶
SetPrimaryStyle marks the style as a primary style.
func (Style) SetSemiHidden ¶
SetSemiHidden controls if the style is hidden in the UI.
func (Style) SetUISortOrder ¶
SetUISortOrder controls the order the style is displayed in the UI.
func (Style) SetUnhideWhenUsed ¶
SetUnhideWhenUsed controls if a semi hidden style becomes visible when used.
type Styles ¶
type Styles struct {
// contains filtered or unexported fields
}
Styles is the document wide styles contained in styles.xml.
func (Styles) InitializeDefault ¶
func (s Styles) InitializeDefault()
InitializeDefault constructs the default styles.
func (Styles) ParagraphStyles ¶
ParagraphStyles returns only the paragraph styles.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table is a table within a document.
func (Table) Properties ¶
func (t Table) Properties() TableProperties
Properties returns the table properties.
type TableBorders ¶
type TableBorders struct {
// contains filtered or unexported fields
}
TableBorders allows manipulation of borders on a table.
func (TableBorders) SetAll ¶
func (b 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 (b 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 (b 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 (b 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 (b 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 (b 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 (b 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 (b TableBorders) X() *wml.CT_TblBorders
X returns the inner wml.CT_TblBorders
type TableProperties ¶
type TableProperties struct {
// contains filtered or unexported fields
}
TableProperties are the properties for a table within a document
func (TableProperties) Borders ¶
func (t TableProperties) Borders() TableBorders
Borders allows manipulation of the table borders.
func (TableProperties) SetCellSpacing ¶
func (t TableProperties) SetCellSpacing(m measurement.Distance)
SetCellSpacing sets the cell spacing within a table.
func (TableProperties) SetCellSpacingAuto ¶
func (t TableProperties) SetCellSpacingAuto()
SetCellSpacingAuto sets the cell spacing within a table to automatic.
func (TableProperties) SetCellSpacingPercent ¶
func (t TableProperties) SetCellSpacingPercent(pct float64)
SetCellSpacingPercent sets the cell spacing within a table to a percent width.
func (TableProperties) SetWidth ¶
func (t TableProperties) SetWidth(d measurement.Distance)
SetWidth sets the table with to a specified width.
func (TableProperties) SetWidthAuto ¶
func (t TableProperties) SetWidthAuto()
SetWidthAuto sets the the table width to automatic.
func (TableProperties) SetWidthPercent ¶
func (t TableProperties) SetWidthPercent(pct float64)
SetWidthPercent sets the table to a width percentage.
func (TableProperties) X ¶
func (t TableProperties) X() *wml.CT_TblPr
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 (s TableWidth) SetValue(m measurement.Distance)
SetValue sets the width value.
func (TableWidth) X ¶
func (s TableWidth) X() *wml.CT_TblWidth
X returns the inner wrapped XML type.
Source Files ¶
- anchoreddrawing.go
- cell.go
- cellproperties.go
- color.go
- doc.go
- document.go
- fonts.go
- footer.go
- formfield.go
- formfieldtype_string.go
- header.go
- image.go
- knownfields.go
- numbering.go
- paragraph.go
- paragraphproperties.go
- paragraphstyleproperties.go
- row.go
- run.go
- runstyleproperties.go
- section.go
- settings.go
- style.go
- styles.go
- table.go
- tableborders.go
- tableproperties.go
- tablewidth.go