Documentation ¶
Overview ¶
Package elements provides internal structures and functions for working with low-level document elements in GoDocx.
These elements, such as runs, paragraphs, tables, etc., are used internally and are not intended for direct use by end-users. End-users will interact with document elements through the higher-level oxml package, which provides a more user-friendly interface for creating and manipulating documents.
Index ¶
- type Anchor
- type Blip
- type BlipFill
- type Bold
- type BorderType
- type Break
- type CNvPicPr
- type CNvPr
- type CellMargin
- type Charset
- type Color
- type ColorIndex
- type DocProp
- type Drawing
- type Extent
- type Family
- type FillRect
- type Font
- type Graphic
- type GraphicData
- type GraphicFrameLocks
- type Highlight
- type Hyperlink
- type IndentLevel
- type Inline
- type Italic
- type Justification
- type LayoutType
- type NonVisualGraphicFrameProp
- type NonVisualPicProp
- type NumberingId
- type NumberingProperty
- type Offset
- type Paragraph
- func (p *Paragraph) AddText(text string) *Run
- func (para *Paragraph) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)
- func (p *Paragraph) Numbering(id int, level int)
- func (p *Paragraph) Style(value string) *Paragraph
- func (p *Paragraph) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)
- type ParagraphBorderPosition
- type ParagraphChild
- type ParagraphProperty
- type ParagraphStyle
- type Pic
- type PicShapeProp
- type Pitch
- type PresetGeometry
- type RowHeight
- type Run
- func (r *Run) Bold(value bool) *Run
- func (r *Run) Color(colorCode string) *Run
- func (r *Run) Highlight(color ColorIndex) *Run
- func (r *Run) Italic(value bool) *Run
- func (r *Run) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)
- func (r *Run) Shading(shdType ShadingType, color, fill string) *Run
- func (r *Run) Size(size uint) *Run
- func (r *Run) Strike(value bool) *Run
- func (r *Run) Style(value string) *Run
- func (r *Run) Underline(value UnderlineStyle) *Run
- func (r *Run) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)
- type RunChild
- type RunProperty
- type RunStyle
- type Shading
- func (s *Shading) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (s *Shading) SetColor(color string) *Shading
- func (s *Shading) SetFill(fill string) *Shading
- func (s *Shading) SetShadingType(shdType ShadingType) *Shading
- func (s *Shading) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
- type ShadingType
- type Stretch
- type Strike
- type Sz
- type SzCs
- type Table
- type TableBorderElement
- type TableBorderPosition
- type TableBorders
- type TableCell
- type TableCellBorderPosition
- type TableCellContent
- type TableCellMargins
- func (tcm TableCellMargins) Margin(top, right, bottom, left uint64) TableCellMargins
- func (tcm TableCellMargins) MarginBottom(v uint64, t WidthType) TableCellMargins
- func (tcm TableCellMargins) MarginLeft(v uint64, t WidthType) TableCellMargins
- func (tcm TableCellMargins) MarginRight(v uint64, t WidthType) TableCellMargins
- func (tcm TableCellMargins) MarginTop(v uint64, t WidthType) TableCellMargins
- func (tcm *TableCellMargins) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)
- func (tcm *TableCellMargins) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)
- type TableCellProperty
- type TableChild
- type TableGrid
- type TableIndent
- type TableLayout
- type TableProperty
- type TableRow
- type TableRowProperty
- type TableStyle
- type TableWidth
- type Text
- type TransformGroup
- type Underline
- type UnderlineStyle
- type WidthType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Anchor ¶
type Anchor struct { /// Specifies that this object shall be positioned using the positioning information in the /// simplePos child element (§20.4.2.13). This positioning, when specified, positions the /// object on the page by placing its top left point at the x-y coordinates specified by that /// element. /// Reference: http://officeopenxml.com/drwPicFloating-position.php SimplePosAttr int /// Specifies the minimum distance which shall be maintained between the top edge of this drawing object and any subsequent text within the document when this graphical object is displayed within the document's contents., /// The distance shall be measured in EMUs (English Mektric Units)., DistTAttr int DistBAttr int DistLAttr int DistRAttr int LayoutInCellAttr int AllowOverlapAttr int RelativeHeightAttr int BehindDocAttr int LockedAttr int // Child elements: SimplePos *types.PositionType PositionH *types.PoistionH PositionV *types.PoistionV Graphic *Graphic Extent *Extent DocProp *DocProp // contains filtered or unexported fields }
func (*Anchor) MarshalXML ¶
func (*Anchor) UnmarshalXML ¶
type Blip ¶
type Blip struct {
EmbedID string
}
func (*Blip) MarshalXML ¶
func (*Blip) UnmarshalXML ¶
type Bold ¶
type Bold struct {
Val bool
}
Bold represents the bold style of text or element.
func (*Bold) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface for the Bold type. It encodes the Bold instance into XML using the "w:b" element with a "w:val" attribute.
func (*Bold) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface for the Bold type. It decodes the XML representation of Bold, extracting the value from the "w:val" attribute. The inner content of the XML element is skipped.
type BorderType ¶
type BorderType string
const ( BorderTypeNil BorderType = "nil" BorderTypeNone BorderType = "none" BorderTypeSingle BorderType = "single" BorderTypeThick BorderType = "thick" BorderTypeDouble BorderType = "double" BorderTypeDotted BorderType = "dotted" BorderTypeDashed BorderType = "dashed" BorderTypeDotDash BorderType = "dotDash" BorderTypeDotDotDash BorderType = "dotDotDash" BorderTypeTriple BorderType = "triple" BorderTypeThinThickSmallGap BorderType = "thinThickSmallGap" BorderTypeThickThinSmallGap BorderType = "thickThinSmallGap" BorderTypeThinThickThinSmallGap BorderType = "thinThickThinSmallGap" BorderTypeThinThickMediumGap BorderType = "thinThickMediumGap" BorderTypeThickThinMediumGap BorderType = "thickThinMediumGap" BorderTypeThinThickThinMediumGap BorderType = "thinThickThinMediumGap" BorderTypeThinThickLargeGap BorderType = "thinThickLargeGap" BorderTypeThickThinLargeGap BorderType = "thickThinLargeGap" BorderTypeThinThickThinLargeGap BorderType = "thinThickThinLargeGap" BorderTypeWave BorderType = "wave" BorderTypeDoubleWave BorderType = "doubleWave" BorderTypeDashSmallGap BorderType = "dashSmallGap" BorderTypeDashDotStroked BorderType = "dashDotStroked" BorderTypeThreeDEmboss BorderType = "threeDEmboss" BorderTypeThreeDEngrave BorderType = "threeDEngrave" BorderTypeOutset BorderType = "outset" BorderTypeInset BorderType = "inset" BorderTypeApples BorderType = "apples" BorderTypeArchedScallops BorderType = "archedScallops" BorderTypeBabyPacifier BorderType = "babyPacifier" BorderTypeBabyRattle BorderType = "babyRattle" )
type Break ¶
func (*Break) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface.
func (*Break) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface.
type CNvPicPr ¶
type CNvPicPr struct{}
func (*CNvPicPr) MarshalXML ¶
func (*CNvPicPr) UnmarshalXML ¶
type CellMargin ¶
func DefaultCellMargin ¶
func DefaultCellMargin() *CellMargin
func NewCellMargin ¶
func NewCellMargin(val uint64, widthType WidthType) *CellMargin
func (*CellMargin) MarshalXML ¶
func (cm *CellMargin) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)
func (*CellMargin) UnmarshalXML ¶
func (cm *CellMargin) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type Charset ¶
type Charset struct {
Value string
}
Charset represents the charset of a text or element.
func NewCharset ¶
NewCharset creates a new Charset instance with the specified charset value.
func (*Charset) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface for the Charset type.
It encodes the Charset instance into XML using the "w:charset" element with a "w:val" attribute.
func (*Charset) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface for the Charset type.
It decodes the XML representation of Charset, extracting the value from the "val" attribute. The inner content of the XML element is skipped.
type Color ¶
type Color struct {
Value string
}
Color represents the color of a text or element.
func (*Color) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface for the Color type.
It encodes the Color instance into XML using the "w:color" element with a "w:val" attribute.
func (*Color) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface for the Color type.
It decodes the XML representation of Color, extracting the value from the "val" attribute. The inner content of the XML element is skipped.
type ColorIndex ¶
type ColorIndex string
ColorIndex represents different color indexes.
const ( ColorIndexAuto ColorIndex = "default" ColorIndexBlack ColorIndex = "black" ColorIndexBlue ColorIndex = "blue" ColorIndexBrightGreen ColorIndex = "green" ColorIndexDarkBlue ColorIndex = "darkBlue" ColorIndexDarkRed ColorIndex = "darkRed" ColorIndexDarkYellow ColorIndex = "darkYellow" ColorIndexGray25 ColorIndex = "lightGray" ColorIndexGray50 ColorIndex = "darkGray" ColorIndexGreen ColorIndex = "darkGreen" ColorIndexPink ColorIndex = "magenta" ColorIndexRed ColorIndex = "red" ColorIndexTeal ColorIndex = "darkCyan" ColorIndexTurquoise ColorIndex = "cyan" ColorIndexVoilet ColorIndex = "darkMagenta" ColorIndexWhite ColorIndex = "white" ColorIndexYellow ColorIndex = "yellow" )
type Family ¶
type Family struct {
Value string
}
Family represents the family of a text or element.
func (*Family) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface for the Family type.
It encodes the Family instance into XML using the "w:family" element with a "w:val" attribute.
func (*Family) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface for the Family type.
It decodes the XML representation of Family, extracting the value from the "val" attribute. The inner content of the XML element is skipped.
type FillRect ¶
type FillRect struct{}
func (*FillRect) MarshalXML ¶
func (*FillRect) UnmarshalXML ¶
type Font ¶
func (*Font) MarshalXML ¶
func (*Font) UnmarshalXML ¶
UnmarshalXML unmarshals XML to Font.
type Graphic ¶
type Graphic struct {
Data *GraphicData
}
func DefaultGraphic ¶
func DefaultGraphic() *Graphic
func (*Graphic) MarshalXML ¶
func (*Graphic) UnmarshalXML ¶
type GraphicData ¶
func (*GraphicData) MarshalXML ¶
func (gd *GraphicData) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*GraphicData) UnmarshalXML ¶
func (gd *GraphicData) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error
type GraphicFrameLocks ¶
type GraphicFrameLocks struct {
// contains filtered or unexported fields
}
func (*GraphicFrameLocks) MarshalXML ¶
func (g *GraphicFrameLocks) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*GraphicFrameLocks) UnmarshalXML ¶
func (g *GraphicFrameLocks) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error
type Highlight ¶
type Highlight struct {
Value ColorIndex
}
Highlight represents the highlighting of a text or element.
func NewHighlight ¶
func NewHighlight(value ColorIndex) *Highlight
NewHighlight creates a new Highlight.
func (*Highlight) MarshalXML ¶
MarshalXML marshals Highlight to XML.
func (*Highlight) UnmarshalXML ¶
UnmarshalXML unmarshals XML to Highlight.
type Hyperlink ¶
type Hyperlink struct { XMLName xml.Name `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main hyperlink,omitempty"` ID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr"` // Run Run Children []*ParagraphChild }
type IndentLevel ¶
type IndentLevel struct {
Val int
}
IndentLevel represents the indentation level of a numbering in a document.
func NewIndentLevel ¶
func NewIndentLevel(val int) *IndentLevel
NewIndentLevel creates a new IndentLevel instance.
func (*IndentLevel) MarshalXML ¶
func (i *IndentLevel) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaler interface for IndentLevel.
func (*IndentLevel) UnmarshalXML ¶
func (i *IndentLevel) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaler interface for IndentLevel.
type Inline ¶
type Inline struct { /// Specifies the minimum distance which shall be maintained between the top edge of this drawing object and any subsequent text within the document when this graphical object is displayed within the document's contents., /// The distance shall be measured in EMUs (English Mektric Units)., DistTAttr int DistBAttr int DistLAttr int DistRAttr int // Child elements: Extent *Extent DocProp *DocProp Graphic *Graphic // contains filtered or unexported fields }
func (*Inline) MarshalXML ¶
func (*Inline) UnmarshalXML ¶
type Italic ¶
type Italic struct {
Val bool
}
Italic represents the italic style of text or element.
func (*Italic) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface for the Italic type. It encodes the Italic instance into XML using the "w:i" element with a "w:val" attribute.
func (*Italic) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface for the Italic type. It decodes the XML representation of Italic, extracting the value from the "w:val" attribute. The inner content of the XML element is skipped.
type Justification ¶
type Justification struct {
Value string
}
Justification represents the justification of a paragraph.
func DefaultJustification ¶
func DefaultJustification() *Justification
DefaultJustification creates the default Justification with the value "centerGroup".
func NewJustification ¶
func NewJustification(val string) *Justification
NewJustification creates a new Justification.
func (*Justification) MarshalXML ¶
func (j *Justification) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*Justification) UnmarshalXML ¶
func (j *Justification) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type LayoutType ¶
type LayoutType string
const ( LayoutTypeFixed LayoutType = "fixed" LayoutTypeAutoFit LayoutType = "autofit" )
type NonVisualGraphicFrameProp ¶
type NonVisualGraphicFrameProp struct {
GraphicFrameLocks *GraphicFrameLocks
}
func (*NonVisualGraphicFrameProp) MarshalXML ¶
func (n *NonVisualGraphicFrameProp) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*NonVisualGraphicFrameProp) UnmarshalXML ¶
func (n *NonVisualGraphicFrameProp) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error
type NonVisualPicProp ¶
func (*NonVisualPicProp) MarshalXML ¶
func (n *NonVisualPicProp) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*NonVisualPicProp) UnmarshalXML ¶
func (n *NonVisualPicProp) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type NumberingId ¶
type NumberingId struct {
Val int
}
NumberingId represents the ID of a numbering in a document.
func NewNumberingId ¶
func NewNumberingId(val int) *NumberingId
NewNumberingId creates a new NumberingId instance.
func (*NumberingId) MarshalXML ¶
func (n *NumberingId) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaler interface for NumberingId.
func (*NumberingId) UnmarshalXML ¶
func (n *NumberingId) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaler interface for NumberingId.
type NumberingProperty ¶
type NumberingProperty struct { ID *NumberingId Level *IndentLevel }
NumberingProperty represents the properties of a numbering in a document.
func NewNumberingProperty ¶
func NewNumberingProperty() *NumberingProperty
NewNumberingProperty creates a new NumberingProperty instance.
func (*NumberingProperty) AddNumber ¶
func (n *NumberingProperty) AddNumber(id *NumberingId, level *IndentLevel) *NumberingProperty
AddNumber adds the numbering ID and indent level to the NumberingProperty.
func (*NumberingProperty) MarshalXML ¶
func (n *NumberingProperty) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaler interface for NumberingProperty.
func (*NumberingProperty) UnmarshalXML ¶
func (n *NumberingProperty) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaler interface for NumberingProperty.
type Paragraph ¶
type Paragraph struct { Property *ParagraphProperty Children []*ParagraphChild // contains filtered or unexported fields }
func AddParagraph ¶
func DefaultParagraph ¶
func DefaultParagraph() *Paragraph
func NewParagraph ¶
func NewParagraph() *Paragraph
func (*Paragraph) AddText ¶
Appends a new text to the Paragraph. Example:
paragraph := AddParagraph() modifiedParagraph := paragraph.AddText("Hello, World!")
Parameters:
- text: A string representing the text to be added to the Paragraph.
Returns:
- *Run: The newly created Run instance added to the Paragraph.
func (*Paragraph) MarshalXML ¶
func (*Paragraph) UnmarshalXML ¶
type ParagraphBorderPosition ¶
type ParagraphBorderPosition int
ParagraphBorderPosition represents the position of a border in a paragraph.
const ( ParagraphBorderPositionLeft ParagraphBorderPosition = 1 ParagraphBorderPositionRight ParagraphBorderPosition = 2 ParagraphBorderPositionTop ParagraphBorderPosition = 3 ParagraphBorderPositionBottom ParagraphBorderPosition = 4 ParagraphBorderPositionBetween ParagraphBorderPosition = 5 ParagraphBorderPositionBar ParagraphBorderPosition = 6 )
type ParagraphChild ¶
func DefaultParagraphChild ¶
func DefaultParagraphChild() *ParagraphChild
func NewParagraphChild ¶
func NewParagraphChild() *ParagraphChild
type ParagraphProperty ¶
type ParagraphProperty struct { DivID *string KeepNext *bool KeepLines *bool PageBreakBefore *bool WidowControl *bool Style *ParagraphStyle Justification *Justification NumberingProperty *NumberingProperty }
func DefaultParaProperty ¶
func DefaultParaProperty() *ParagraphProperty
func (*ParagraphProperty) MarshalXML ¶
func (pp *ParagraphProperty) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)
func (*ParagraphProperty) UnmarshalXML ¶
func (pp *ParagraphProperty) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)
type ParagraphStyle ¶
type ParagraphStyle struct {
Value string
}
ParagraphStyle represents the name of a paragraph style associated with a numbering level in a document. When a paragraph style includes a numbering definition, any numbering level defined by the numPr element (§17.3.1.19) shall be ignored. Instead, this element specifies the numbering level associated with that paragraph style.
func DefaultParagraphStyle ¶
func DefaultParagraphStyle() *ParagraphStyle
DefaultParagraphStyle creates the default ParagraphStyle with the value "Normal".
func NewParagraphStyle ¶
func NewParagraphStyle(val string) *ParagraphStyle
NewParagraphStyle creates a new ParagraphStyle.
func (*ParagraphStyle) MarshalXML ¶
func (p *ParagraphStyle) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*ParagraphStyle) UnmarshalXML ¶
func (p *ParagraphStyle) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type Pic ¶
type Pic struct { NonVisualPicProp *NonVisualPicProp BlipFill *BlipFill PicShapeProp *PicShapeProp }
func (*Pic) MarshalXML ¶
func (*Pic) UnmarshalXML ¶
type PicShapeProp ¶
type PicShapeProp struct { TransformGroup *TransformGroup PresetGeometry *PresetGeometry }
func (*PicShapeProp) MarshalXML ¶
func (p *PicShapeProp) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*PicShapeProp) UnmarshalXML ¶
func (p *PicShapeProp) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type Pitch ¶
type Pitch struct {
Value types.FontPitchType
}
Pitch represents the pitch of a text or element.
func NewPitch ¶
func NewPitch(value types.FontPitchType) *Pitch
NewPitch creates a new Pitch instance with the specified pitch value.
func (*Pitch) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface for the Pitch type.
It encodes the Pitch instance into XML using the "w:pitch" element with a "w:val" attribute.
func (*Pitch) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface for the Pitch type.
It decodes the XML representation of Pitch, extracting the value from the "val" attribute. The inner content of the XML element is skipped.
type PresetGeometry ¶
type PresetGeometry struct {
Preset string
}
func (*PresetGeometry) MarshalXML ¶
func (p *PresetGeometry) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*PresetGeometry) UnmarshalXML ¶
func (p *PresetGeometry) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type Run ¶
type Run struct { RunProperty *RunProperty Children []*RunChild }
A Run is part of a paragraph that has its own style. It could be
func (*Run) Color ¶
Sets the color of the Run.
Example:
run := NewRun() modifiedRun := run.Color("FF0000")
Parameters:
- colorCode: A string representing the color code (e.g., "FF0000" for red).
Returns:
- *Run: The modified Run instance with the updated color.
func (*Run) Highlight ¶
func (r *Run) Highlight(color ColorIndex) *Run
AddHighlight sets the highlight color for the run.
func (*Run) MarshalXML ¶
func (*Run) Underline ¶
func (r *Run) Underline(value UnderlineStyle) *Run
func (*Run) UnmarshalXML ¶
type RunProperty ¶
type RunProperty struct { Color *Color Style *RunStyle Size *Sz SizeCs *SzCs Shading *Shading Highlight *Highlight Bold *Bold Italic *Italic Strike *Strike Underline *Underline }
RunProperty represents the properties of a run of text within a paragraph.
func NewRunProperty ¶
func NewRunProperty() RunProperty
NewRunProperty creates a new RunProperty with default values.
func (*RunProperty) MarshalXML ¶
func (rp *RunProperty) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML marshals RunProperty to XML.
func (*RunProperty) UnmarshalXML ¶
func (rp *RunProperty) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshals XML to RunProperty.
type RunStyle ¶
type RunStyle struct {
Value string
}
RunStyle represents the style of a run within a document.
func DefaultRunStyle ¶
func DefaultRunStyle() *RunStyle
DefaultRunStyle creates the default RunStyle with the value "Normal".
func (*RunStyle) MarshalXML ¶
MarshalXML marshals RunStyle to XML.
func (*RunStyle) UnmarshalXML ¶
UnmarshalXML unmarshals XML to RunStyle.
type Shading ¶
type Shading struct { ShdType ShadingType Color string Fill string }
Shading represents the shading properties.
func DefaultShading ¶
func DefaultShading() *Shading
DefaultShading creates a new Shading with default values.
func (*Shading) MarshalXML ¶
func (*Shading) SetShadingType ¶
func (s *Shading) SetShadingType(shdType ShadingType) *Shading
ShadingType sets the shading type for the shading.
func (*Shading) UnmarshalXML ¶
UnmarshalXML unmarshals XML to Shading.
type ShadingType ¶
type ShadingType string
ShadingType represents the shading type. ShadingType represents different shading types.
const ( ShadingTypeNil ShadingType = "Nil" ShadingTypeClear ShadingType = "Clear" ShadingTypeSolid ShadingType = "Solid" ShadingTypeHorzStripe ShadingType = "HorzStripe" ShadingTypeVertStripe ShadingType = "VertStripe" ShadingTypeReverseDiagStripe ShadingType = "ReverseDiagStripe" ShadingTypeDiagStripe ShadingType = "DiagStripe" ShadingTypeHorzCross ShadingType = "HorzCross" ShadingTypeDiagCross ShadingType = "DiagCross" ShadingTypeThinHorzStripe ShadingType = "ThinHorzStripe" ShadingTypeThinVertStripe ShadingType = "ThinVertStripe" ShadingTypeThinReverseDiagStripe ShadingType = "ThinReverseDiagStripe" ShadingTypeThinDiagStripe ShadingType = "ThinDiagStripe" ShadingTypeThinHorzCross ShadingType = "ThinHorzCross" ShadingTypeThinDiagCross ShadingType = "ThinDiagCross" ShadingTypePct5 ShadingType = "Pct5" ShadingTypePct10 ShadingType = "Pct10" ShadingTypePct12 ShadingType = "Pct12" ShadingTypePct15 ShadingType = "Pct15" ShadingTypePct20 ShadingType = "Pct20" ShadingTypePct25 ShadingType = "Pct25" ShadingTypePct30 ShadingType = "Pct30" ShadingTypePct35 ShadingType = "Pct35" ShadingTypePct37 ShadingType = "Pct37" ShadingTypePct40 ShadingType = "Pct40" ShadingTypePct45 ShadingType = "Pct45" ShadingTypePct50 ShadingType = "Pct50" ShadingTypePct55 ShadingType = "Pct55" ShadingTypePct60 ShadingType = "Pct60" ShadingTypePct62 ShadingType = "Pct62" ShadingTypePct65 ShadingType = "Pct65" ShadingTypePct70 ShadingType = "Pct70" ShadingTypePct75 ShadingType = "Pct75" ShadingTypePct80 ShadingType = "Pct80" ShadingTypePct85 ShadingType = "Pct85" ShadingTypePct87 ShadingType = "Pct87" ShadingTypePct90 ShadingType = "Pct90" ShadingTypePct95 ShadingType = "Pct95" )
type Stretch ¶
type Stretch struct {
FillRect *FillRect
}
func (*Stretch) MarshalXML ¶
func (*Stretch) UnmarshalXML ¶
type Strike ¶
type Strike struct {
Val bool
}
Strike represents the strike style of text or element.
func (*Strike) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface for the Strike type. It encodes the Strike instance into XML using the "w:b" element with a "w:val" attribute.
func (*Strike) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface for the Strike type. It decodes the XML representation of Strike, extracting the value from the "w:val" attribute. The inner content of the XML element is skipped.
type Sz ¶
type Sz struct {
Value uint
}
Sz represents the font size of a text or element.
func (*Sz) MarshalXML ¶
func (*Sz) UnmarshalXML ¶
type SzCs ¶
type SzCs struct {
Value uint
}
SzCs represents the font size of a text or element.
func (*SzCs) MarshalXML ¶
func (*SzCs) UnmarshalXML ¶
type Table ¶
type Table struct { Rows []TableChild Grid *TableGrid Property *TableProperty HasNumbering bool }
func DefaultTable ¶
func DefaultTable() *Table
func (*Table) MarshalXML ¶
func (*Table) UnmarshalXML ¶
type TableBorderElement ¶
type TableBorderElement struct { BorderType BorderType Position TableBorderPosition Size uint64 Space uint64 Color string }
func DefaulTableBorderElement ¶
func DefaulTableBorderElement() *TableBorderElement
DefaulTableBorderElement creates a new TableBorderElement instance with default values. It sets the default border type to single, size to 2, space to 0, color to "000000", and position to TableBorderPositionBottom.
func NewTableBorderElement ¶
func NewTableBorderElement(borderType BorderType, size uint64, color string, position TableBorderPosition, space uint64) *TableBorderElement
NewTableBorderElement returns a new table border with the given properties.
func (*TableBorderElement) MarshalXML ¶
func (t *TableBorderElement) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaler interface for TableBorderElement.
func (*TableBorderElement) UnmarshalXML ¶
func (t *TableBorderElement) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)
type TableBorderPosition ¶
type TableBorderPosition string
TableBorderPosition represents the position of a border in a table.
const ( TableBorderPositionLeft TableBorderPosition = "w:left" TableBorderPositionRight TableBorderPosition = "w:right" TableBorderPositionTop TableBorderPosition = "w:top" TableBorderPositionBottom TableBorderPosition = "w:bottom" TableBorderPositionInsideH TableBorderPosition = "w:insideH" TableBorderPositionInsideV TableBorderPosition = "w:insideV" )
type TableBorders ¶
type TableBorders struct { Top *TableBorderElement Bottom *TableBorderElement Left *TableBorderElement Right *TableBorderElement InsideH *TableBorderElement InsideV *TableBorderElement }
func DefaultTableBorders ¶
func DefaultTableBorders() *TableBorders
func (*TableBorders) MarshalXML ¶
func (t *TableBorders) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*TableBorders) UnmarshalXML ¶
func (t *TableBorders) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type TableCell ¶
type TableCell struct { Children []*TableCellContent Property TableCellProperty HasNumbering bool }
func DefaultCell ¶
func DefaultCell() *TableCell
func (*TableCell) AddParagraph ¶
func (*TableCell) MarshalXML ¶
func (*TableCell) UnmarshalXML ¶
type TableCellBorderPosition ¶
type TableCellBorderPosition int
TableCellBorderPosition represents the position of a border in a table cell.
const ( TableCellBorderPositionLeft TableCellBorderPosition = 1 TableCellBorderPositionRight TableCellBorderPosition = 2 TableCellBorderPositionTop TableCellBorderPosition = 3 TableCellBorderPositionBottom TableCellBorderPosition = 4 TableCellBorderPositionInsideH TableCellBorderPosition = 5 TableCellBorderPositionInsideV TableCellBorderPosition = 6 TableCellBorderPositionTl2br TableCellBorderPosition = 7 TableCellBorderPositionTr2bl TableCellBorderPosition = 8 )
type TableCellContent ¶
type TableCellMargins ¶
type TableCellMargins struct { Top *CellMargin Left *CellMargin Bottom *CellMargin Right *CellMargin }
func DefaultTableCellMargins ¶
func DefaultTableCellMargins() TableCellMargins
func (TableCellMargins) Margin ¶
func (tcm TableCellMargins) Margin(top, right, bottom, left uint64) TableCellMargins
func (TableCellMargins) MarginBottom ¶
func (tcm TableCellMargins) MarginBottom(v uint64, t WidthType) TableCellMargins
func (TableCellMargins) MarginLeft ¶
func (tcm TableCellMargins) MarginLeft(v uint64, t WidthType) TableCellMargins
func (TableCellMargins) MarginRight ¶
func (tcm TableCellMargins) MarginRight(v uint64, t WidthType) TableCellMargins
func (TableCellMargins) MarginTop ¶
func (tcm TableCellMargins) MarginTop(v uint64, t WidthType) TableCellMargins
func (*TableCellMargins) MarshalXML ¶
func (tcm *TableCellMargins) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)
func (*TableCellMargins) UnmarshalXML ¶
func (tcm *TableCellMargins) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)
type TableCellProperty ¶
type TableCellProperty struct {
Shading *Shading
}
func (*TableCellProperty) MarshalXML ¶
func (t *TableCellProperty) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)
func (*TableCellProperty) UnmarshalXML ¶
func (t *TableCellProperty) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type TableChild ¶
type TableChild struct {
TableRow *TableRow
}
type TableGrid ¶
type TableGrid struct {
Grid []uint64
}
TableGrid represents the grid columns of a table.
func DefaultTableGrid ¶
func DefaultTableGrid() *TableGrid
func NewTableGrid ¶
NewTableGrid creates a new TableGrid instance.
func (*TableGrid) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface for TableGrid.
func (*TableGrid) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface for TableGrid.
type TableIndent ¶
TableWidth represents the width of a table in a document.
func NewTableIndent ¶
func NewTableIndent(width int, widthType WidthType) *TableIndent
func (*TableIndent) MarshalXML ¶
func (t *TableIndent) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)
func (*TableIndent) UnmarshalXML ¶
func (t *TableIndent) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)
type TableLayout ¶
type TableLayout struct {
LayoutType LayoutType
}
TableLayout represents the layout of a table in a document.
func DefaultTableLayout ¶
func DefaultTableLayout() *TableLayout
func NewTableLayout ¶
func NewTableLayout(t LayoutType) *TableLayout
NewTableLayout creates a new TableLayout instance.
func (*TableLayout) MarshalXML ¶
func (t *TableLayout) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaler interface for TableLayout.
func (*TableLayout) UnmarshalXML ¶
func (t *TableLayout) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaler interface for TableLayout.
type TableProperty ¶
type TableProperty struct { Width *TableWidth Justification *Justification Layout *TableLayout Style *TableStyle Indent *TableIndent Margins *TableCellMargins Borders *TableBorders }
func DefaultTableProperty ¶
func DefaultTableProperty() *TableProperty
func (*TableProperty) MarshalXML ¶
func (t *TableProperty) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)
func (*TableProperty) UnmarshalXML ¶
func (t *TableProperty) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type TableRow ¶
type TableRow struct { Cells []*TableCell Property *TableRowProperty HasNumbering bool }
func DefaultTableRow ¶
func DefaultTableRow() *TableRow
func (*TableRow) MarshalXML ¶
func (*TableRow) UnmarshalXML ¶
type TableRowProperty ¶
type TableRowProperty struct { GridAfter *uint32 WidthAfter *float32 GridBefore *uint32 WidthBefore *float32 RowHeight *RowHeight }
TableRowProperty represents the properties of a table row.
func DefaultTableRowProperty ¶
func DefaultTableRowProperty() *TableRowProperty
NewTableRowProperty creates a new TableRowProperty instance.
type TableStyle ¶
type TableStyle struct {
Val string
}
TableStyle represents the style of a table in a document. This is applicable when creating a new document. When using this style in a new document, you need to ensure that the specified style ID exists in your document's style base or is manually created through the library.
Some examples of predefined style IDs that can be used for table styles:
- "LightShading"
- "LightShading-Accent1"
- "LightShading-Accent2"
- "LightShading-Accent3"
- "LightShading-Accent4"
- "LightShading-Accent5"
- "LightShading-Accent6"
- "LightList"
- "LightList-Accent1"..."LightList-Accent6"
- "LightGrid"
- "LightGrid-Accent1"..."LightGrid-Accent6"
- "MediumShading"
- "MediumShading-Accent1"..."MediumShading-Accent6"
- "MediumShading2"
- "MediumShading2-Accent1"..."MediumShading2-Accent6"
- "MediumList1"
- "MediumList1-Accent1"..."MediumList1-Accent6"
- "MediumList2"
- "MediumList2-Accent1"..."MediumList2-Accent6"
- "TableGrid"
- "MediumGrid1"
- "MediumGrid1-Accent1"..."MediumGrid1-Accent6"
- "MediumGrid2"
- "MediumGrid2-Accent1"..."MediumGrid2-Accent6"
- "MediumGrid3"
- "MediumGrid3-Accent1"..."MediumGrid3-Accent6"
- "DarkList"
- "DarkList-Accent1"..."DarkList-Accent6"
- "ColorfulShading"
- "ColorfulShading-Accent1"..."ColorfulShading-Accent6"
- "ColorfulList"
- "ColorfulList-Accent1"..."ColorfulList-Accent6"
- "ColorfulGrid"
- "ColorfulGrid-Accent1"..."ColorfulGrid-Accent6"
func NewTableStyle ¶
func NewTableStyle(val string) *TableStyle
NewTableStyle creates a new TableStyle instance.
func (*TableStyle) MarshalXML ¶
func (t *TableStyle) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaler interface for TableStyle.
func (*TableStyle) UnmarshalXML ¶
func (t *TableStyle) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaler interface for TableStyle.
type TableWidth ¶
TableWidth represents the width of a table in a document.
func (*TableWidth) MarshalXML ¶
func (t *TableWidth) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)
func (*TableWidth) UnmarshalXML ¶
func (t *TableWidth) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
func TextFromString ¶
func (*Text) MarshalXML ¶
func (*Text) UnmarshalXML ¶
type TransformGroup ¶
func (*TransformGroup) MarshalXML ¶
func (t *TransformGroup) MarshalXML(e *xml.Encoder, start xml.StartElement) error
func (*TransformGroup) UnmarshalXML ¶
func (t *TransformGroup) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type Underline ¶
type Underline struct {
Val UnderlineStyle
}
Underline represents the underline style of text or element.
func NewUnderline ¶
func NewUnderline(val UnderlineStyle) *Underline
NewUnderline creates a new Underline instance.
func (*Underline) MarshalXML ¶
MarshalXML implements the xml.Marshaler interface for the Underline type. It encodes the Underline instance into XML using the "w:u" element with a "w:val" attribute.
func (*Underline) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface for the Underline type. It decodes the XML representation of Underline, extracting the value from the "w:val" attribute. The inner content of the XML element is skipped.
type UnderlineStyle ¶
type UnderlineStyle string
UnderlineStyle represents different styles for underline.
const ( UnderlineNone UnderlineStyle = "none" UnderlineSingle UnderlineStyle = "single" UnderlineWords UnderlineStyle = "words" UnderlineDouble UnderlineStyle = "double" UnderlineDotted UnderlineStyle = "dotted" UnderlineThick UnderlineStyle = "thick" UnderlineDash UnderlineStyle = "dash" UnderlineDotDash UnderlineStyle = "dotDash" UnderlineDotDotDash UnderlineStyle = "dotDotDash" UnderlineWavy UnderlineStyle = "wavy" UnderlineDottedHeavy UnderlineStyle = "dottedHeavy" UnderlineDashHeavy UnderlineStyle = "dashHeavy" UnderlineDotDashHeavy UnderlineStyle = "dotDashHeavy" UnderlineDotDotDashHeavy UnderlineStyle = "dotDotDashHeavy" UnderlineWavyHeavy UnderlineStyle = "wavyHeavy" UnderlineDashLong UnderlineStyle = "dashLong" UnderlineWavyDouble UnderlineStyle = "wavyDouble" UnderlineDashLongHeavy UnderlineStyle = "dashLongHeavy" )
Source Files ¶
- bold.go
- border_position.go
- border_type.go
- br.go
- color.go
- doc.go
- drawing.go
- drawing_data.go
- font.go
- graphic.go
- highlight.go
- indent_level.go
- italic.go
- justification.go
- numbering_id.go
- numbering_property.go
- paragraph.go
- paragraph_property.go
- paragraph_style.go
- pic.go
- run.go
- run_property.go
- runstyle.go
- shading.go
- strike.go
- sz.go
- szcs.go
- table.go
- table_borders.go
- table_cell.go
- table_cell_margins.go
- table_cell_property.go
- table_grid.go
- table_indent.go
- table_layout.go
- table_property.go
- table_row.go
- table_row_property.go
- table_style.go
- table_width.go
- text.go
- underline.go