ctypes

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package ctypes provides complex types used in various components of Office Open XML (OOXML) WordprocessingML (WML) documents. It includes structured definitions for paragraphs, tables, styles, headers, footers, and other complex document elements, facilitating structured data handling and manipulation within WML files.

Index

Constants

View Source
const (
	TextSpaceDefault  = "default"
	TextSpacePreserve = "preserve"
)

Variables

View Source
var (
	// A1
	A1Width  = uint64(23386) // 594mm in twips
	A1Height = uint64(33110) // 841mm in twips
	A1Code   = 4
	A1       = &PageSize{
		Width:  &A1Width,
		Height: &A1Height,
		Orient: stypes.PageOrientPortrait,
		Code:   &A1Code,
	}

	// A2
	A2Width  = uint64(16535) // 420mm in twips
	A2Height = uint64(23386) // 594mm in twips
	A2Code   = 4
	A2       = &PageSize{
		Width:  &A2Width,
		Height: &A2Height,
		Orient: stypes.PageOrientPortrait,
		Code:   &A2Code,
	}

	// A3
	A3Width  = uint64(11693) // 297mm in twips
	A3Height = uint64(16535) // 420mm in twips
	A3Code   = 4
	A3       = &PageSize{
		Width:  &A3Width,
		Height: &A3Height,
		Orient: stypes.PageOrientPortrait,
		Code:   &A3Code,
	}

	// A4
	A4Width  = uint64(11906) // 210mm in twips
	A4Height = uint64(16838) // 297mm in twips
	A4Code   = 1
	A4       = &PageSize{
		Width:  &A4Width,
		Height: &A4Height,
		Orient: stypes.PageOrientPortrait,
		Code:   &A4Code,
	}

	// A5
	A5Width  = uint64(8268)  // 148mm in twips
	A5Height = uint64(11693) // 210mm in twips
	A5Code   = 1
	A5       = &PageSize{
		Width:  &A5Width,
		Height: &A5Height,
		Orient: stypes.PageOrientPortrait,
		Code:   &A5Code,
	}
)

Functions

func CentimetersToTwips

func CentimetersToTwips(cm float64) uint64

func HeightRuleFromStr

func HeightRuleFromStr(value string) (stypes.HeightRule, error)

HeightRuleFromStr converts a string to HeightRule type.

func InchesToTwips

func InchesToTwips(inches float64) uint64

单位转换函数

func MillimetersToTwips

func MillimetersToTwips(mm float64) uint64

func PointsToTwips

func PointsToTwips(points float64) int

Types

type AnnotationVMerge

type AnnotationVMerge string
const (
	// AnnotationVMergeCont represents a vertically merged cell.
	AnnotationVMergeCont AnnotationVMerge = "cont"
	// AnnotationVMergeRest represents a vertically split cell.
	AnnotationVMergeRest AnnotationVMerge = "rest"
)

func AnnotationVMergeFromStr

func AnnotationVMergeFromStr(value string) (AnnotationVMerge, error)

AnnotationVMergeFromStr converts a string to AnnotationVMerge type.

func (*AnnotationVMerge) UnmarshalXMLAttr

func (a *AnnotationVMerge) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr unmarshals XML attribute into AnnotationVMerge.

type Border

type Border struct {
	Val        stypes.BorderStyle `xml:"val,attr"`
	Color      *string            `xml:"color,attr,omitempty"`
	ThemeColor *stypes.ThemeColor `xml:"themeColor,attr,omitempty"`
	ThemeTint  *string            `xml:"themeTint,attr,omitempty"`
	ThemeShade *string            `xml:"themeShade,attr,omitempty"`
	Space      *string            `xml:"space,attr,omitempty"`
	Shadow     *stypes.OnOff      `xml:"shadow,attr,omitempty"`
	Frame      *stypes.OnOff      `xml:"frame,attr,omitempty"`
	Size       *int               `xml:"sz,attr,omitempty"`
}

func NewCellBorder

func NewCellBorder(style stypes.BorderStyle, color string, space string, size int) *Border

new cell border @param style: border style @param color: border color; @see github.com/MamaShip/godocx/wml/color @param space: the gap between the border and the cell content @param size: border size

func (Border) MarshalXML

func (t Border) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Break

type Break struct {
	BreakType *stypes.BreakType  `xml:"type,attr,omitempty"`
	Clear     *stypes.BreakClear `xml:"clear,attr,omitempty"`
}

func NewBreak

func NewBreak(breakType stypes.BreakType) *Break

NewBreak creates a new Break element with the given break type.

func (Break) MarshalXML

func (b Break) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface.

type CTString

type CTString struct {
	Val string `xml:"val,attr"`
}

CTString - Generic Element that has only one string-type attribute And the String type does not have validation dont use this if the element requires validation

func DefaultParagraphStyle

func DefaultParagraphStyle() *CTString

DefaultParagraphStyle creates the default ParagraphStyle with the value "Normal".

func DefaultRunStyle

func DefaultRunStyle() *CTString

DefaultRunStyle creates the default RunStyle with the value "Normal".

func NewCTString

func NewCTString(value string) *CTString

func NewParagraphStyle

func NewParagraphStyle(val string) *CTString

NewParagraphStyle creates a new ParagraphStyle.

func NewRunStyle

func NewRunStyle(value string) *CTString

NewRunStyle creates a new RunStyle.

func (CTString) MarshalXML

func (s CTString) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for the CTString type. It encodes the instance into XML using the "w:ELEMENT_NAME" element with a "w:val" attribute.

type Cell

type Cell struct {
	// 1.Table Cell Properties
	Property *CellProperty

	// 2.1 Choice: ZeroOrMore
	// Any number of elements can exists within this choice group
	Contents []TCBlockContent
}

func DefaultCell

func DefaultCell() *Cell

func (Cell) MarshalXML

func (c Cell) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

func (*Cell) UnmarshalXML

func (c *Cell) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)

type CellBorders

type CellBorders struct {
	// 1. Table Cell Top Border
	Top *Border `xml:"top,omitempty"`

	// 2. Table Cell Left Border
	Left *Border `xml:"left,omitempty"`

	// 3. Table Cell Bottom Border
	Bottom *Border `xml:"bottom,omitempty"`

	// 4. Table Cell Right Border
	Right *Border `xml:"right,omitempty"`

	// 5. Table Cell Inside Horizontal Edges Border
	InsideH *Border `xml:"insideH,omitempty"`

	// 6. Table Cell Inside Vertical Edges Border
	InsideV *Border `xml:"insideV,omitempty"`

	// 7. Table Cell Top Left to Bottom Right Diagonal Border
	TL2BR *Border `xml:"tl2br,omitempty"`

	// 8. Table Cell Top Right to Bottom Left Diagonal Border
	TR2BL *Border `xml:"tr2bl,omitempty"`
}

Table Cell Borders

func DefaultCellBorders

func DefaultCellBorders() *CellBorders

func (CellBorders) MarshalXML

func (t CellBorders) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type CellMargins

type CellMargins struct {
	// 1. Table Cell Top Margin Default
	Top *TableWidth `xml:"top,omitempty"`

	// 2. Table Cell Left Margin Default
	Left *TableWidth `xml:"left,omitempty"`

	// 3. Table Cell Bottom Margin Default
	Bottom *TableWidth `xml:"bottom,omitempty"`

	// 4. Table Cell Right Margin Default
	Right *TableWidth `xml:"right,omitempty"`
}

Table Cell Margin Defaults

func DefaultCellMargins

func DefaultCellMargins() CellMargins

func (CellMargins) Margin

func (tcm CellMargins) Margin(top, left, bottom, right int) CellMargins

func (CellMargins) MarginBottom

func (tcm CellMargins) MarginBottom(v int, t stypes.TableWidth) CellMargins

func (CellMargins) MarginLeft

func (tcm CellMargins) MarginLeft(v int, t stypes.TableWidth) CellMargins

func (CellMargins) MarginRight

func (tcm CellMargins) MarginRight(v int, t stypes.TableWidth) CellMargins

func (CellMargins) MarginTop

func (tcm CellMargins) MarginTop(v int, t stypes.TableWidth) CellMargins

func (CellMargins) MarshalXML

func (tcm CellMargins) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

type CellMerge

type CellMerge struct {
	ID         int               `xml:"id,attr"`
	Author     string            `xml:"author,attr"`
	Date       *string           `xml:"date,attr,omitempty"`
	VMerge     *AnnotationVMerge `xml:"vMerge,attr,omitempty"`     //Revised Vertical Merge Setting
	VMergeOrig *AnnotationVMerge `xml:"vMergeOrig,attr,omitempty"` //Vertical Merge Setting Removed by Revision

}

func (CellMerge) MarshalXML

func (t CellMerge) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type CellProperty

type CellProperty struct {

	// 1. Table Cell Conditional Formatting
	CnfStyle *CTString `xml:"cnfStyle,omitempty"`

	// 2. Preferred Table Cell Width
	Width *TableWidth `xml:"tcW,omitempty"`

	// 3.Grid Columns Spanned by Current Table Cell
	GridSpan *DecimalNum `xml:"gridSpan,omitempty"`

	// 4.Horizontally Merged Cell
	HMerge *GenOptStrVal[stypes.MergeCell] `xml:"hMerge,omitempty"`

	// 5.Vertically Merged Cell
	VMerge *GenOptStrVal[stypes.MergeCell] `xml:"vMerge,omitempty"`

	// 6.Table Cell Borders
	Borders *CellBorders `xml:"tcBorders,omitempty"`

	//7.Table Cell Shading
	Shading *Shading `xml:"shd,omitempty"`

	//8.Don't Wrap Cell Content
	NoWrap *OnOff `xml:"noWrap,omitempty"`

	//9.Single Table Cell Margins
	Margins *CellMargins `xml:"tcMar,omitempty"`

	//10.Table Cell Text Flow Direction
	TextDirection *GenSingleStrVal[stypes.TextDirection] `xml:"textDirection,omitempty"`

	//11.Fit Text Within Cell
	FitText *OnOff `xml:"tcFitText,omitempty"`

	//12. Table Cell Vertical Alignment
	VAlign *GenSingleStrVal[stypes.VerticalJc] `xml:"vAlign,omitempty"`

	//13.Ignore End Of Cell Marker In Row Height Calculation
	HideMark *OnOff `xml:"hideMark,omitempty"`

	//Table Cell Insertion
	CellInsertion *TrackChange `xml:"cellIns,omitempty"`

	//Table Cell Deletion
	CellDeletion *TrackChange `xml:"cellDel,omitempty"`

	//Vertically Merged/Split Table Cells
	CellMerge *CellMerge `xml:"cellMerge,omitempty"`

	//15.Revision Information for Table Cell Properties
	PrChange *TCPrChange `xml:"tcPrChange,omitempty"`
}

func (CellProperty) MarshalXML

func (t CellProperty) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

type Color

type Color struct {
	//Run Content Color
	Val string `xml:"val,attr"`

	//Run Content Theme Color
	ThemeColor *stypes.ThemeColor `xml:"themeColor,attr,omitempty"`

	//Run Content Theme Color Tint
	ThemeTint *string `xml:"themeTint,attr,omitempty"`

	//Run Content Theme Color Shade
	ThemeShade *string `xml:"themeShade,attr,omitempty"`
}

Color represents the color of a text or element.

func NewColor

func NewColor(value string) *Color

NewColor creates a new Color instance with the specified color value.

func (Color) MarshalXML

func (c Color) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for the Color type.

type Column

type Column struct {
	Width *uint64 `xml:"w,attr,omitempty"` //Grid Column Width
}

Grid Column Definition

func (Column) MarshalXML

func (c Column) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type DecimalNum

type DecimalNum struct {
	Val int `xml:"val,attr"`
}

func NewDecimalNum

func NewDecimalNum(value int) *DecimalNum

func (DecimalNum) MarshalXML

func (s DecimalNum) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type DocDefault

type DocDefault struct {

	//1.Default Run Properties
	RunProp *RunPropDefault `xml:"rPrDefault,omitempty"`

	//2.Default Paragraph Properties
	ParaProp *ParaPropDefault `xml:"pPrDefault,omitempty"`
}

Document Default Paragraph and Run Properties

func (*DocDefault) MarshalXML

func (d *DocDefault) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type DocGrid

type DocGrid struct {
	Type      stypes.DocGridType `xml:"type,attr,omitempty"`
	LinePitch *int               `xml:"linePitch,attr,omitempty"`
	CharSpace *int               `xml:"charSpace,attr,omitempty"`
}

DocGrid represents the document grid settings.

func (DocGrid) MarshalXML

func (docGrid DocGrid) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for the DocGrid type. It encodes the DocGrid to its corresponding XML representation.

type EALayout

type EALayout struct {
	ID           *int                    `xml:"id,attr,omitempty"`
	Combine      *stypes.OnOff           `xml:"combine,attr,omitempty"`
	CombineBrkts *stypes.CombineBrackets `xml:"combineBrackets,attr,omitempty"`
	Vert         *stypes.OnOff           `xml:"vert,attr,omitempty"`
	VertCompress *stypes.OnOff           `xml:"vertCompress,attr,omitempty"`
}

East Asian Typography Settings

func (EALayout) MarshalXML

func (ea EALayout) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Effect

type Effect struct {
	Val *stypes.TextEffect `xml:"val,attr,omitempty"`
}

func (Effect) MarshalXML

func (eff Effect) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for the Effect type. It encodes the instance into XML using the "w:XMLName" element with a "w:val" attribute.

type Empty

type Empty struct {
}

func (Empty) MarshalXML

func (s Empty) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type ExpaComp

type ExpaComp struct {
	Val *stypes.TextScale `xml:"val,attr,omitempty"`
}

This element specifies the amount by which each character shall be expanded or when the character is rendered in the document

This property has an of stretching or compressing each character in the run, as opposed to the spacing element (§2.3.2.33) which expands/compresses the text by adding additional character pitch but not changing the width of the actual characters displayed on the line.

func (ExpaComp) MarshalXML

func (ec ExpaComp) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for the ExpaComp type. It encodes the instance into XML using the "w:XMLName" element with a "w:val" attribute.

type FitText

type FitText struct {
	Val uint64 `xml:"val,attr"`
	ID  *int   `xml:"id,attr,omitempty"`
}

func (FitText) MarshalXML

func (f FitText) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type FloatPos

type FloatPos struct {
	LeftFromText   *uint64 `xml:"leftFromText,attr,omitempty"`
	RightFromText  *uint64 `xml:"rightFromText,attr,omitempty"`
	TopFromText    *uint64 `xml:"topFromText,attr,omitempty"`
	BottomFromText *uint64 `xml:"bottomFromText,attr,omitempty"`

	//Frame Horizontal Positioning Base
	HAnchor *stypes.Anchor `xml:"hAnchor,attr,omitempty"`

	//Frame Vertical Positioning Base
	VAnchor *stypes.Anchor `xml:"vAnchor,attr,omitempty"`

	//Relative Horizontal Alignment From Anchor
	XAlign *stypes.XAlign `xml:"tblpXSpec,attr,omitempty"`

	//Relative Vertical Alignment from Anchor
	YAlign *stypes.YAlign `xml:"tblpYSpec,attr,omitempty"`

	//Absolute Horizontal Distance From Anchor
	AbsXDist *int `xml:"tblpX,attr,omitempty"`

	// Absolute Vertical Distance From Anchor
	AbsYDist *int `xml:"tblpY,attr,omitempty"`
}

func (FloatPos) MarshalXML

func (t FloatPos) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type FontSize

type FontSize struct {
	Value uint64 `xml:"val,attr,omitempty"`
}

FontSize represents the font size of a text or element.

func NewFontSize

func NewFontSize(value uint64) *FontSize

NewFontSize creates a new FontSize with the specified font size value.

func (FontSize) MarshalXML

func (s FontSize) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type FontSizeCS

type FontSizeCS struct {
	Value uint64 `xml:"val,attr,omitempty"`
}

FontSizeCs represents the font size of a text or element.

func NewFontSizeCS

func NewFontSizeCS(value uint64) *FontSizeCS

NewFontSizeCs creates a new FontSizeCs with the specified font size value.

func (FontSizeCS) MarshalXML

func (s FontSizeCS) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type FooterReference

type FooterReference struct {
	Type stypes.HdrFtrType `xml:"type,attr"` //Footer or Footer Type
	ID   string            `xml:"id,attr"`   //Relationship to Part
}

Footer Reference

func (FooterReference) MarshalXML

func (h FooterReference) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type FrameProp

type FrameProp struct {
	Width  *int64 `xml:"w,attr,omitempty"`
	Height *int64 `xml:"h,attr,omitempty"`

	//Drop Cap Frame
	DropCap *stypes.DropCap `xml:"dropCap,attr,omitempty"`

	//Drop Cap Vertical Height in Lines
	Lines *int `xml:"lines,attr,omitempty"`

	//Frame Padding
	VSpace *int64 `xml:"vSpace,attr,omitempty"`
	HSpace *int64 `xml:"hSpace,attr,omitempty"`

	//Text Wrapping Around Frame
	Wrap *stypes.Wrap `xml:"wrap,attr,omitempty"`

	//Frame Horizontal Positioning Base
	HAnchor *stypes.Anchor `xml:"hAnchor,attr,omitempty"`

	//Frame Vertical Positioning Base
	VAnchor *stypes.Anchor `xml:"vAnchor,attr,omitempty"`

	//Absolute Horizontal Position
	AbsHPos *int `xml:"x,attr,omitempty"`

	//Absolute Vertical Position
	AbsVPos *int `xml:"y,attr,omitempty"`

	//Relative Horizontal Position
	XAlign *stypes.XAlign `xml:"xAlign,attr,omitempty"`

	//Relative Vertical Position
	YAlign *stypes.YAlign `xml:"yAlign,attr,omitempty"`

	//Frame Height Type
	HRule *stypes.HeightRule `xml:"hRule,attr,omitempty"`

	//Lock Frame Anchor to Paragraph
	AnchorLock *stypes.OnOff `xml:"anchorLock,attr,omitempty"`
}

func (FrameProp) MarshalXML

func (f FrameProp) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type GenOptStrVal

type GenOptStrVal[T ~string] struct {
	Val *T `xml:"val,attr"`
}

Generic Element with Optional Single Val attribute

func NewGenOptStrVal

func NewGenOptStrVal[T ~string](val T) *GenOptStrVal[T]

func (GenOptStrVal[T]) MarshalXML

func (g GenOptStrVal[T]) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type GenSingleStrVal

type GenSingleStrVal[T ~string] struct {
	Val T `xml:"val,attr"`
}

Generic Element with Single Val attribute

func NewGenSingleStrVal

func NewGenSingleStrVal[T ~string](val T) *GenSingleStrVal[T]

func (GenSingleStrVal[T]) MarshalXML

func (g GenSingleStrVal[T]) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Grid

type Grid struct {
	//1. Grid Column Definition
	Col []Column `xml:"gridCol,omitempty"`

	//2.Revision Information for Table Grid Column Definitions
	GridChange *GridChange `xml:"tblGridChange,omitempty"`
}

Table Grid

func (Grid) MarshalXML

func (g Grid) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type GridChange

type GridChange struct {
	ID int `xml:"id,attr,omitempty"` //Annotation Identifier
}

Revision Information for Table Grid Column Definitions

func (GridChange) MarshalXML

func (g GridChange) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type HeaderReference

type HeaderReference struct {
	Type stypes.HdrFtrType `xml:"type,attr"` //Header or Footer Type
	ID   string            `xml:"id,attr"`   //Relationship to Part
}

Header Reference

func (HeaderReference) MarshalXML

func (h HeaderReference) MarshalXML(e *xml.Encoder, start xml.StartElement) error
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 ImageData

type ImageData struct {
	RId   string `xml:"id,attr,omitempty"`
	Title string `xml:"title,attr,omitempty"`
}

func (ImageData) MarshalXML

func (b ImageData) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface.

type Indent

type Indent struct {
	Left           *int    `xml:"left,attr,omitempty"`           // Left Indentation
	LeftChars      *int    `xml:"leftChars,attr,omitempty"`      // Left Indentation in Character Units
	Right          *int    `xml:"right,attr,omitempty"`          // Right Indentation
	RightChars     *int    `xml:"rightChars,attr,omitempty"`     // Right Indentation in Character Units
	Hanging        *uint64 `xml:"hanging,attr,omitempty"`        // Indentation Removed from First Line
	HangingChars   *int    `xml:"hangingChars,attr,omitempty"`   // Indentation Removed From First Line in Character Units
	FirstLine      *uint64 `xml:"firstLine,attr,omitempty"`      // Additional First Line Indentation
	FirstLineChars *int    `xml:"firstLineChars,attr,omitempty"` // Additional First Line Indentation in Character Units
}

Indent represents the Paragraph Indentation structure.

func (Indent) MarshalXML

func (i Indent) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for Indent.

type Lang

type Lang struct {
	Val      *string `xml:"val,attr,omitempty"`
	EastAsia *string `xml:"eastAsia,attr,omitempty"`
	Bidi     *string `xml:"bidi,attr,omitempty"`
}

Languages for Run Content

func (Lang) MarshalXML

func (l Lang) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type LatentStyle

type LatentStyle struct {
	//Default Style Locking Setting
	DefLockedState *stypes.OnOff `xml:"defLockedState,attr,omitempty"`

	//Default User Interface Priority Setting
	DefUIPriority *int `xml:"defUIPriority,attr,omitempty"`

	//Default Semi-Hidden Setting
	DefSemiHidden *stypes.OnOff `xml:"defSemiHidden,attr,omitempty"`

	//Default Hidden Until Used Setting
	DefUnhideWhenUsed *stypes.OnOff `xml:"defUnhideWhenUsed,attr,omitempty"`

	//Default Primary Style Setting
	DefQFormat *stypes.OnOff `xml:"defQFormat,attr,omitempty"`

	//Latent Style Count
	Count *int `xml:"count,attr,omitempty"`

	LsdExceptions []LsdException `xml:",any"`
}

Latent Style Information

func (LatentStyle) MarshalXML

func (l LatentStyle) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type LsdException

type LsdException struct {
	Name           string        `xml:"name,attr"`
	Locked         *stypes.OnOff `xml:"locked,attr,omitempty"`
	UIPriority     *int          `xml:"uiPriority,attr,omitempty"`
	SemiHidden     *stypes.OnOff `xml:"semiHidden,attr,omitempty"`
	UnhideWhenUsed *stypes.OnOff `xml:"unhideWhenUsed,attr,omitempty"`
	QFormat        *stypes.OnOff `xml:"qFormat,attr,omitempty"`
}

Latent Style Exception

func (LsdException) MarshalXML

func (l LsdException) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Markup

type Markup struct {
	ID int `xml:"id,attr"`
}

func (Markup) MarshalXML

func (m Markup) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type NumProp

type NumProp struct {
	//Numbering Level Reference
	ILvl *DecimalNum `xml:"ilvl,omitempty"`

	//Numbering Definition Instance Reference
	NumID *DecimalNum `xml:"numId,omitempty"`

	//Previous Paragraph Numbering Properties
	NumChange *TrackChangeNum `xml:"numberingChange,omitempty"`

	//Inserted Numbering Properties
	Ins *TrackChange `xml:"ins,omitempty"`
}

Numbering Definition Instance Reference

func NewNumberingProperty

func NewNumberingProperty() *NumProp

NewNumberingProperty creates a new NumberingProperty instance.

func (NumProp) MarshalXML

func (n NumProp) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type OnOff

type OnOff struct {
	Val *stypes.OnOff `xml:"val,attr,omitempty"`
}

Optional Bool Element: Helper element that only has one attribute which is optional

func OnOffFromBool

func OnOffFromBool(value bool) *OnOff

func OnOffFromStr

func OnOffFromStr(value string) (*OnOff, error)

func (*OnOff) Disable

func (n *OnOff) Disable()

Disable sets the value to false and valexists true

func (OnOff) MarshalXML

func (n OnOff) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for the Bold type. It encodes the instance into XML using the "w:XMLName" element with a "w:val" attribute.

type PPrChange

type PPrChange struct {
	ID       int            `xml:"id,attr"`
	Author   string         `xml:"author,attr"`
	Date     *string        `xml:"date,attr,omitempty"`
	ParaProp *ParagraphProp `xml:"pPr"`
}

Revision Information for Paragraph Properties

func (PPrChange) MarshalXML

func (p PPrChange) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type PTab

type PTab struct {
	Alignment  stypes.PTabAlignment  `xml:"alignment,attr,omitempty"`
	RelativeTo stypes.PTabRelativeTo `xml:"relativeTo,attr,omitempty"`
	Leader     stypes.PTabLeader     `xml:"leader,attr,omitempty"`
}

func (PTab) MarshalXML

func (t PTab) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type PageMargin

type PageMargin struct {
	Left   *int `xml:"left,attr,omitempty"`
	Right  *int `xml:"right,attr,omitempty"`
	Gutter *int `xml:"gutter,attr,omitempty"`
	Header *int `xml:"header,attr,omitempty"`
	Top    *int `xml:"top,attr,omitempty"`
	Footer *int `xml:"footer,attr,omitempty"`
	Bottom *int `xml:"bottom,attr,omitempty"`
}

PageMargin represents the page margins of a Word document.

func (PageMargin) MarshalXML

func (p PageMargin) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for the PageMargin type. It encodes the PageMargin to its corresponding XML representation.

type PageNumbering

type PageNumbering struct {
	Format stypes.NumFmt `xml:"fmt,attr,omitempty"`
}

PageNumbering represents the page numbering format in a Word document.

func (PageNumbering) MarshalXML

func (p PageNumbering) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for the PageNumbering type. It encodes the PageNumbering to its corresponding XML representation.

type PageSize

type PageSize struct {
	Width  *uint64           `xml:"w,attr,omitempty"`
	Height *uint64           `xml:"h,attr,omitempty"`
	Orient stypes.PageOrient `xml:"orient,attr,omitempty"`
	Code   *int              `xml:"code,attr,omitempty"`
}

Page Size : w:pgSz

func (PageSize) MarshalXML

func (p PageSize) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type ParaBorder

type ParaBorder struct {
	Top     *Border `xml:"top,omitempty"`
	Left    *Border `xml:"left,omitempty"`
	Right   *Border `xml:"right,omitempty"`
	Bottom  *Border `xml:"bottom,omitempty"`
	Between *Border `xml:"between,omitempty"`
	Bar     *Border `xml:"bar,omitempty"`
}

func (ParaBorder) MarshalXML

func (p ParaBorder) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type ParaPropDefault

type ParaPropDefault struct {
	ParaProp *ParagraphProp `xml:"pPr,omitempty"`
}

func (*ParaPropDefault) MarshalXML

func (p *ParaPropDefault) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Paragraph

type Paragraph struct {

	// Attributes
	RsidRPr      *stypes.LongHexNum // Revision Identifier for Paragraph Glyph Formatting
	RsidR        *stypes.LongHexNum // Revision Identifier for Paragraph
	RsidDel      *stypes.LongHexNum // Revision Identifier for Paragraph Deletion
	RsidP        *stypes.LongHexNum // Revision Identifier for Paragraph Properties
	RsidRDefault *stypes.LongHexNum // Default Revision Identifier for Runs

	// 1. Paragraph Properties
	Property *ParagraphProp

	// 2. Choices (Slice of Child elements)
	Children []ParagraphChild
	// contains filtered or unexported fields
}

func AddParagraph

func AddParagraph(text string) *Paragraph

func (*Paragraph) AddText

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

func (Paragraph) MarshalXML

func (p Paragraph) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

func (*Paragraph) UnmarshalXML

func (p *Paragraph) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)

type ParagraphChild

type ParagraphChild struct {
	Link *Hyperlink // w:hyperlink
	Run  *Run       // i.e w:r
}

type ParagraphProp

type ParagraphProp struct {
	// 1. This element specifies the style ID of the paragraph style which shall be used to format the contents of this paragraph.
	Style *CTString `xml:"pStyle,omitempty"`

	// 2. Keep Paragraph With Next Paragraph
	KeepNext *OnOff `xml:"keepNext,omitempty"`

	// 3. Keep All Lines On One Page
	KeepLines *OnOff `xml:"keepLines,omitempty"`

	// 4. Start Paragraph on Next Page
	PageBreakBefore *OnOff `xml:"pageBreakBefore,omitempty"`

	// 5. Text Frame Properties
	FrameProp *FrameProp `xml:"framePr,omitempty"`

	// 6. Allow First/Last Line to Display on a Separate Page
	WindowControl *OnOff `xml:"widowControl,omitempty"`

	// 7. Numbering Definition Instance Reference
	NumProp *NumProp `xml:"numPr,omitempty"`

	// 8. Suppress Line Numbers for Paragraph
	SuppressLineNmbrs *OnOff `xml:"suppressLineNumbers,omitempty"`

	// 9. Paragraph Borders
	Border *ParaBorder `xml:"pBdr,omitempty"`

	// 10. This element specifies the shading applied to the contents of the paragraph.
	Shading *Shading `xml:"shd,omitempty"`

	// 11. Set of Custom Tab Stops
	Tabs Tabs `xml:"tabs,omitempty"`

	// 12. Suppress Hyphenation for Paragraph
	SuppressAutoHyphens *OnOff `xml:"suppressAutoHyphens,omitempty"`

	// 13. Use East Asian Typography Rules for First and Last Character per Line
	Kinsoku *OnOff `xml:"kinsoku,omitempty"`

	// 14. Allow Line Breaking At Character Level
	WordWrap *OnOff `xml:"wordWrap,omitempty"`

	// 15. Allow Punctuation to Extent Past Text Extents
	OverflowPunct *OnOff `xml:"overflowPunct,omitempty"`

	// 16. Compress Punctuation at Start of a Line
	TopLinePunct *OnOff `xml:"topLinePunct,omitempty"`

	// 17. Automatically Adjust Spacing of Latin and East Asian Text
	AutoSpaceDE *OnOff `xml:"autoSpaceDE,omitempty"`

	// 18. Automatically Adjust Spacing of East Asian Text and Numbers
	AutoSpaceDN *OnOff `xml:"autoSpaceDN,omitempty"`

	// 19. Right to Left Paragraph Layout
	Bidi *OnOff `xml:"bidi,omitempty"`

	// 20. Automatically Adjust Right Indent When Using Document Grid
	AdjustRightInd *OnOff `xml:"adjustRightInd,omitempty"`

	// 21. Use Document Grid Settings for Inter-Line Paragraph Spacing
	SnapToGrid *OnOff `xml:"snapToGrid,omitempty"`

	// 22. Spacing Between Lines and Above/Below Paragraph
	Spacing *Spacing `xml:"spacing,omitempty"`

	// 23. Paragraph Indentation
	Indent *Indent `xml:"ind,omitempty"`

	// 24. Ignore Spacing Above and Below When Using Identical Styles
	CtxlSpacing *OnOff `xml:"contextualSpacing,omitempty"`

	// 25. Use Left/Right Indents as Inside/Outside Indents
	MirrorIndents *OnOff `xml:"mirrorIndents,omitempty"`

	// 26. Prevent Text Frames From Overlapping
	SuppressOverlap *OnOff `xml:"suppressOverlap,omitempty"`

	// 27. Paragraph Alignment
	Justification *GenSingleStrVal[stypes.Justification] `xml:"jc,omitempty"`

	// 28. Paragraph Text Flow Direction
	TextDirection *GenSingleStrVal[stypes.TextDirection] `xml:"textDirection,omitempty"`

	// 29. Vertical Character Alignment on Line
	TextAlignment *GenSingleStrVal[stypes.TextAlign] `xml:"textAlignment,omitempty"`

	// 30.Allow Surrounding Paragraphs to Tight Wrap to Text Box Contents
	TextboxTightWrap *GenSingleStrVal[stypes.TextboxTightWrap] `xml:"textboxTightWrap,omitempty"`

	// 31. Associated Outline Level
	OutlineLvl *DecimalNum `xml:"outlineLvl,omitempty"`

	// 32. Associated HTML div ID
	DivID *DecimalNum `xml:"divId,omitempty"`

	// 33. Paragraph Conditional Formatting
	CnfStyle *CTString `xml:"cnfStyle,omitempty"`

	// 34. Run Properties for the Paragraph Mark
	RunProperty *RunProperty `xml:"rPr,omitempty"`

	// 35. Section Properties
	SectPr *SectionProp `xml:"sectPr,omitempty"`

	// 36. Revision Information for Paragraph Properties
	PPrChange *PPrChange `xml:"pPrChange,omitempty"`
}

Numbering Level Associated Paragraph Properties

func DefaultParaProperty

func DefaultParaProperty() *ParagraphProp

func (ParagraphProp) MarshalXML

func (pp ParagraphProp) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

type Pict

type Pict struct {
	Shape *Shape `xml:"shape,omitempty"`
}

func (Pict) MarshalXML

func (b Pict) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface.

type PropException

type PropException struct {
}

func (PropException) MarshalXML

func (p PropException) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type RngMarkupElem

type RngMarkupElem struct {
}

Range Markup elements

func (RngMarkupElem) MarshalXML

func (r RngMarkupElem) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Row

type Row struct {
	// 1. Table-Level Property Exceptions
	PropException *PropException

	// 2.Table Row Properties
	Property *RowProperty

	// 3.1 Choice
	Contents []TRCellContent
}

func DefaultRow

func DefaultRow() *Row

func (Row) MarshalXML

func (r Row) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

func (*Row) UnmarshalXML

func (r *Row) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)

type RowContent

type RowContent struct {
	Row *Row `xml:"tr,omitempty"`
}

func (RowContent) MarshalXML

func (r RowContent) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type RowProperty

type RowProperty struct {

	//Table Row Conditional Formatting
	Cnf *CTString

	// Associated HTML div ID
	DivId *DecimalNum

	//Grid Columns Before First Cell
	GridBefore *DecimalNum

	//Grid Columns After Last Cell
	GridAfter *DecimalNum

	//Preferred Width Before Table Row
	WidthBefore *TableWidth

	//Preferred Width After Table Row
	WidthAfter *TableWidth

	//Table Row Cannot Break Across Pages
	CantSplit *OnOff

	//Table Row Height
	Height *TableRowHeight

	//Repeat Table Row on Every New Page
	Header *OnOff

	//Table Row Cell Spacing
	CellSpacing *TableWidth

	// Table Row Alignment
	JC *GenSingleStrVal[stypes.Justification]

	//Hidden Table Row Marker
	Hidden *OnOff

	//2.Inserted Table Row
	Ins *TrackChange

	//3. Deleted Table Row
	Del *TrackChange

	//4.Revision Information for Table Row Properties
	Change *TRPrChange
}

Table Row Properties

func DefaultRowProperty

func DefaultRowProperty() *RowProperty

NewRowProperty creates a new RowProperty instance.

func (*RowProperty) MarshalChoice

func (r *RowProperty) MarshalChoice(e *xml.Encoder, start xml.StartElement) error

func (*RowProperty) MarshalXML

func (r *RowProperty) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*RowProperty) UnmarshalXML

func (r *RowProperty) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Run

type Run struct {
	// Attributes
	RsidRPr *stypes.LongHexNum // Revision Identifier for Run Properties
	RsidR   *stypes.LongHexNum // Revision Identifier for Run
	RsidDel *stypes.LongHexNum // Revision Identifier for Run Deletion

	//1. Run Properties
	Property *RunProperty

	// 2. Choice - Run Inner content
	Children []RunChild
}

A Run is part of a paragraph that has its own style. It could be

func NewRun

func NewRun() *Run

func (*Run) MarshalChild

func (r *Run) MarshalChild(e *xml.Encoder) error

func (Run) MarshalXML

func (r Run) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

func (*Run) UnmarshalXML

func (r *Run) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)

type RunChild

type RunChild struct {
	//specifies that a break shall be placed at the current location in the run content
	Break *Break `xml:"br,omitempty"`

	//specifies that this run contains literal text which shall be displayed in the document
	Text *Text `xml:"t,omitempty"`

	//specifies that this run contains literal text which shall be displayed in the document
	DelText *Text `xml:"delText,omitempty"`

	//Field Code
	InstrText *Text `xml:"instrText,omitempty"`

	//Deleted Field Code
	DelInstrText *Text `xml:"delInstrText,omitempty"`

	//Non Breaking Hyphen Character
	NoBreakHyphen *Empty `xml:"noBreakHyphen,omitempty"`

	//Non Breaking Hyphen Character
	SoftHyphen *Empty `xml:"softHyphen,omitempty"`

	//Date Block - Short Day Format
	DayShort *Empty `xml:"dayShort,omitempty"`

	//Date Block - Short Month Format
	MonthShort *Empty `xml:"monthShort,omitempty"`

	//Date Block - Short Year Format
	YearShort *Empty `xml:"yearShort,omitempty"`

	//Date Block - Long Day Format
	DayLong *Empty `xml:"dayLong,omitempty"`

	//Date Block - Long Month Format
	MonthLong *Empty `xml:"monthLong,omitempty"`

	//Date Block - Long Year Format
	YearLong *Empty `xml:"yearLong,omitempty"`

	//Comment Information Block
	AnnotationRef *Empty `xml:"annotationRef,omitempty"`

	//Footnote Reference Mark
	FootnoteRef *Empty `xml:"footnoteRef,omitempty"`

	//Endnote Reference Mark
	EndnoteRef *Empty `xml:"endnoteRef,omitempty"`

	//Footnote/Endnote Separator Mark
	Separator *Empty `xml:"separator,omitempty"`

	//Continuation Separator Mark
	ContSeparator *Empty `xml:"continuationSeparator,omitempty"`

	//Symbol Character
	Sym *Sym `xml:"sym,omitempty"`

	//Page Number Block
	PgNumBlock *Empty `xml:"pgNum,omitempty"`

	//Carriage Return
	CarrRtn *Empty `xml:"cr,omitempty"`

	//Tab Character
	Tab *Empty `xml:"tab,omitempty"`

	// Picture reference
	Pict *Pict `xml:"pict,omitempty"`

	//Comment Content Reference Mark
	CmntRef *Markup `xml:"commentReference,omitempty"`

	//DrawingML Object
	Drawing *dml.Drawing `xml:"drawing,omitempty"`

	//Absolute Position Tab Character
	PTab *PTab `xml:"ptab,omitempty"`

	//Position of Last Calculated Page Break
	LastRenPgBrk *Empty `xml:"lastRenderedPageBreak,omitempty"`
}

type RunFonts

type RunFonts struct {
	Hint          stypes.FontTypeHint `xml:"hint,attr,omitempty"`
	Ascii         string              `xml:"ascii,attr,omitempty"`
	HAnsi         string              `xml:"hAnsi,attr,omitempty"`
	EastAsia      string              `xml:"eastAsia,attr,omitempty"`
	CS            string              `xml:"cs,attr,omitempty"`
	AsciiTheme    stypes.ThemeFont    `xml:"asciiTheme,attr,omitempty"`
	HAnsiTheme    stypes.ThemeFont    `xml:"hAnsiTheme,attr,omitempty"`
	EastAsiaTheme stypes.ThemeFont    `xml:"eastAsiaTheme,attr,omitempty"`
	CSTheme       stypes.ThemeFont    `xml:"cstheme,attr,omitempty"`
}

Run Fonts

func (RunFonts) MarshalXML

func (rf RunFonts) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type RunPropDefault

type RunPropDefault struct {
	RunProp *RunProperty `xml:"rPr,omitempty"`
}

func (*RunPropDefault) MarshalXML

func (r *RunPropDefault) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type RunProperty

type RunProperty struct {
	//1. Referenced Character Style
	Style *CTString `xml:"rStyle,omitempty"`

	//2. Run Fonts
	Fonts *RunFonts `xml:"rFonts,omitempty"`

	//3. Bold
	Bold *OnOff `xml:"b,omitempty"`

	//4.Complex Script Bold
	BoldCS *OnOff `xml:"bCs,omitempty"`

	// 5.Italics
	Italic *OnOff `xml:"i,omitempty"`

	//6.Complex Script Italics
	ItalicCS *OnOff `xml:"iCs,omitempty"`

	//7.Display All Characters As Capital Letters
	Caps *OnOff `xml:"caps,omitempty"`

	//8.Small Caps
	SmallCaps *OnOff `xml:"smallCaps,omitempty"`

	//9.Single Strikethrough
	Strike *OnOff `xml:"strike,omitempty"`

	//10.Double Strikethrough
	DoubleStrike *OnOff `xml:"dstrike,omitempty"`

	//11.Display Character Outline
	Outline *OnOff `xml:"outline,omitempty"`

	//12.Shadow
	Shadow *OnOff `xml:"shadow,omitempty"`

	//13.Embossing
	Emboss *OnOff `xml:"emboss,omitempty"`

	//14.Imprinting
	Imprint *OnOff `xml:"imprint,omitempty"`

	//15.Do Not Check Spelling or Grammar
	NoGrammar *OnOff `xml:"noProof,omitempty"`

	//16.Use Document Grid Settings For Inter-Character Spacing
	SnapToGrid *OnOff `xml:"snapToGrid,omitempty"`

	//17.Hidden Text
	Vanish *OnOff `xml:"vanish,omitempty"`

	//18.Web Hidden Text
	WebHidden *OnOff `xml:"webHidden,omitempty"`

	//19.Run Content Color
	Color *Color `xml:"color,omitempty"`

	//20. Character Spacing Adjustment
	Spacing *DecimalNum `xml:"spacing,omitempty"`

	//21.Expanded/Compressed Text
	ExpaComp *ExpaComp `xml:"w,omitempty"`

	//22.Font Kerning
	Kern *Uint64Elem `xml:"kern,omitempty"`

	//23. Vertically Raised or Lowered Text
	Position *DecimalNum `xml:"position,omitempty"`

	//24.Font Size
	Size *FontSize `xml:"sz,omitempty"`

	//25.Complex Script Font Size
	SizeCs *FontSizeCS `xml:"szCs,omitempty"`

	//26.Text Highlighting
	Highlight *CTString `xml:"highlight,omitempty"`

	//27.Underline
	Underline *GenSingleStrVal[stypes.Underline] `xml:"u,omitempty"`

	//28.Animated Text Effect
	Effect *Effect `xml:"effect,omitempty"`

	//29.Text Border
	Border *Border `xml:"bdr,omitempty"`

	//30.Run Shading
	Shading *Shading `xml:"shd,omitempty"`

	//31.Manual Run Width
	FitText *FitText `xml:"fitText,omitempty"`

	//32.Subscript/Superscript Text
	VertAlign *GenSingleStrVal[stypes.VerticalAlignRun] `xml:"vertAlign,omitempty"`

	//33.Right To Left Text
	RightToLeft *OnOff `xml:"rtl,omitempty"`

	//34.Use Complex Script Formatting on Run
	CSFormat *OnOff `xml:"cs,omitempty"`

	//35.Emphasis Mark
	Em *GenSingleStrVal[stypes.Em] `xml:"em,omitempty"`

	//36.Languages for Run Content
	Lang *Lang `xml:"lang,omitempty"`

	//37.East Asian Typography Settings
	EALayout *EALayout `xml:"eastAsianLayout,omitempty"`

	//38.Paragraph Mark Is Always Hidden
	SpecVanish *OnOff `xml:"specVanish,omitempty"`

	//39.Office Open XML Math
	OMath *OnOff `xml:"oMath,omitempty"`
}

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.

type SectionProp

type SectionProp struct {
	HeaderReference *HeaderReference                       `xml:"headerReference,omitempty"`
	FooterReference *FooterReference                       `xml:"footerReference,omitempty"`
	PageSize        *PageSize                              `xml:"pgSz,omitempty"`
	Type            *GenSingleStrVal[stypes.SectionMark]   `xml:"type,omitempty"`
	PageMargin      *PageMargin                            `xml:"pgMar,omitempty"`
	PageNum         *PageNumbering                         `xml:"pgNumType,omitempty"`
	FormProt        *GenSingleStrVal[stypes.OnOff]         `xml:"formProt,omitempty"`
	TitlePg         *GenSingleStrVal[stypes.OnOff]         `xml:"titlePg,omitempty"`
	TextDir         *GenSingleStrVal[stypes.TextDirection] `xml:"textDirection,omitempty"`
	DocGrid         *DocGrid                               `xml:"docGrid,omitempty"`
}

Document Final Section Properties : w:sectPr

func NewSectionProper

func NewSectionProper() *SectionProp

func (SectionProp) MarshalXML

func (s SectionProp) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Shading

type Shading struct {
	Val            stypes.Shading     `xml:"val,attr"`
	Color          *string            `xml:"color,attr,omitempty"`
	ThemeColor     *stypes.ThemeColor `xml:"themeColor,attr,omitempty"`
	ThemeFill      *stypes.ThemeColor `xml:"themeFill,attr,omitempty"`
	ThemeTint      *string            `xml:"themeTint,attr,omitempty"`
	ThemeShade     *string            `xml:"themeShade,attr,omitempty"`
	Fill           *string            `xml:"fill,attr,omitempty"`
	ThemeFillTint  *string            `xml:"themeFillTint,attr,omitempty"`
	ThemeFillShade *string            `xml:"themeFillShade,attr,omitempty"`
}

Shading represents the shading properties for a run in a WordprocessingML document.

func DefaultShading

func DefaultShading() *Shading

DefaultShading creates a new Shading with default values.

func NewShading

func NewShading() *Shading

NewShading creates a new Shading.

func (Shading) MarshalXML

func (s Shading) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*Shading) SetColor

func (s *Shading) SetColor(color string) *Shading

Color sets the color for the shading.

func (*Shading) SetFill

func (s *Shading) SetFill(fill string) *Shading

Fill sets the fill for the shading.

func (*Shading) SetShadingType

func (s *Shading) SetShadingType(shdType stypes.Shading) *Shading

ShadingType sets the shading type for the shading.

type Shape

type Shape struct {
	Type  string `xml:"type,attr,omitempty"`
	Style string `xml:"style,attr,omitempty"`

	ImageData *ImageData `xml:"imagedata,omitempty"`
}

func (Shape) MarshalXML

func (b Shape) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface.

type Spacing

type Spacing struct {
	//Spacing Above Paragraph
	Before *uint64 `xml:"before,attr,omitempty"`

	//Spacing Above Paragraph IN Line Units
	BeforeLines *int `xml:"beforeLines,attr,omitempty"`

	//Spacing Below Paragraph
	After *uint64 `xml:"after,attr,omitempty"`

	// Automatically Determine Spacing Above Paragraph
	BeforeAutospacing *stypes.OnOff `xml:"beforeAutospacing,attr,omitempty"`

	// Automatically Determine Spacing Below Paragraph
	AfterAutospacing *stypes.OnOff `xml:"afterAutospacing,attr,omitempty"`

	//Spacing Between Lines in Paragraph
	Line *int `xml:"line,omitempty"`

	//Type of Spacing Between Lines
	LineRule *stypes.LineSpacingRule `xml:"lineRule,attr,omitempty"`
}

Spacing Between Lines and Above/Below Paragraph

func NewParagraphSpacing

func NewParagraphSpacing(before uint64, after uint64) *Spacing

func (Spacing) MarshalXML

func (s Spacing) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Style

type Style struct {

	//1. Primary Style Name
	Name *CTString `xml:"name,omitempty"`

	//2. Alternate Style Names
	Alias *CTString `xml:"alias,omitempty"`

	//3. Parent Style ID
	BasedOn *CTString `xml:"basedOn,omitempty"`

	//4. Style For Next Paragraph
	Next *CTString `xml:"next,omitempty"`

	//5. Linked Style Reference
	Link *CTString `xml:"link,omitempty"`

	//6.Automatically Merge User Formatting Into Style Definition
	AutoRedefine *OnOff `xml:"autoRedefine,omitempty"`

	//7.Hide Style From User Interface
	Hidden *OnOff `xml:"hidden,omitempty"`

	//8.Optional User Interface Sorting Order
	UIPriority *DecimalNum `xml:"uiPriority,omitempty"`

	// 9. Hide Style From Main User Interface
	SemiHidden *OnOff `xml:"semiHidden,omitempty"`

	// 10. Remove Semi-Hidden Property When Style Is Used
	UnhideWhenUsed *OnOff `xml:"unhideWhenUsed,omitempty"`

	// 11. Primary Style
	QFormat *OnOff `xml:"qFormat,omitempty"`

	// 12. Style Cannot Be Applied
	Locked *OnOff `xml:"locked,omitempty"`

	// 13. E-Mail Message Text Style
	Personal *OnOff `xml:"personal,omitempty"`

	// 14. E-Mail Message Composition Style
	PersonalCompose *OnOff `xml:"personalCompose,omitempty"`

	// 15. E-Mail Message Reply Style
	PersonalReply *OnOff `xml:"personalReply,omitempty"`

	//16. Revision Identifier for Style Definition
	RevID *GenSingleStrVal[stypes.LongHexNum] `xml:"rsid,omitempty"`

	//17. Style Paragraph Properties
	ParaProp *ParagraphProp `xml:"pPr,omitempty"`

	//18. Run Properties
	RunProp *RunProperty `xml:"rPr,omitempty"`

	//19. Style Table Properties
	TableProp *TableProp `xml:"tblPr,omitempty"`

	//20. Style Table Row Properties
	TableRowProp *RowProperty `xml:"trPr,omitempty"`

	//21. Style Table Cell Properties
	TableCellProp *CellProperty `xml:"tcPr,omitempty"`

	//22.Style Conditional Table Formatting Properties
	TableStylePr []TableStyleProp `xml:",any"`

	//Style Type
	Type *stypes.StyleType `xml:"type,attr,omitempty"`

	//Style ID
	ID *string `xml:"styleId,attr,omitempty"`

	//Default Style
	Default *stypes.OnOff `xml:"default,attr,omitempty"`

	//User-Defined Style
	CustomStyle *stypes.OnOff `xml:"customStyle,attr,omitempty"`
}

func (*Style) MarshalXML

func (s *Style) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Styles

type Styles struct {
	RelativePath string `xml:"-"`
	Attr         []xml.Attr

	//1. Document Default Paragraph and Run Properties
	DocDefaults *DocDefault `xml:"docDefaults,omitempty"`

	//2. Latent Style Information
	LatentStyle *LatentStyle `xml:"latentStyles,omitempty"`

	//3. Style Definition
	StyleList []Style `xml:",any"`
}

Style Definitions

func (*Styles) MarshalXML

func (s *Styles) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*Styles) UnmarshalXML

func (s *Styles) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)

type Sym

type Sym struct {
	Font *string `xml:"font,attr,omitempty"`
	Char *string `xml:"char,attr,omitempty"`
}

Sym represents a symbol character in a document.

func NewSym

func NewSym(font, char string) *Sym

func (Sym) MarshalXML

func (s Sym) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

type TCBlockContent

type TCBlockContent struct {
	//Paragraph
	//	- ZeroOrMore: Any number of times Paragraph can repeat within cell
	Paragraph *Paragraph
	//Table
	//	- ZeroOrMore: Any number of times Table can repeat within cell
	Table *Table
}

Table Cell - ContentBlockContent

func (TCBlockContent) MarshalXML

func (t TCBlockContent) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type TCPrChange

type TCPrChange struct {
	ID     int          `xml:"id,attr"`
	Author string       `xml:"author,attr"`
	Date   *string      `xml:"date,attr,omitempty"`
	Prop   CellProperty `xml:"tcPr"`
}

func (TCPrChange) MarshalXML

func (t TCPrChange) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type TRCellContent

type TRCellContent struct {
	Cell *Cell `xml:"tc,omitempty"`
}

func (TRCellContent) MarshalXML

func (c TRCellContent) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type TRPrChange

type TRPrChange struct {
	ID     int         `xml:"id,attr"`
	Author string      `xml:"author,attr"`
	Date   *string     `xml:"date,attr,omitempty"`
	Prop   RowProperty `xml:"tcPr"`
}

func (TRPrChange) MarshalXML

func (t TRPrChange) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Tab

type Tab struct {
	// Tab Stop Type
	Val stypes.CustTabStop `xml:"val,attr,omitempty"`

	//Tab Stop Position
	Position int `xml:"pos,attr,omitempty"`

	//Custom Tab Stop Leader Character
	LeaderChar *stypes.CustLeadChar `xml:"leader,attr,omitempty"`
}

Custom Tab Stop

func (Tab) MarshalXML

func (t Tab) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Table

type Table struct {
	//1.Choice: RangeMarkupElements
	RngMarkupElems []RngMarkupElem

	//2. Table Properties
	TableProp TableProp `xml:"tblPr,omitempty"`

	//3. Table Grid
	Grid Grid `xml:"tblGrid,omitempty"`

	//4.1 Choice:
	RowContents []RowContent
}

Table

func DefaultTable

func DefaultTable() *Table

func (Table) MarshalXML

func (t Table) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

func (*Table) UnmarshalXML

func (t *Table) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)

type TableBorders

type TableBorders struct {
	// 1. Table Top Border
	Top *Border `xml:"top,omitempty"`

	// 2. Table Left Border
	Left *Border `xml:"left,omitempty"`

	// 3. Table Bottom Border
	Bottom *Border `xml:"bottom,omitempty"`

	// 4. Table Right Border
	Right *Border `xml:"right,omitempty"`

	// 5. Table Inside Horizontal Edges Border
	InsideH *Border `xml:"insideH,omitempty"`
	// 6. Table Inside Vertical Edges Border
	InsideV *Border `xml:"insideV,omitempty"`
}

func DefaultTableBorders

func DefaultTableBorders() *TableBorders

func (TableBorders) MarshalXML

func (t TableBorders) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type TableLayout

type TableLayout struct {
	LayoutType *stypes.TableLayout `xml:"type,attr,omitempty"`
}

TableLayout represents the layout of a table in a document.

func DefaultTableLayout

func DefaultTableLayout() *TableLayout

func NewTableLayout

func NewTableLayout(t stypes.TableLayout) *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.

type TableProp

type TableProp struct {

	// 1. Referenced Table Style
	// 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"
	Style *CTString `xml:"tblStyle,omitempty"`

	// 2. Floating Table Positioning
	FloatPos *FloatPos `xml:"tblpPr,omitempty"`

	// 3.Floating Table Allows Other Tables to Overlap
	Overlap *GenSingleStrVal[stypes.TblOverlap] `xml:"tblOverlap,omitempty"`

	// 4. Visually Right to Left Table
	BidiVisual *OnOff `xml:"bidiVisual,omitempty"`

	// 5. Number of Rows in Row Band
	RowCountInRowBand *DecimalNum `xml:"tblStyleRowBandSize,omitempty"`

	// 6. Number of Columns in Column Band
	RowCountInColBand *DecimalNum `xml:"tblStyleColBandSize,omitempty"`

	// 7. Preferred Table Width
	Width *TableWidth `xml:"tblW,omitempty"`

	// 8.Table Alignment
	Justification *GenSingleStrVal[stypes.Justification] `xml:"jc,omitempty"`

	// 9.Table Cell Spacing Default
	CellSpacing *TableWidth `xml:"blCellSpacing,omitempty"`

	// 10. Table Indent from Leading Margin
	Indent *TableWidth `xml:"tblInd,omitempty"`

	// 11. Table Indent from Leading Margin
	Borders *TableBorders `xml:"tblBorders,omitempty"`

	// 12. Table Shading
	Shading *Shading `xml:"shd,omitempty"`

	// 13. Table Layout
	Layout *TableLayout `xml:"tblLayout,omitempty"`

	// 14. Table Cell Margin Defaults
	CellMargin *CellMargins `xml:"tblCellMar,omitempty"`

	// 15. Table Style Conditional Formatting Settings
	TableLook *CTString `xml:"tblLook,omitempty"`

	//16. Revision Information for Table Properties
	PrChange *TblPrChange `xml:"tblPrChange,omitempty"`
}

This element specifies the set of table-wide properties applied to the current table. These properties affect the appearance of all rows and cells within the parent table, but may be overridden by individual table-level exception, row, and cell level properties as defined by each TableProp.

func DefaultTableProp

func DefaultTableProp() *TableProp

func (TableProp) MarshalXML

func (t TableProp) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

type TableRowHeight

type TableRowHeight struct {
	Val   *int               `xml:"val,attr,omitempty"`
	HRule *stypes.HeightRule `xml:"hRule,attr,omitempty"`
}

TableRowHeight represents the height of a table row in a document.

func NewTableRowHeight

func NewTableRowHeight(val int, hRule stypes.HeightRule) *TableRowHeight

NewTableRowHeight creates a new TableRowHeight instance.

func (TableRowHeight) MarshalXML

func (h TableRowHeight) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML marshals TableRowHeight to XML.

func (*TableRowHeight) UnmarshalXML

func (h *TableRowHeight) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML unmarshals XML into TableRowHeight.

type TableStyleProp

type TableStyleProp struct {

	//1.Table Style Conditional Formatting Paragraph Properties
	ParaProp *ParagraphProp `xml:"pPr,omitempty"`

	//2.Table Style Conditional Formatting Run Properties
	RunProp *RunProperty `xml:"rPr,omitempty"`

	//3.Table Style Conditional Formatting Table Properties
	TableProp *TableProp `xml:"tblPr,omitempty"`

	//4.Table Style Conditional Formatting Table Row Properties
	RowProp *RowProperty `xml:"trPr,omitempty"`

	//5.Table Style Conditional Formatting Table Cell Properties
	CellProp *CellProperty `xml:"tcPr,omitempty"`

	//Table Style Conditional Formatting Type
	Type stypes.TblStyleOverrideType `xml:"type,attr"`
}

Style Conditional Table Formatting Properties

func (*TableStyleProp) MarshalXML

func (t *TableStyleProp) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type TableWidth

type TableWidth struct {
	Width     *int               `xml:"w,attr,omitempty"`
	WidthType *stypes.TableWidth `xml:"type,attr,omitempty"`
}

TableWidth represents the width of a table in a document.

func NewTableWidth

func NewTableWidth(width int, widthType stypes.TableWidth) *TableWidth

func (TableWidth) MarshalXML

func (t TableWidth) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

type Tabs

type Tabs struct {
	Tab []Tab `xml:"tab,omitempty"`
}

func (Tabs) MarshalXML

func (t Tabs) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type TblPrChange

type TblPrChange struct {
	ID     int       `xml:"id,attr"`
	Author string    `xml:"author,attr"`
	Date   *string   `xml:"date,attr,omitempty"`
	Prop   TableProp `xml:"tblPr"`
}

func (TblPrChange) MarshalXML

func (t TblPrChange) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Text

type Text struct {
	Text  string
	Space *string
}

func NewText

func NewText() *Text

func TextFromString

func TextFromString(text string) *Text

func (Text) MarshalXML

func (t Text) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

func (*Text) UnmarshalXML

func (t *Text) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)

type TrackChange

type TrackChange struct {
	ID     int     `xml:"id,attr"`
	Author string  `xml:"author,attr"`
	Date   *string `xml:"date,attr,omitempty"`
}

TrackChange represents the complex type for track change

func (TrackChange) MarshalXML

func (t TrackChange) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type TrackChangeNum

type TrackChangeNum struct {
	ID       int     `xml:"id,attr"`
	Author   string  `xml:"author,attr"`
	Date     *string `xml:"date,attr,omitempty"`
	Original *string `xml:"original,attr,omitempty"`
}

TrackChangeNum represents the complex type for track change numbering

func (TrackChangeNum) MarshalXML

func (t TrackChangeNum) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type Uint64Elem

type Uint64Elem struct {
	Val uint64 `xml:"val,attr"`
}

Uint64Elem - Gomplex type that contains single val attribute which is type of uint64 can be used where w:ST_UnsignedDecimalNumber is applicable example: ST_HpsMeasure

func NewUint64Elem

func NewUint64Elem(value uint64) *Uint64Elem

func (Uint64Elem) MarshalXML

func (s Uint64Elem) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML implements the xml.Marshaler interface for the Uint64Elem type. It encodes the instance into XML using the "w:ELEMENT_NAME" element with a "w:val" attribute.

Jump to

Keyboard shortcuts

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