2017-08-28 20:56:18 -05:00
//
2020-08-23 14:15:53 +00:00
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/
2017-08-28 20:56:18 -05:00
2020-08-23 14:15:53 +00:00
/ *
2017-09-01 16:12:59 -05:00
2020-08-23 14:15:53 +00:00
Package document provides creation , reading , and writing of ECMA 376 Open
Office XML documents .
2017-09-01 16:12:59 -05:00
2020-08-23 14:15:53 +00:00
Example :
2018-01-24 18:59:09 -06:00
2020-08-23 14:15:53 +00:00
doc := document . New ( )
para := doc . AddParagraph ( )
run := para . AddRun ( )
run . SetText ( "foo" )
doc . SaveToFile ( "foo.docx" )
* /
2020-11-09 01:00:18 +00:00
package document ; import ( _fd "archive/zip" ; _dc "bytes" ; _f "errors" ; _cb "fmt" ; _c "github.com/unidoc/unioffice" ; _fb "github.com/unidoc/unioffice/color" ; _da "github.com/unidoc/unioffice/common" ; _gd "github.com/unidoc/unioffice/common/license" ; _ed "github.com/unidoc/unioffice/common/tempstorage" ; _cg "github.com/unidoc/unioffice/measurement" ; _gg "github.com/unidoc/unioffice/schema/soo/dml" ; _cd "github.com/unidoc/unioffice/schema/soo/dml/picture" ; _cbc "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes" ; _ca "github.com/unidoc/unioffice/schema/soo/pkg/relationships" ; _edb "github.com/unidoc/unioffice/schema/soo/wml" ; _af "github.com/unidoc/unioffice/zippkg" ; _de "image" ; _gfd "image/jpeg" ; _ee "io" ; _a "log" ; _b "math/rand" ; _d "os" ; _eg "path/filepath" ; _e "strings" ; _gf "unicode" ; ) ;
2018-01-24 18:59:09 -06:00
2020-11-09 01:00:18 +00:00
// SetValue sets the value of a FormFieldTypeText or FormFieldTypeDropDown. For
// FormFieldTypeDropDown, the value must be one of the fields possible values.
func ( _gbab FormField ) SetValue ( v string ) { if _gbab . _aaed . DdList != nil { for _fgbc , _efcf := range _gbab . PossibleValues ( ) { if _efcf == v { _gbab . _aaed . DdList . Result = _edb . NewCT_DecimalNumber ( ) ; _gbab . _aaed . DdList . Result . ValAttr = int64 ( _fgbc ) ; break ; } ; } ; } else if _gbab . _aaed . TextInput != nil { _gbab . _cgba . T = _edb . NewCT_Text ( ) ; _gbab . _cgba . T . Content = v ; } ; } ;
2017-08-28 20:56:18 -05:00
2020-11-09 01:00:18 +00:00
// Footnote returns the footnote based on the ID; this can be used nicely with
// the run.IsFootnote() functionality.
func ( _afaf * Document ) Footnote ( id int64 ) Footnote { for _ , _cbgc := range _afaf . Footnotes ( ) { if _cbgc . id ( ) == id { return _cbgc ; } ; } ; return Footnote { } ; } ;
2017-08-28 20:56:18 -05:00
2020-11-09 01:00:18 +00:00
// AddParagraph adds a paragraph to the footer.
func ( _dfa Footer ) AddParagraph ( ) Paragraph { _adbd := _edb . NewEG_ContentBlockContent ( ) ; _dfa . _dbcd . EG_ContentBlockContent = append ( _dfa . _dbcd . EG_ContentBlockContent , _adbd ) ; _dgga := _edb . NewCT_P ( ) ; _adbd . P = append ( _adbd . P , _dgga ) ; return Paragraph { _dfa . _aecf , _dgga } ; } ;
2017-08-28 20:56:18 -05:00
2020-11-09 01:00:18 +00:00
// SetRight sets the right border to a specified type, color and thickness.
func ( _caeae TableBorders ) SetRight ( t _edb . ST_Border , c _fb . Color , thickness _cg . Distance ) { _caeae . _dgac . Right = _edb . NewCT_Border ( ) ; _gaca ( _caeae . _dgac . Right , t , c , thickness ) ; } ;
2017-08-28 20:56:18 -05:00
2020-11-09 01:00:18 +00:00
// SetOutlineLevel sets the outline level of this style.
func ( _feec ParagraphStyleProperties ) SetOutlineLevel ( lvl int ) { _feec . _bggb . OutlineLvl = _edb . NewCT_DecimalNumber ( ) ; _feec . _bggb . OutlineLvl . ValAttr = int64 ( lvl ) ; } ;
2017-08-28 20:56:18 -05:00
2020-11-09 01:00:18 +00:00
// New constructs an empty document that content can be added to.
func New ( ) * Document { _geag := & Document { _edg : _edb . NewDocument ( ) } ; _geag . ContentTypes = _da . NewContentTypes ( ) ; _geag . _edg . Body = _edb . NewCT_Body ( ) ; _geag . _edg . ConformanceAttr = _cbc . ST_ConformanceClassTransitional ; _geag . _gcgf = _da . NewRelationships ( ) ; _geag . AppProperties = _da . NewAppProperties ( ) ; _geag . CoreProperties = _da . NewCoreProperties ( ) ; _geag . ContentTypes . AddOverride ( "\u002fw\u006fr\u0064\u002f\u0064\u006f\u0063u\u006d\u0065n\u0074\u002e\u0078\u006d\u006c" , "\u0061p\u0070\u006c\u0069c\u0061\u0074\u0069o\u006e/v\u006e\u0064\u002e\u006f\u0070\u0065\u006ex\u006d\u006c\u0066\u006f\u0072\u006d\u0061\u0074\u0073\u002d\u006f\u0066\u0066\u0069\u0063\u0065\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0077\u006f\u0072dp\u0072o\u0063\u0065\u0073\u0073\u0069\u006eg\u006d\u006c\u002e\u0064\u006fc\u0075\u006d\u0065\u006e\u0074\u002e\u006d\u0061\u0069\u006e\u002bx\u006d\u006c" ) ; _geag . Settings = NewSettings ( ) ; _geag . _gcgf . AddRelationship ( "\u0073\u0065\u0074t\u0069\u006e\u0067\u0073\u002e\u0078\u006d\u006c" , _c . SettingsType ) ; _geag . ContentTypes . AddOverride ( "\u002fw\u006fr\u0064\u002f\u0073\u0065\u0074t\u0069\u006eg\u0073\u002e\u0078\u006d\u006c" , "\u0061\u0070\u0070\u006c\u0069\u0063\u0061\u0074\u0069o\u006e\u002fv\u006e\u0064\u002e\u006f\u0070\u0065\u006e\u0078\u006dl\u0066\u006f\u0072\u006da\u0074\u0073\u002d\u006f\u0066\u0066\u0069\u0063\u0065\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0077\u006f\u0072\u0064\u0070\u0072\u006f\u0063\u0065\u0073\u0073\u0069n\u0067\u006d\u006c.\u0073\u0065\u0074\u0074\u0069\u006e\u0067\u0073\u002b\u0078\u006d\u006c" ) ; _geag . Rels = _da . NewRelationships ( ) ; _geag . Rels . AddRelationship ( _c . RelativeFilename ( _c . DocTypeDocument , "" , _c . CorePropertiesType , 0 ) , _c . CorePropertiesType ) ; _geag . Rels . AddRelationship ( "\u0064\u006fc\u0050\u0072\u006fp\u0073\u002f\u0061\u0070\u0070\u002e\u0078\u006d\u006c" , _c . ExtendedPropertiesType ) ; _geag . Rels . AddRelationship ( "\u0077\u006f\u0072\u0064\u002f\u0064\u006f\u0063\u0075\u006d\u0065\u006et\u002e\u0078\u006d\u006c" , _c . OfficeDocumentType ) ; _geag . Numbering = NewNumbering ( ) ; _geag . Numbering . InitializeDefault ( ) ; _geag . ContentTypes . AddOverride ( "\u002f\u0077\u006f\u0072d/\u006e\u0075\u006d\u0062\u0065\u0072\u0069\u006e\u0067\u002e\u0078\u006d\u006c" , "\u0061\u0070\u0070\u006c\u0069c\u0061\u0074\u0069\u006f\u006e\u002f\u0076n\u0064\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072\u006d\u0061\u0074\u0073\u002d\u006f\u0066\u0066\u0069\u0063\u0065\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0077\u006f\u0072\u0064\u0070\u0072\u006f\u0063e\u0073\u0073\u0069\u006e\u0067\u006d\u006c\u002e\u006e\u0075\u006d\u0062e\u0072\u0069\u006e\u0067\u002b\u0078m\u006c" ) ; _geag . _gcgf . AddRelationship ( "\u006e\u0075\u006d\u0062\u0065\u0072\u0069\u006e\u0067\u002e\u0078\u006d\u006c" , _c . NumberingType ) ; _geag . Styles = NewStyles ( ) ; _geag . Styles . InitializeDefault ( ) ; _geag . ContentTypes . AddOverride ( "\u002f\u0077o\u0072\u0064\u002fs\u0074\u0079\u006c\u0065\u0073\u002e\u0078\u006d\u006c" , "\u0061p\u0070l\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u0076\u006e\u0064.\u006f\u0070\u0065\u006ex\u006d\u006c\u0066\u006f\u0072m\u0061\u0074\u0073\u002d\u006f\u0066\u0066\u0069\u0063\u0065\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0077\u006f\u0072\u0064\u0070\u0072\u006f\u0063\u0065\u0073\u0073\u0069n\u0067\u006d\u006c\u002e\u0073\u0074\u0079\u006ce\u0073\u002b\u0078\u006d\u006c" ) ; _geag . _gcgf . AddRelationship ( "\u0073\u0074\u0079\u006c\u0065\u0073\u002e\u0078\u006d\u006c" , _c . StylesType ) ; _geag . _edg . Body = _edb . NewCT_Body ( ) ; return _geag ; } ; func _affg ( _aba * _edb . CT_Tbl , _cbag map [ string ] string ) { for _ , _cabf := range _aba . EG_ContentRowContent { for _ , _fdeb := range _cabf . Tr { for _ , _bfda := range _fdeb . EG_ContentCellContent { for _ , _dgf := range _bfda . Tc { for _ , _baa := range _dgf . EG_BlockLevelElts { for _ , _afbf := range _baa . EG_ContentBlockContent { for _ , _gccg := range _afbf . P { _bacd ( _gccg , _cbag ) ; } ; for _ , _bfag := range _afbf . Tbl { _affg ( _bfag , _cbag ) ; } ; } ; } ; } ; } ; } ; } ; } ; var _efgf = [ ... ] uint8 { 0 , 20 , 37 , 58 ,
2017-08-28 20:56:18 -05:00
2020-11-09 01:00:18 +00:00
// Read reads a document from an io.Reader.
func Read ( r _ee . ReaderAt , size int64 ) ( * Document , error ) { _cfd := New ( ) ; _cfd . Numbering . _fbd = nil ; _fbee , _beb := _ed . TempDir ( "\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065-\u0064\u006f\u0063\u0078" ) ; if _beb != nil { return nil , _beb ; } ; _cfd . TmpPath = _fbee ; _facc , _beb := _fd . NewReader ( r , size ) ; if _beb != nil { return nil , _cb . Errorf ( "\u0070a\u0072s\u0069\u006e\u0067\u0020\u007a\u0069\u0070\u003a\u0020\u0025\u0073" , _beb ) ; } ; _gccd := [ ] * _fd . File { } ; _gccd = append ( _gccd , _facc . File ... ) ; _deeaf := false ; for _ , _cge := range _gccd { if _cge . FileHeader . Name == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _deeaf = true ; break ; } ; } ; if _deeaf { _cfd . CreateCustomProperties ( ) ; } ; _dfb := _cfd . _edg . ConformanceAttr ; _eagb := _af . DecodeMap { } ; _eagb . SetOnNewRelationshipFunc ( _cfd . onNewRelationship ) ; _eagb . AddTarget ( _c . ContentTypesFilename , _cfd . ContentTypes . X ( ) , "" , 0 ) ; _eagb . AddTarget ( _c . BaseRelsFilename , _cfd . Rels . X ( ) , "" , 0 ) ; if _ege := _eagb . Decode ( _gccd ) ; _ege != nil { return nil , _ege ; } ; _cfd . _edg . ConformanceAttr = _dfb ; for _ , _aad := range _gccd { if _aad == nil { continue ; } ; if _fdfd := _cfd . AddExtraFileFromZip ( _aad ) ; _fdfd != nil { return nil , _fdfd ; } ; } ; if _deeaf { _bda := false ; for _ , _bfaf := range _cfd . Rels . X ( ) . Relationship { if _bfaf . TargetAttr == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _bda = true ; break ; } ; } ; if ! _bda { _cfd . AddCustomRelationships ( ) ; } ; } ; return _cfd , nil ; } ;
2017-08-28 20:56:18 -05:00
2020-11-09 01:00:18 +00:00
// Endnotes returns the endnotes defined in the document.
func ( _ggec * Document ) Endnotes ( ) [ ] Endnote { _dfef := [ ] Endnote { } ; for _ , _adbc := range _ggec . _dacb . CT_Endnotes . Endnote { _dfef = append ( _dfef , Endnote { _ggec , _adbc } ) ; } ; return _dfef ; } ;
2019-10-23 22:06:11 +03:00
2020-11-09 01:00:18 +00:00
// SetName sets the name of the image, visible in the properties of the image
// within Word.
func ( _ec AnchoredDrawing ) SetName ( name string ) { _ec . _eef . DocPr . NameAttr = name ; for _ , _afb := range _ec . _eef . Graphic . GraphicData . Any { if _fc , _ae := _afb . ( * _cd . Pic ) ; _ae { _fc . NvPicPr . CNvPr . DescrAttr = _c . String ( name ) ; } ; } ; } ;
2018-01-24 18:59:09 -06:00
2020-11-09 01:00:18 +00:00
// Cell is a table cell within a document (not a spreadsheet)
type Cell struct { _df * Document ; _ece * _edb . CT_Tc ; } ; func _cgc ( _gea * _edb . CT_TblWidth , _bbd float64 ) { _gea . TypeAttr = _edb . ST_TblWidthPct ; _gea . WAttr = & _edb . ST_MeasurementOrPercent { } ; _gea . WAttr . ST_DecimalNumberOrPercent = & _edb . ST_DecimalNumberOrPercent { } ; _gea . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _c . Int64 ( int64 ( _bbd * 50 ) ) ; } ;
2017-08-28 20:56:18 -05:00
2020-11-09 01:00:18 +00:00
// Properties returns the table properties.
func ( _gegec Table ) Properties ( ) TableProperties { if _gegec . _cbcgd . TblPr == nil { _gegec . _cbcgd . TblPr = _edb . NewCT_TblPr ( ) ; } ; return TableProperties { _gegec . _cbcgd . TblPr } ; } ;
2017-10-10 17:57:44 -04:00
2020-11-09 01:00:18 +00:00
// SetVerticalAlignment controls the vertical alignment of the run, this is used
// to control if text is superscript/subscript.
func ( _ccdd RunProperties ) SetVerticalAlignment ( v _cbc . ST_VerticalAlignRun ) { if v == _cbc . ST_VerticalAlignRunUnset { _ccdd . _ccbg . VertAlign = nil ; } else { _ccdd . _ccbg . VertAlign = _edb . NewCT_VerticalAlignRun ( ) ; _ccdd . _ccbg . VertAlign . ValAttr = v ; } ; } ;
2017-10-10 17:57:44 -04:00
2020-11-09 01:00:18 +00:00
// Name returns the name of the style if set.
func ( _ebfb Style ) Name ( ) string { if _ebfb . _abcbf . Name == nil { return "" ; } ; return _ebfb . _abcbf . Name . ValAttr ; } ;
2018-07-17 00:35:15 +03:00
2020-11-09 01:00:18 +00:00
// AddSection adds a new document section with an optional section break. If t
// is ST_SectionMarkUnset, then no break will be inserted.
func ( _fbfb ParagraphProperties ) AddSection ( t _edb . ST_SectionMark ) Section { _fbfb . _beefd . SectPr = _edb . NewCT_SectPr ( ) ; if t != _edb . ST_SectionMarkUnset { _fbfb . _beefd . SectPr . Type = _edb . NewCT_SectType ( ) ; _fbfb . _beefd . SectPr . Type . ValAttr = t ; } ; return Section { _fbfb . _fdab , _fbfb . _beefd . SectPr } ; } ;
2018-07-17 00:35:15 +03:00
2020-11-09 01:00:18 +00:00
// AddParagraph adds a paragraph to the footnote.
func ( _daf Footnote ) AddParagraph ( ) Paragraph { _cgbf := _edb . NewEG_ContentBlockContent ( ) ; _efce := len ( _daf . _gfff . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent ) ; _daf . _gfff . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent = append ( _daf . _gfff . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent , _cgbf ) ; _ccgfg := _edb . NewCT_P ( ) ; var _bdad * _edb . CT_String ; if _efce != 0 { _gdgbd := len ( _daf . _gfff . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent [ _efce - 1 ] . P ) ; _bdad = _daf . _gfff . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent [ _efce - 1 ] . P [ _gdgbd - 1 ] . PPr . PStyle ; } else { _bdad = _edb . NewCT_String ( ) ; _bdad . ValAttr = "\u0046\u006f\u006f\u0074\u006e\u006f\u0074\u0065" ; } ; _cgbf . P = append ( _cgbf . P , _ccgfg ) ; _egc := Paragraph { _daf . _agea , _ccgfg } ; _egc . _ccdca . PPr = _edb . NewCT_PPr ( ) ; _egc . _ccdca . PPr . PStyle = _bdad ; _egc . _ccdca . PPr . RPr = _edb . NewCT_ParaRPr ( ) ; return _egc ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _dbgd Numbering ) X ( ) * _edb . Numbering { return _dbgd . _fbd } ; func ( _cbddd Paragraph ) addSeparateFldChar ( ) * _edb . CT_FldChar { _baegd := _cbddd . addFldChar ( ) ; _baegd . FldCharTypeAttr = _edb . ST_FldCharTypeSeparate ; return _baegd ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetSize sets size attribute for a FormFieldTypeCheckBox in pt.
func ( _cdaba FormField ) SetSize ( size uint64 ) { size *= 2 ; if _cdaba . _aaed . CheckBox != nil { _cdaba . _aaed . CheckBox . Choice = _edb . NewCT_FFCheckBoxChoice ( ) ; _cdaba . _aaed . CheckBox . Choice . Size = _edb . NewCT_HpsMeasure ( ) ; _cdaba . _aaed . CheckBox . Choice . Size . ValAttr = _edb . ST_HpsMeasure { ST_UnsignedDecimalNumber : & size } ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetInsideVertical sets the interior vertical borders to a specified type, color and thickness.
func ( _fa CellBorders ) SetInsideVertical ( t _edb . ST_Border , c _fb . Color , thickness _cg . Distance ) { _fa . _gcg . InsideV = _edb . NewCT_Border ( ) ; _gaca ( _fa . _gcg . InsideV , t , c , thickness ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// CellProperties are a table cells properties within a document.
type CellProperties struct { _dcb * _edb . CT_TcPr } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetXOffset sets the X offset for an image relative to the origin.
func ( _gda AnchoredDrawing ) SetXOffset ( x _cg . Distance ) { _gda . _eef . PositionH . Choice = & _edb . WdCT_PosHChoice { } ; _gda . _eef . PositionH . Choice . PosOffset = _c . Int32 ( int32 ( x / _cg . EMU ) ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the internally wrapped *wml.CT_SectPr.
func ( _ggeg Section ) X ( ) * _edb . CT_SectPr { return _ggeg . _gecd } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddFooter creates a Footer associated with the document, but doesn't add it
// to the document for display.
func ( _cga * Document ) AddFooter ( ) Footer { _age := _edb . NewFtr ( ) ; _cga . _bcd = append ( _cga . _bcd , _age ) ; _fce := _cb . Sprintf ( "\u0066\u006f\u006ft\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c" , len ( _cga . _bcd ) ) ; _cga . _gcgf . AddRelationship ( _fce , _c . FooterType ) ; _cga . ContentTypes . AddOverride ( "\u002f\u0077\u006f\u0072\u0064\u002f" + _fce , "\u0061p\u0070l\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u0076\u006e\u0064.\u006f\u0070\u0065\u006ex\u006d\u006c\u0066\u006f\u0072m\u0061\u0074\u0073\u002d\u006f\u0066\u0066\u0069\u0063\u0065\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0077\u006f\u0072\u0064\u0070\u0072\u006f\u0063\u0065\u0073\u0073\u0069n\u0067\u006d\u006c\u002e\u0066\u006f\u006f\u0074e\u0072\u002b\u0078\u006d\u006c" ) ; _cga . _cbd = append ( _cga . _cbd , _da . NewRelationships ( ) ) ; return Footer { _cga , _age } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddImage adds an image to the document package, returning a reference that
// can be used to add the image to a run and place it in the document contents.
func ( _ccac * Document ) AddImage ( i _da . Image ) ( _da . ImageRef , error ) { _bebf := _da . MakeImageRef ( i , & _ccac . DocBase , _ccac . _gcgf ) ; if i . Data == nil && i . Path == "" { return _bebf , _f . New ( "\u0069\u006d\u0061\u0067\u0065\u0020\u006d\u0075\u0073\u0074 \u0068\u0061\u0076\u0065\u0020\u0064\u0061t\u0061\u0020\u006f\u0072\u0020\u0061\u0020\u0070\u0061\u0074\u0068" ) ; } ; if i . Format == "" { return _bebf , _f . New ( "\u0069\u006d\u0061\u0067\u0065\u0020\u006d\u0075\u0073\u0074 \u0068\u0061\u0076\u0065\u0020\u0061\u0020v\u0061\u006c\u0069\u0064\u0020\u0066\u006f\u0072\u006d\u0061\u0074" ) ; } ; if i . Size . X == 0 || i . Size . Y == 0 { return _bebf , _f . New ( "\u0069\u006d\u0061\u0067e\u0020\u006d\u0075\u0073\u0074\u0020\u0068\u0061\u0076\u0065 \u0061 \u0076\u0061\u006c\u0069\u0064\u0020\u0073i\u007a\u0065" ) ; } ; if i . Path != "" { _eddb := _ed . Add ( i . Path ) ; if _eddb != nil { return _bebf , _eddb ; } ; } ; _ccac . Images = append ( _ccac . Images , _bebf ) ; _bgdd := _cb . Sprintf ( "\u006d\u0065d\u0069\u0061\u002fi\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073" , len ( _ccac . Images ) , i . Format ) ; _gefg := _ccac . _gcgf . AddRelationship ( _bgdd , _c . ImageType ) ; _ccac . ContentTypes . EnsureDefault ( "\u0070\u006e\u0067" , "\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg" ) ; _ccac . ContentTypes . EnsureDefault ( "\u006a\u0070\u0065\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _ccac . ContentTypes . EnsureDefault ( "\u006a\u0070\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _ccac . ContentTypes . EnsureDefault ( "\u0077\u006d\u0066" , "i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066" ) ; _ccac . ContentTypes . EnsureDefault ( i . Format , "\u0069\u006d\u0061\u0067\u0065\u002f" + i . Format ) ; _bebf . SetRelID ( _gefg . X ( ) . IdAttr ) ; _bebf . SetTarget ( _bgdd ) ; return _bebf , nil ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Style returns the style for a paragraph, or an empty string if it is unset.
func ( _deeg Paragraph ) Style ( ) string { if _deeg . _ccdca . PPr != nil && _deeg . _ccdca . PPr . PStyle != nil { return _deeg . _ccdca . PPr . PStyle . ValAttr ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Text returns the underlying tet in the run.
func ( _geed Run ) Text ( ) string { if len ( _geed . _abcbb . EG_RunInnerContent ) == 0 { return "" ; } ; _cdfdf := _dc . Buffer { } ; for _ , _gbcg := range _geed . _abcbb . EG_RunInnerContent { if _gbcg . T != nil { _cdfdf . WriteString ( _gbcg . T . Content ) ; } ; if _gbcg . Tab != nil { _cdfdf . WriteByte ( '\t' ) ; } ; } ; return _cdfdf . String ( ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// GetImage returns the ImageRef associated with an InlineDrawing.
func ( _egdd InlineDrawing ) GetImage ( ) ( _da . ImageRef , bool ) { _eafa := _egdd . _fadc . Graphic . GraphicData . Any ; if len ( _eafa ) > 0 { _ebef , _dafe := _eafa [ 0 ] . ( * _cd . Pic ) ; if _dafe { if _ebef . BlipFill != nil && _ebef . BlipFill . Blip != nil && _ebef . BlipFill . Blip . EmbedAttr != nil { return _egdd . _dgca . GetImageByRelID ( * _ebef . BlipFill . Blip . EmbedAttr ) ; } ; } ; } ; return _da . ImageRef { } , false ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetBefore sets the spacing that comes before the paragraph.
func ( _ggg ParagraphSpacing ) SetBefore ( before _cg . Distance ) { _ggg . _cgdgb . BeforeAttr = & _cbc . ST_TwipsMeasure { } ; _ggg . _cgdgb . BeforeAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( before / _cg . Twips ) ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetThemeColor sets the color from the theme.
func ( _bc Color ) SetThemeColor ( t _edb . ST_ThemeColor ) { _bc . _cff . ThemeColorAttr = t } ;
2020-10-12 13:59:12 +00:00
2020-11-09 01:00:18 +00:00
// SetAfter sets the spacing that comes after the paragraph.
func ( _ggcb ParagraphSpacing ) SetAfter ( after _cg . Distance ) { _ggcb . _cgdgb . AfterAttr = & _cbc . ST_TwipsMeasure { } ; _ggcb . _cgdgb . AfterAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( after / _cg . Twips ) ) ; } ;
2020-08-23 14:15:53 +00:00
2020-08-31 22:58:25 +00:00
// X returns the inner wrapped XML type.
2020-11-09 01:00:18 +00:00
func ( _beeg Row ) X ( ) * _edb . CT_Row { return _beeg . _eaeb } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Type returns the type of the field.
func ( _bbc FormField ) Type ( ) FormFieldType { if _bbc . _aaed . TextInput != nil { return FormFieldTypeText ; } else if _bbc . _aaed . CheckBox != nil { return FormFieldTypeCheckBox ; } else if _bbc . _aaed . DdList != nil { return FormFieldTypeDropDown ; } ; return FormFieldTypeUnknown ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// TableConditionalFormatting controls the conditional formatting within a table
// style.
type TableConditionalFormatting struct { _efgd * _edb . CT_TblStylePr } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddImage adds an image to the document package, returning a reference that
// can be used to add the image to a run and place it in the document contents.
func ( _eafd Footer ) AddImage ( i _da . Image ) ( _da . ImageRef , error ) { var _begg _da . Relationships ; for _faeg , _ffgg := range _eafd . _aecf . _bcd { if _ffgg == _eafd . _dbcd { _begg = _eafd . _aecf . _cbd [ _faeg ] ; } ; } ; _bcabf := _da . MakeImageRef ( i , & _eafd . _aecf . DocBase , _begg ) ; if i . Data == nil && i . Path == "" { return _bcabf , _f . New ( "\u0069\u006d\u0061\u0067\u0065\u0020\u006d\u0075\u0073\u0074 \u0068\u0061\u0076\u0065\u0020\u0064\u0061t\u0061\u0020\u006f\u0072\u0020\u0061\u0020\u0070\u0061\u0074\u0068" ) ; } ; if i . Format == "" { return _bcabf , _f . New ( "\u0069\u006d\u0061\u0067\u0065\u0020\u006d\u0075\u0073\u0074 \u0068\u0061\u0076\u0065\u0020\u0061\u0020v\u0061\u006c\u0069\u0064\u0020\u0066\u006f\u0072\u006d\u0061\u0074" ) ; } ; if i . Size . X == 0 || i . Size . Y == 0 { return _bcabf , _f . New ( "\u0069\u006d\u0061\u0067e\u0020\u006d\u0075\u0073\u0074\u0020\u0068\u0061\u0076\u0065 \u0061 \u0076\u0061\u006c\u0069\u0064\u0020\u0073i\u007a\u0065" ) ; } ; _eafd . _aecf . Images = append ( _eafd . _aecf . Images , _bcabf ) ; _fbg := _cb . Sprintf ( "\u006d\u0065d\u0069\u0061\u002fi\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073" , len ( _eafd . _aecf . Images ) , i . Format ) ; _bbdf := _begg . AddRelationship ( _fbg , _c . ImageType ) ; _bcabf . SetRelID ( _bbdf . X ( ) . IdAttr ) ; return _bcabf , nil ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// RemoveParagraph removes a paragraph from the endnote.
func ( _addd Endnote ) RemoveParagraph ( p Paragraph ) { for _ , _dffg := range _addd . content ( ) { for _dgg , _acbeb := range _dffg . P { if _acbeb == p . _ccdca { copy ( _dffg . P [ _dgg : ] , _dffg . P [ _dgg + 1 : ] ) ; _dffg . P = _dffg . P [ 0 : len ( _dffg . P ) - 1 ] ; return ; } ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetInsideHorizontal sets the interior horizontal borders to a specified type, color and thickness.
func ( _ddea TableBorders ) SetInsideHorizontal ( t _edb . ST_Border , c _fb . Color , thickness _cg . Distance ) { _ddea . _dgac . InsideH = _edb . NewCT_Border ( ) ; _gaca ( _ddea . _dgac . InsideH , t , c , thickness ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetAlignment positions an anchored image via alignment. Offset is
// incompatible with SetOffset, whichever is called last is applied.
func ( _daa AnchoredDrawing ) SetAlignment ( h _edb . WdST_AlignH , v _edb . WdST_AlignV ) { _daa . SetHAlignment ( h ) ; _daa . SetVAlignment ( v ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Footnotes returns the footnotes defined in the document.
func ( _bed * Document ) Footnotes ( ) [ ] Footnote { _gcc := [ ] Footnote { } ; for _ , _deea := range _bed . _fba . CT_Footnotes . Footnote { _gcc = append ( _gcc , Footnote { _bed , _deea } ) ; } ; return _gcc ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetVerticalMerge controls the vertical merging of cells.
func ( _egg CellProperties ) SetVerticalMerge ( mergeVal _edb . ST_Merge ) { if mergeVal == _edb . ST_MergeUnset { _egg . _dcb . VMerge = nil ; } else { _egg . _dcb . VMerge = _edb . NewCT_VMerge ( ) ; _egg . _dcb . VMerge . ValAttr = mergeVal ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Font returns the name of run font family.
func ( _cgbea RunProperties ) Font ( ) string { if _gaed := _cgbea . _ccbg . RFonts ; _gaed != nil { if _gaed . AsciiAttr != nil { return * _gaed . AsciiAttr ; } else if _gaed . HAnsiAttr != nil { return * _gaed . HAnsiAttr ; } else if _gaed . CsAttr != nil { return * _gaed . CsAttr ; } ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Color controls the run or styles color.
type Color struct { _cff * _edb . CT_Color } ; func ( _eggg Paragraph ) ensurePPr ( ) { if _eggg . _ccdca . PPr == nil { _eggg . _ccdca . PPr = _edb . NewCT_PPr ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// PossibleValues returns the possible values for a FormFieldTypeDropDown.
func ( _aaea FormField ) PossibleValues ( ) [ ] string { if _aaea . _aaed . DdList == nil { return nil ; } ; _dgff := [ ] string { } ; for _ , _eeea := range _aaea . _aaed . DdList . ListEntry { if _eeea == nil { continue ; } ; _dgff = append ( _dgff , _eeea . ValAttr ) ; } ; return _dgff ; } ;
2017-08-28 20:56:18 -05:00
2020-11-09 01:00:18 +00:00
// SetHeight allows controlling the height of a row within a table.
func ( _fcff RowProperties ) SetHeight ( ht _cg . Distance , rule _edb . ST_HeightRule ) { if rule == _edb . ST_HeightRuleUnset { _fcff . _ecgga . TrHeight = nil ; } else { _aggb := _edb . NewCT_Height ( ) ; _aggb . HRuleAttr = rule ; _aggb . ValAttr = & _cbc . ST_TwipsMeasure { } ; _aggb . ValAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( ht / _cg . Twips ) ) ; _fcff . _ecgga . TrHeight = [ ] * _edb . CT_Height { _aggb } ; } ; } ;
2017-08-28 20:56:18 -05:00
2020-11-09 01:00:18 +00:00
// TableProperties are the properties for a table within a document
type TableProperties struct { _eebbg * _edb . CT_TblPr } ;
2017-08-28 20:56:18 -05:00
2020-11-09 01:00:18 +00:00
// TableBorders allows manipulation of borders on a table.
type TableBorders struct { _dgac * _edb . CT_TblBorders } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetCalcOnExit marks if a FormField should be CalcOnExit or not.
func ( _dbba FormField ) SetCalcOnExit ( calcOnExit bool ) { _efbf := _edb . NewCT_OnOff ( ) ; _efbf . ValAttr = & _cbc . ST_OnOff { Bool : & calcOnExit } ; _dbba . _aaed . CalcOnExit = [ ] * _edb . CT_OnOff { _efbf } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// GetFooter gets a section Footer for given type
func ( _aabbd Section ) GetFooter ( t _edb . ST_HdrFtr ) ( Footer , bool ) { for _ , _ggbe := range _aabbd . _gecd . EG_HdrFtrReferences { if _ggbe . FooterReference . TypeAttr == t { for _ , _baad := range _aabbd . _egbea . Footers ( ) { _dgce := _aabbd . _egbea . _gcgf . FindRIDForN ( _baad . Index ( ) , _c . FooterType ) ; if _dgce == _ggbe . FooterReference . IdAttr { return _baad , true ; } ; } ; } ; } ; return Footer { } , false ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetAfterAuto controls if spacing after a paragraph is automatically determined.
func ( _bgea ParagraphSpacing ) SetAfterAuto ( b bool ) { if b { _bgea . _cgdgb . AfterAutospacingAttr = & _cbc . ST_OnOff { } ; _bgea . _cgdgb . AfterAutospacingAttr . Bool = _c . Bool ( true ) ; } else { _bgea . _cgdgb . AfterAutospacingAttr = nil ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// BoldValue returns the precise nature of the bold setting (unset, off or on).
func ( _dgeda RunProperties ) BoldValue ( ) OnOffValue { return _daeg ( _dgeda . _ccbg . B ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetAll sets all of the borders to a given value.
func ( _gb CellBorders ) SetAll ( t _edb . ST_Border , c _fb . Color , thickness _cg . Distance ) { _gb . SetBottom ( t , c , thickness ) ; _gb . SetLeft ( t , c , thickness ) ; _gb . SetRight ( t , c , thickness ) ; _gb . SetTop ( t , c , thickness ) ; _gb . SetInsideHorizontal ( t , c , thickness ) ; _gb . SetInsideVertical ( t , c , thickness ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetTableIndent sets the Table Indent from the Leading Margin
func ( _bccgc TableStyleProperties ) SetTableIndent ( ind _cg . Distance ) { _bccgc . _caead . TblInd = _edb . NewCT_TblWidth ( ) ; _bccgc . _caead . TblInd . TypeAttr = _edb . ST_TblWidthDxa ; _bccgc . _caead . TblInd . WAttr = & _edb . ST_MeasurementOrPercent { } ; _bccgc . _caead . TblInd . WAttr . ST_DecimalNumberOrPercent = & _edb . ST_DecimalNumberOrPercent { } ; _bccgc . _caead . TblInd . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _c . Int64 ( int64 ( ind / _cg . Dxa ) ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// ClearColor clears the text color.
func ( _beea RunProperties ) ClearColor ( ) { _beea . _ccbg . Color = nil } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddParagraph adds a new paragraph to the document body.
func ( _daad * Document ) AddParagraph ( ) Paragraph { _fda := _edb . NewEG_BlockLevelElts ( ) ; _daad . _edg . Body . EG_BlockLevelElts = append ( _daad . _edg . Body . EG_BlockLevelElts , _fda ) ; _dbd := _edb . NewEG_ContentBlockContent ( ) ; _fda . EG_ContentBlockContent = append ( _fda . EG_ContentBlockContent , _dbd ) ; _daaf := _edb . NewCT_P ( ) ; _dbd . P = append ( _dbd . P , _daaf ) ; return Paragraph { _daad , _daaf } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// FormFields extracts all of the fields from a document. They can then be
// manipulated via the methods on the field and the document saved.
func ( _fde * Document ) FormFields ( ) [ ] FormField { _aec := [ ] FormField { } ; for _ , _adbcd := range _fde . Paragraphs ( ) { _ffg := _adbcd . Runs ( ) ; for _gdffa , _fdad := range _ffg { for _ , _dabb := range _fdad . _abcbb . EG_RunInnerContent { if _dabb . FldChar == nil || _dabb . FldChar . FfData == nil { continue ; } ; if _dabb . FldChar . FldCharTypeAttr == _edb . ST_FldCharTypeBegin { if len ( _dabb . FldChar . FfData . Name ) == 0 || _dabb . FldChar . FfData . Name [ 0 ] . ValAttr == nil { continue ; } ; _abfa := FormField { _aaed : _dabb . FldChar . FfData } ; if _dabb . FldChar . FfData . TextInput != nil { for _ecb := _gdffa + 1 ; _ecb < len ( _ffg ) - 1 ; _ecb ++ { if len ( _ffg [ _ecb ] . _abcbb . EG_RunInnerContent ) == 0 { continue ; } ; _gacb := _ffg [ _ecb ] . _abcbb . EG_RunInnerContent [ 0 ] ; if _gacb . FldChar != nil && _gacb . FldChar . FldCharTypeAttr == _edb . ST_FldCharTypeSeparate { if len ( _ffg [ _ecb + 1 ] . _abcbb . EG_RunInnerContent ) == 0 { continue ; } ; if _ffg [ _ecb + 1 ] . _abcbb . EG_RunInnerContent [ 0 ] . FldChar == nil { _abfa . _cgba = _ffg [ _ecb + 1 ] . _abcbb . EG_RunInnerContent [ 0 ] ; break ; } ; } ; } ; } ; _aec = append ( _aec , _abfa ) ; } ; } ; } ; } ; return _aec ; } ; func _edfg ( _cddd * _edb . CT_P , _cdgc , _ecbe map [ int64 ] int64 ) { for _ , _fcf := range _cddd . EG_PContent { for _ , _bced := range _fcf . EG_ContentRunContent { if _bced . R != nil { for _ , _bafa := range _bced . R . EG_RunInnerContent { _babb := _bafa . EndnoteReference ; if _babb != nil && _babb . IdAttr > 0 { if _cgdc , _gfab := _ecbe [ _babb . IdAttr ] ; _gfab { _babb . IdAttr = _cgdc ; } ; } ; _dgaa := _bafa . FootnoteReference ; if _dgaa != nil && _dgaa . IdAttr > 0 { if _bega , _ecee := _cdgc [ _dgaa . IdAttr ] ; _ecee { _dgaa . IdAttr = _bega ; } ; } ; } ; } ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Bookmarks returns all of the bookmarks defined in the document.
func ( _dfbe Document ) Bookmarks ( ) [ ] Bookmark { if _dfbe . _edg . Body == nil { return nil ; } ; _fccg := [ ] Bookmark { } ; for _ , _ebg := range _dfbe . _edg . Body . EG_BlockLevelElts { for _ , _cgde := range _ebg . EG_ContentBlockContent { for _ , _bea := range _cde ( _cgde ) { _fccg = append ( _fccg , _bea ) ; } ; } ; } ; return _fccg ; } ; func _afafe ( _fbad string ) mergeFieldInfo { _acgf := [ ] string { } ; _dgbg := _dc . Buffer { } ; _dege := - 1 ; for _ded , _dcfc := range _fbad { switch _dcfc { case ' ' : if _dgbg . Len ( ) != 0 { _acgf = append ( _acgf , _dgbg . String ( ) ) ; } ; _dgbg . Reset ( ) ; case '"' : if _dege != - 1 { _acgf = append ( _acgf , _fbad [ _dege + 1 : _ded ] ) ; _dege = - 1 ; } else { _dege = _ded ; } ; default : _dgbg . WriteRune ( _dcfc ) ; } ; } ; if _dgbg . Len ( ) != 0 { _acgf = append ( _acgf , _dgbg . String ( ) ) ; } ; _cgbe := mergeFieldInfo { } ; for _becf := 0 ; _becf < len ( _acgf ) - 1 ; _becf ++ { _bgcb := _acgf [ _becf ] ; switch _bgcb { case "\u004d\u0045\u0052\u0047\u0045\u0046\u0049\u0045\u004c\u0044" : _cgbe . _dabga = _acgf [ _becf + 1 ] ; _becf ++ ; case "\u005c\u0066" : _cgbe . _fbacd = _acgf [ _becf + 1 ] ; _becf ++ ; case "\u005c\u0062" : _cgbe . _egge = _acgf [ _becf + 1 ] ; _becf ++ ; case "\u005c\u002a" : switch _acgf [ _becf + 1 ] { case "\u0055\u0070\u0070e\u0072" : _cgbe . _eggff = true ; case "\u004c\u006f\u0077e\u0072" : _cgbe . _eeffb = true ; case "\u0043\u0061\u0070\u0073" : _cgbe . _abgf = true ; case "\u0046\u0069\u0072\u0073\u0074\u0043\u0061\u0070" : _cgbe . _gee = true ; } ; _becf ++ ; } ; } ; return _cgbe ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Copy makes a deep copy of the document by saving and reading it back.
// It can be useful to avoid sharing common data between two documents.
func ( _bgbf * Document ) Copy ( ) ( * Document , error ) { _aeca := _dc . NewBuffer ( [ ] byte { } ) ; _cegb := _bgbf . Save ( _aeca ) ; if _cegb != nil { return nil , _cegb ; } ; _gfgg := _aeca . Bytes ( ) ; _gba := _dc . NewReader ( _gfgg ) ; return Read ( _gba , int64 ( _gba . Len ( ) ) ) ; } ; func _cde ( _fgd * _edb . EG_ContentBlockContent ) [ ] Bookmark { _afag := [ ] Bookmark { } ; for _ , _gcbg := range _fgd . P { for _ , _effe := range _gcbg . EG_PContent { for _ , _bfcc := range _effe . EG_ContentRunContent { for _ , _bgg := range _bfcc . EG_RunLevelElts { for _ , _bcaed := range _bgg . EG_RangeMarkupElements { if _bcaed . BookmarkStart != nil { _afag = append ( _afag , Bookmark { _bcaed . BookmarkStart } ) ; } ; } ; } ; } ; } ; } ; for _ , _aac := range _fgd . EG_RunLevelElts { for _ , _bdg := range _aac . EG_RangeMarkupElements { if _bdg . BookmarkStart != nil { _afag = append ( _afag , Bookmark { _bdg . BookmarkStart } ) ; } ; } ; } ; for _ , _dadc := range _fgd . Tbl { for _ , _cgbc := range _dadc . EG_ContentRowContent { for _ , _cgfd := range _cgbc . Tr { for _ , _gaef := range _cgfd . EG_ContentCellContent { for _ , _bef := range _gaef . Tc { for _ , _gdfd := range _bef . EG_BlockLevelElts { for _ , _gcdb := range _gdfd . EG_ContentBlockContent { for _ , _cfa := range _cde ( _gcdb ) { _afag = append ( _afag , _cfa ) ; } ; } ; } ; } ; } ; } ; } ; } ; return _afag ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Document is a text document that can be written out in the OOXML .docx
// format. It can be opened from a file on disk and modified, or created from
// scratch.
type Document struct { _da . DocBase ; _edg * _edb . Document ; Settings Settings ; Numbering Numbering ; Styles Styles ; _ccg [ ] * _edb . Hdr ; _dac [ ] _da . Relationships ; _bcd [ ] * _edb . Ftr ; _cbd [ ] _da . Relationships ; _gcgf _da . Relationships ; _cfc [ ] * _gg . Theme ; _fe * _edb . WebSettings ; _bcc * _edb . Fonts ; _dacb * _edb . Endnotes ; _fba * _edb . Footnotes ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetPrimaryStyle marks the style as a primary style.
func ( _aaab Style ) SetPrimaryStyle ( b bool ) { if b { _aaab . _abcbf . QFormat = _edb . NewCT_OnOff ( ) ; } else { _aaab . _abcbf . QFormat = nil ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Shadow returns true if run shadow is on.
func ( _cbcba RunProperties ) Shadow ( ) bool { return _bgbe ( _cbcba . _ccbg . Shadow ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _eefdd HyperLink ) X ( ) * _edb . CT_Hyperlink { return _eefdd . _fffed } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// RStyle returns the name of character style.
// It is defined here http://officeopenxml.com/WPstyleCharStyles.php
func ( _dgcc RunProperties ) RStyle ( ) string { if _dgcc . _ccbg . RStyle != nil { return _dgcc . _ccbg . RStyle . ValAttr ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _gfcg TableProperties ) X ( ) * _edb . CT_TblPr { return _gfcg . _eebbg } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddRow adds a row to a table.
func ( _eeef Table ) AddRow ( ) Row { _efee := _edb . NewEG_ContentRowContent ( ) ; _eeef . _cbcgd . EG_ContentRowContent = append ( _eeef . _cbcgd . EG_ContentRowContent , _efee ) ; _ebcff := _edb . NewCT_Row ( ) ; _efee . Tr = append ( _efee . Tr , _ebcff ) ; return Row { _eeef . _aeecb , _ebcff } ; } ;
2020-10-12 13:59:12 +00:00
2020-11-09 01:00:18 +00:00
// SetTarget sets the URL target of the hyperlink.
func ( _fedcb HyperLink ) SetTarget ( url string ) { _gbdef := _fedcb . _fegga . AddHyperlink ( url ) ; _fedcb . _fffed . IdAttr = _c . String ( _da . Relationship ( _gbdef ) . ID ( ) ) ; _fedcb . _fffed . AnchorAttr = nil ; } ; func ( _fbfd Paragraph ) addEndBookmark ( _edeb int64 ) * _edb . CT_MarkupRange { _acf := _edb . NewEG_PContent ( ) ; _fbfd . _ccdca . EG_PContent = append ( _fbfd . _ccdca . EG_PContent , _acf ) ; _fggd := _edb . NewEG_ContentRunContent ( ) ; _egbbd := _edb . NewEG_RunLevelElts ( ) ; _dcacd := _edb . NewEG_RangeMarkupElements ( ) ; _fdfa := _edb . NewCT_MarkupRange ( ) ; _fdfa . IdAttr = _edeb ; _dcacd . BookmarkEnd = _fdfa ; _acf . EG_ContentRunContent = append ( _acf . EG_ContentRunContent , _fggd ) ; _fggd . EG_RunLevelElts = append ( _fggd . EG_RunLevelElts , _egbbd ) ; _egbbd . EG_RangeMarkupElements = append ( _egbbd . EG_RangeMarkupElements , _dcacd ) ; return _fdfa ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Tables returns the tables defined in the document.
func ( _cadb * Document ) Tables ( ) [ ] Table { _cee := [ ] Table { } ; if _cadb . _edg . Body == nil { return nil ; } ; for _ , _bcb := range _cadb . _edg . Body . EG_BlockLevelElts { for _ , _cda := range _bcb . EG_ContentBlockContent { for _ , _fdfce := range _cadb . tables ( _cda ) { _cee = append ( _cee , _fdfce ) ; } ; } ; } ; return _cee ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Header is a header for a document section.
type Header struct { _egbb * Document ; _decf * _edb . Hdr ; } ; func ( _abg * Document ) validateTableCells ( ) error { for _ , _bgb := range _abg . _edg . Body . EG_BlockLevelElts { for _ , _bbe := range _bgb . EG_ContentBlockContent { for _ , _cfef := range _bbe . Tbl { for _ , _bcca := range _cfef . EG_ContentRowContent { for _ , _cebd := range _bcca . Tr { _bcef := false ; for _ , _adbf := range _cebd . EG_ContentCellContent { _eeg := false ; for _ , _eeda := range _adbf . Tc { _bcef = true ; for _ , _aaee := range _eeda . EG_BlockLevelElts { for _ , _bff := range _aaee . EG_ContentBlockContent { if len ( _bff . P ) > 0 { _eeg = true ; break ; } ; } ; } ; } ; if ! _eeg { return _f . New ( "t\u0061\u0062\u006c\u0065\u0020\u0063e\u006c\u006c\u0020\u006d\u0075\u0073t\u0020\u0063\u006f\u006e\u0074\u0061\u0069n\u0020\u0061\u0020\u0070\u0061\u0072\u0061\u0067\u0072\u0061p\u0068" ) ; } ; } ; if ! _bcef { return _f . New ( "\u0074\u0061b\u006c\u0065\u0020\u0072\u006f\u0077\u0020\u006d\u0075\u0073\u0074\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0020\u0061\u0020ce\u006c\u006c" ) ; } ; } ; } ; } ; } ; } ; return nil ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Margins allows controlling individual cell margins.
func ( _gde CellProperties ) Margins ( ) CellMargins { if _gde . _dcb . TcMar == nil { _gde . _dcb . TcMar = _edb . NewCT_TcMar ( ) ; } ; return CellMargins { _gde . _dcb . TcMar } ; } ; const ( FieldCurrentPage = "\u0050\u0041\u0047\u0045" ; FieldNumberOfPages = "\u004e\u0055\u004d\u0050\u0041\u0047\u0045\u0053" ; FieldDate = "\u0044\u0041\u0054\u0045" ; FieldCreateDate = "\u0043\u0052\u0045\u0041\u0054\u0045\u0044\u0041\u0054\u0045" ; FieldEditTime = "\u0045\u0044\u0049\u0054\u0054\u0049\u004d\u0045" ; FieldPrintDate = "\u0050R\u0049\u004e\u0054\u0044\u0041\u0054E" ; FieldSaveDate = "\u0053\u0041\u0056\u0045\u0044\u0041\u0054\u0045" ; FieldTIme = "\u0054\u0049\u004d\u0045" ; FieldTOC = "\u0054\u004f\u0043" ; ) ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// InlineDrawing is an inlined image within a run.
type InlineDrawing struct { _dgca * Document ; _fadc * _edb . WdInline ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// RightToLeft returns true if paragraph text goes from right to left.
func ( _badce ParagraphProperties ) RightToLeft ( ) bool { return _bgbe ( _badce . _beefd . RPr . Rtl ) } ;
2020-08-23 14:15:53 +00:00
2020-10-12 13:59:12 +00:00
// X returns the inner wrapped XML type.
2020-11-09 01:00:18 +00:00
func ( _cea Header ) X ( ) * _edb . Hdr { return _cea . _decf } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetLeftPct sets the cell left margin
func ( _aea CellMargins ) SetLeftPct ( pct float64 ) { _aea . _ead . Left = _edb . NewCT_TblWidth ( ) ; _cgc ( _aea . _ead . Left , pct ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetWidthAuto sets the the table width to automatic.
func ( _gece TableProperties ) SetWidthAuto ( ) { _gece . _eebbg . TblW = _edb . NewCT_TblWidth ( ) ; _gece . _eebbg . TblW . TypeAttr = _edb . ST_TblWidthAuto ; } ; const ( FormFieldTypeUnknown FormFieldType = iota ; FormFieldTypeText ; FormFieldTypeCheckBox ; FormFieldTypeDropDown ; ) ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddStyle adds a new empty style.
func ( _fbcf Styles ) AddStyle ( styleID string , t _edb . ST_StyleType , isDefault bool ) Style { _fdfcc := _edb . NewCT_Style ( ) ; _fdfcc . TypeAttr = t ; if isDefault { _fdfcc . DefaultAttr = & _cbc . ST_OnOff { } ; _fdfcc . DefaultAttr . Bool = _c . Bool ( isDefault ) ; } ; _fdfcc . StyleIdAttr = _c . String ( styleID ) ; _fbcf . _fdee . Style = append ( _fbcf . _fdee . Style , _fdfcc ) ; return Style { _fdfcc } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddText adds tet to a run.
func ( _dbbb Run ) AddText ( s string ) { _dacbf := _edb . NewEG_RunInnerContent ( ) ; _dbbb . _abcbb . EG_RunInnerContent = append ( _dbbb . _abcbb . EG_RunInnerContent , _dacbf ) ; _dacbf . T = _edb . NewCT_Text ( ) ; if _c . NeedsSpacePreserve ( s ) { _dbdb := "\u0070\u0072\u0065\u0073\u0065\u0072\u0076\u0065" ; _dacbf . T . SpaceAttr = & _dbdb ; } ; _dacbf . T . Content = s ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetStartPct sets the cell start margin
func ( _bfd CellMargins ) SetStartPct ( pct float64 ) { _bfd . _ead . Start = _edb . NewCT_TblWidth ( ) ; _cgc ( _bfd . _ead . Start , pct ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetTextWrapSquare sets the text wrap to square with a given wrap type.
func ( _ff AnchoredDrawing ) SetTextWrapSquare ( t _edb . WdST_WrapText ) { _ff . _eef . Choice = & _edb . WdEG_WrapTypeChoice { } ; _ff . _eef . Choice . WrapSquare = _edb . NewWdCT_WrapSquare ( ) ; _ff . _eef . Choice . WrapSquare . WrapTextAttr = t ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _febfa Settings ) X ( ) * _edb . Settings { return _febfa . _dcea } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// InsertRowBefore inserts a row before another row
func ( _cfbf Table ) InsertRowBefore ( r Row ) Row { for _cbed , _fcdg := range _cfbf . _cbcgd . EG_ContentRowContent { if len ( _fcdg . Tr ) > 0 && r . X ( ) == _fcdg . Tr [ 0 ] { _afgc := _edb . NewEG_ContentRowContent ( ) ; _cfbf . _cbcgd . EG_ContentRowContent = append ( _cfbf . _cbcgd . EG_ContentRowContent , nil ) ; copy ( _cfbf . _cbcgd . EG_ContentRowContent [ _cbed + 1 : ] , _cfbf . _cbcgd . EG_ContentRowContent [ _cbed : ] ) ; _cfbf . _cbcgd . EG_ContentRowContent [ _cbed ] = _afgc ; _bdeg := _edb . NewCT_Row ( ) ; _afgc . Tr = append ( _afgc . Tr , _bdeg ) ; return Row { _cfbf . _aeecb , _bdeg } ; } ; } ; return _cfbf . AddRow ( ) ; } ; func ( _cdd * Document ) insertParagraph ( _agc Paragraph , _gbde bool ) Paragraph { if _cdd . _edg . Body == nil { return _cdd . AddParagraph ( ) ; } ; _acb := _agc . X ( ) ; for _ , _ecbdf := range _cdd . _edg . Body . EG_BlockLevelElts { for _ , _gaf := range _ecbdf . EG_ContentBlockContent { for _ggdc , _cgbb := range _gaf . P { if _cgbb == _acb { _efb := _edb . NewCT_P ( ) ; _gaf . P = append ( _gaf . P , nil ) ; if _gbde { copy ( _gaf . P [ _ggdc + 1 : ] , _gaf . P [ _ggdc : ] ) ; _gaf . P [ _ggdc ] = _efb ; } else { copy ( _gaf . P [ _ggdc + 2 : ] , _gaf . P [ _ggdc + 1 : ] ) ; _gaf . P [ _ggdc + 1 ] = _efb ; } ; return Paragraph { _cdd , _efb } ; } ; } ; for _ , _cbeeb := range _gaf . Tbl { for _ , _dbf := range _cbeeb . EG_ContentRowContent { for _ , _eda := range _dbf . Tr { for _ , _gdfa := range _eda . EG_ContentCellContent { for _ , _gfbd := range _gdfa . Tc { for _ , _fcaa := range _gfbd . EG_BlockLevelElts { for _ , _ada := range _fcaa . EG_ContentBlockContent { for _fafff , _dabd := range _ada . P { if _dabd == _acb { _dbgf := _edb . NewCT_P ( ) ; _ada . P = append ( _ada . P , nil ) ; if _gbde { copy ( _ada . P [ _fafff + 1 : ] , _ada . P [ _fafff : ] ) ; _ada . P [ _fafff ] = _dbgf ; } else { copy ( _ada . P [ _fafff + 2 : ] , _ada . P [ _fafff + 1 : ] ) ; _ada . P [ _fafff + 1 ] = _dbgf ; } ; return Paragraph { _cdd , _dbgf } ; } ; } ; } ; } ; } ; } ; } ; } ; } ; if _gaf . Sdt != nil && _gaf . Sdt . SdtContent != nil && _gaf . Sdt . SdtContent . P != nil { for _bdae , _cbf := range _gaf . Sdt . SdtContent . P { if _cbf == _acb { _gdg := _edb . NewCT_P ( ) ; _gaf . Sdt . SdtContent . P = append ( _gaf . Sdt . SdtContent . P , nil ) ; if _gbde { copy ( _gaf . Sdt . SdtContent . P [ _bdae + 1 : ] , _gaf . Sdt . SdtContent . P [ _bdae : ] ) ; _gaf . Sdt . SdtContent . P [ _bdae ] = _gdg ; } else { copy ( _gaf . Sdt . SdtContent . P [ _bdae + 2 : ] , _gaf . Sdt . SdtContent . P [ _bdae + 1 : ] ) ; _gaf . Sdt . SdtContent . P [ _bdae + 1 ] = _gdg ; } ; return Paragraph { _cdd , _gdg } ; } ; } ; } ; } ; } ; return _cdd . AddParagraph ( ) ; } ;
2020-10-12 13:59:12 +00:00
2020-11-09 01:00:18 +00:00
// SetVerticalAlignment sets the vertical alignment of content within a table cell.
func ( _bae CellProperties ) SetVerticalAlignment ( align _edb . ST_VerticalJc ) { if align == _edb . ST_VerticalJcUnset { _bae . _dcb . VAlign = nil ; } else { _bae . _dcb . VAlign = _edb . NewCT_VerticalJc ( ) ; _bae . _dcb . VAlign . ValAttr = align ; } ; } ; func ( _abfc Paragraph ) addFldCharsForField ( _badb , _efda string ) FormField { _aagf := _abfc . addBeginFldChar ( _badb ) ; _cfaf := FormField { _aaed : _aagf } ; _cdga := _abfc . _debe . Bookmarks ( ) ; _gcfe := int64 ( len ( _cdga ) ) ; if _badb != "" { _abfc . addStartBookmark ( _gcfe , _badb ) ; } ; _abfc . addInstrText ( _efda ) ; _abfc . addSeparateFldChar ( ) ; if _efda == "\u0046\u004f\u0052\u004d\u0054\u0045\u0058\u0054" { _cefc := _abfc . AddRun ( ) ; _cbcbf := _edb . NewEG_RunInnerContent ( ) ; _cefc . _abcbb . EG_RunInnerContent = [ ] * _edb . EG_RunInnerContent { _cbcbf } ; _cfaf . _cgba = _cbcbf ; } ; _abfc . addEndFldChar ( ) ; if _badb != "" { _abfc . addEndBookmark ( _gcfe ) ; } ; return _cfaf ; } ; func ( _dbfg Footnote ) id ( ) int64 { return _dbfg . _gfff . IdAttr } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetHighlight highlights text in a specified color.
func ( _edfa RunProperties ) SetHighlight ( c _edb . ST_HighlightColor ) { _edfa . _ccbg . Highlight = _edb . NewCT_Highlight ( ) ; _edfa . _ccbg . Highlight . ValAttr = c ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// RemoveParagraph removes a paragraph from the footnote.
func ( _cdba Footnote ) RemoveParagraph ( p Paragraph ) { for _ , _cfg := range _cdba . content ( ) { for _cfae , _fgfc := range _cfg . P { if _fgfc == p . _ccdca { copy ( _cfg . P [ _cfae : ] , _cfg . P [ _cfae + 1 : ] ) ; _cfg . P = _cfg . P [ 0 : len ( _cfg . P ) - 1 ] ; return ; } ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Levels returns all of the numbering levels defined in the definition.
func ( _babbf NumberingDefinition ) Levels ( ) [ ] NumberingLevel { _fbfg := [ ] NumberingLevel { } ; for _ , _deac := range _babbf . _begd . Lvl { _fbfg = append ( _fbfg , NumberingLevel { _deac } ) ; } ; return _fbfg ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Shadow returns true if paragraph shadow is on.
func ( _geaff ParagraphProperties ) Shadow ( ) bool { return _bgbe ( _geaff . _beefd . RPr . Shadow ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Row is a row within a table within a document.
type Row struct { _fgfab * Document ; _eaeb * _edb . CT_Row ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetBottom sets the bottom border to a specified type, color and thickness.
func ( _gbeb TableBorders ) SetBottom ( t _edb . ST_Border , c _fb . Color , thickness _cg . Distance ) { _gbeb . _dgac . Bottom = _edb . NewCT_Border ( ) ; _gaca ( _gbeb . _dgac . Bottom , t , c , thickness ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetHANSITheme sets the font H ANSI Theme.
func ( _gbad Fonts ) SetHANSITheme ( t _edb . ST_Theme ) { _gbad . _adddd . HAnsiThemeAttr = t } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SizeValue returns the value of paragraph font size in points.
func ( _faad ParagraphProperties ) SizeValue ( ) float64 { if _cagg := _faad . _beefd . RPr . Sz ; _cagg != nil { _bdfcg := _cagg . ValAttr ; if _bdfcg . ST_UnsignedDecimalNumber != nil { return float64 ( * _bdfcg . ST_UnsignedDecimalNumber ) / 2 ; } ; } ; return 0.0 ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// HasEndnotes returns a bool based on the presence or abscence of endnotes within
// the document.
func ( _cdg * Document ) HasEndnotes ( ) bool { return _cdg . _dacb != nil } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetShadow sets the run to shadowed text.
func ( _faee RunProperties ) SetShadow ( b bool ) { if ! b { _faee . _ccbg . Shadow = nil ; } else { _faee . _ccbg . Shadow = _edb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetEffect sets a text effect on the run.
func ( _abde RunProperties ) SetEffect ( e _edb . ST_TextEffect ) { if e == _edb . ST_TextEffectUnset { _abde . _ccbg . Effect = nil ; } else { _abde . _ccbg . Effect = _edb . NewCT_TextEffect ( ) ; _abde . _ccbg . Effect . ValAttr = _edb . ST_TextEffectShimmer ; } ; } ; func ( _fdag Footnote ) content ( ) [ ] * _edb . EG_ContentBlockContent { var _cbdbb [ ] * _edb . EG_ContentBlockContent ; for _ , _aeae := range _fdag . _gfff . EG_BlockLevelElts { _cbdbb = append ( _cbdbb , _aeae . EG_ContentBlockContent ... ) ; } ; return _cbdbb ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Properties returns the row properties.
func ( _eafdg Row ) Properties ( ) RowProperties { if _eafdg . _eaeb . TrPr == nil { _eafdg . _eaeb . TrPr = _edb . NewCT_TrPr ( ) ; } ; return RowProperties { _eafdg . _eaeb . TrPr } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetEnabled marks a FormField as enabled or disabled.
func ( _ddbb FormField ) SetEnabled ( enabled bool ) { _gdag := _edb . NewCT_OnOff ( ) ; _gdag . ValAttr = & _cbc . ST_OnOff { Bool : & enabled } ; _ddbb . _aaed . Enabled = [ ] * _edb . CT_OnOff { _gdag } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Properties returns the run properties.
func ( _accdd Run ) Properties ( ) RunProperties { if _accdd . _abcbb . RPr == nil { _accdd . _abcbb . RPr = _edb . NewCT_RPr ( ) ; } ; return RunProperties { _accdd . _abcbb . RPr } ; } ; type mergeFieldInfo struct { _dabga string ; _fbacd string ; _egge string ; _eggff bool ; _eeffb bool ; _gee bool ; _abgf bool ; _abbe Paragraph ; _ggdb , _baef , _efeb int ; _gcce * _edb . EG_PContent ; _eacb bool ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetFooter sets a section footer.
func ( _ggeda Section ) SetFooter ( f Footer , t _edb . ST_HdrFtr ) { _ecad := _edb . NewEG_HdrFtrReferences ( ) ; _ggeda . _gecd . EG_HdrFtrReferences = append ( _ggeda . _gecd . EG_HdrFtrReferences , _ecad ) ; _ecad . FooterReference = _edb . NewCT_HdrFtrRef ( ) ; _ecad . FooterReference . TypeAttr = t ; _gdab := _ggeda . _egbea . _gcgf . FindRIDForN ( f . Index ( ) , _c . FooterType ) ; if _gdab == "" { _a . Print ( "\u0075\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0064\u0065\u0074\u0065\u0072\u006d\u0069\u006e\u0065\u0020\u0066\u006f\u006f\u0074\u0065r \u0049\u0044" ) ; } ; _ecad . FooterReference . IdAttr = _gdab ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _dg Cell ) X ( ) * _edb . CT_Tc { return _dg . _ece } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Emboss returns true if run emboss is on.
func ( _egad RunProperties ) Emboss ( ) bool { return _bgbe ( _egad . _ccbg . Emboss ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Borders allows manipulation of the table borders.
func ( _ccffe TableStyleProperties ) Borders ( ) TableBorders { if _ccffe . _caead . TblBorders == nil { _ccffe . _caead . TblBorders = _edb . NewCT_TblBorders ( ) ; } ; return TableBorders { _ccffe . _caead . TblBorders } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetTargetBookmark sets the bookmark target of the hyperlink.
func ( _bebd HyperLink ) SetTargetBookmark ( bm Bookmark ) { _bebd . _fffed . AnchorAttr = _c . String ( bm . Name ( ) ) ; _bebd . _fffed . IdAttr = nil ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _dde Fonts ) X ( ) * _edb . CT_Fonts { return _dde . _adddd } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetStrikeThrough sets the run to strike-through.
func ( _egba RunProperties ) SetStrikeThrough ( b bool ) { if ! b { _egba . _ccbg . Strike = nil ; } else { _egba . _ccbg . Strike = _edb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetBold sets the run to bold.
func ( _eceed RunProperties ) SetBold ( b bool ) { if ! b { _eceed . _ccbg . B = nil ; _eceed . _ccbg . BCs = nil ; } else { _eceed . _ccbg . B = _edb . NewCT_OnOff ( ) ; _eceed . _ccbg . BCs = _edb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Footers returns the footers defined in the document.
func ( _fddf * Document ) Footers ( ) [ ] Footer { _fbf := [ ] Footer { } ; for _ , _dea := range _fddf . _bcd { _fbf = append ( _fbf , Footer { _fddf , _dea } ) ; } ; return _fbf ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetHangingIndent controls the indentation of the non-first lines in a paragraph.
func ( _gffaa ParagraphProperties ) SetHangingIndent ( m _cg . Distance ) { if _gffaa . _beefd . Ind == nil { _gffaa . _beefd . Ind = _edb . NewCT_Ind ( ) ; } ; if m == _cg . Zero { _gffaa . _beefd . Ind . HangingAttr = nil ; } else { _gffaa . _beefd . Ind . HangingAttr = & _cbc . ST_TwipsMeasure { } ; _gffaa . _beefd . Ind . HangingAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( m / _cg . Twips ) ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetColumnSpan sets the number of Grid Columns Spanned by the Cell. This is used
// to give the appearance of merged cells.
func ( _gca CellProperties ) SetColumnSpan ( cols int ) { if cols == 0 { _gca . _dcb . GridSpan = nil ; } else { _gca . _dcb . GridSpan = _edb . NewCT_DecimalNumber ( ) ; _gca . _dcb . GridSpan . ValAttr = int64 ( cols ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetKeepNext controls if the paragraph is kept with the next paragraph.
func ( _fcfb ParagraphStyleProperties ) SetKeepNext ( b bool ) { if ! b { _fcfb . _bggb . KeepNext = nil ; } else { _fcfb . _bggb . KeepNext = _edb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// NewSettings constructs a new empty Settings
func NewSettings ( ) Settings { _dddg := _edb . NewSettings ( ) ; _dddg . Compat = _edb . NewCT_Compat ( ) ; _gbae := _edb . NewCT_CompatSetting ( ) ; _gbae . NameAttr = _c . String ( "\u0063\u006f\u006d\u0070\u0061\u0074\u0069\u0062\u0069\u006c\u0069\u0074y\u004d\u006f\u0064\u0065" ) ; _gbae . UriAttr = _c . String ( "h\u0074\u0074\u0070\u003a\u002f\u002f\u0073\u0063\u0068\u0065\u006d\u0061\u0073\u002e\u006d\u0069\u0063\u0072o\u0073\u006f\u0066\u0074\u002e\u0063\u006f\u006d\u002f\u006fff\u0069\u0063\u0065/\u0077o\u0072\u0064" ) ; _gbae . ValAttr = _c . String ( "\u0031\u0035" ) ; _dddg . Compat . CompatSetting = append ( _dddg . Compat . CompatSetting , _gbae ) ; return Settings { _dddg } ; } ; func ( _edeg Styles ) initializeStyleDefaults ( ) { _acfc := _edeg . AddStyle ( "\u004e\u006f\u0072\u006d\u0061\u006c" , _edb . ST_StyleTypeParagraph , true ) ; _acfc . SetName ( "\u004e\u006f\u0072\u006d\u0061\u006c" ) ; _acfc . SetPrimaryStyle ( true ) ; _gcea := _edeg . AddStyle ( "D\u0065f\u0061\u0075\u006c\u0074\u0050\u0061\u0072\u0061g\u0072\u0061\u0070\u0068Fo\u006e\u0074" , _edb . ST_StyleTypeCharacter , true ) ; _gcea . SetName ( "\u0044\u0065\u0066\u0061ul\u0074\u0020\u0050\u0061\u0072\u0061\u0067\u0072\u0061\u0070\u0068\u0020\u0046\u006fn\u0074" ) ; _gcea . SetUISortOrder ( 1 ) ; _gcea . SetSemiHidden ( true ) ; _gcea . SetUnhideWhenUsed ( true ) ; _adeba := _edeg . AddStyle ( "\u0054i\u0074\u006c\u0065\u0043\u0068\u0061r" , _edb . ST_StyleTypeCharacter , false ) ; _adeba . SetName ( "\u0054\u0069\u0074\u006c\u0065\u0020\u0043\u0068\u0061\u0072" ) ; _adeba . SetBasedOn ( _gcea . StyleID ( ) ) ; _adeba . SetLinkedStyle ( "\u0054\u0069\u0074l\u0065" ) ; _adeba . SetUISortOrder ( 10 ) ; _adeba . RunProperties ( ) . Fonts ( ) . SetASCIITheme ( _edb . ST_ThemeMajorAscii ) ; _adeba . RunProperties ( ) . Fonts ( ) . SetEastAsiaTheme ( _edb . ST_ThemeMajorEastAsia ) ; _adeba . RunProperties ( ) . Fonts ( ) . SetHANSITheme ( _edb . ST_ThemeMajorHAnsi ) ; _adeba . RunProperties ( ) . Fonts ( ) . SetCSTheme ( _edb . ST_ThemeMajorBidi ) ; _adeba . RunProperties ( ) . SetSize ( 28 * _cg . Point ) ; _adeba . RunProperties ( ) . SetKerning ( 14 * _cg . Point ) ; _adeba . RunProperties ( ) . SetCharacterSpacing ( - 10 * _cg . Twips ) ; _abdb := _edeg . AddStyle ( "\u0054\u0069\u0074l\u0065" , _edb . ST_StyleTypeParagraph , false ) ; _abdb . SetName ( "\u0054\u0069\u0074l\u0065" ) ; _abdb . SetBasedOn ( _acfc . StyleID ( ) ) ; _abdb . SetNextStyle ( _acfc . StyleID ( ) ) ; _abdb . SetLinkedStyle ( _adeba . StyleID ( ) ) ; _abdb . SetUISortOrder ( 10 ) ; _abdb . SetPrimaryStyle ( true ) ; _abdb . ParagraphProperties ( ) . SetContextualSpacing ( true ) ; _abdb . RunProperties ( ) . Fonts ( ) . SetASCIITheme ( _edb . ST_ThemeMajorAscii ) ; _abdb . RunProperties ( ) . Fonts ( ) . SetEastAsiaTheme ( _edb . ST_ThemeMajorEastAsia ) ; _abdb . RunProperties ( ) . Fonts ( ) . SetHANSITheme ( _edb . ST_ThemeMajorHAnsi ) ; _abdb . RunProperties ( ) . Fonts ( ) . SetCSTheme ( _edb . ST_ThemeMajorBidi ) ; _abdb . RunProperties ( ) . SetSize ( 28 * _cg . Point ) ; _abdb . RunProperties ( ) . SetKerning ( 14 * _cg . Point ) ; _abdb . RunProperties ( ) . SetCharacterSpacing ( - 10 * _cg . Twips ) ; _baegc := _edeg . AddStyle ( "T\u0061\u0062\u006c\u0065\u004e\u006f\u0072\u006d\u0061\u006c" , _edb . ST_StyleTypeTable , false ) ; _baegc . SetName ( "\u004e\u006f\u0072m\u0061\u006c\u0020\u0054\u0061\u0062\u006c\u0065" ) ; _baegc . SetUISortOrder ( 99 ) ; _baegc . SetSemiHidden ( true ) ; _baegc . SetUnhideWhenUsed ( true ) ; _baegc . X ( ) . TblPr = _edb . NewCT_TblPrBase ( ) ; _acbb := NewTableWidth ( ) ; _baegc . X ( ) . TblPr . TblInd = _acbb . X ( ) ; _acbb . SetValue ( 0 * _cg . Dxa ) ; _baegc . X ( ) . TblPr . TblCellMar = _edb . NewCT_TblCellMar ( ) ; _acbb = NewTableWidth ( ) ; _baegc . X ( ) . TblPr . TblCellMar . Top = _acbb . X ( ) ; _acbb . SetValue ( 0 * _cg . Dxa ) ; _acbb = NewTableWidth ( ) ; _baegc . X ( ) . TblPr . TblCellMar . Bottom = _acbb . X ( ) ; _acbb . SetValue ( 0 * _cg . Dxa ) ; _acbb = NewTableWidth ( ) ; _baegc . X ( ) . TblPr . TblCellMar . Left = _acbb . X ( ) ; _acbb . SetValue ( 108 * _cg . Dxa ) ; _acbb = NewTableWidth ( ) ; _baegc . X ( ) . TblPr . TblCellMar . Right = _acbb . X ( ) ; _acbb . SetValue ( 108 * _cg . Dxa ) ; _dfdf := _edeg . AddStyle ( "\u004e\u006f\u004c\u0069\u0073\u0074" , _edb . ST_StyleTypeNumbering , false ) ; _dfdf . SetName ( "\u004eo\u0020\u004c\u0069\u0073\u0074" ) ; _dfdf . SetUISortOrder ( 1 ) ; _dfdf . SetSemiHidden ( true ) ; _dfdf . SetUnhideWhenUsed ( true ) ; _egce := [ ] _cg . Distance { 16 , 13 , 12 , 11
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetRowBandSize sets the number of Rows in the row band
func ( _eadbc TableStyleProperties ) SetRowBandSize ( rows int64 ) { _eadbc . _caead . TblStyleRowBandSize = _edb . NewCT_DecimalNumber ( ) ; _eadbc . _caead . TblStyleRowBandSize . ValAttr = rows ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Paragraphs returns the paragraphs defined in a header.
func ( _fdcb Header ) Paragraphs ( ) [ ] Paragraph { _fbab := [ ] Paragraph { } ; for _ , _bgba := range _fdcb . _decf . EG_ContentBlockContent { for _ , _bccd := range _bgba . P { _fbab = append ( _fbab , Paragraph { _fdcb . _egbb , _bccd } ) ; } ; } ; for _ , _fbeb := range _fdcb . Tables ( ) { for _ , _afbc := range _fbeb . Rows ( ) { for _ , _gfeb := range _afbc . Cells ( ) { _fbab = append ( _fbab , _gfeb . Paragraphs ( ) ... ) ; } ; } ; } ; return _fbab ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Fonts returns the style's Fonts.
func ( _bacef RunProperties ) Fonts ( ) Fonts { if _bacef . _ccbg . RFonts == nil { _bacef . _ccbg . RFonts = _edb . NewCT_Fonts ( ) ; } ; return Fonts { _bacef . _ccbg . RFonts } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetStartIndent controls the start indent of the paragraph.
func ( _egegd ParagraphStyleProperties ) SetStartIndent ( m _cg . Distance ) { if _egegd . _bggb . Ind == nil { _egegd . _bggb . Ind = _edb . NewCT_Ind ( ) ; } ; if m == _cg . Zero { _egegd . _bggb . Ind . StartAttr = nil ; } else { _egegd . _bggb . Ind . StartAttr = & _edb . ST_SignedTwipsMeasure { } ; _egegd . _bggb . Ind . StartAttr . Int64 = _c . Int64 ( int64 ( m / _cg . Twips ) ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetLeftIndent controls the left indent of the paragraph.
func ( _efgb ParagraphStyleProperties ) SetLeftIndent ( m _cg . Distance ) { if _efgb . _bggb . Ind == nil { _efgb . _bggb . Ind = _edb . NewCT_Ind ( ) ; } ; if m == _cg . Zero { _efgb . _bggb . Ind . LeftAttr = nil ; } else { _efgb . _bggb . Ind . LeftAttr = & _edb . ST_SignedTwipsMeasure { } ; _efgb . _bggb . Ind . LeftAttr . Int64 = _c . Int64 ( int64 ( m / _cg . Twips ) ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Index returns the index of the header within the document. This is used to
// form its zip packaged filename as well as to match it with its relationship
// ID.
func ( _efcc Header ) Index ( ) int { for _eeage , _egfc := range _efcc . _egbb . _ccg { if _egfc == _efcc . _decf { return _eeage ; } ; } ; return - 1 ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// DoubleStrike returns true if run is double striked.
func ( _acd RunProperties ) DoubleStrike ( ) bool { return _bgbe ( _acd . _ccbg . Dstrike ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddTab adds tab to a run and can be used with the the Paragraph's tab stops.
func ( _dbea Run ) AddTab ( ) { _agec := _dbea . newIC ( ) ; _agec . Tab = _edb . NewCT_Empty ( ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetAlignment sets the paragraph alignment
func ( _gdge NumberingLevel ) SetAlignment ( j _edb . ST_Jc ) { if j == _edb . ST_JcUnset { _gdge . _geaa . LvlJc = nil ; } else { _gdge . _geaa . LvlJc = _edb . NewCT_Jc ( ) ; _gdge . _geaa . LvlJc . ValAttr = j ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Tables returns the tables defined in the footer.
func ( _cfcg Footer ) Tables ( ) [ ] Table { _gddb := [ ] Table { } ; if _cfcg . _dbcd == nil { return nil ; } ; for _ , _efcad := range _cfcg . _dbcd . EG_ContentBlockContent { for _ , _ffc := range _cfcg . _aecf . tables ( _efcad ) { _gddb = append ( _gddb , _ffc ) ; } ; } ; return _gddb ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Name returns the name of the field.
func ( _efcae FormField ) Name ( ) string { return * _efcae . _aaed . Name [ 0 ] . ValAttr } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetTop sets the top border to a specified type, color and thickness.
func ( _ef CellBorders ) SetTop ( t _edb . ST_Border , c _fb . Color , thickness _cg . Distance ) { _ef . _gcg . Top = _edb . NewCT_Border ( ) ; _gaca ( _ef . _gcg . Top , t , c , thickness ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SizeValue returns the value of run font size in points.
func ( _fbeda RunProperties ) SizeValue ( ) float64 { if _feeca := _fbeda . _ccbg . Sz ; _feeca != nil { _edec := _feeca . ValAttr ; if _edec . ST_UnsignedDecimalNumber != nil { return float64 ( * _edec . ST_UnsignedDecimalNumber ) / 2 ; } ; } ; return 0.0 ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// HasFootnotes returns a bool based on the presence or abscence of footnotes within
// the document.
func ( _baee * Document ) HasFootnotes ( ) bool { return _baee . _fba != nil } ;
// HyperLink is a link within a document.
type HyperLink struct { _fegga * Document ; _fffed * _edb . CT_Hyperlink ; } ;
// SetHeader sets a section header.
func ( _gcag Section ) SetHeader ( h Header , t _edb . ST_HdrFtr ) { _fddc := _edb . NewEG_HdrFtrReferences ( ) ; _gcag . _gecd . EG_HdrFtrReferences = append ( _gcag . _gecd . EG_HdrFtrReferences , _fddc ) ; _fddc . HeaderReference = _edb . NewCT_HdrFtrRef ( ) ; _fddc . HeaderReference . TypeAttr = t ; _eeaf := _gcag . _egbea . _gcgf . FindRIDForN ( h . Index ( ) , _c . HeaderType ) ; if _eeaf == "" { _a . Print ( "\u0075\u006ea\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0064\u0065\u0074\u0065\u0072\u006d\u0069\u006e\u0065\u0020\u0068\u0065\u0061\u0064\u0065r \u0049\u0044" ) ; } ; _fddc . HeaderReference . IdAttr = _eeaf ; } ;
// RemoveParagraph removes a paragraph from a document.
func ( _edfd * Document ) RemoveParagraph ( p Paragraph ) { if _edfd . _edg . Body == nil { return ; } ; for _ , _dcae := range _edfd . _edg . Body . EG_BlockLevelElts { for _ , _eade := range _dcae . EG_ContentBlockContent { for _ecca , _aga := range _eade . P { if _aga == p . _ccdca { copy ( _eade . P [ _ecca : ] , _eade . P [ _ecca + 1 : ] ) ; _eade . P = _eade . P [ 0 : len ( _eade . P ) - 1 ] ; return ; } ; } ; if _eade . Sdt != nil && _eade . Sdt . SdtContent != nil && _eade . Sdt . SdtContent . P != nil { for _dad , _agg := range _eade . Sdt . SdtContent . P { if _agg == p . _ccdca { copy ( _eade . P [ _dad : ] , _eade . P [ _dad + 1 : ] ) ; _eade . P = _eade . P [ 0 : len ( _eade . P ) - 1 ] ; return ; } ; } ; } ; } ; } ; for _ , _adg := range _edfd . Tables ( ) { for _ , _fddd := range _adg . Rows ( ) { for _ , _gdff := range _fddd . Cells ( ) { for _ , _ffac := range _gdff . _ece . EG_BlockLevelElts { for _ , _cgb := range _ffac . EG_ContentBlockContent { for _bbbd , _aaf := range _cgb . P { if _aaf == p . _ccdca { copy ( _cgb . P [ _bbbd : ] , _cgb . P [ _bbbd + 1 : ] ) ; _cgb . P = _cgb . P [ 0 : len ( _cgb . P ) - 1 ] ; return ; } ; } ; } ; } ; } ; } ; } ; for _ , _ceb := range _edfd . Headers ( ) { _ceb . RemoveParagraph ( p ) ; } ; for _ , _fffe := range _edfd . Footers ( ) { _fffe . RemoveParagraph ( p ) ; } ; } ;
// RightToLeft returns true if run text goes from right to left.
func ( _bfgd RunProperties ) RightToLeft ( ) bool { return _bgbe ( _bfgd . _ccbg . Rtl ) } ;
2020-08-23 14:15:53 +00:00
2020-10-12 13:59:12 +00:00
// SetName sets the name of the bookmark. This is the name that is used to
// reference the bookmark from hyperlinks.
2020-11-09 01:00:18 +00:00
func ( _ba Bookmark ) SetName ( name string ) { _ba . _afa . NameAttr = name } ;
2020-08-23 14:15:53 +00:00
2020-10-12 13:59:12 +00:00
// X returns the inner wrapped XML type.
2020-11-09 01:00:18 +00:00
func ( _bede Footer ) X ( ) * _edb . Ftr { return _bede . _dbcd } ;
2018-03-13 07:24:02 -05:00
2020-11-09 01:00:18 +00:00
// SetText sets the text to be used in bullet mode.
func ( _faegd NumberingLevel ) SetText ( t string ) { if t == "" { _faegd . _geaa . LvlText = nil ; } else { _faegd . _geaa . LvlText = _edb . NewCT_LevelText ( ) ; _faegd . _geaa . LvlText . ValAttr = _c . String ( t ) ; } ; } ;
2017-08-28 20:56:18 -05:00
2020-11-09 01:00:18 +00:00
// SetColor sets a specific color or auto.
func ( _fcg Color ) SetColor ( v _fb . Color ) { if v . IsAuto ( ) { _fcg . _cff . ValAttr . ST_HexColorAuto = _edb . ST_HexColorAutoAuto ; _fcg . _cff . ValAttr . ST_HexColorRGB = nil ; } else { _fcg . _cff . ValAttr . ST_HexColorAuto = _edb . ST_HexColorAutoUnset ; _fcg . _cff . ValAttr . ST_HexColorRGB = v . AsRGBString ( ) ; } ; } ; func _ggb ( _gaag * _edb . CT_Tbl , _dba * _edb . CT_P , _gbg bool ) * _edb . CT_Tbl { for _ , _bgd := range _gaag . EG_ContentRowContent { for _ , _geaf := range _bgd . Tr { for _ , _aa := range _geaf . EG_ContentCellContent { for _ , _cbg := range _aa . Tc { for _bbgc , _bbf := range _cbg . EG_BlockLevelElts { for _ , _ffff := range _bbf . EG_ContentBlockContent { for _cgcb , _bec := range _ffff . P { if _bec == _dba { _fcee := _edb . NewEG_BlockLevelElts ( ) ; _ggd := _edb . NewEG_ContentBlockContent ( ) ; _fcee . EG_ContentBlockContent = append ( _fcee . EG_ContentBlockContent , _ggd ) ; _gcf := _edb . NewCT_Tbl ( ) ; _ggd . Tbl = append ( _ggd . Tbl , _gcf ) ; _cbg . EG_BlockLevelElts = append ( _cbg . EG_BlockLevelElts , nil ) ; if _gbg { copy ( _cbg . EG_BlockLevelElts [ _bbgc + 1 : ] , _cbg . EG_BlockLevelElts [ _bbgc : ] ) ; _cbg . EG_BlockLevelElts [ _bbgc ] = _fcee ; if _cgcb != 0 { _cbcg := _edb . NewEG_BlockLevelElts ( ) ; _fga := _edb . NewEG_ContentBlockContent ( ) ; _cbcg . EG_ContentBlockContent = append ( _cbcg . EG_ContentBlockContent , _fga ) ; _fga . P = _ffff . P [ : _cgcb ] ; _cbg . EG_BlockLevelElts = append ( _cbg . EG_BlockLevelElts , nil ) ; copy ( _cbg . EG_BlockLevelElts [ _bbgc + 1 : ] , _cbg . EG_BlockLevelElts [ _bbgc : ] ) ; _cbg . EG_BlockLevelElts [ _bbgc ] = _cbcg ; } ; _ffff . P = _ffff . P [ _cgcb : ] ; } else { copy ( _cbg . EG_BlockLevelElts [ _bbgc + 2 : ] , _cbg . EG_BlockLevelElts [ _bbgc + 1 : ] ) ; _cbg . EG_BlockLevelElts [ _bbgc + 1 ] = _fcee ; if _cgcb != len ( _ffff . P ) - 1 { _egbc := _edb . NewEG_BlockLevelElts ( ) ; _ega := _edb . NewEG_ContentBlockContent ( ) ; _egbc . EG_ContentBlockContent = append ( _egbc . EG_ContentBlockContent , _ega ) ; _ega . P = _ffff . P [ _cgcb + 1 : ] ; _cbg . EG_BlockLevelElts = append ( _cbg . EG_BlockLevelElts , nil ) ; copy ( _cbg . EG_BlockLevelElts [ _bbgc + 3 : ] , _cbg . EG_BlockLevelElts [ _bbgc + 2 : ] ) ; _cbg . EG_BlockLevelElts [ _bbgc + 2 ] = _egbc ; } else { _eed := _edb . NewEG_BlockLevelElts ( ) ; _ddf := _edb . NewEG_ContentBlockContent ( ) ; _eed . EG_ContentBlockContent = append ( _eed . EG_ContentBlockContent , _ddf ) ; _ddf . P = [ ] * _edb . CT_P { _edb . NewCT_P ( ) } ; _cbg . EG_BlockLevelElts = append ( _cbg . EG_BlockLevelElts , nil ) ; copy ( _cbg . EG_BlockLevelElts [ _bbgc + 3 : ] , _cbg . EG_BlockLevelElts [ _bbgc + 2 : ] ) ; _cbg . EG_BlockLevelElts [ _bbgc + 2 ] = _eed ; } ; _ffff . P = _ffff . P [ : _cgcb + 1 ] ; } ; return _gcf ; } ; } ; for _ , _bde := range _ffff . Tbl { _bgc := _ggb ( _bde , _dba , _gbg ) ; if _bgc != nil { return _bgc ; } ; } ; } ; } ; } ; } ; } ; } ; return nil ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddImage adds an image to the document package, returning a reference that
// can be used to add the image to a run and place it in the document contents.
func ( _bfee Header ) AddImage ( i _da . Image ) ( _da . ImageRef , error ) { var _fecd _da . Relationships ; for _bdge , _deeb := range _bfee . _egbb . _ccg { if _deeb == _bfee . _decf { _fecd = _bfee . _egbb . _dac [ _bdge ] ; } ; } ; _dceg := _da . MakeImageRef ( i , & _bfee . _egbb . DocBase , _fecd ) ; if i . Data == nil && i . Path == "" { return _dceg , _f . New ( "\u0069\u006d\u0061\u0067\u0065\u0020\u006d\u0075\u0073\u0074 \u0068\u0061\u0076\u0065\u0020\u0064\u0061t\u0061\u0020\u006f\u0072\u0020\u0061\u0020\u0070\u0061\u0074\u0068" ) ; } ; if i . Format == "" { return _dceg , _f . New ( "\u0069\u006d\u0061\u0067\u0065\u0020\u006d\u0075\u0073\u0074 \u0068\u0061\u0076\u0065\u0020\u0061\u0020v\u0061\u006c\u0069\u0064\u0020\u0066\u006f\u0072\u006d\u0061\u0074" ) ; } ; if i . Size . X == 0 || i . Size . Y == 0 { return _dceg , _f . New ( "\u0069\u006d\u0061\u0067e\u0020\u006d\u0075\u0073\u0074\u0020\u0068\u0061\u0076\u0065 \u0061 \u0076\u0061\u006c\u0069\u0064\u0020\u0073i\u007a\u0065" ) ; } ; _bfee . _egbb . Images = append ( _bfee . _egbb . Images , _dceg ) ; _cbgb := _cb . Sprintf ( "\u006d\u0065d\u0069\u0061\u002fi\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073" , len ( _bfee . _egbb . Images ) , i . Format ) ; _ggdcb := _fecd . AddRelationship ( _cbgb , _c . ImageType ) ; _dceg . SetRelID ( _ggdcb . X ( ) . IdAttr ) ; return _dceg , nil ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetBottomPct sets the cell bottom margin
func ( _cef CellMargins ) SetBottomPct ( pct float64 ) { _cef . _ead . Bottom = _edb . NewCT_TblWidth ( ) ; _cgc ( _cef . _ead . Bottom , pct ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddTable adds a table to the table cell.
func ( _dgc Cell ) AddTable ( ) Table { _eea := _edb . NewEG_BlockLevelElts ( ) ; _dgc . _ece . EG_BlockLevelElts = append ( _dgc . _ece . EG_BlockLevelElts , _eea ) ; _cac := _edb . NewEG_ContentBlockContent ( ) ; _eea . EG_ContentBlockContent = append ( _eea . EG_ContentBlockContent , _cac ) ; _cf := _edb . NewCT_Tbl ( ) ; _cac . Tbl = append ( _cac . Tbl , _cf ) ; return Table { _dgc . _df , _cf } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// CellProperties returns the cell properties.
func ( _abfeb TableConditionalFormatting ) CellProperties ( ) CellProperties { if _abfeb . _efgd . TcPr == nil { _abfeb . _efgd . TcPr = _edb . NewCT_TcPr ( ) ; } ; return CellProperties { _abfeb . _efgd . TcPr } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// InitializeDefault constructs a default numbering.
func ( _bfab Numbering ) InitializeDefault ( ) { _gagd := _edb . NewCT_AbstractNum ( ) ; _gagd . MultiLevelType = _edb . NewCT_MultiLevelType ( ) ; _gagd . MultiLevelType . ValAttr = _edb . ST_MultiLevelTypeHybridMultilevel ; _bfab . _fbd . AbstractNum = append ( _bfab . _fbd . AbstractNum , _gagd ) ; _gagd . AbstractNumIdAttr = 1 ; const _efcb = 720 ; const _efgg = 720 ; const _aeece = 360 ; for _fcgea := 0 ; _fcgea < 9 ; _fcgea ++ { _gcdd := _edb . NewCT_Lvl ( ) ; _gcdd . IlvlAttr = int64 ( _fcgea ) ; _gcdd . Start = _edb . NewCT_DecimalNumber ( ) ; _gcdd . Start . ValAttr = 1 ; _gcdd . NumFmt = _edb . NewCT_NumFmt ( ) ; _gcdd . NumFmt . ValAttr = _edb . ST_NumberFormatBullet ; _gcdd . Suff = _edb . NewCT_LevelSuffix ( ) ; _gcdd . Suff . ValAttr = _edb . ST_LevelSuffixNothing ; _gcdd . LvlText = _edb . NewCT_LevelText ( ) ; _gcdd . LvlText . ValAttr = _c . String ( "\uf0b7" ) ; _gcdd . LvlJc = _edb . NewCT_Jc ( ) ; _gcdd . LvlJc . ValAttr = _edb . ST_JcLeft ; _gcdd . RPr = _edb . NewCT_RPr ( ) ; _gcdd . RPr . RFonts = _edb . NewCT_Fonts ( ) ; _gcdd . RPr . RFonts . AsciiAttr = _c . String ( "\u0053\u0079\u006d\u0062\u006f\u006c" ) ; _gcdd . RPr . RFonts . HAnsiAttr = _c . String ( "\u0053\u0079\u006d\u0062\u006f\u006c" ) ; _gcdd . RPr . RFonts . HintAttr = _edb . ST_HintDefault ; _gcdd . PPr = _edb . NewCT_PPrGeneral ( ) ; _cgff := int64 ( _fcgea * _efgg + _efcb ) ; _gcdd . PPr . Ind = _edb . NewCT_Ind ( ) ; _gcdd . PPr . Ind . LeftAttr = & _edb . ST_SignedTwipsMeasure { } ; _gcdd . PPr . Ind . LeftAttr . Int64 = _c . Int64 ( _cgff ) ; _gcdd . PPr . Ind . HangingAttr = & _cbc . ST_TwipsMeasure { } ; _gcdd . PPr . Ind . HangingAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( _aeece ) ) ; _gagd . Lvl = append ( _gagd . Lvl , _gcdd ) ; } ; _bbbdd := _edb . NewCT_Num ( ) ; _bbbdd . NumIdAttr = 1 ; _bbbdd . AbstractNumId = _edb . NewCT_DecimalNumber ( ) ; _bbbdd . AbstractNumId . ValAttr = 1 ; _bfab . _fbd . Num = append ( _bfab . _fbd . Num , _bbbdd ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetYOffset sets the Y offset for an image relative to the origin.
func ( _gc AnchoredDrawing ) SetYOffset ( y _cg . Distance ) { _gc . _eef . PositionV . Choice = & _edb . WdCT_PosVChoice { } ; _gc . _eef . PositionV . Choice . PosOffset = _c . Int32 ( int32 ( y / _cg . EMU ) ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetLeft sets the left border to a specified type, color and thickness.
func ( _gaa CellBorders ) SetLeft ( t _edb . ST_Border , c _fb . Color , thickness _cg . Distance ) { _gaa . _gcg . Left = _edb . NewCT_Border ( ) ; _gaca ( _gaa . _gcg . Left , t , c , thickness ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetStyle sets the style of a paragraph and is identical to setting it on the
// paragraph's Properties()
func ( _dfdc Paragraph ) SetStyle ( s string ) { _dfdc . ensurePPr ( ) ; if s == "" { _dfdc . _ccdca . PPr . PStyle = nil ; } else { _dfdc . _ccdca . PPr . PStyle = _edb . NewCT_String ( ) ; _dfdc . _ccdca . PPr . PStyle . ValAttr = s ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetTop sets the top border to a specified type, color and thickness.
func ( _gfcae TableBorders ) SetTop ( t _edb . ST_Border , c _fb . Color , thickness _cg . Distance ) { _gfcae . _dgac . Top = _edb . NewCT_Border ( ) ; _gaca ( _gfcae . _dgac . Top , t , c , thickness ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddParagraph adds a paragraph to the table cell.
func ( _dab Cell ) AddParagraph ( ) Paragraph { _db := _edb . NewEG_BlockLevelElts ( ) ; _dab . _ece . EG_BlockLevelElts = append ( _dab . _ece . EG_BlockLevelElts , _db ) ; _bb := _edb . NewEG_ContentBlockContent ( ) ; _db . EG_ContentBlockContent = append ( _db . EG_ContentBlockContent , _bb ) ; _ga := _edb . NewCT_P ( ) ; _bb . P = append ( _bb . P , _ga ) ; return Paragraph { _dab . _df , _ga } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetStyle sets the font size.
func ( _agaaa RunProperties ) SetStyle ( style string ) { if style == "" { _agaaa . _ccbg . RStyle = nil ; } else { _agaaa . _ccbg . RStyle = _edb . NewCT_String ( ) ; _agaaa . _ccbg . RStyle . ValAttr = style ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetName sets the name of the style.
func ( _ecge Style ) SetName ( name string ) { _ecge . _abcbf . Name = _edb . NewCT_String ( ) ; _ecge . _abcbf . Name . ValAttr = name ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetNumberingLevel sets the numbering level of a paragraph. If used, then the
// NumberingDefinition must also be set via SetNumberingDefinition or
// SetNumberingDefinitionByID.
func ( _cbdba Paragraph ) SetNumberingLevel ( listLevel int ) { _cbdba . ensurePPr ( ) ; if _cbdba . _ccdca . PPr . NumPr == nil { _cbdba . _ccdca . PPr . NumPr = _edb . NewCT_NumPr ( ) ; } ; _bdadg := _edb . NewCT_DecimalNumber ( ) ; _bdadg . ValAttr = int64 ( listLevel ) ; _cbdba . _ccdca . PPr . NumPr . Ilvl = _bdadg ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// VerticalAlign returns the value of paragraph vertical align.
func ( _dccd ParagraphProperties ) VerticalAlignment ( ) _cbc . ST_VerticalAlignRun { if _gfee := _dccd . _beefd . RPr . VertAlign ; _gfee != nil { return _gfee . ValAttr ; } ; return 0 ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetHeadingLevel sets a heading level and style based on the level to a
// paragraph. The default styles for a new unioffice document support headings
// from level 1 to 8.
func ( _fbda ParagraphProperties ) SetHeadingLevel ( idx int ) { _fbda . SetStyle ( _cb . Sprintf ( "\u0048e\u0061\u0064\u0069\u006e\u0067\u0025d" , idx ) ) ; if _fbda . _beefd . NumPr == nil { _fbda . _beefd . NumPr = _edb . NewCT_NumPr ( ) ; } ; _fbda . _beefd . NumPr . Ilvl = _edb . NewCT_DecimalNumber ( ) ; _fbda . _beefd . NumPr . Ilvl . ValAttr = int64 ( idx ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// IsChecked returns true if a FormFieldTypeCheckBox is checked.
func ( _cged FormField ) IsChecked ( ) bool { if _cged . _aaed . CheckBox == nil { return false ; } ; if _cged . _aaed . CheckBox . Checked != nil { return true ; } ; return false ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SaveToFile writes the document out to a file.
func ( _ggca * Document ) SaveToFile ( path string ) error { _abe , _bfc := _d . Create ( path ) ; if _bfc != nil { return _bfc ; } ; defer _abe . Close ( ) ; return _ggca . Save ( _abe ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// GetColor returns the color.Color object representing the run color.
func ( _dbcag RunProperties ) GetColor ( ) _fb . Color { if _bccdf := _dbcag . _ccbg . Color ; _bccdf != nil { _adfe := _bccdf . ValAttr ; if _adfe . ST_HexColorRGB != nil { return _fb . FromHex ( * _adfe . ST_HexColorRGB ) ; } ; } ; return _fb . Color { } ; } ; func ( _aadb Paragraph ) addStartBookmark ( _efgge int64 , _ceec string ) * _edb . CT_Bookmark { _befb := _edb . NewEG_PContent ( ) ; _aadb . _ccdca . EG_PContent = append ( _aadb . _ccdca . EG_PContent , _befb ) ; _bdcg := _edb . NewEG_ContentRunContent ( ) ; _bfcd := _edb . NewEG_RunLevelElts ( ) ; _eaac := _edb . NewEG_RangeMarkupElements ( ) ; _affag := _edb . NewCT_Bookmark ( ) ; _affag . NameAttr = _ceec ; _affag . IdAttr = _efgge ; _eaac . BookmarkStart = _affag ; _befb . EG_ContentRunContent = append ( _befb . EG_ContentRunContent , _bdcg ) ; _bdcg . EG_RunLevelElts = append ( _bdcg . EG_RunLevelElts , _bfcd ) ; _bfcd . EG_RangeMarkupElements = append ( _bfcd . EG_RangeMarkupElements , _eaac ) ; return _affag ; } ; func ( _bdc Endnote ) content ( ) [ ] * _edb . EG_ContentBlockContent { var _fae [ ] * _edb . EG_ContentBlockContent ; for _ , _dgcf := range _bdc . _cecc . EG_BlockLevelElts { _fae = append ( _fae , _dgcf . EG_ContentBlockContent ... ) ; } ; return _fae ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// GetColor returns the color.Color object representing the run color.
func ( _fafe ParagraphProperties ) GetColor ( ) _fb . Color { if _gfga := _fafe . _beefd . RPr . Color ; _gfga != nil { _baddg := _gfga . ValAttr ; if _baddg . ST_HexColorRGB != nil { return _fb . FromHex ( * _baddg . ST_HexColorRGB ) ; } ; } ; return _fb . Color { } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// ParagraphStyles returns only the paragraph styles.
func ( _eefc Styles ) ParagraphStyles ( ) [ ] Style { _cdea := [ ] Style { } ; for _ , _baege := range _eefc . _fdee . Style { if _baege . TypeAttr != _edb . ST_StyleTypeParagraph { continue ; } ; _cdea = append ( _cdea , Style { _baege } ) ; } ; return _cdea ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// CharacterSpacingMeasure returns paragraph characters spacing with its measure which can be mm, cm, in, pt, pc or pi.
func ( _cffac ParagraphProperties ) CharacterSpacingMeasure ( ) string { if _egab := _cffac . _beefd . RPr . Spacing ; _egab != nil { _aagb := _egab . ValAttr ; if _aagb . ST_UniversalMeasure != nil { return * _aagb . ST_UniversalMeasure ; } ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// ParagraphSpacing controls the spacing for a paragraph and its lines.
type ParagraphSpacing struct { _cgdgb * _edb . CT_Spacing } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// ParagraphProperties are the properties for a paragraph.
type ParagraphProperties struct { _fdab * Document ; _beefd * _edb . CT_PPr ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Clear clears all content within a header
func ( _efef Header ) Clear ( ) { _efef . _decf . EG_ContentBlockContent = nil } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Settings controls the document settings.
type Settings struct { _dcea * _edb . Settings } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _ea AnchoredDrawing ) X ( ) * _edb . WdAnchor { return _ea . _eef } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetStyle sets the style of a paragraph.
func ( _bafc ParagraphProperties ) SetStyle ( s string ) { if s == "" { _bafc . _beefd . PStyle = nil ; } else { _bafc . _beefd . PStyle = _edb . NewCT_String ( ) ; _bafc . _beefd . PStyle . ValAttr = s ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// ComplexSizeValue returns the value of run font size for complex fonts in points.
func ( _aefe RunProperties ) ComplexSizeValue ( ) float64 { if _eddea := _aefe . _ccbg . SzCs ; _eddea != nil { _edfdg := _eddea . ValAttr ; if _edfdg . ST_UnsignedDecimalNumber != nil { return float64 ( * _edfdg . ST_UnsignedDecimalNumber ) / 2 ; } ; } ; return 0.0 ; } ;
// SetEndIndent controls the end indentation.
func ( _fggaf ParagraphProperties ) SetEndIndent ( m _cg . Distance ) { if _fggaf . _beefd . Ind == nil { _fggaf . _beefd . Ind = _edb . NewCT_Ind ( ) ; } ; if m == _cg . Zero { _fggaf . _beefd . Ind . EndAttr = nil ; } else { _fggaf . _beefd . Ind . EndAttr = & _edb . ST_SignedTwipsMeasure { } ; _fggaf . _beefd . Ind . EndAttr . Int64 = _c . Int64 ( int64 ( m / _cg . Twips ) ) ; } ; } ;
// AddFootnote will create a new footnote and attach it to the Paragraph in the
// location at the end of the previous run (footnotes create their own run within
// the paragraph). The text given to the function is simply a convenience helper,
// paragraphs and runs can always be added to the text of the footnote later.
func ( _gdac Paragraph ) AddFootnote ( text string ) Footnote { var _ddad int64 ; if _gdac . _debe . HasFootnotes ( ) { for _ , _bbcg := range _gdac . _debe . Footnotes ( ) { if _bbcg . id ( ) > _ddad { _ddad = _bbcg . id ( ) ; } ; } ; _ddad ++ ; } else { _ddad = 0 ; _gdac . _debe . _fba = & _edb . Footnotes { } ; _gdac . _debe . _fba . CT_Footnotes = _edb . CT_Footnotes { } ; _gdac . _debe . _fba . Footnote = make ( [ ] * _edb . CT_FtnEdn , 0 ) ; } ; _eaga := _edb . NewCT_FtnEdn ( ) ; _fccga := _edb . NewCT_FtnEdnRef ( ) ; _fccga . IdAttr = _ddad ; _gdac . _debe . _fba . CT_Footnotes . Footnote = append ( _gdac . _debe . _fba . CT_Footnotes . Footnote , _eaga ) ; _edfde := _gdac . AddRun ( ) ; _eagc := _edfde . Properties ( ) ; _eagc . SetStyle ( "\u0046\u006f\u006f\u0074\u006e\u006f\u0074\u0065\u0041n\u0063\u0068\u006f\u0072" ) ; _edfde . _abcbb . EG_RunInnerContent = [ ] * _edb . EG_RunInnerContent { _edb . NewEG_RunInnerContent ( ) } ; _edfde . _abcbb . EG_RunInnerContent [ 0 ] . FootnoteReference = _fccga ; _dgfe := Footnote { _gdac . _debe , _eaga } ; _dgfe . _gfff . IdAttr = _ddad ; _dgfe . _gfff . EG_BlockLevelElts = [ ] * _edb . EG_BlockLevelElts { _edb . NewEG_BlockLevelElts ( ) } ; _ebcb := _dgfe . AddParagraph ( ) ; _ebcb . Properties ( ) . SetStyle ( "\u0046\u006f\u006f\u0074\u006e\u006f\u0074\u0065" ) ; _ebcb . _ccdca . PPr . RPr = _edb . NewCT_ParaRPr ( ) ; _beag := _ebcb . AddRun ( ) ; _beag . AddTab ( ) ; _beag . AddText ( text ) ; return _dgfe ; } ;
// SetInsideHorizontal sets the interior horizontal borders to a specified type, color and thickness.
func ( _ge CellBorders ) SetInsideHorizontal ( t _edb . ST_Border , c _fb . Color , thickness _cg . Distance ) { _ge . _gcg . InsideH = _edb . NewCT_Border ( ) ; _gaca ( _ge . _gcg . InsideH , t , c , thickness ) ; } ;
2020-08-23 14:15:53 +00:00
2020-10-12 13:59:12 +00:00
// X returns the inner wrapped XML type.
2020-11-09 01:00:18 +00:00
func ( _abfbf Run ) X ( ) * _edb . CT_R { return _abfbf . _abcbb } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// NumberingDefinition defines a numbering definition for a list of pragraphs.
type NumberingDefinition struct { _begd * _edb . CT_AbstractNum } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddParagraph adds a paragraph to the header.
func ( _ccff Header ) AddParagraph ( ) Paragraph { _ecf := _edb . NewEG_ContentBlockContent ( ) ; _ccff . _decf . EG_ContentBlockContent = append ( _ccff . _decf . EG_ContentBlockContent , _ecf ) ; _affd := _edb . NewCT_P ( ) ; _ecf . P = append ( _ecf . P , _affd ) ; return Paragraph { _ccff . _egbb , _affd } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetKeepWithNext controls if this paragraph should be kept with the next.
func ( _eaea ParagraphProperties ) SetKeepWithNext ( b bool ) { if ! b { _eaea . _beefd . KeepNext = nil ; } else { _eaea . _beefd . KeepNext = _edb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Value returns the tring value of a FormFieldTypeText or FormFieldTypeDropDown.
func ( _fegg FormField ) Value ( ) string { if _fegg . _aaed . TextInput != nil && _fegg . _cgba . T != nil { return _fegg . _cgba . T . Content ; } else if _fegg . _aaed . DdList != nil && _fegg . _aaed . DdList . Result != nil { _fgdb := _fegg . PossibleValues ( ) ; _dcde := int ( _fegg . _aaed . DdList . Result . ValAttr ) ; if _dcde < len ( _fgdb ) { return _fgdb [ _dcde ] ; } ; } else if _fegg . _aaed . CheckBox != nil { if _fegg . IsChecked ( ) { return "\u0074\u0072\u0075\u0065" ; } ; return "\u0066\u0061\u006cs\u0065" ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetKeepOnOnePage controls if all lines in a paragraph are kept on the same
// page.
func ( _cegdg ParagraphProperties ) SetKeepOnOnePage ( b bool ) { if ! b { _cegdg . _beefd . KeepLines = nil ; } else { _cegdg . _beefd . KeepLines = _edb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// CharacterSpacingValue returns the value of characters spacing in twips (1/20 of point).
func ( _cgee ParagraphProperties ) CharacterSpacingValue ( ) int64 { if _efge := _cgee . _beefd . RPr . Spacing ; _efge != nil { _bgeb := _efge . ValAttr ; if _bgeb . Int64 != nil { return * _bgeb . Int64 ; } ; } ; return int64 ( 0 ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetUpdateFieldsOnOpen controls if fields are recalculated upon opening the
// document. This is useful for things like a table of contents as the library
// only adds the field code and relies on Word/LibreOffice to actually compute
// the content.
func ( _afgg Settings ) SetUpdateFieldsOnOpen ( b bool ) { if ! b { _afgg . _dcea . UpdateFields = nil ; } else { _afgg . _dcea . UpdateFields = _edb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Paragraphs returns all of the paragraphs in the document body including tables.
func ( _fdcd * Document ) Paragraphs ( ) [ ] Paragraph { _eeae := [ ] Paragraph { } ; if _fdcd . _edg . Body == nil { return nil ; } ; for _ , _feg := range _fdcd . _edg . Body . EG_BlockLevelElts { for _ , _feff := range _feg . EG_ContentBlockContent { for _ , _bgac := range _feff . P { _eeae = append ( _eeae , Paragraph { _fdcd , _bgac } ) ; } ; } ; } ; for _ , _cba := range _fdcd . Tables ( ) { for _ , _afd := range _cba . Rows ( ) { for _ , _ecgg := range _afd . Cells ( ) { _eeae = append ( _eeae , _ecgg . Paragraphs ( ) ... ) ; } ; } ; } ; return _eeae ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetMultiLevelType sets the multilevel type.
func ( _gfeg NumberingDefinition ) SetMultiLevelType ( t _edb . ST_MultiLevelType ) { if t == _edb . ST_MultiLevelTypeUnset { _gfeg . _begd . MultiLevelType = nil ; } else { _gfeg . _begd . MultiLevelType = _edb . NewCT_MultiLevelType ( ) ; _gfeg . _begd . MultiLevelType . ValAttr = t ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// RunProperties controls run styling properties
type RunProperties struct { _ccbg * _edb . CT_RPr } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetItalic sets the run to italic.
func ( _gefc RunProperties ) SetItalic ( b bool ) { if ! b { _gefc . _ccbg . I = nil ; _gefc . _ccbg . ICs = nil ; } else { _gefc . _ccbg . I = _edb . NewCT_OnOff ( ) ; _gefc . _ccbg . ICs = _edb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetAlignment controls the paragraph alignment
func ( _dfbc ParagraphProperties ) SetAlignment ( align _edb . ST_Jc ) { if align == _edb . ST_JcUnset { _dfbc . _beefd . Jc = nil ; } else { _dfbc . _beefd . Jc = _edb . NewCT_Jc ( ) ; _dfbc . _beefd . Jc . ValAttr = align ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetASCIITheme sets the font ASCII Theme.
func ( _dcba Fonts ) SetASCIITheme ( t _edb . ST_Theme ) { _dcba . _adddd . AsciiThemeAttr = t } ;
2020-08-23 14:15:53 +00:00
2020-10-12 13:59:12 +00:00
// Borders allows manipulation of the table borders.
2020-11-09 01:00:18 +00:00
func ( _cgec TableProperties ) Borders ( ) TableBorders { if _cgec . _eebbg . TblBorders == nil { _cgec . _eebbg . TblBorders = _edb . NewCT_TblBorders ( ) ; } ; return TableBorders { _cgec . _eebbg . TblBorders } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Clear removes all of the content from within a run.
func ( _egead Run ) Clear ( ) { _egead . _abcbb . EG_RunInnerContent = nil } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _cfgf RunProperties ) X ( ) * _edb . CT_RPr { return _cfgf . _ccbg } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetSize sets the font size for a run.
func ( _ffeb RunProperties ) SetSize ( size _cg . Distance ) { _ffeb . _ccbg . Sz = _edb . NewCT_HpsMeasure ( ) ; _ffeb . _ccbg . Sz . ValAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( size / _cg . HalfPoint ) ) ; _ffeb . _ccbg . SzCs = _edb . NewCT_HpsMeasure ( ) ; _ffeb . _ccbg . SzCs . ValAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( size / _cg . HalfPoint ) ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _dbed TableLook ) X ( ) * _edb . CT_TblLook { return _dbed . _dddgf } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// IsItalic returns true if the run has been set to italics.
func ( _gafc RunProperties ) IsItalic ( ) bool { return _gafc . ItalicValue ( ) == OnOffValueOn } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Bookmark is a bookmarked location within a document that can be referenced
// with a hyperlink.
type Bookmark struct { _afa * _edb . CT_Bookmark } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetKerning sets the run's font kerning.
func ( _bccac RunProperties ) SetKerning ( size _cg . Distance ) { _bccac . _ccbg . Kern = _edb . NewCT_HpsMeasure ( ) ; _bccac . _ccbg . Kern . ValAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( size / _cg . HalfPoint ) ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetChecked marks a FormFieldTypeCheckBox as checked or unchecked.
func ( _adfg FormField ) SetChecked ( b bool ) { if _adfg . _aaed . CheckBox == nil { return ; } ; if ! b { _adfg . _aaed . CheckBox . Checked = nil ; } else { _adfg . _aaed . CheckBox . Checked = _edb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddParagraph adds a paragraph to the endnote.
func ( _afdga Endnote ) AddParagraph ( ) Paragraph { _bafg := _edb . NewEG_ContentBlockContent ( ) ; _gdfc := len ( _afdga . _cecc . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent ) ; _afdga . _cecc . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent = append ( _afdga . _cecc . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent , _bafg ) ; _daeb := _edb . NewCT_P ( ) ; var _edde * _edb . CT_String ; if _gdfc != 0 { _aeb := len ( _afdga . _cecc . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent [ _gdfc - 1 ] . P ) ; _edde = _afdga . _cecc . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent [ _gdfc - 1 ] . P [ _aeb - 1 ] . PPr . PStyle ; } else { _edde = _edb . NewCT_String ( ) ; _edde . ValAttr = "\u0045n\u0064\u006e\u006f\u0074\u0065" ; } ; _bafg . P = append ( _bafg . P , _daeb ) ; _ccee := Paragraph { _afdga . _cdab , _daeb } ; _ccee . _ccdca . PPr = _edb . NewCT_PPr ( ) ; _ccee . _ccdca . PPr . PStyle = _edde ; _ccee . _ccdca . PPr . RPr = _edb . NewCT_ParaRPr ( ) ; return _ccee ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Validate validates the structure and in cases where it't possible, the ranges
// of elements within a document. A validation error dones't mean that the
// document won't work in MS Word or LibreOffice, but it's worth checking into.
func ( _aae * Document ) Validate ( ) error { if _aae == nil || _aae . _edg == nil { return _f . New ( "\u0064o\u0063\u0075m\u0065\u006e\u0074\u0020n\u006f\u0074\u0020i\u006e\u0069\u0074\u0069\u0061\u006c\u0069\u007a\u0065d \u0063\u006f\u0072r\u0065\u0063t\u006c\u0079\u002c\u0020\u006e\u0069l\u0020\u0062a\u0073\u0065" ) ; } ; for _ , _cgab := range [ ] func ( ) error { _aae . validateTableCells , _aae . validateBookmarks } { if _ebc := _cgab ( ) ; _ebc != nil { return _ebc ; } ; } ; if _adga := _aae . _edg . Validate ( ) ; _adga != nil { return _adga ; } ; return nil ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wml.CT_TblBorders
func ( _eeba TableBorders ) X ( ) * _edb . CT_TblBorders { return _eeba . _dgac } ; func ( _dfbf Paragraph ) addInstrText ( _adff string ) * _edb . CT_Text { _aecce := _dfbf . AddRun ( ) ; _bgbeg := _aecce . X ( ) ; _eabe := _edb . NewEG_RunInnerContent ( ) ; _eeed := _edb . NewCT_Text ( ) ; _bage := "\u0070\u0072\u0065\u0073\u0065\u0072\u0076\u0065" ; _eeed . SpaceAttr = & _bage ; _eeed . Content = "\u0020" + _adff + "\u0020" ; _eabe . InstrText = _eeed ; _bgbeg . EG_RunInnerContent = append ( _bgbeg . EG_RunInnerContent , _eabe ) ; return _eeed ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetName marks sets a name attribute for a FormField.
func ( _aeec FormField ) SetName ( name string ) { _gbec := _edb . NewCT_FFName ( ) ; _gbec . ValAttr = & name ; _aeec . _aaed . Name = [ ] * _edb . CT_FFName { _gbec } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetContextualSpacing controls whether to Ignore Spacing Above and Below When
// Using Identical Styles
func ( _bcbf ParagraphStyleProperties ) SetContextualSpacing ( b bool ) { if ! b { _bcbf . _bggb . ContextualSpacing = nil ; } else { _bcbf . _bggb . ContextualSpacing = _edb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddTable adds a new table to the document body.
func ( _eec * Document ) AddTable ( ) Table { _fbc := _edb . NewEG_BlockLevelElts ( ) ; _eec . _edg . Body . EG_BlockLevelElts = append ( _eec . _edg . Body . EG_BlockLevelElts , _fbc ) ; _gdd := _edb . NewEG_ContentBlockContent ( ) ; _fbc . EG_ContentBlockContent = append ( _fbc . EG_ContentBlockContent , _gdd ) ; _dfd := _edb . NewCT_Tbl ( ) ; _gdd . Tbl = append ( _gdd . Tbl , _dfd ) ; return Table { _eec , _dfd } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddRun adds a run to a paragraph.
func ( _dgcdf Paragraph ) AddRun ( ) Run { _fbag := _edb . NewEG_PContent ( ) ; _dgcdf . _ccdca . EG_PContent = append ( _dgcdf . _ccdca . EG_PContent , _fbag ) ; _cbcgf := _edb . NewEG_ContentRunContent ( ) ; _fbag . EG_ContentRunContent = append ( _fbag . EG_ContentRunContent , _cbcgf ) ; _ccga := _edb . NewCT_R ( ) ; _cbcgf . R = _ccga ; return Run { _dgcdf . _debe , _ccga } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// InitializeDefault constructs the default styles.
func ( _ddfd Styles ) InitializeDefault ( ) { _ddfd . initializeDocDefaults ( ) ; _ddfd . initializeStyleDefaults ( ) ; } ; func ( _bdgfg Paragraph ) addBeginFldChar ( _cgdf string ) * _edb . CT_FFData { _adgc := _bdgfg . addFldChar ( ) ; _adgc . FldCharTypeAttr = _edb . ST_FldCharTypeBegin ; _adgc . FfData = _edb . NewCT_FFData ( ) ; _bebc := _edb . NewCT_FFName ( ) ; _bebc . ValAttr = & _cgdf ; _adgc . FfData . Name = [ ] * _edb . CT_FFName { _bebc } ; return _adgc . FfData ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetNumberingDefinition sets the numbering definition ID via a NumberingDefinition
// defined in numbering.xml
func ( _degg Paragraph ) SetNumberingDefinition ( nd NumberingDefinition ) { _degg . ensurePPr ( ) ; if _degg . _ccdca . PPr . NumPr == nil { _degg . _ccdca . PPr . NumPr = _edb . NewCT_NumPr ( ) ; } ; _afgb := _edb . NewCT_DecimalNumber ( ) ; _aebd := int64 ( - 1 ) ; for _ , _fbbf := range _degg . _debe . Numbering . _fbd . Num { if _fbbf . AbstractNumId != nil && _fbbf . AbstractNumId . ValAttr == nd . AbstractNumberID ( ) { _aebd = _fbbf . NumIdAttr ; } ; } ; if _aebd == - 1 { _addg := _edb . NewCT_Num ( ) ; _degg . _debe . Numbering . _fbd . Num = append ( _degg . _debe . Numbering . _fbd . Num , _addg ) ; _addg . NumIdAttr = int64 ( len ( _degg . _debe . Numbering . _fbd . Num ) ) ; _addg . AbstractNumId = _edb . NewCT_DecimalNumber ( ) ; _addg . AbstractNumId . ValAttr = nd . AbstractNumberID ( ) ; } ; _afgb . ValAttr = _aebd ; _degg . _ccdca . PPr . NumPr . NumId = _afgb ; } ;
2017-09-26 18:18:59 -05:00
2020-11-09 01:00:18 +00:00
// Paragraphs returns the paragraphs defined in a footnote.
func ( _efec Footnote ) Paragraphs ( ) [ ] Paragraph { _ccaa := [ ] Paragraph { } ; for _ , _fgdd := range _efec . content ( ) { for _ , _adcb := range _fgdd . P { _ccaa = append ( _ccaa , Paragraph { _efec . _agea , _adcb } ) ; } ; } ; return _ccaa ; } ;
2017-09-26 18:18:59 -05:00
2020-11-09 01:00:18 +00:00
// TableStyleProperties are table properties as defined in a style.
type TableStyleProperties struct { _caead * _edb . CT_TblPrBase } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// EastAsiaFont returns the name of paragraph font family for East Asia.
func ( _ccba ParagraphProperties ) EastAsiaFont ( ) string { if _beed := _ccba . _beefd . RPr . RFonts ; _beed != nil { if _beed . EastAsiaAttr != nil { return * _beed . EastAsiaAttr ; } ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddDrawingAnchored adds an anchored (floating) drawing from an ImageRef.
func ( _gbga Run ) AddDrawingAnchored ( img _da . ImageRef ) ( AnchoredDrawing , error ) { _ggea := _gbga . newIC ( ) ; _ggea . Drawing = _edb . NewCT_Drawing ( ) ; _gcac := _edb . NewWdAnchor ( ) ; _cbaga := AnchoredDrawing { _gbga . _ddgb , _gcac } ; _gcac . SimplePosAttr = _c . Bool ( false ) ; _gcac . AllowOverlapAttr = true ; _gcac . CNvGraphicFramePr = _gg . NewCT_NonVisualGraphicFrameProperties ( ) ; _ggea . Drawing . Anchor = append ( _ggea . Drawing . Anchor , _gcac ) ; _gcac . Graphic = _gg . NewGraphic ( ) ; _gcac . Graphic . GraphicData = _gg . NewCT_GraphicalObjectData ( ) ; _gcac . Graphic . GraphicData . UriAttr = "\u0068\u0074\u0074\u0070\u003a\u002f/\u0073\u0063\u0068e\u006d\u0061\u0073.\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072m\u0061\u0074\u0073\u002e\u006frg\u002f\u0064\u0072\u0061\u0077\u0069\u006e\u0067\u006d\u006c\u002f\u0032\u0030\u0030\u0036\u002f\u0070\u0069\u0063\u0074\u0075\u0072\u0065" ; _gcac . SimplePos . XAttr . ST_CoordinateUnqualified = _c . Int64 ( 0 ) ; _gcac . SimplePos . YAttr . ST_CoordinateUnqualified = _c . Int64 ( 0 ) ; _gcac . PositionH . RelativeFromAttr = _edb . WdST_RelFromHPage ; _gcac . PositionH . Choice = & _edb . WdCT_PosHChoice { } ; _gcac . PositionH . Choice . PosOffset = _c . Int32 ( 0 ) ; _gcac . PositionV . RelativeFromAttr = _edb . WdST_RelFromVPage ; _gcac . PositionV . Choice = & _edb . WdCT_PosVChoice { } ; _gcac . PositionV . Choice . PosOffset = _c . Int32 ( 0 ) ; _gcac . Extent . CxAttr = int64 ( float64 ( img . Size ( ) . X * _cg . Pixel72 ) / _cg . EMU ) ; _gcac . Extent . CyAttr = int64 ( float64 ( img . Size ( ) . Y * _cg . Pixel72 ) / _cg . EMU ) ; _gcac . Choice = & _edb . WdEG_WrapTypeChoice { } ; _gcac . Choice . WrapSquare = _edb . NewWdCT_WrapSquare ( ) ; _gcac . Choice . WrapSquare . WrapTextAttr = _edb . WdST_WrapTextBothSides ; _deda := 0x7FFFFFFF & _b . Uint32 ( ) ; _gcac . DocPr . IdAttr = _deda ; _gcbga := _cd . NewPic ( ) ; _gcbga . NvPicPr . CNvPr . IdAttr = _deda ; _gfaf := img . RelID ( ) ; if _gfaf == "" { return _cbaga , _f . New ( "\u0063\u006f\u0075\u006c\u0064\u006e\u0027\u0074\u0020\u0066\u0069\u006e\u0064\u0020\u0072\u0065\u0066\u0065\u0072\u0065n\u0063\u0065\u0020\u0074\u006f\u0020\u0069\u006d\u0061g\u0065\u0020\u0077\u0069\u0074\u0068\u0069\u006e\u0020\u0064\u006f\u0063\u0075m\u0065\u006e\u0074\u0020\u0072\u0065l\u0061\u0074\u0069o\u006e\u0073" ) ; } ; _gcac . Graphic . GraphicData . Any = append ( _gcac . Graphic . GraphicData . Any , _gcbga ) ; _gcbga . BlipFill = _gg . NewCT_BlipFillProperties ( ) ; _gcbga . BlipFill . Blip = _gg . NewCT_Blip ( ) ; _gcbga . BlipFill . Blip . EmbedAttr = & _gfaf ; _gcbga . BlipFill . Stretch = _gg . NewCT_StretchInfoProperties ( ) ; _gcbga . BlipFill . Stretch . FillRect = _gg . NewCT_RelativeRect ( ) ; _gcbga . SpPr = _gg . NewCT_ShapeProperties ( ) ; _gcbga . SpPr . Xfrm = _gg . NewCT_Transform2D ( ) ; _gcbga . SpPr . Xfrm . Off = _gg . NewCT_Point2D ( ) ; _gcbga . SpPr . Xfrm . Off . XAttr . ST_CoordinateUnqualified = _c . Int64 ( 0 ) ; _gcbga . SpPr . Xfrm . Off . YAttr . ST_CoordinateUnqualified = _c . Int64 ( 0 ) ; _gcbga . SpPr . Xfrm . Ext = _gg . NewCT_PositiveSize2D ( ) ; _gcbga . SpPr . Xfrm . Ext . CxAttr = int64 ( img . Size ( ) . X * _cg . Point ) ; _gcbga . SpPr . Xfrm . Ext . CyAttr = int64 ( img . Size ( ) . Y * _cg . Point ) ; _gcbga . SpPr . PrstGeom = _gg . NewCT_PresetGeometry2D ( ) ; _gcbga . SpPr . PrstGeom . PrstAttr = _gg . ST_ShapeTypeRect ; return _cbaga , nil ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddPageBreak adds a page break to a run.
func ( _acgff Run ) AddPageBreak ( ) { _beedc := _acgff . newIC ( ) ; _beedc . Br = _edb . NewCT_Br ( ) ; _beedc . Br . TypeAttr = _edb . ST_BrTypePage ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// OpenTemplate opens a document, removing all content so it can be used as a
// template. Since Word removes unused styles from a document upon save, to
// create a template in Word add a paragraph with every style of interest. When
// opened with OpenTemplate the document's styles will be available but the
// content will be gone.
func OpenTemplate ( filename string ) ( * Document , error ) { _bbda , _eggd := Open ( filename ) ; if _eggd != nil { return nil , _eggd ; } ; _bbda . _edg . Body = _edb . NewCT_Body ( ) ; return _bbda , nil ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Paragraph is a paragraph within a document.
type Paragraph struct { _debe * Document ; _ccdca * _edb . CT_P ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Clear clears the styes.
func ( _bebe Styles ) Clear ( ) { _bebe . _fdee . DocDefaults = nil ; _bebe . _fdee . LatentStyles = nil ; _bebe . _fdee . Style = nil ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetColumnBandSize sets the number of Columns in the column band
func ( _efgee TableStyleProperties ) SetColumnBandSize ( cols int64 ) { _efgee . _caead . TblStyleColBandSize = _edb . NewCT_DecimalNumber ( ) ; _efgee . _caead . TblStyleColBandSize . ValAttr = cols ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Style returns the style for a paragraph, or an empty string if it is unset.
func ( _ceea ParagraphProperties ) Style ( ) string { if _ceea . _beefd . PStyle != nil { return _ceea . _beefd . PStyle . ValAttr ; } ; return "" ; } ; func ( _eeca Endnote ) id ( ) int64 { return _eeca . _cecc . IdAttr } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Outline returns true if run outline is on.
func ( _eeeb RunProperties ) Outline ( ) bool { return _bgbe ( _eeeb . _ccbg . Outline ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetFirstLineIndent controls the indentation of the first line in a paragraph.
func ( _gdfag ParagraphProperties ) SetFirstLineIndent ( m _cg . Distance ) { if _gdfag . _beefd . Ind == nil { _gdfag . _beefd . Ind = _edb . NewCT_Ind ( ) ; } ; if m == _cg . Zero { _gdfag . _beefd . Ind . FirstLineAttr = nil ; } else { _gdfag . _beefd . Ind . FirstLineAttr = & _cbc . ST_TwipsMeasure { } ; _gdfag . _beefd . Ind . FirstLineAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( m / _cg . Twips ) ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetLayout controls the table layout. wml.ST_TblLayoutTypeAutofit corresponds
// to "Automatically resize to fit contents" being checked, while
// wml.ST_TblLayoutTypeFixed corresponds to it being unchecked.
func ( _cegg TableProperties ) SetLayout ( l _edb . ST_TblLayoutType ) { if l == _edb . ST_TblLayoutTypeUnset || l == _edb . ST_TblLayoutTypeAutofit { _cegg . _eebbg . TblLayout = nil ; } else { _cegg . _eebbg . TblLayout = _edb . NewCT_TblLayoutType ( ) ; _cegg . _eebbg . TblLayout . TypeAttr = l ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// InsertRunAfter inserts a run in the paragraph after the relative run.
func ( _eced Paragraph ) InsertRunAfter ( relativeTo Run ) Run { return _eced . insertRun ( relativeTo , false ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddTextInput adds text input form field to the paragraph and returns it.
func ( _beef Paragraph ) AddTextInput ( name string ) FormField { _fggf := _beef . addFldCharsForField ( name , "\u0046\u004f\u0052\u004d\u0054\u0045\u0058\u0054" ) ; _fggf . _aaed . TextInput = _edb . NewCT_FFTextInput ( ) ; return _fggf ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _fefdd ParagraphProperties ) X ( ) * _edb . CT_PPr { return _fefdd . _beefd } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddBreak adds a line break to a run.
func ( _bafbd Run ) AddBreak ( ) { _bcgg := _bafbd . newIC ( ) ; _bcgg . Br = _edb . NewCT_Br ( ) } ; func ( _edcf Paragraph ) addFldChar ( ) * _edb . CT_FldChar { _agaa := _edcf . AddRun ( ) ; _dgdg := _agaa . X ( ) ; _fcgg := _edb . NewEG_RunInnerContent ( ) ; _egea := _edb . NewCT_FldChar ( ) ; _fcgg . FldChar = _egea ; _dgdg . EG_RunInnerContent = append ( _dgdg . EG_RunInnerContent , _fcgg ) ; return _egea ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// IsBold returns true if the run has been set to bold.
func ( _bfcb RunProperties ) IsBold ( ) bool { return _bfcb . BoldValue ( ) == OnOffValueOn } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Styles returns all styles.
func ( _accc Styles ) Styles ( ) [ ] Style { _gdagb := [ ] Style { } ; for _ , _efaf := range _accc . _fdee . Style { _gdagb = append ( _gdagb , Style { _efaf } ) ; } ; return _gdagb ; } ; func ( _cgfc Document ) mergeFields ( ) [ ] mergeFieldInfo { _ggfb := [ ] Paragraph { } ; _gddg := [ ] mergeFieldInfo { } ; for _ , _eebg := range _cgfc . Tables ( ) { for _ , _feae := range _eebg . Rows ( ) { for _ , _bfdd := range _feae . Cells ( ) { _ggfb = append ( _ggfb , _bfdd . Paragraphs ( ) ... ) ; } ; } ; } ; _ggfb = append ( _ggfb , _cgfc . Paragraphs ( ) ... ) ; for _ , _eegd := range _ggfb { _abec := _eegd . Runs ( ) ; _abga := - 1 ; _dabdg := - 1 ; _def := - 1 ; _eeffe := mergeFieldInfo { } ; for _ , _dbad := range _eegd . _ccdca . EG_PContent { for _ , _cbfed := range _dbad . FldSimple { if _e . Contains ( _cbfed . InstrAttr , "\u004d\u0045\u0052\u0047\u0045\u0046\u0049\u0045\u004c\u0044" ) { _ecdf := _afafe ( _cbfed . InstrAttr ) ; _ecdf . _eacb = true ; _ecdf . _abbe = _eegd ; _ecdf . _gcce = _dbad ; _gddg = append ( _gddg , _ecdf ) ; } ; } ; } ; for _aefaf := 0 ; _aefaf < len ( _abec ) ; _aefaf ++ { _gcgg := _abec [ _aefaf ] ; for _ , _fgfbb := range _gcgg . X ( ) . EG_RunInnerContent { if _fgfbb . FldChar != nil { switch _fgfbb . FldChar . FldCharTypeAttr { case _edb . ST_FldCharTypeBegin : _abga = _aefaf ; case _edb . ST_FldCharTypeSeparate : _dabdg = _aefaf ; case _edb . ST_FldCharTypeEnd : _def = _aefaf ; if _eeffe . _dabga != "" { _eeffe . _abbe = _eegd ; _eeffe . _ggdb = _abga ; _eeffe . _efeb = _def ; _eeffe . _baef = _dabdg ; _gddg = append ( _gddg , _eeffe ) ; } ; _abga = - 1 ; _dabdg = - 1 ; _def = - 1 ; _eeffe = mergeFieldInfo { } ; } ; } else if _fgfbb . InstrText != nil && _e . Contains ( _fgfbb . InstrText . Content , "\u004d\u0045\u0052\u0047\u0045\u0046\u0049\u0045\u004c\u0044" ) { if _abga != - 1 && _def == - 1 { _eeffe = _afafe ( _fgfbb . InstrText . Content ) ; } ; } ; } ; } ; } ; return _gddg ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetDefaultValue sets the default value of a FormFieldTypeDropDown. For
// FormFieldTypeDropDown, the value must be one of the fields possible values.
func ( _dgge FormField ) SetDefaultValue ( v string ) { if _dgge . _aaed . DdList != nil { for _acbaf , _fea := range _dgge . PossibleValues ( ) { if _fea == v { _dgge . _aaed . DdList . Default = _edb . NewCT_DecimalNumber ( ) ; _dgge . _aaed . DdList . Default . ValAttr = int64 ( _acbaf ) ; break ; } ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Run is a run of text within a paragraph that shares the same formatting.
type Run struct { _ddgb * Document ; _abcbb * _edb . CT_R ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _gaae CellProperties ) X ( ) * _edb . CT_TcPr { return _gaae . _dcb } ; func ( _dade FormFieldType ) String ( ) string { if _dade >= FormFieldType ( len ( _efgf ) - 1 ) { return _cb . Sprintf ( "\u0046\u006f\u0072\u006d\u0046\u0069\u0065\u006c\u0064\u0054\u0079\u0070e\u0028\u0025\u0064\u0029" , _dade ) ; } ; return _bdd [ _efgf [ _dade ] : _efgf [ _dade + 1 ] ] ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Properties returns the numbering level paragraph properties.
func ( _gcdg NumberingLevel ) Properties ( ) ParagraphStyleProperties { if _gcdg . _geaa . PPr == nil { _gcdg . _geaa . PPr = _edb . NewCT_PPrGeneral ( ) ; } ; return ParagraphStyleProperties { _gcdg . _geaa . PPr } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetLastRow controls the conditional formatting for the last row in a table.
// This is called the 'Total' row within Word.
func ( _bfcg TableLook ) SetLastRow ( on bool ) { if ! on { _bfcg . _dddgf . LastRowAttr = & _cbc . ST_OnOff { } ; _bfcg . _dddgf . LastRowAttr . ST_OnOff1 = _cbc . ST_OnOff1Off ; } else { _bfcg . _dddgf . LastRowAttr = & _cbc . ST_OnOff { } ; _bfcg . _dddgf . LastRowAttr . ST_OnOff1 = _cbc . ST_OnOff1On ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetLeft sets the left border to a specified type, color and thickness.
func ( _aafgf TableBorders ) SetLeft ( t _edb . ST_Border , c _fb . Color , thickness _cg . Distance ) { _aafgf . _dgac . Left = _edb . NewCT_Border ( ) ; _gaca ( _aafgf . _dgac . Left , t , c , thickness ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Caps returns true if paragraph font is capitalized.
func ( _gbdfg ParagraphProperties ) Caps ( ) bool { return _bgbe ( _gbdfg . _beefd . RPr . Caps ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// MailMerge finds mail merge fields and replaces them with the text provided. It also removes
// the mail merge source info from the document settings.
func ( _fbeef * Document ) MailMerge ( mergeContent map [ string ] string ) { _adab := _fbeef . mergeFields ( ) ; _ddbc := map [ Paragraph ] [ ] Run { } ; for _ , _dcbc := range _adab { _eggfe , _gbdf := mergeContent [ _dcbc . _dabga ] ; if _gbdf { if _dcbc . _eggff { _eggfe = _e . ToUpper ( _eggfe ) ; } else if _dcbc . _eeffb { _eggfe = _e . ToLower ( _eggfe ) ; } else if _dcbc . _abgf { _eggfe = _e . Title ( _eggfe ) ; } else if _dcbc . _gee { _gbadc := _dc . Buffer { } ; for _dggb , _ffcd := range _eggfe { if _dggb == 0 { _gbadc . WriteRune ( _gf . ToUpper ( _ffcd ) ) ; } else { _gbadc . WriteRune ( _ffcd ) ; } ; } ; _eggfe = _gbadc . String ( ) ; } ; if _eggfe != "" && _dcbc . _egge != "" { _eggfe = _dcbc . _egge + _eggfe ; } ; if _eggfe != "" && _dcbc . _fbacd != "" { _eggfe = _eggfe + _dcbc . _fbacd ; } ; } ; if _dcbc . _eacb { if len ( _dcbc . _gcce . FldSimple ) == 1 && len ( _dcbc . _gcce . FldSimple [ 0 ] . EG_PContent ) == 1 && len ( _dcbc . _gcce . FldSimple [ 0 ] . EG_PContent [ 0 ] . EG_ContentRunContent ) == 1 { _bfec := & _edb . EG_ContentRunContent { } ; _bfec . R = _dcbc . _gcce . FldSimple [ 0 ] . EG_PContent [ 0 ] . EG_ContentRunContent [ 0 ] . R ; _dcbc . _gcce . FldSimple = nil ; _gcfb := Run { _fbeef , _bfec . R } ; _gcfb . ClearContent ( ) ; _gcfb . AddText ( _eggfe ) ; _dcbc . _gcce . EG_ContentRunContent = append ( _dcbc . _gcce . EG_ContentRunContent , _bfec ) ; } ; } else { _fggb := _dcbc . _abbe . Runs ( ) ; for _afdgf := _dcbc . _ggdb ; _afdgf <= _dcbc . _efeb ; _afdgf ++ { if _afdgf == _dcbc . _baef + 1 { _fggb [ _afdgf ] . ClearContent ( ) ; _fggb [ _afdgf ] . AddText ( _eggfe ) ; } else { _ddbc [ _dcbc . _abbe ] = append ( _ddbc [ _dcbc . _abbe ] , _fggb [ _afdgf ] ) ; } ; } ; } ; } ; for _fddg , _acefb := range _ddbc { for _ , _ffcc := range _acefb { _fddg . RemoveRun ( _ffcc ) ; } ; } ; _fbeef . Settings . RemoveMailMerge ( ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Table is a table within a document.
type Table struct { _aeecb * Document ; _cbcgd * _edb . CT_Tbl ; } ; func ( _aedg * Document ) onNewRelationship ( _beg * _af . DecodeMap , _eeag , _egfg string , _aag [ ] * _fd . File , _ecbd * _ca . Relationship , _aee _af . Target ) error { _feb := _c . DocTypeDocument ; switch _egfg { case _c . OfficeDocumentType , _c . OfficeDocumentTypeStrict : _aedg . _edg = _edb . NewDocument ( ) ; _beg . AddTarget ( _eeag , _aedg . _edg , _egfg , 0 ) ; _beg . AddTarget ( _af . RelationsPathFor ( _eeag ) , _aedg . _gcgf . X ( ) , _egfg , 0 ) ; _ecbd . TargetAttr = _c . RelativeFilename ( _feb , _aee . Typ , _egfg , 0 ) ; case _c . CorePropertiesType : _beg . AddTarget ( _eeag , _aedg . CoreProperties . X ( ) , _egfg , 0 ) ; _ecbd . TargetAttr = _c . RelativeFilename ( _feb , _aee . Typ , _egfg , 0 ) ; case _c . CustomPropertiesType : _beg . AddTarget ( _eeag , _aedg . CustomProperties . X ( ) , _egfg , 0 ) ; _ecbd . TargetAttr = _c . RelativeFilename ( _feb , _aee . Typ , _egfg , 0 ) ; case _c . ExtendedPropertiesType , _c . ExtendedPropertiesTypeStrict : _beg . AddTarget ( _eeag , _aedg . AppProperties . X ( ) , _egfg , 0 ) ; _ecbd . TargetAttr = _c . RelativeFilename ( _feb , _aee . Typ , _egfg , 0 ) ; case _c . ThumbnailType , _c . ThumbnailTypeStrict : for _cab , _aafe := range _aag { if _aafe == nil { continue ; } ; if _aafe . Name == _eeag { _gdffg , _bfde := _aafe . Open ( ) ; if _bfde != nil { return _cb . Errorf ( "e\u0072\u0072\u006f\u0072\u0020\u0072e\u0061\u0064\u0069\u006e\u0067\u0020\u0074\u0068\u0075m\u0062\u006e\u0061i\u006c:\u0020\u0025\u0073" , _bfde ) ; } ; _aedg . Thumbnail , _ , _bfde = _de . Decode ( _gdffg ) ; _gdffg . Close ( ) ; if _bfde != nil { return _cb . Errorf ( "\u0065\u0072\u0072\u006fr\u0020\u0064\u0065\u0063\u006f\u0064\u0069\u006e\u0067\u0020t\u0068u\u006d\u0062\u006e\u0061\u0069\u006c\u003a \u0025\u0073" , _bfde ) ; } ; _aag [ _cab ] = nil ; } ; } ; case _c . SettingsType , _c . SettingsTypeStrict : _beg . AddTarget ( _eeag , _aedg . Settings . X ( ) , _egfg , 0 ) ; _ecbd . TargetAttr = _c . RelativeFilename ( _feb , _aee . Typ , _egfg , 0 ) ; case _c . NumberingType , _c . NumberingTypeStrict : _aedg . Numbering = NewNumbering ( ) ; _beg . AddTarget ( _eeag , _aedg . Numbering . X ( ) , _egfg , 0 ) ; _ecbd . TargetAttr = _c . RelativeFilename ( _feb , _aee . Typ , _egfg , 0 ) ; case _c . StylesType , _c . StylesTypeStrict : _aedg . Styles . Clear ( ) ; _beg . AddTarget ( _eeag , _aedg . Styles . X ( ) , _egfg , 0 ) ; _ecbd . TargetAttr = _c . RelativeFilename ( _feb , _aee . Typ , _egfg , 0 ) ; case _c . HeaderType , _c . HeaderTypeStrict : _edgc := _edb . NewHdr ( ) ; _beg . AddTarget ( _eeag , _edgc , _egfg , uint32 ( len ( _aedg . _ccg ) ) ) ; _aedg . _ccg = append ( _aedg . _ccg , _edgc ) ; _ecbd . TargetAttr = _c . RelativeFilename ( _feb , _aee . Typ , _egfg , len ( _aedg . _ccg ) ) ; _ebb := _da . NewRelationships ( ) ; _beg . AddTarget ( _af . RelationsPathFor ( _eeag ) , _ebb . X ( ) , _egfg , 0 ) ; _aedg . _dac = append ( _aedg . _dac , _ebb ) ; case _c . FooterType , _c . FooterTypeStrict : _bafe := _edb . NewFtr ( ) ; _beg . AddTarget ( _eeag , _bafe , _egfg , uint32 ( len ( _aedg . _bcd ) ) ) ; _aedg . _bcd = append ( _aedg . _bcd , _bafe ) ; _ecbd . TargetAttr = _c . RelativeFilename ( _feb , _aee . Typ , _egfg , len ( _aedg . _bcd ) ) ; _ggde := _da . NewRelationships ( ) ; _beg . AddTarget ( _af . RelationsPathFor ( _eeag ) , _ggde . X ( ) , _egfg , 0 ) ; _aedg . _cbd = append ( _aedg . _cbd , _ggde ) ; case _c . ThemeType , _c . ThemeTypeStrict : _bdbf := _gg . NewTheme ( ) ; _beg . AddTarget ( _eeag , _bdbf , _egfg , uint32 ( len ( _aedg . _cfc ) ) ) ; _aedg . _cfc = append ( _aedg . _cfc , _bdbf ) ; _ecbd . TargetAttr = _c . RelativeFilename ( _feb , _aee . Typ , _egfg , len ( _aedg . _cfc ) ) ; case _c . WebSettingsType , _c . WebSettingsTypeStrict : _aedg . _fe = _edb . NewWebSettings ( ) ; _beg . AddTarget ( _eeag , _aedg . _fe , _egfg , 0 ) ; _ecbd . TargetAttr = _c . RelativeFilename ( _feb , _aee . Typ , _egfg , 0 ) ; case _c . FontTableType , _c . FontTableTypeStrict : _aedg . _bcc = _edb . NewFonts ( ) ; _beg . AddTarget ( _eeag , _aedg . _bcc , _egfg , 0 ) ; _ecbd . TargetAttr = _c . RelativeFilename ( _feb , _aee . Typ , _egfg , 0 ) ; case _c . EndNotesType , _c . EndNotesTypeStrict : _aedg . _dacb = _edb . NewEndnotes ( ) ; _beg . AddTarget ( _eeag , _aedg . _dacb , _egfg , 0 ) ; _ecbd . TargetAttr = _c . RelativeFilename ( _feb , _aee . Typ , _egfg , 0 ) ; case _c . FootNotesType , _c . FootNotesTypeStrict : _aedg . _fba = _edb . NewFootnotes ( ) ; _beg . AddTarget ( _eeag , _aedg . _fba , _egfg , 0 ) ; _ecbd . TargetAttr = _c . RelativeFilena
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// RemoveFootnote removes a footnote from both the paragraph and the document
// the requested footnote must be anchored on the paragraph being referenced.
func ( _feba Paragraph ) RemoveFootnote ( id int64 ) { _ffcdc := _feba . _debe . _fba ; var _bege int ; for _aeff , _feca := range _ffcdc . CT_Footnotes . Footnote { if _feca . IdAttr == id { _bege = _aeff ; } ; } ; _bege = 0 ; _ffcdc . CT_Footnotes . Footnote [ _bege ] = nil ; _ffcdc . CT_Footnotes . Footnote [ _bege ] = _ffcdc . CT_Footnotes . Footnote [ len ( _ffcdc . CT_Footnotes . Footnote ) - 1 ] ; _ffcdc . CT_Footnotes . Footnote = _ffcdc . CT_Footnotes . Footnote [ : len ( _ffcdc . CT_Footnotes . Footnote ) - 1 ] ; var _badd Run ; for _ , _efac := range _feba . Runs ( ) { if _adcac , _fgea := _efac . IsFootnote ( ) ; _adcac { if _fgea == id { _badd = _efac ; } ; } ; } ; _feba . RemoveRun ( _badd ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// RemoveMailMerge removes any mail merge settings
func ( _gbgd Settings ) RemoveMailMerge ( ) { _gbgd . _dcea . MailMerge = nil } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddEndnote will create a new endnote and attach it to the Paragraph in the
// location at the end of the previous run (endnotes create their own run within
// the paragraph. The text given to the function is simply a convenience helper,
// paragraphs and runs can always be added to the text of the endnote later.
func ( _decfb Paragraph ) AddEndnote ( text string ) Endnote { var _dggbf int64 ; if _decfb . _debe . HasEndnotes ( ) { for _ , _ccab := range _decfb . _debe . Endnotes ( ) { if _ccab . id ( ) > _dggbf { _dggbf = _ccab . id ( ) ; } ; } ; _dggbf ++ ; } else { _dggbf = 0 ; _decfb . _debe . _dacb = & _edb . Endnotes { } ; } ; _fefd := _edb . NewCT_FtnEdn ( ) ; _daccb := _edb . NewCT_FtnEdnRef ( ) ; _daccb . IdAttr = _dggbf ; _decfb . _debe . _dacb . CT_Endnotes . Endnote = append ( _decfb . _debe . _dacb . CT_Endnotes . Endnote , _fefd ) ; _ddd := _decfb . AddRun ( ) ; _fdbf := _ddd . Properties ( ) ; _fdbf . SetStyle ( "\u0045\u006e\u0064\u006e\u006f\u0074\u0065\u0041\u006e\u0063\u0068\u006f\u0072" ) ; _ddd . _abcbb . EG_RunInnerContent = [ ] * _edb . EG_RunInnerContent { _edb . NewEG_RunInnerContent ( ) } ; _ddd . _abcbb . EG_RunInnerContent [ 0 ] . EndnoteReference = _daccb ; _bbag := Endnote { _decfb . _debe , _fefd } ; _bbag . _cecc . IdAttr = _dggbf ; _bbag . _cecc . EG_BlockLevelElts = [ ] * _edb . EG_BlockLevelElts { _edb . NewEG_BlockLevelElts ( ) } ; _eegf := _bbag . AddParagraph ( ) ; _eegf . Properties ( ) . SetStyle ( "\u0045n\u0064\u006e\u006f\u0074\u0065" ) ; _eegf . _ccdca . PPr . RPr = _edb . NewCT_ParaRPr ( ) ; _bddg := _eegf . AddRun ( ) ; _bddg . AddTab ( ) ; _bddg . AddText ( text ) ; return _bbag ; } ; const ( OnOffValueUnset OnOffValue = iota ; OnOffValueOff ; OnOffValueOn ; ) ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetRight sets the right border to a specified type, color and thickness.
func ( _ccf CellBorders ) SetRight ( t _edb . ST_Border , c _fb . Color , thickness _cg . Distance ) { _ccf . _gcg . Right = _edb . NewCT_Border ( ) ; _gaca ( _ccf . _gcg . Right , t , c , thickness ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetPossibleValues sets possible values for a FormFieldTypeDropDown.
func ( _ddgd FormField ) SetPossibleValues ( values [ ] string ) { if _ddgd . _aaed . DdList != nil { for _ , _gfaa := range values { _bcabe := _edb . NewCT_String ( ) ; _bcabe . ValAttr = _gfaa ; _ddgd . _aaed . DdList . ListEntry = append ( _ddgd . _aaed . DdList . ListEntry , _bcabe ) ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetSize sets the size of the displayed image on the page.
func ( _fdbc InlineDrawing ) SetSize ( w , h _cg . Distance ) { _fdbc . _fadc . Extent . CxAttr = int64 ( float64 ( w * _cg . Pixel72 ) / _cg . EMU ) ; _fdbc . _fadc . Extent . CyAttr = int64 ( float64 ( h * _cg . Pixel72 ) / _cg . EMU ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Clear resets the numbering.
func ( _caga Numbering ) Clear ( ) { _caga . _fbd . AbstractNum = nil ; _caga . _fbd . Num = nil ; _caga . _fbd . NumIdMacAtCleanup = nil ; _caga . _fbd . NumPicBullet = nil ; } ; func _dae ( _dabe * _edb . CT_TblWidth , _baf _cg . Distance ) { _dabe . TypeAttr = _edb . ST_TblWidthDxa ; _dabe . WAttr = & _edb . ST_MeasurementOrPercent { } ; _dabe . WAttr . ST_DecimalNumberOrPercent = & _edb . ST_DecimalNumberOrPercent { } ; _dabe . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _c . Int64 ( int64 ( _baf / _cg . Dxa ) ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Caps returns true if run font is capitalized.
func ( _bcfc RunProperties ) Caps ( ) bool { return _bgbe ( _bcfc . _ccbg . Caps ) } ;
2017-08-28 20:56:18 -05:00
2020-11-09 01:00:18 +00:00
// Open opens and reads a document from a file (.docx).
func Open ( filename string ) ( * Document , error ) { _cbe , _abee := _d . Open ( filename ) ; if _abee != nil { return nil , _cb . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _abee ) ; } ; defer _cbe . Close ( ) ; _fab , _abee := _d . Stat ( filename ) ; if _abee != nil { return nil , _cb . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _abee ) ; } ; _ = _fab ; return Read ( _cbe , _fab . Size ( ) ) ; } ; func ( _cbdc Run ) newIC ( ) * _edb . EG_RunInnerContent { _cfecg := _edb . NewEG_RunInnerContent ( ) ; _cbdc . _abcbb . EG_RunInnerContent = append ( _cbdc . _abcbb . EG_RunInnerContent , _cfecg ) ; return _cfecg ; } ;
2020-03-13 09:53:51 +00:00
2020-10-12 13:59:12 +00:00
// Underline returns the type of paragraph underline.
2020-11-09 01:00:18 +00:00
func ( _bgafe ParagraphProperties ) Underline ( ) _edb . ST_Underline { if _adgae := _bgafe . _beefd . RPr . U ; _adgae != nil { return _adgae . ValAttr ; } ; return 0 ; } ;
2020-03-13 09:53:51 +00:00
2020-11-09 01:00:18 +00:00
// AddDrawingInline adds an inline drawing from an ImageRef.
func ( _fbbg Run ) AddDrawingInline ( img _da . ImageRef ) ( InlineDrawing , error ) { _fgbd := _fbbg . newIC ( ) ; _fgbd . Drawing = _edb . NewCT_Drawing ( ) ; _effcc := _edb . NewWdInline ( ) ; _efecc := InlineDrawing { _fbbg . _ddgb , _effcc } ; _effcc . CNvGraphicFramePr = _gg . NewCT_NonVisualGraphicFrameProperties ( ) ; _fgbd . Drawing . Inline = append ( _fgbd . Drawing . Inline , _effcc ) ; _effcc . Graphic = _gg . NewGraphic ( ) ; _effcc . Graphic . GraphicData = _gg . NewCT_GraphicalObjectData ( ) ; _effcc . Graphic . GraphicData . UriAttr = "\u0068\u0074\u0074\u0070\u003a\u002f/\u0073\u0063\u0068e\u006d\u0061\u0073.\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006f\u0072m\u0061\u0074\u0073\u002e\u006frg\u002f\u0064\u0072\u0061\u0077\u0069\u006e\u0067\u006d\u006c\u002f\u0032\u0030\u0030\u0036\u002f\u0070\u0069\u0063\u0074\u0075\u0072\u0065" ; _effcc . DistTAttr = _c . Uint32 ( 0 ) ; _effcc . DistLAttr = _c . Uint32 ( 0 ) ; _effcc . DistBAttr = _c . Uint32 ( 0 ) ; _effcc . DistRAttr = _c . Uint32 ( 0 ) ; _effcc . Extent . CxAttr = int64 ( float64 ( img . Size ( ) . X * _cg . Pixel72 ) / _cg . EMU ) ; _effcc . Extent . CyAttr = int64 ( float64 ( img . Size ( ) . Y * _cg . Pixel72 ) / _cg . EMU ) ; _ebdd := 0x7FFFFFFF & _b . Uint32 ( ) ; _effcc . DocPr . IdAttr = _ebdd ; _ebbd := _cd . NewPic ( ) ; _ebbd . NvPicPr . CNvPr . IdAttr = _ebdd ; _ceab := img . RelID ( ) ; if _ceab == "" { return _efecc , _f . New ( "\u0063\u006f\u0075\u006c\u0064\u006e\u0027\u0074\u0020\u0066\u0069\u006e\u0064\u0020\u0072\u0065\u0066\u0065\u0072\u0065n\u0063\u0065\u0020\u0074\u006f\u0020\u0069\u006d\u0061g\u0065\u0020\u0077\u0069\u0074\u0068\u0069\u006e\u0020\u0064\u006f\u0063\u0075m\u0065\u006e\u0074\u0020\u0072\u0065l\u0061\u0074\u0069o\u006e\u0073" ) ; } ; _effcc . Graphic . GraphicData . Any = append ( _effcc . Graphic . GraphicData . Any , _ebbd ) ; _ebbd . BlipFill = _gg . NewCT_BlipFillProperties ( ) ; _ebbd . BlipFill . Blip = _gg . NewCT_Blip ( ) ; _ebbd . BlipFill . Blip . EmbedAttr = & _ceab ; _ebbd . BlipFill . Stretch = _gg . NewCT_StretchInfoProperties ( ) ; _ebbd . BlipFill . Stretch . FillRect = _gg . NewCT_RelativeRect ( ) ; _ebbd . SpPr = _gg . NewCT_ShapeProperties ( ) ; _ebbd . SpPr . Xfrm = _gg . NewCT_Transform2D ( ) ; _ebbd . SpPr . Xfrm . Off = _gg . NewCT_Point2D ( ) ; _ebbd . SpPr . Xfrm . Off . XAttr . ST_CoordinateUnqualified = _c . Int64 ( 0 ) ; _ebbd . SpPr . Xfrm . Off . YAttr . ST_CoordinateUnqualified = _c . Int64 ( 0 ) ; _ebbd . SpPr . Xfrm . Ext = _gg . NewCT_PositiveSize2D ( ) ; _ebbd . SpPr . Xfrm . Ext . CxAttr = int64 ( img . Size ( ) . X * _cg . Point ) ; _ebbd . SpPr . Xfrm . Ext . CyAttr = int64 ( img . Size ( ) . Y * _cg . Point ) ; _ebbd . SpPr . PrstGeom = _gg . NewCT_PresetGeometry2D ( ) ; _ebbd . SpPr . PrstGeom . PrstAttr = _gg . ST_ShapeTypeRect ; return _efecc , nil ; } ;
2020-03-13 09:53:51 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _fecdb ParagraphStyleProperties ) X ( ) * _edb . CT_PPrGeneral { return _fecdb . _bggb } ;
2020-03-13 09:53:51 +00:00
2020-11-09 01:00:18 +00:00
// SetImprint sets the run to imprinted text.
func ( _cefdc RunProperties ) SetImprint ( b bool ) { if ! b { _cefdc . _ccbg . Imprint = nil ; } else { _cefdc . _ccbg . Imprint = _edb . NewCT_OnOff ( ) ; } ; } ;
2020-03-13 09:53:51 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _egd Footnote ) X ( ) * _edb . CT_FtnEdn { return _egd . _gfff } ;
2020-03-13 09:53:51 +00:00
2020-11-09 01:00:18 +00:00
// MergeFields returns the list of all mail merge fields found in the document.
func ( _ggcg Document ) MergeFields ( ) [ ] string { _dbfe := map [ string ] struct { } { } ; for _ , _bbdg := range _ggcg . mergeFields ( ) { _dbfe [ _bbdg . _dabga ] = struct { } { } ; } ; _cceee := [ ] string { } ; for _ffe := range _dbfe { _cceee = append ( _cceee , _ffe ) ; } ; return _cceee ; } ;
2017-08-28 20:56:18 -05:00
2020-11-09 01:00:18 +00:00
// SetUnhideWhenUsed controls if a semi hidden style becomes visible when used.
func ( _adcaf Style ) SetUnhideWhenUsed ( b bool ) { if b { _adcaf . _abcbf . UnhideWhenUsed = _edb . NewCT_OnOff ( ) ; } else { _adcaf . _abcbf . UnhideWhenUsed = nil ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// RowProperties are the properties for a row within a table
type RowProperties struct { _ecgga * _edb . CT_TrPr } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Footnote is an individual footnote reference within the document.
type Footnote struct { _agea * Document ; _gfff * _edb . CT_FtnEdn ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetWidth sets the cell width to a specified width.
func ( _dgcd CellProperties ) SetWidth ( d _cg . Distance ) { _dgcd . _dcb . TcW = _edb . NewCT_TblWidth ( ) ; _dgcd . _dcb . TcW . TypeAttr = _edb . ST_TblWidthDxa ; _dgcd . _dcb . TcW . WAttr = & _edb . ST_MeasurementOrPercent { } ; _dgcd . _dcb . TcW . WAttr . ST_DecimalNumberOrPercent = & _edb . ST_DecimalNumberOrPercent { } ; _dgcd . _dcb . TcW . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _c . Int64 ( int64 ( d / _cg . Twips ) ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddTabStop adds a tab stop to the paragraph. It controls the position of text when using Run.AddTab()
func ( _bcf ParagraphProperties ) AddTabStop ( position _cg . Distance , justificaton _edb . ST_TabJc , leader _edb . ST_TabTlc ) { if _bcf . _beefd . Tabs == nil { _bcf . _beefd . Tabs = _edb . NewCT_Tabs ( ) ; } ; _edda := _edb . NewCT_TabStop ( ) ; _edda . LeaderAttr = leader ; _edda . ValAttr = justificaton ; _edda . PosAttr . Int64 = _c . Int64 ( int64 ( position / _cg . Twips ) ) ; _bcf . _beefd . Tabs . Tab = append ( _bcf . _beefd . Tabs . Tab , _edda ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// RunProperties returns the run style properties.
func ( _cbfg Style ) RunProperties ( ) RunProperties { if _cbfg . _abcbf . RPr == nil { _cbfg . _abcbf . RPr = _edb . NewCT_RPr ( ) ; } ; return RunProperties { _cbfg . _abcbf . RPr } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// VerticalAlign returns the value of run vertical align.
func ( _cccd RunProperties ) VerticalAlignment ( ) _cbc . ST_VerticalAlignRun { if _ecefa := _cccd . _ccbg . VertAlign ; _ecefa != nil { return _ecefa . ValAttr ; } ; return 0 ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// GetHeader gets a section Header for given type t [ST_HdrFtrDefault, ST_HdrFtrEven, ST_HdrFtrFirst]
func ( _addgc Section ) GetHeader ( t _edb . ST_HdrFtr ) ( Header , bool ) { for _ , _ebafe := range _addgc . _gecd . EG_HdrFtrReferences { if _ebafe . HeaderReference . TypeAttr == t { for _ , _bfed := range _addgc . _egbea . Headers ( ) { _fccf := _addgc . _egbea . _gcgf . FindRIDForN ( _bfed . Index ( ) , _c . HeaderType ) ; if _fccf == _ebafe . HeaderReference . IdAttr { return _bfed , true ; } ; } ; } ; } ; return Header { } , false ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetHorizontalBanding controls the conditional formatting for horizontal banding.
func ( _dacg TableLook ) SetHorizontalBanding ( on bool ) { if ! on { _dacg . _dddgf . NoHBandAttr = & _cbc . ST_OnOff { } ; _dacg . _dddgf . NoHBandAttr . ST_OnOff1 = _cbc . ST_OnOff1On ; } else { _dacg . _dddgf . NoHBandAttr = & _cbc . ST_OnOff { } ; _dacg . _dddgf . NoHBandAttr . ST_OnOff1 = _cbc . ST_OnOff1Off ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// NewTableWidth returns a newly intialized TableWidth
func NewTableWidth ( ) TableWidth { return TableWidth { _edb . NewCT_TblWidth ( ) } } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Fonts allows manipulating a style or run's fonts.
type Fonts struct { _adddd * _edb . CT_Fonts } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetStart sets the cell start margin
func ( _fdc CellMargins ) SetStart ( d _cg . Distance ) { _fdc . _ead . Start = _edb . NewCT_TblWidth ( ) ; _dae ( _fdc . _ead . Start , d ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// IsFootnote returns a bool based on whether the run has a
// footnote or not. Returns both a bool as to whether it has
// a footnote as well as the ID of the footnote.
func ( _gec Run ) IsFootnote ( ) ( bool , int64 ) { if _gec . _abcbb . EG_RunInnerContent != nil { if _gec . _abcbb . EG_RunInnerContent [ 0 ] . FootnoteReference != nil { return true , _gec . _abcbb . EG_RunInnerContent [ 0 ] . FootnoteReference . IdAttr ; } ; } ; return false , 0 ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Bold returns true if run font is bold.
func ( _ccec RunProperties ) Bold ( ) bool { _edcfg := _ccec . _ccbg ; return _bgbe ( _edcfg . B ) || _bgbe ( _edcfg . BCs ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AnchoredDrawing is an absolutely positioned image within a document page.
type AnchoredDrawing struct { _eb * Document ; _eef * _edb . WdAnchor ; } ;
2020-10-12 13:59:12 +00:00
2020-11-09 01:00:18 +00:00
// SetBeforeAuto controls if spacing before a paragraph is automatically determined.
func ( _edbe ParagraphSpacing ) SetBeforeAuto ( b bool ) { if b { _edbe . _cgdgb . BeforeAutospacingAttr = & _cbc . ST_OnOff { } ; _edbe . _cgdgb . BeforeAutospacingAttr . Bool = _c . Bool ( true ) ; } else { _edbe . _cgdgb . BeforeAutospacingAttr = nil ; } ; } ; func ( _gcdf * Document ) InsertTableBefore ( relativeTo Paragraph ) Table { return _gcdf . insertTable ( relativeTo , true ) ; } ;
2020-10-12 13:59:12 +00:00
// X returns the inner wrapped XML type.
2020-11-09 01:00:18 +00:00
func ( _fdebf Styles ) X ( ) * _edb . Styles { return _fdebf . _fdee } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetTargetByRef sets the URL target of the hyperlink and is more efficient if a link
// destination will be used many times.
func ( _gffa HyperLink ) SetTargetByRef ( link _da . Hyperlink ) { _gffa . _fffed . IdAttr = _c . String ( _da . Relationship ( link ) . ID ( ) ) ; _gffa . _fffed . AnchorAttr = nil ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _aacc TableConditionalFormatting ) X ( ) * _edb . CT_TblStylePr { return _aacc . _efgd } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// TableConditionalFormatting returns a conditional formatting object of a given
// type. Calling this method repeatedly will return the same object.
func ( _bfafb Style ) TableConditionalFormatting ( typ _edb . ST_TblStyleOverrideType ) TableConditionalFormatting { for _ , _eceb := range _bfafb . _abcbf . TblStylePr { if _eceb . TypeAttr == typ { return TableConditionalFormatting { _eceb } ; } ; } ; _ffcf := _edb . NewCT_TblStylePr ( ) ; _ffcf . TypeAttr = typ ; _bfafb . _abcbf . TblStylePr = append ( _bfafb . _abcbf . TblStylePr , _ffcf ) ; return TableConditionalFormatting { _ffcf } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddCheckBox adds checkbox form field to the paragraph and returns it.
func ( _aeee Paragraph ) AddCheckBox ( name string ) FormField { _gdae := _aeee . addFldCharsForField ( name , "\u0046\u004f\u0052M\u0043\u0048\u0045\u0043\u004b\u0042\u004f\u0058" ) ; _gdae . _aaed . CheckBox = _edb . NewCT_FFCheckBox ( ) ; return _gdae ; } ; func ( _cgad Paragraph ) addEndFldChar ( ) * _edb . CT_FldChar { _gfag := _cgad . addFldChar ( ) ; _gfag . FldCharTypeAttr = _edb . ST_FldCharTypeEnd ; return _gfag ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Color returns the style's Color.
func ( _egfgb RunProperties ) Color ( ) Color { if _egfgb . _ccbg . Color == nil { _egfgb . _ccbg . Color = _edb . NewCT_Color ( ) ; } ; return Color { _egfgb . _ccbg . Color } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _bbfd Table ) X ( ) * _edb . CT_Tbl { return _bbfd . _cbcgd } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// ClearContent clears any content in the run (text, tabs, breaks, etc.)
func ( _cbba Run ) ClearContent ( ) { _cbba . _abcbb . EG_RunInnerContent = nil } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetToolTip sets the tooltip text for a hyperlink.
func ( _abb HyperLink ) SetToolTip ( text string ) { if text == "" { _abb . _fffed . TooltipAttr = nil ; } else { _abb . _fffed . TooltipAttr = _c . String ( text ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Name returns the name of the bookmark whcih is the document unique ID that
// identifies the bookmark.
func ( _cc Bookmark ) Name ( ) string { return _cc . _afa . NameAttr } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetInsideVertical sets the interior vertical borders to a specified type, color and thickness.
func ( _ggbf TableBorders ) SetInsideVertical ( t _edb . ST_Border , c _fb . Color , thickness _cg . Distance ) { _ggbf . _dgac . InsideV = _edb . NewCT_Border ( ) ; _gaca ( _ggbf . _dgac . InsideV , t , c , thickness ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _fega TableWidth ) X ( ) * _edb . CT_TblWidth { return _fega . _gbcgc } ; const _bdd = "\u0046\u006f\u0072\u006d\u0046\u0069\u0065l\u0064\u0054\u0079\u0070\u0065\u0055\u006e\u006b\u006e\u006f\u0077\u006e\u0046\u006fr\u006dF\u0069\u0065\u006c\u0064\u0054\u0079p\u0065\u0054\u0065\u0078\u0074\u0046\u006fr\u006d\u0046\u0069\u0065\u006c\u0064\u0054\u0079\u0070\u0065\u0043\u0068\u0065\u0063\u006b\u0042\u006f\u0078\u0046\u006f\u0072\u006d\u0046i\u0065\u006c\u0064\u0054\u0079\u0070\u0065\u0044\u0072\u006f\u0070\u0044\u006fw\u006e" ; func _dbe ( _deeag * _edb . CT_P , _deae map [ string ] string ) { for _ , _cfcd := range _deeag . EG_PContent { for _ , _dgcb := range _cfcd . EG_ContentRunContent { if _dgcb . R != nil { for _ , _caec := range _dgcb . R . EG_RunInnerContent { _effc := _caec . Drawing ; if _effc != nil { for _ , _cefd := range _effc . Anchor { for _ , _dged := range _cefd . Graphic . GraphicData . Any { switch _bceg := _dged . ( type ) { case * _cd . Pic : if _bceg . BlipFill != nil && _bceg . BlipFill . Blip != nil { _gafb ( _bceg . BlipFill . Blip , _deae ) ; } ; default : } ; } ; } ; for _ , _dcbe := range _effc . Inline { for _ , _gabg := range _dcbe . Graphic . GraphicData . Any { switch _bgda := _gabg . ( type ) { case * _cd . Pic : if _bgda . BlipFill != nil && _bgda . BlipFill . Blip != nil { _gafb ( _bgda . BlipFill . Blip , _deae ) ; } ; default : } ; } ; } ; } ; } ; } ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// DoubleStrike returns true if paragraph is double striked.
func ( _gcgd ParagraphProperties ) DoubleStrike ( ) bool { return _bgbe ( _gcgd . _beefd . RPr . Dstrike ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetTopPct sets the cell top margin
func ( _gab CellMargins ) SetTopPct ( pct float64 ) { _gab . _ead . Top = _edb . NewCT_TblWidth ( ) ; _cgc ( _gab . _ead . Top , pct ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetShading controls the cell shading.
func ( _dee CellProperties ) SetShading ( shd _edb . ST_Shd , foreground , fill _fb . Color ) { if shd == _edb . ST_ShdUnset { _dee . _dcb . Shd = nil ; } else { _dee . _dcb . Shd = _edb . NewCT_Shd ( ) ; _dee . _dcb . Shd . ValAttr = shd ; _dee . _dcb . Shd . ColorAttr = & _edb . ST_HexColor { } ; if foreground . IsAuto ( ) { _dee . _dcb . Shd . ColorAttr . ST_HexColorAuto = _edb . ST_HexColorAutoAuto ; } else { _dee . _dcb . Shd . ColorAttr . ST_HexColorRGB = foreground . AsRGBString ( ) ; } ; _dee . _dcb . Shd . FillAttr = & _edb . ST_HexColor { } ; if fill . IsAuto ( ) { _dee . _dcb . Shd . FillAttr . ST_HexColorAuto = _edb . ST_HexColorAutoAuto ; } else { _dee . _dcb . Shd . FillAttr . ST_HexColorRGB = fill . AsRGBString ( ) ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetTop sets the cell top margin
func ( _gfb CellMargins ) SetTop ( d _cg . Distance ) { _gfb . _ead . Top = _edb . NewCT_TblWidth ( ) ; _dae ( _gfb . _ead . Top , d ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// ParagraphStyleProperties is the styling information for a paragraph.
type ParagraphStyleProperties struct { _bggb * _edb . CT_PPrGeneral } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddField adds a field (automatically computed text) to the document.
func ( _cfcdg Run ) AddField ( code string ) { _cfcdg . AddFieldWithFormatting ( code , "" , true ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Font returns the name of paragraph font family.
func ( _cabcc ParagraphProperties ) Font ( ) string { if _dbgc := _cabcc . _beefd . RPr . RFonts ; _dbgc != nil { if _dbgc . AsciiAttr != nil { return * _dbgc . AsciiAttr ; } else if _dbgc . HAnsiAttr != nil { return * _dbgc . HAnsiAttr ; } else if _dbgc . CsAttr != nil { return * _dbgc . CsAttr ; } ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// EastAsiaFont returns the name of run font family for East Asia.
func ( _cdbd RunProperties ) EastAsiaFont ( ) string { if _egcf := _cdbd . _ccbg . RFonts ; _egcf != nil { if _egcf . EastAsiaAttr != nil { return * _egcf . EastAsiaAttr ; } ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Close closes the document, removing any temporary files that might have been
// created when opening a document.
func ( _fegd * Document ) Close ( ) error { if _fegd . TmpPath != "" { return _ed . RemoveAll ( _fegd . TmpPath ) ; } ; return nil ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Outline returns true if paragraph outline is on.
func ( _bafd ParagraphProperties ) Outline ( ) bool { return _bgbe ( _bafd . _beefd . RPr . Outline ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// RStyle returns the name of character style.
// It is defined here http://officeopenxml.com/WPstyleCharStyles.php
func ( _dbca ParagraphProperties ) RStyle ( ) string { if _dbca . _beefd . RPr . RStyle != nil { return _dbca . _beefd . RPr . RStyle . ValAttr ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// FormField is a form within a document. It references the document, so changes
// to the form field wil be reflected in the document if it is saved.
type FormField struct { _aaed * _edb . CT_FFData ; _cgba * _edb . EG_RunInnerContent ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetSemiHidden controls if the style is hidden in the UI.
func ( _ffge Style ) SetSemiHidden ( b bool ) { if b { _ffge . _abcbf . SemiHidden = _edb . NewCT_OnOff ( ) ; } else { _ffge . _abcbf . SemiHidden = nil ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// ItalicValue returns the precise nature of the italic setting (unset, off or on).
func ( _gbbe RunProperties ) ItalicValue ( ) OnOffValue { return _daeg ( _gbbe . _ccbg . I ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// ComplexSizeValue returns the value of paragraph font size for complex fonts in points.
func ( _agf ParagraphProperties ) ComplexSizeValue ( ) float64 { if _dggg := _agf . _beefd . RPr . SzCs ; _dggg != nil { _fbagb := _dggg . ValAttr ; if _fbagb . ST_UnsignedDecimalNumber != nil { return float64 ( * _fbagb . ST_UnsignedDecimalNumber ) / 2 ; } ; } ; return 0.0 ; } ;
2020-08-31 22:58:25 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _gdcf TableStyleProperties ) X ( ) * _edb . CT_TblPrBase { return _gdcf . _caead } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetFontFamily sets the Ascii & HAnsi fonly family for a run.
func ( _dggaa RunProperties ) SetFontFamily ( family string ) { if _dggaa . _ccbg . RFonts == nil { _dggaa . _ccbg . RFonts = _edb . NewCT_Fonts ( ) ; } ; _dggaa . _ccbg . RFonts . AsciiAttr = _c . String ( family ) ; _dggaa . _ccbg . RFonts . HAnsiAttr = _c . String ( family ) ; _dggaa . _ccbg . RFonts . EastAsiaAttr = _c . String ( family ) ; } ; func ( _ggeb * Document ) InsertTableAfter ( relativeTo Paragraph ) Table { return _ggeb . insertTable ( relativeTo , false ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetCharacterSpacing sets the run's Character Spacing Adjustment.
func ( _cebc RunProperties ) SetCharacterSpacing ( size _cg . Distance ) { _cebc . _ccbg . Spacing = _edb . NewCT_SignedTwipsMeasure ( ) ; _cebc . _ccbg . Spacing . ValAttr . Int64 = _c . Int64 ( int64 ( size / _cg . Twips ) ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Paragraphs returns the paragraphs defined in a footer.
func ( _ggbd Footer ) Paragraphs ( ) [ ] Paragraph { _ecef := [ ] Paragraph { } ; for _ , _fbed := range _ggbd . _dbcd . EG_ContentBlockContent { for _ , _ceeg := range _fbed . P { _ecef = append ( _ecef , Paragraph { _ggbd . _aecf , _ceeg } ) ; } ; } ; for _ , _cfda := range _ggbd . Tables ( ) { for _ , _cefdb := range _cfda . Rows ( ) { for _ , _bdfc := range _cefdb . Cells ( ) { _ecef = append ( _ecef , _bdfc . Paragraphs ( ) ... ) ; } ; } ; } ; return _ecef ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// RemoveRun removes a child run from a paragraph.
func ( _aabc Paragraph ) RemoveRun ( r Run ) { for _ , _ebgc := range _aabc . _ccdca . EG_PContent { for _acgg , _bbgcc := range _ebgc . EG_ContentRunContent { if _bbgcc . R == r . _abcbb { copy ( _ebgc . EG_ContentRunContent [ _acgg : ] , _ebgc . EG_ContentRunContent [ _acgg + 1 : ] ) ; _ebgc . EG_ContentRunContent = _ebgc . EG_ContentRunContent [ 0 : len ( _ebgc . EG_ContentRunContent ) - 1 ] ; } ; if _bbgcc . Sdt != nil && _bbgcc . Sdt . SdtContent != nil { for _bfadd , _eaca := range _bbgcc . Sdt . SdtContent . EG_ContentRunContent { if _eaca . R == r . _abcbb { copy ( _bbgcc . Sdt . SdtContent . EG_ContentRunContent [ _bfadd : ] , _bbgcc . Sdt . SdtContent . EG_ContentRunContent [ _bfadd + 1 : ] ) ; _bbgcc . Sdt . SdtContent . EG_ContentRunContent = _bbgcc . Sdt . SdtContent . EG_ContentRunContent [ 0 : len ( _bbgcc . Sdt . SdtContent . EG_ContentRunContent ) - 1 ] ; } ; } ; } ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.
func ( _fggag RunProperties ) SizeMeasure ( ) string { if _cgcf := _fggag . _ccbg . Sz ; _cgcf != nil { _gbcb := _cgcf . ValAttr ; if _gbcb . ST_PositiveUniversalMeasure != nil { return * _gbcb . ST_PositiveUniversalMeasure ; } ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetDoubleStrikeThrough sets the run to double strike-through.
func ( _gaga RunProperties ) SetDoubleStrikeThrough ( b bool ) { if ! b { _gaga . _ccbg . Dstrike = nil ; } else { _gaga . _ccbg . Dstrike = _edb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetSize sets the size of the displayed image on the page.
func ( _ace AnchoredDrawing ) SetSize ( w , h _cg . Distance ) { _ace . _eef . Extent . CxAttr = int64 ( float64 ( w * _cg . Pixel72 ) / _cg . EMU ) ; _ace . _eef . Extent . CyAttr = int64 ( float64 ( h * _cg . Pixel72 ) / _cg . EMU ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetFirstColumn controls the conditional formatting for the first column in a table.
func ( _cafe TableLook ) SetFirstColumn ( on bool ) { if ! on { _cafe . _dddgf . FirstColumnAttr = & _cbc . ST_OnOff { } ; _cafe . _dddgf . FirstColumnAttr . ST_OnOff1 = _cbc . ST_OnOff1Off ; } else { _cafe . _dddgf . FirstColumnAttr = & _cbc . ST_OnOff { } ; _cafe . _dddgf . FirstColumnAttr . ST_OnOff1 = _cbc . ST_OnOff1On ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// InsertRunBefore inserts a run in the paragraph before the relative run.
func ( _gacbc Paragraph ) InsertRunBefore ( relativeTo Run ) Run { return _gacbc . insertRun ( relativeTo , true ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// UnderlineColor returns the hex color value of paragraph underline.
func ( _ggecg ParagraphProperties ) UnderlineColor ( ) string { if _egac := _ggecg . _beefd . RPr . U ; _egac != nil { _ecefc := _egac . ColorAttr ; if _ecefc != nil && _ecefc . ST_HexColorRGB != nil { return * _ecefc . ST_HexColorRGB ; } ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddFieldWithFormatting adds a field (automatically computed text) to the
// document with field specifc formatting.
func ( _daag Run ) AddFieldWithFormatting ( code string , fmt string , isDirty bool ) { _ecgc := _daag . newIC ( ) ; _ecgc . FldChar = _edb . NewCT_FldChar ( ) ; _ecgc . FldChar . FldCharTypeAttr = _edb . ST_FldCharTypeBegin ; if isDirty { _ecgc . FldChar . DirtyAttr = & _cbc . ST_OnOff { } ; _ecgc . FldChar . DirtyAttr . Bool = _c . Bool ( true ) ; } ; _ecgc = _daag . newIC ( ) ; _ecgc . InstrText = _edb . NewCT_Text ( ) ; if fmt != "" { _ecgc . InstrText . Content = code + "\u0020" + fmt ; } else { _ecgc . InstrText . Content = code ; } ; _ecgc = _daag . newIC ( ) ; _ecgc . FldChar = _edb . NewCT_FldChar ( ) ; _ecgc . FldChar . FldCharTypeAttr = _edb . ST_FldCharTypeEnd ; } ;
2020-08-23 14:15:53 +00:00
2020-10-12 13:59:12 +00:00
// X returns the inner wrapped XML type.
2020-11-09 01:00:18 +00:00
func ( _fdf Bookmark ) X ( ) * _edb . CT_Bookmark { return _fdf . _afa } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetPageMargins sets the page margins for a section
func ( _dabgag Section ) SetPageMargins ( top , right , bottom , left , header , footer , gutter _cg . Distance ) { _bffd := _edb . NewCT_PageMar ( ) ; _bffd . TopAttr . Int64 = _c . Int64 ( int64 ( top / _cg . Twips ) ) ; _bffd . BottomAttr . Int64 = _c . Int64 ( int64 ( bottom / _cg . Twips ) ) ; _bffd . RightAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( right / _cg . Twips ) ) ; _bffd . LeftAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( left / _cg . Twips ) ) ; _bffd . HeaderAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( header / _cg . Twips ) ) ; _bffd . FooterAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( footer / _cg . Twips ) ) ; _bffd . GutterAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( gutter / _cg . Twips ) ) ; _dabgag . _gecd . PgMar = _bffd ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Definitions returns the defined numbering definitions.
func ( _ebfd Numbering ) Definitions ( ) [ ] NumberingDefinition { _gcegf := [ ] NumberingDefinition { } ; for _ , _bafgc := range _ebfd . _fbd . AbstractNum { _gcegf = append ( _gcegf , NumberingDefinition { _bafgc } ) ; } ; return _gcegf ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped type
func ( _dgd CellBorders ) X ( ) * _edb . CT_TcBorders { return _dgd . _gcg } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetLinkedStyle sets the style that this style is linked to.
func ( _eaaf Style ) SetLinkedStyle ( name string ) { if name == "" { _eaaf . _abcbf . Link = nil ; } else { _eaaf . _abcbf . Link = _edb . NewCT_String ( ) ; _eaaf . _abcbf . Link . ValAttr = name ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetEastAsiaTheme sets the font East Asia Theme.
func ( _cfdd Fonts ) SetEastAsiaTheme ( t _edb . ST_Theme ) { _cfdd . _adddd . EastAsiaThemeAttr = t } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetEmboss sets the run to embossed text.
func ( _afff RunProperties ) SetEmboss ( b bool ) { if ! b { _afff . _ccbg . Emboss = nil ; } else { _afff . _ccbg . Emboss = _edb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Strike returns true if paragraph is striked.
func ( _faab ParagraphProperties ) Strike ( ) bool { return _bgbe ( _faab . _beefd . RPr . Strike ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetStartIndent controls the start indentation.
func ( _dgdc ParagraphProperties ) SetStartIndent ( m _cg . Distance ) { if _dgdc . _beefd . Ind == nil { _dgdc . _beefd . Ind = _edb . NewCT_Ind ( ) ; } ; if m == _cg . Zero { _dgdc . _beefd . Ind . StartAttr = nil ; } else { _dgdc . _beefd . Ind . StartAttr = & _edb . ST_SignedTwipsMeasure { } ; _dgdc . _beefd . Ind . StartAttr . Int64 = _c . Int64 ( int64 ( m / _cg . Twips ) ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// TableLook returns the table look, or conditional formatting applied to a table style.
func ( _gefb TableProperties ) TableLook ( ) TableLook { if _gefb . _eebbg . TblLook == nil { _gefb . _eebbg . TblLook = _edb . NewCT_TblLook ( ) ; } ; return TableLook { _gefb . _eebbg . TblLook } ; } ;
2017-08-28 20:56:18 -05:00
2020-11-09 01:00:18 +00:00
// SetLineSpacing sets the spacing between lines in a paragraph.
func ( _eafc ParagraphSpacing ) SetLineSpacing ( d _cg . Distance , rule _edb . ST_LineSpacingRule ) { if rule == _edb . ST_LineSpacingRuleUnset { _eafc . _cgdgb . LineRuleAttr = _edb . ST_LineSpacingRuleUnset ; _eafc . _cgdgb . LineAttr = nil ; } else { _eafc . _cgdgb . LineRuleAttr = rule ; _eafc . _cgdgb . LineAttr = & _edb . ST_SignedTwipsMeasure { } ; _eafc . _cgdgb . LineAttr . Int64 = _c . Int64 ( int64 ( d / _cg . Twips ) ) ; } ; } ;
2017-08-30 16:49:57 -05:00
2020-11-09 01:00:18 +00:00
// AddLevel adds a new numbering level to a NumberingDefinition.
func ( _edbd NumberingDefinition ) AddLevel ( ) NumberingLevel { _adeb := _edb . NewCT_Lvl ( ) ; _adeb . Start = & _edb . CT_DecimalNumber { ValAttr : 1 } ; _adeb . IlvlAttr = int64 ( len ( _edbd . _begd . Lvl ) ) ; _edbd . _begd . Lvl = append ( _edbd . _begd . Lvl , _adeb ) ; return NumberingLevel { _adeb } ; } ;
2017-08-28 20:56:18 -05:00
2020-11-09 01:00:18 +00:00
// RemoveParagraph removes a paragraph from a footer.
func ( _ddeb Header ) RemoveParagraph ( p Paragraph ) { for _ , _ecfc := range _ddeb . _decf . EG_ContentBlockContent { for _bgab , _cgg := range _ecfc . P { if _cgg == p . _ccdca { copy ( _ecfc . P [ _bgab : ] , _ecfc . P [ _bgab + 1 : ] ) ; _ecfc . P = _ecfc . P [ 0 : len ( _ecfc . P ) - 1 ] ; return ; } ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetCellSpacingAuto sets the cell spacing within a table to automatic.
func ( _fdebd TableProperties ) SetCellSpacingAuto ( ) { _fdebd . _eebbg . TblCellSpacing = _edb . NewCT_TblWidth ( ) ; _fdebd . _eebbg . TblCellSpacing . TypeAttr = _edb . ST_TblWidthAuto ; } ;
2020-10-12 13:59:12 +00:00
2020-11-09 01:00:18 +00:00
// SetAll sets all of the borders to a given value.
func ( _gaac TableBorders ) SetAll ( t _edb . ST_Border , c _fb . Color , thickness _cg . Distance ) { _gaac . SetBottom ( t , c , thickness ) ; _gaac . SetLeft ( t , c , thickness ) ; _gaac . SetRight ( t , c , thickness ) ; _gaac . SetTop ( t , c , thickness ) ; _gaac . SetInsideHorizontal ( t , c , thickness ) ; _gaac . SetInsideVertical ( t , c , thickness ) ; } ;
2020-10-12 13:59:12 +00:00
2020-11-09 01:00:18 +00:00
// AddCell adds a cell to a row and returns it
func ( _fefg Row ) AddCell ( ) Cell { _ccbd := _edb . NewEG_ContentCellContent ( ) ; _fefg . _eaeb . EG_ContentCellContent = append ( _fefg . _eaeb . EG_ContentCellContent , _ccbd ) ; _facd := _edb . NewCT_Tc ( ) ; _ccbd . Tc = append ( _ccbd . Tc , _facd ) ; return Cell { _fefg . _fgfab , _facd } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetVAlignment sets the vertical alignment for an anchored image.
func ( _gge AnchoredDrawing ) SetVAlignment ( v _edb . WdST_AlignV ) { _gge . _eef . PositionV . Choice = & _edb . WdCT_PosVChoice { } ; _gge . _eef . PositionV . Choice . Align = v ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetSmallCaps sets the run to small caps.
func ( _eggfff RunProperties ) SetSmallCaps ( b bool ) { if ! b { _eggfff . _ccbg . SmallCaps = nil ; } else { _eggfff . _ccbg . SmallCaps = _edb . NewCT_OnOff ( ) ; } ; } ;
// RemoveEndnote removes a endnote from both the paragraph and the document
// the requested endnote must be anchored on the paragraph being referenced.
func ( _eadc Paragraph ) RemoveEndnote ( id int64 ) { _cbcb := _eadc . _debe . _dacb ; var _fgff int ; for _dggf , _gbc := range _cbcb . CT_Endnotes . Endnote { if _gbc . IdAttr == id { _fgff = _dggf ; } ; } ; _fgff = 0 ; _cbcb . CT_Endnotes . Endnote [ _fgff ] = nil ; _cbcb . CT_Endnotes . Endnote [ _fgff ] = _cbcb . CT_Endnotes . Endnote [ len ( _cbcb . CT_Endnotes . Endnote ) - 1 ] ; _cbcb . CT_Endnotes . Endnote = _cbcb . CT_Endnotes . Endnote [ : len ( _cbcb . CT_Endnotes . Endnote ) - 1 ] ; var _ggbg Run ; for _ , _ccgb := range _eadc . Runs ( ) { if _eggfb , _abfad := _ccgb . IsEndnote ( ) ; _eggfb { if _abfad == id { _ggbg = _ccgb ; } ; } ; } ; _eadc . RemoveRun ( _ggbg ) ; } ;
2020-08-23 14:15:53 +00:00
2020-10-12 13:59:12 +00:00
// SetCellSpacing sets the cell spacing within a table.
2020-11-09 01:00:18 +00:00
func ( _gage TableProperties ) SetCellSpacing ( m _cg . Distance ) { _gage . _eebbg . TblCellSpacing = _edb . NewCT_TblWidth ( ) ; _gage . _eebbg . TblCellSpacing . TypeAttr = _edb . ST_TblWidthDxa ; _gage . _eebbg . TblCellSpacing . WAttr = & _edb . ST_MeasurementOrPercent { } ; _gage . _eebbg . TblCellSpacing . WAttr . ST_DecimalNumberOrPercent = & _edb . ST_DecimalNumberOrPercent { } ; _gage . _eebbg . TblCellSpacing . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _c . Int64 ( int64 ( m / _cg . Dxa ) ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Underline returns the type of run underline.
func ( _gdda RunProperties ) Underline ( ) _edb . ST_Underline { if _caea := _gdda . _ccbg . U ; _caea != nil { return _caea . ValAttr ; } ; return 0 ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddTabStop adds a tab stop to the paragraph.
func ( _bccg ParagraphStyleProperties ) AddTabStop ( position _cg . Distance , justificaton _edb . ST_TabJc , leader _edb . ST_TabTlc ) { if _bccg . _bggb . Tabs == nil { _bccg . _bggb . Tabs = _edb . NewCT_Tabs ( ) ; } ; _cdfa := _edb . NewCT_TabStop ( ) ; _cdfa . LeaderAttr = leader ; _cdfa . ValAttr = justificaton ; _cdfa . PosAttr . Int64 = _c . Int64 ( int64 ( position / _cg . Twips ) ) ; _bccg . _bggb . Tabs . Tab = append ( _bccg . _bggb . Tabs . Tab , _cdfa ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// TableProperties returns the table style properties.
func ( _dabee Style ) TableProperties ( ) TableStyleProperties { if _dabee . _abcbf . TblPr == nil { _dabee . _abcbf . TblPr = _edb . NewCT_TblPrBase ( ) ; } ; return TableStyleProperties { _dabee . _abcbf . TblPr } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// ComplexSizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.
func ( _acad RunProperties ) ComplexSizeMeasure ( ) string { if _dcbf := _acad . _ccbg . SzCs ; _dcbf != nil { _dfab := _dcbf . ValAttr ; if _dfab . ST_PositiveUniversalMeasure != nil { return * _dfab . ST_PositiveUniversalMeasure ; } ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddHyperLink adds a new hyperlink to a parapgraph.
func ( _deaee Paragraph ) AddHyperLink ( ) HyperLink { _egebd := _edb . NewEG_PContent ( ) ; _deaee . _ccdca . EG_PContent = append ( _deaee . _ccdca . EG_PContent , _egebd ) ; _egebd . Hyperlink = _edb . NewCT_Hyperlink ( ) ; return HyperLink { _deaee . _debe , _egebd . Hyperlink } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetHAlignment sets the horizontal alignment for an anchored image.
func ( _ac AnchoredDrawing ) SetHAlignment ( h _edb . WdST_AlignH ) { _ac . _eef . PositionH . Choice = & _edb . WdCT_PosHChoice { } ; _ac . _eef . PositionH . Choice . Align = h ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// OnOffValue represents an on/off value that can also be unset
type OnOffValue byte ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddDropdownList adds dropdown list form field to the paragraph and returns it.
func ( _eafg Paragraph ) AddDropdownList ( name string ) FormField { _cbgf := _eafg . addFldCharsForField ( name , "\u0046\u004f\u0052M\u0044\u0052\u004f\u0050\u0044\u004f\u0057\u004e" ) ; _cbgf . _aaed . DdList = _edb . NewCT_FFDDList ( ) ; return _cbgf ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Borders allows controlling individual cell borders.
func ( _aef CellProperties ) Borders ( ) CellBorders { if _aef . _dcb . TcBorders == nil { _aef . _dcb . TcBorders = _edb . NewCT_TcBorders ( ) ; } ; return CellBorders { _aef . _dcb . TcBorders } ; } ; var _adc = false ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetLineSpacing sets the spacing between lines in a paragraph.
func ( _fabc Paragraph ) SetLineSpacing ( d _cg . Distance , rule _edb . ST_LineSpacingRule ) { _fabc . ensurePPr ( ) ; if _fabc . _ccdca . PPr . Spacing == nil { _fabc . _ccdca . PPr . Spacing = _edb . NewCT_Spacing ( ) ; } ; _gga := _fabc . _ccdca . PPr . Spacing ; if rule == _edb . ST_LineSpacingRuleUnset { _gga . LineRuleAttr = _edb . ST_LineSpacingRuleUnset ; _gga . LineAttr = nil ; } else { _gga . LineRuleAttr = rule ; _gga . LineAttr = & _edb . ST_SignedTwipsMeasure { } ; _gga . LineAttr . Int64 = _c . Int64 ( int64 ( d / _cg . Twips ) ) ; } ; } ; func _gaca ( _acdd * _edb . CT_Border , _cbbb _edb . ST_Border , _fccc _fb . Color , _adad _cg . Distance ) { _acdd . ValAttr = _cbbb ; _acdd . ColorAttr = & _edb . ST_HexColor { } ; if _fccc . IsAuto ( ) { _acdd . ColorAttr . ST_HexColorAuto = _edb . ST_HexColorAutoAuto ; } else { _acdd . ColorAttr . ST_HexColorRGB = _fccc . AsRGBString ( ) ; } ; if _adad != _cg . Zero { _acdd . SzAttr = _c . Uint64 ( uint64 ( _adad / _cg . Point * 8 ) ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetNumberingDefinitionByID sets the numbering definition ID directly, which must
// match an ID defined in numbering.xml
func ( _gddgb Paragraph ) SetNumberingDefinitionByID ( abstractNumberID int64 ) { _gddgb . ensurePPr ( ) ; if _gddgb . _ccdca . PPr . NumPr == nil { _gddgb . _ccdca . PPr . NumPr = _edb . NewCT_NumPr ( ) ; } ; _gfbb := _edb . NewCT_DecimalNumber ( ) ; _gfbb . ValAttr = int64 ( abstractNumberID ) ; _gddgb . _ccdca . PPr . NumPr . NumId = _gfbb ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// ComplexSizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.
func ( _fbca ParagraphProperties ) ComplexSizeMeasure ( ) string { if _aefg := _fbca . _beefd . RPr . SzCs ; _aefg != nil { _dcdb := _aefg . ValAttr ; if _dcdb . ST_PositiveUniversalMeasure != nil { return * _dcdb . ST_PositiveUniversalMeasure ; } ; } ; return "" ; } ;
2020-10-12 13:59:12 +00:00
2020-11-09 01:00:18 +00:00
// Clear clears all content within a footer
func ( _cede Footer ) Clear ( ) { _cede . _dbcd . EG_ContentBlockContent = nil } ;
2020-10-12 13:59:12 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _aecfg InlineDrawing ) X ( ) * _edb . WdInline { return _aecfg . _fadc } ;
2020-10-12 13:59:12 +00:00
2020-11-09 01:00:18 +00:00
// SetOrigin sets the origin of the image. It defaults to ST_RelFromHPage and
// ST_RelFromVPage
func ( _ebf AnchoredDrawing ) SetOrigin ( h _edb . WdST_RelFromH , v _edb . WdST_RelFromV ) { _ebf . _eef . PositionH . RelativeFromAttr = h ; _ebf . _eef . PositionV . RelativeFromAttr = v ; } ;
2020-10-12 13:59:12 +00:00
2020-11-09 01:00:18 +00:00
// CellMargins are the margins for an individual cell.
type CellMargins struct { _ead * _edb . CT_TcMar } ;
2020-10-12 13:59:12 +00:00
2020-11-09 01:00:18 +00:00
// Italic returns true if paragraph font is italic.
func ( _agdd ParagraphProperties ) Italic ( ) bool { _acga := _agdd . _beefd . RPr ; return _bgbe ( _acga . I ) || _bgbe ( _acga . ICs ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Cells returns the cells defined in the table.
func ( _eagdb Row ) Cells ( ) [ ] Cell { _beca := [ ] Cell { } ; for _ , _eaef := range _eagdb . _eaeb . EG_ContentCellContent { for _ , _aaff := range _eaef . Tc { _beca = append ( _beca , Cell { _eagdb . _fgfab , _aaff } ) ; } ; if _eaef . Sdt != nil && _eaef . Sdt . SdtContent != nil { for _ , _bacb := range _eaef . Sdt . SdtContent . Tc { _beca = append ( _beca , Cell { _eagdb . _fgfab , _bacb } ) ; } ; } ; } ; return _beca ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// DrawingAnchored returns a slice of AnchoredDrawings.
func ( _aged Run ) DrawingAnchored ( ) [ ] AnchoredDrawing { _eefff := [ ] AnchoredDrawing { } ; for _ , _dccc := range _aged . _abcbb . EG_RunInnerContent { if _dccc . Drawing == nil { continue ; } ; for _ , _dgeg := range _dccc . Drawing . Anchor { _eefff = append ( _eefff , AnchoredDrawing { _aged . _ddgb , _dgeg } ) ; } ; } ; return _eefff ; } ;
// NewStyles constructs a new empty Styles
func NewStyles ( ) Styles { return Styles { _edb . NewStyles ( ) } } ;
// AbstractNumberID returns the ID that is unique within all numbering
// definitions that is used to assign the definition to a paragraph.
func ( _aede NumberingDefinition ) AbstractNumberID ( ) int64 { return _aede . _begd . AbstractNumIdAttr } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Emboss returns true if paragraph emboss is on.
func ( _ggbdb ParagraphProperties ) Emboss ( ) bool { return _bgbe ( _ggbdb . _beefd . RPr . Emboss ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Paragraphs returns the paragraphs within a structured document tag.
func ( _gbfa StructuredDocumentTag ) Paragraphs ( ) [ ] Paragraph { if _gbfa . _aceg . SdtContent == nil { return nil ; } ; _gabb := [ ] Paragraph { } ; for _ , _gecc := range _gbfa . _aceg . SdtContent . P { _gabb = append ( _gabb , Paragraph { _gbfa . _dccf , _gecc } ) ; } ; return _gabb ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// RemoveParagraph removes a paragraph from a footer.
func ( _cbdg Footer ) RemoveParagraph ( p Paragraph ) { for _ , _cffa := range _cbdg . _dbcd . EG_ContentBlockContent { for _gbgg , _aabb := range _cffa . P { if _aabb == p . _ccdca { copy ( _cffa . P [ _gbgg : ] , _cffa . P [ _gbgg + 1 : ] ) ; _cffa . P = _cffa . P [ 0 : len ( _cffa . P ) - 1 ] ; return ; } ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetVerticalBanding controls the conditional formatting for vertical banding.
func ( _abcbc TableLook ) SetVerticalBanding ( on bool ) { if ! on { _abcbc . _dddgf . NoVBandAttr = & _cbc . ST_OnOff { } ; _abcbc . _dddgf . NoVBandAttr . ST_OnOff1 = _cbc . ST_OnOff1On ; } else { _abcbc . _dddgf . NoVBandAttr = & _cbc . ST_OnOff { } ; _abcbc . _dddgf . NoVBandAttr . ST_OnOff1 = _cbc . ST_OnOff1Off ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-08-31 22:58:25 +00:00
// X returns the inner wrapped XML type.
2020-11-09 01:00:18 +00:00
func ( _bge Endnote ) X ( ) * _edb . CT_FtnEdn { return _bge . _cecc } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddBookmark adds a bookmark to a document that can then be used from a hyperlink. Name is a document
// unique name that identifies the bookmark so it can be referenced from hyperlinks.
func ( _cgdg Paragraph ) AddBookmark ( name string ) Bookmark { _gebd := _edb . NewEG_PContent ( ) ; _fbcg := _edb . NewEG_ContentRunContent ( ) ; _gebd . EG_ContentRunContent = append ( _gebd . EG_ContentRunContent , _fbcg ) ; _ceee := _edb . NewEG_RunLevelElts ( ) ; _fbcg . EG_RunLevelElts = append ( _fbcg . EG_RunLevelElts , _ceee ) ; _gabd := _edb . NewEG_RangeMarkupElements ( ) ; _fdaga := _edb . NewCT_Bookmark ( ) ; _gabd . BookmarkStart = _fdaga ; _ceee . EG_RangeMarkupElements = append ( _ceee . EG_RangeMarkupElements , _gabd ) ; _gabd = _edb . NewEG_RangeMarkupElements ( ) ; _gabd . BookmarkEnd = _edb . NewCT_MarkupRange ( ) ; _ceee . EG_RangeMarkupElements = append ( _ceee . EG_RangeMarkupElements , _gabd ) ; _cgdg . _ccdca . EG_PContent = append ( _cgdg . _ccdca . EG_PContent , _gebd ) ; _afdag := Bookmark { _fdaga } ; _afdag . SetName ( name ) ; return _afdag ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// MultiLevelType returns the multilevel type, or ST_MultiLevelTypeUnset if not set.
func ( _gdb NumberingDefinition ) MultiLevelType ( ) _edb . ST_MultiLevelType { if _gdb . _begd . MultiLevelType != nil { return _gdb . _begd . MultiLevelType . ValAttr ; } else { return _edb . ST_MultiLevelTypeUnset ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// TableWidth controls width values in table settings.
type TableWidth struct { _gbcgc * _edb . CT_TblWidth } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.
func ( _fcgb ParagraphProperties ) SizeMeasure ( ) string { if _ggfga := _fcgb . _beefd . RPr . Sz ; _ggfga != nil { _adcf := _ggfga . ValAttr ; if _adcf . ST_PositiveUniversalMeasure != nil { return * _adcf . ST_PositiveUniversalMeasure ; } ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// InsertParagraphBefore adds a new empty paragraph before the relativeTo
// paragraph.
func ( _cdag * Document ) InsertParagraphBefore ( relativeTo Paragraph ) Paragraph { return _cdag . insertParagraph ( relativeTo , true ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _bdcb Style ) X ( ) * _edb . CT_Style { return _bdcb . _abcbf } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Spacing returns the paragraph spacing settings.
func ( _gccbd ParagraphProperties ) Spacing ( ) ParagraphSpacing { if _gccbd . _beefd . Spacing == nil { _gccbd . _beefd . Spacing = _edb . NewCT_Spacing ( ) ; } ; return ParagraphSpacing { _gccbd . _beefd . Spacing } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetWidthAuto sets the the cell width to automatic.
func ( _gcd CellProperties ) SetWidthAuto ( ) { _gcd . _dcb . TcW = _edb . NewCT_TblWidth ( ) ; _gcd . _dcb . TcW . TypeAttr = _edb . ST_TblWidthAuto ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetFormat sets the numbering format.
func ( _beddd NumberingLevel ) SetFormat ( f _edb . ST_NumberFormat ) { if _beddd . _geaa . NumFmt == nil { _beddd . _geaa . NumFmt = _edb . NewCT_NumFmt ( ) ; } ; _beddd . _geaa . NumFmt . ValAttr = f ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// ParagraphProperties returns the paragraph properties controlling text formatting within the table.
func ( _caaa TableConditionalFormatting ) ParagraphProperties ( ) ParagraphStyleProperties { if _caaa . _efgd . PPr == nil { _caaa . _efgd . PPr = _edb . NewCT_PPrGeneral ( ) ; } ; return ParagraphStyleProperties { _caaa . _efgd . PPr } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Rows returns the rows defined in the table.
func ( _dffa Table ) Rows ( ) [ ] Row { _ccgc := [ ] Row { } ; for _ , _aafg := range _dffa . _cbcgd . EG_ContentRowContent { for _ , _fead := range _aafg . Tr { _ccgc = append ( _ccgc , Row { _dffa . _aeecb , _fead } ) ; } ; if _aafg . Sdt != nil && _aafg . Sdt . SdtContent != nil { for _ , _gbada := range _aafg . Sdt . SdtContent . Tr { _ccgc = append ( _ccgc , Row { _dffa . _aeecb , _gbada } ) ; } ; } ; } ; return _ccgc ; } ; func ( _dgbb * Document ) tables ( _fgf * _edb . EG_ContentBlockContent ) [ ] Table { _dfe := [ ] Table { } ; for _ , _ggc := range _fgf . Tbl { _dfe = append ( _dfe , Table { _dgbb , _ggc } ) ; for _ , _baeg := range _ggc . EG_ContentRowContent { for _ , _ebe := range _baeg . Tr { for _ , _fag := range _ebe . EG_ContentCellContent { for _ , _cce := range _fag . Tc { for _ , _fdb := range _cce . EG_BlockLevelElts { for _ , _ffa := range _fdb . EG_ContentBlockContent { for _ , _gege := range _dgbb . tables ( _ffa ) { _dfe = append ( _dfe , _gege ) ; } ; } ; } ; } ; } ; } ; } ; } ; return _dfe ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Save writes the document to an io.Writer in the Zip package format.
func ( _cbb * Document ) Save ( w _ee . Writer ) error { if _gbd := _cbb . _edg . Validate ( ) ; _gbd != nil { _c . Log ( "\u0076\u0061\u006c\u0069\u0064\u0061\u0074\u0069\u006f\u006e\u0020\u0065\u0072\u0072\u006fr\u0020i\u006e\u0020\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u003a\u0020\u0025\u0073" , _gbd ) ; } ; _ceg := _c . DocTypeDocument ; if ! _gd . GetLicenseKey ( ) . IsLicensed ( ) && ! _adc { _cb . Println ( "\u0055\u006e\u006ci\u0063\u0065\u006e\u0073e\u0064\u0020\u0076\u0065\u0072\u0073\u0069o\u006e\u0020\u006f\u0066\u0020\u0055\u006e\u0069\u004f\u0066\u0066\u0069\u0063\u0065" ) ; _cb . Println ( "\u002d\u0020\u0047e\u0074\u0020\u0061\u0020\u0074\u0072\u0069\u0061\u006c\u0020\u006c\u0069\u0063\u0065\u006e\u0073\u0065\u0020\u006f\u006e\u0020\u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002fu\u006e\u0069\u0064\u006f\u0063\u002e\u0069\u006f" ) ; return _f . New ( "\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065\u0020\u006ci\u0063\u0065\u006e\u0073\u0065\u0020\u0072\u0065\u0071\u0075i\u0072\u0065\u0064" ) ; } ; _fg := _fd . NewWriter ( w ) ; defer _fg . Close ( ) ; if _fdg := _af . MarshalXML ( _fg , _c . BaseRelsFilename , _cbb . Rels . X ( ) ) ; _fdg != nil { return _fdg ; } ; if _abd := _af . MarshalXMLByType ( _fg , _ceg , _c . ExtendedPropertiesType , _cbb . AppProperties . X ( ) ) ; _abd != nil { return _abd ; } ; if _bcae := _af . MarshalXMLByType ( _fg , _ceg , _c . CorePropertiesType , _cbb . CoreProperties . X ( ) ) ; _bcae != nil { return _bcae ; } ; if _cbb . CustomProperties . X ( ) != nil { if _cbbg := _af . MarshalXMLByType ( _fg , _ceg , _c . CustomPropertiesType , _cbb . CustomProperties . X ( ) ) ; _cbbg != nil { return _cbbg ; } ; } ; if _cbb . Thumbnail != nil { _fec , _fdgg := _fg . Create ( "\u0064\u006f\u0063Pr\u006f\u0070\u0073\u002f\u0074\u0068\u0075\u006d\u0062\u006e\u0061\u0069\u006c\u002e\u006a\u0070\u0065\u0067" ) ; if _fdgg != nil { return _fdgg ; } ; if _cec := _gfd . Encode ( _fec , _cbb . Thumbnail , nil ) ; _cec != nil { return _cec ; } ; } ; if _deec := _af . MarshalXMLByType ( _fg , _ceg , _c . SettingsType , _cbb . Settings . X ( ) ) ; _deec != nil { return _deec ; } ; _fef := _c . AbsoluteFilename ( _ceg , _c . OfficeDocumentType , 0 ) ; if _dfg := _af . MarshalXML ( _fg , _fef , _cbb . _edg ) ; _dfg != nil { return _dfg ; } ; if _cefg := _af . MarshalXML ( _fg , _af . RelationsPathFor ( _fef ) , _cbb . _gcgf . X ( ) ) ; _cefg != nil { return _cefg ; } ; if _cbb . Numbering . X ( ) != nil { if _fca := _af . MarshalXMLByType ( _fg , _ceg , _c . NumberingType , _cbb . Numbering . X ( ) ) ; _fca != nil { return _fca ; } ; } ; if _acef := _af . MarshalXMLByType ( _fg , _ceg , _c . StylesType , _cbb . Styles . X ( ) ) ; _acef != nil { return _acef ; } ; if _cbb . _fe != nil { if _caa := _af . MarshalXMLByType ( _fg , _ceg , _c . WebSettingsType , _cbb . _fe ) ; _caa != nil { return _caa ; } ; } ; if _cbb . _bcc != nil { if _cad := _af . MarshalXMLByType ( _fg , _ceg , _c . FontTableType , _cbb . _bcc ) ; _cad != nil { return _cad ; } ; } ; if _cbb . _dacb != nil { if _bfac := _af . MarshalXMLByType ( _fg , _ceg , _c . EndNotesType , _cbb . _dacb ) ; _bfac != nil { return _bfac ; } ; } ; if _cbb . _fba != nil { if _bcad := _af . MarshalXMLByType ( _fg , _ceg , _c . FootNotesType , _cbb . _fba ) ; _bcad != nil { return _bcad ; } ; } ; for _ddb , _bbg := range _cbb . _cfc { if _eae := _af . MarshalXMLByTypeIndex ( _fg , _ceg , _c . ThemeType , _ddb + 1 , _bbg ) ; _eae != nil { return _eae ; } ; } ; for _afe , _bcab := range _cbb . _ccg { _acg := _c . AbsoluteFilename ( _ceg , _c . HeaderType , _afe + 1 ) ; if _bcg := _af . MarshalXML ( _fg , _acg , _bcab ) ; _bcg != nil { return _bcg ; } ; if ! _cbb . _dac [ _afe ] . IsEmpty ( ) { _af . MarshalXML ( _fg , _af . RelationsPathFor ( _acg ) , _cbb . _dac [ _afe ] . X ( ) ) ; } ; } ; for _gad , _fed := range _cbb . _bcd { _gac := _c . AbsoluteFilename ( _ceg , _c . FooterType , _gad + 1 ) ; if _gfc := _af . MarshalXMLByTypeIndex ( _fg , _ceg , _c . FooterType , _gad + 1 , _fed ) ; _gfc != nil { return _gfc ; } ; if ! _cbb . _cbd [ _gad ] . IsEmpty ( ) { _af . MarshalXML ( _fg , _af . RelationsPathFor ( _gac ) , _cbb . _cbd [ _gad ] . X ( ) ) ; } ; } ; for _cca , _ccd := range _cbb . Images { if _dcd := _da . AddImageToZip ( _fg , _ccd , _cca + 1 , _c . DocTypeDocument ) ; _dcd != nil { return _dcd ; } ; } ; if _cfe := _af . MarshalXML ( _fg , _c . ContentTypesFilename , _cbb . ContentTypes . X ( ) ) ; _cfe != nil { return _cfe ; } ; if _dgb := _cbb . WriteExtraFiles ( _fg ) ; _dgb != nil { return _dgb ; } ; return _fg . Close ( ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetStyle sets the table style name.
func ( _face TableProperties ) SetStyle ( name string ) { if name == "" { _face . _eebbg . TblStyle = nil ; } else { _face . _eebbg . TblStyle = _edb . NewCT_String ( ) ; _face . _eebbg . TblStyle . ValAttr = name ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetLastColumn controls the conditional formatting for the last column in a table.
func ( _cgcg TableLook ) SetLastColumn ( on bool ) { if ! on { _cgcg . _dddgf . LastColumnAttr = & _cbc . ST_OnOff { } ; _cgcg . _dddgf . LastColumnAttr . ST_OnOff1 = _cbc . ST_OnOff1Off ; } else { _cgcg . _dddgf . LastColumnAttr = & _cbc . ST_OnOff { } ; _cgcg . _dddgf . LastColumnAttr . ST_OnOff1 = _cbc . ST_OnOff1On ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetUnderline controls underline for a run style.
func ( _edgbb RunProperties ) SetUnderline ( style _edb . ST_Underline , c _fb . Color ) { if style == _edb . ST_UnderlineUnset { _edgbb . _ccbg . U = nil ; } else { _edgbb . _ccbg . U = _edb . NewCT_Underline ( ) ; _edgbb . _ccbg . U . ColorAttr = & _edb . ST_HexColor { } ; _edgbb . _ccbg . U . ColorAttr . ST_HexColorRGB = c . AsRGBString ( ) ; _edgbb . _ccbg . U . ValAttr = style ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// GetImage returns the ImageRef associated with an AnchoredDrawing.
func ( _bf AnchoredDrawing ) GetImage ( ) ( _da . ImageRef , bool ) { _gfdf := _bf . _eef . Graphic . GraphicData . Any ; if len ( _gfdf ) > 0 { _bfa , _dd := _gfdf [ 0 ] . ( * _cd . Pic ) ; if _dd { if _bfa . BlipFill != nil && _bfa . BlipFill . Blip != nil && _bfa . BlipFill . Blip . EmbedAttr != nil { return _bf . _eb . GetImageByRelID ( * _bfa . BlipFill . Blip . EmbedAttr ) ; } ; } ; } ; return _da . ImageRef { } , false ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetNextStyle sets the style that the next paragraph will use.
func ( _cddc Style ) SetNextStyle ( name string ) { if name == "" { _cddc . _abcbf . Next = nil ; } else { _cddc . _abcbf . Next = _edb . NewCT_String ( ) ; _cddc . _abcbf . Next . ValAttr = name ; } ; } ; func _bgbe ( _fafa * _edb . CT_OnOff ) bool { return _fafa != nil } ; func ( _fdcg Paragraph ) insertRun ( _bcdea Run , _fbabc bool ) Run { for _ , _fecg := range _fdcg . _ccdca . EG_PContent { for _gbgge , _ggbb := range _fecg . EG_ContentRunContent { if _ggbb . R == _bcdea . X ( ) { _ccb := _edb . NewCT_R ( ) ; _fecg . EG_ContentRunContent = append ( _fecg . EG_ContentRunContent , nil ) ; if _fbabc { copy ( _fecg . EG_ContentRunContent [ _gbgge + 1 : ] , _fecg . EG_ContentRunContent [ _gbgge : ] ) ; _fecg . EG_ContentRunContent [ _gbgge ] = _edb . NewEG_ContentRunContent ( ) ; _fecg . EG_ContentRunContent [ _gbgge ] . R = _ccb ; } else { copy ( _fecg . EG_ContentRunContent [ _gbgge + 2 : ] , _fecg . EG_ContentRunContent [ _gbgge + 1 : ] ) ; _fecg . EG_ContentRunContent [ _gbgge + 1 ] = _edb . NewEG_ContentRunContent ( ) ; _fecg . EG_ContentRunContent [ _gbgge + 1 ] . R = _ccb ; } ; return Run { _fdcg . _debe , _ccb } ; } ; if _ggbb . Sdt != nil && _ggbb . Sdt . SdtContent != nil { for _ , _deaf := range _ggbb . Sdt . SdtContent . EG_ContentRunContent { if _deaf . R == _bcdea . X ( ) { _dfea := _edb . NewCT_R ( ) ; _ggbb . Sdt . SdtContent . EG_ContentRunContent = append ( _ggbb . Sdt . SdtContent . EG_ContentRunContent , nil ) ; if _fbabc { copy ( _ggbb . Sdt . SdtContent . EG_ContentRunContent [ _gbgge + 1 : ] , _ggbb . Sdt . SdtContent . EG_ContentRunContent [ _gbgge : ] ) ; _ggbb . Sdt . SdtContent . EG_ContentRunContent [ _gbgge ] = _edb . NewEG_ContentRunContent ( ) ; _ggbb . Sdt . SdtContent . EG_ContentRunContent [ _gbgge ] . R = _dfea ; } else { copy ( _ggbb . Sdt . SdtContent . EG_ContentRunContent [ _gbgge + 2 : ] , _ggbb . Sdt . SdtContent . EG_ContentRunContent [ _gbgge + 1 : ] ) ; _ggbb . Sdt . SdtContent . EG_ContentRunContent [ _gbgge + 1 ] = _edb . NewEG_ContentRunContent ( ) ; _ggbb . Sdt . SdtContent . EG_ContentRunContent [ _gbgge + 1 ] . R = _dfea ; } ; return Run { _fdcg . _debe , _dfea } ; } ; } ; } ; } ; } ; return _fdcg . AddRun ( ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetRight sets the cell right margin
func ( _fff CellMargins ) SetRight ( d _cg . Distance ) { _fff . _ead . Right = _edb . NewCT_TblWidth ( ) ; _dae ( _fff . _ead . Right , d ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetWidthPercent sets the cell to a width percentage.
func ( _dabg CellProperties ) SetWidthPercent ( pct float64 ) { _dabg . _dcb . TcW = _edb . NewCT_TblWidth ( ) ; _dabg . _dcb . TcW . TypeAttr = _edb . ST_TblWidthPct ; _dabg . _dcb . TcW . WAttr = & _edb . ST_MeasurementOrPercent { } ; _dabg . _dcb . TcW . WAttr . ST_DecimalNumberOrPercent = & _edb . ST_DecimalNumberOrPercent { } ; _dabg . _dcb . TcW . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _c . Int64 ( int64 ( pct * 50 ) ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetUISortOrder controls the order the style is displayed in the UI.
func ( _aggd Style ) SetUISortOrder ( order int ) { _aggd . _abcbf . UiPriority = _edb . NewCT_DecimalNumber ( ) ; _aggd . _abcbf . UiPriority . ValAttr = int64 ( order ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetWindowControl controls if the first or last line of the paragraph is
// allowed to dispay on a separate page.
func ( _cdc ParagraphProperties ) SetWindowControl ( b bool ) { if ! b { _cdc . _beefd . WidowControl = nil ; } else { _cdc . _beefd . WidowControl = _edb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetBottom sets the bottom border to a specified type, color and thickness.
func ( _eee CellBorders ) SetBottom ( t _edb . ST_Border , c _fb . Color , thickness _cg . Distance ) { _eee . _gcg . Bottom = _edb . NewCT_Border ( ) ; _gaca ( _eee . _gcg . Bottom , t , c , thickness ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetBottom sets the cell bottom margin
func ( _fcc CellMargins ) SetBottom ( d _cg . Distance ) { _fcc . _ead . Bottom = _edb . NewCT_TblWidth ( ) ; _dae ( _fcc . _ead . Bottom , d ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Runs returns all of the runs in a paragraph.
func ( _dcdd Paragraph ) Runs ( ) [ ] Run { _gfdb := [ ] Run { } ; for _ , _aefd := range _dcdd . _ccdca . EG_PContent { for _ , _fdafa := range _aefd . EG_ContentRunContent { if _fdafa . R != nil { _gfdb = append ( _gfdb , Run { _dcdd . _debe , _fdafa . R } ) ; } ; if _fdafa . Sdt != nil && _fdafa . Sdt . SdtContent != nil { for _ , _cbca := range _fdafa . Sdt . SdtContent . EG_ContentRunContent { if _cbca . R != nil { _gfdb = append ( _gfdb , Run { _dcdd . _debe , _cbca . R } ) ; } ; } ; } ; } ; } ; return _gfdb ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// RunProperties returns the run properties controlling text formatting within the table.
func ( _cbbc TableConditionalFormatting ) RunProperties ( ) RunProperties { if _cbbc . _efgd . RPr == nil { _cbbc . _efgd . RPr = _edb . NewCT_RPr ( ) ; } ; return RunProperties { _cbbc . _efgd . RPr } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetLeft sets the cell left margin
func ( _ce CellMargins ) SetLeft ( d _cg . Distance ) { _ce . _ead . Left = _edb . NewCT_TblWidth ( ) ; _dae ( _ce . _ead . Left , d ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetRightPct sets the cell right margin
func ( _efd CellMargins ) SetRightPct ( pct float64 ) { _efd . _ead . Right = _edb . NewCT_TblWidth ( ) ; _cgc ( _efd . _ead . Right , pct ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// IsEndnote returns a bool based on whether the run has a
// footnote or not. Returns both a bool as to whether it has
// a footnote as well as the ID of the footnote.
func ( _fgeb Run ) IsEndnote ( ) ( bool , int64 ) { if _fgeb . _abcbb . EG_RunInnerContent != nil { if _fgeb . _abcbb . EG_RunInnerContent [ 0 ] . EndnoteReference != nil { return true , _fgeb . _abcbb . EG_RunInnerContent [ 0 ] . EndnoteReference . IdAttr ; } ; } ; return false , 0 ; } ;
2020-08-23 14:15:53 +00:00
2020-10-12 13:59:12 +00:00
// X returns the inner wrapped XML type.
2020-11-09 01:00:18 +00:00
func ( _gbadf NumberingLevel ) X ( ) * _edb . CT_Lvl { return _gbadf . _geaa } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Endnote returns the endnote based on the ID; this can be used nicely with
// the run.IsEndnote() functionality.
func ( _bafb * Document ) Endnote ( id int64 ) Endnote { for _ , _fcd := range _bafb . Endnotes ( ) { if _fcd . id ( ) == id { return _fcd ; } ; } ; return Endnote { } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// RunProperties returns the RunProperties controlling numbering level font, etc.
func ( _ecbda NumberingLevel ) RunProperties ( ) RunProperties { if _ecbda . _geaa . RPr == nil { _ecbda . _geaa . RPr = _edb . NewCT_RPr ( ) ; } ; return RunProperties { _ecbda . _geaa . RPr } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Strike returns true if run is striked.
func ( _bgdc RunProperties ) Strike ( ) bool { return _bgbe ( _bgdc . _ccbg . Strike ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetValue sets the width value.
func ( _cdcc TableWidth ) SetValue ( m _cg . Distance ) { _cdcc . _gbcgc . WAttr = & _edb . ST_MeasurementOrPercent { } ; _cdcc . _gbcgc . WAttr . ST_DecimalNumberOrPercent = & _edb . ST_DecimalNumberOrPercent { } ; _cdcc . _gbcgc . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _c . Int64 ( int64 ( m / _cg . Twips ) ) ; _cdcc . _gbcgc . TypeAttr = _edb . ST_TblWidthDxa ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Style is a style within the styles.xml file.
type Style struct { _abcbf * _edb . CT_Style } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetHangingIndent controls the hanging indent of the paragraph.
func ( _aedaf ParagraphStyleProperties ) SetHangingIndent ( m _cg . Distance ) { if _aedaf . _bggb . Ind == nil { _aedaf . _bggb . Ind = _edb . NewCT_Ind ( ) ; } ; if m == _cg . Zero { _aedaf . _bggb . Ind . HangingAttr = nil ; } else { _aedaf . _bggb . Ind . HangingAttr = & _cbc . ST_TwipsMeasure { } ; _aedaf . _bggb . Ind . HangingAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( m / _cg . Twips ) ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetKeepOnOnePage controls if all lines in a paragraph are kept on the same
// page.
func ( _debb ParagraphStyleProperties ) SetKeepOnOnePage ( b bool ) { if ! b { _debb . _bggb . KeepLines = nil ; } else { _debb . _bggb . KeepLines = _edb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Italic returns true if run font is italic.
func ( _ccfa RunProperties ) Italic ( ) bool { _dddf := _ccfa . _ccbg ; return _bgbe ( _dddf . I ) || _bgbe ( _dddf . ICs ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetSpacing sets the spacing that comes before and after the paragraph.
// Deprecated: See Spacing() instead which allows finer control.
func ( _gdef ParagraphProperties ) SetSpacing ( before , after _cg . Distance ) { if _gdef . _beefd . Spacing == nil { _gdef . _beefd . Spacing = _edb . NewCT_Spacing ( ) ; } ; _gdef . _beefd . Spacing . BeforeAttr = & _cbc . ST_TwipsMeasure { } ; _gdef . _beefd . Spacing . BeforeAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( before / _cg . Twips ) ) ; _gdef . _beefd . Spacing . AfterAttr = & _cbc . ST_TwipsMeasure { } ; _gdef . _beefd . Spacing . AfterAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( after / _cg . Twips ) ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetFirstLineIndent controls the indentation of the first line in a paragraph.
func ( _bace Paragraph ) SetFirstLineIndent ( m _cg . Distance ) { _bace . ensurePPr ( ) ; _bcbc := _bace . _ccdca . PPr ; if _bcbc . Ind == nil { _bcbc . Ind = _edb . NewCT_Ind ( ) ; } ; if m == _cg . Zero { _bcbc . Ind . FirstLineAttr = nil ; } else { _bcbc . Ind . FirstLineAttr = & _cbc . ST_TwipsMeasure { } ; _bcbc . Ind . FirstLineAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( m / _cg . Twips ) ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// UnderlineColor returns the hex color value of run underline.
func ( _faae RunProperties ) UnderlineColor ( ) string { if _fcca := _faae . _ccbg . U ; _fcca != nil { _agb := _fcca . ColorAttr ; if _agb != nil && _agb . ST_HexColorRGB != nil { return * _agb . ST_HexColorRGB ; } ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Footer is a footer for a document section.
type Footer struct { _aecf * Document ; _dbcd * _edb . Ftr ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// InsertRowAfter inserts a row after another row
func ( _bbfdg Table ) InsertRowAfter ( r Row ) Row { for _bcgb , _befc := range _bbfdg . _cbcgd . EG_ContentRowContent { if len ( _befc . Tr ) > 0 && r . X ( ) == _befc . Tr [ 0 ] { _afcf := _edb . NewEG_ContentRowContent ( ) ; if len ( _bbfdg . _cbcgd . EG_ContentRowContent ) < _bcgb + 2 { return _bbfdg . AddRow ( ) ; } ; _bbfdg . _cbcgd . EG_ContentRowContent = append ( _bbfdg . _cbcgd . EG_ContentRowContent , nil ) ; copy ( _bbfdg . _cbcgd . EG_ContentRowContent [ _bcgb + 2 : ] , _bbfdg . _cbcgd . EG_ContentRowContent [ _bcgb + 1 : ] ) ; _bbfdg . _cbcgd . EG_ContentRowContent [ _bcgb + 1 ] = _afcf ; _baac := _edb . NewCT_Row ( ) ; _afcf . Tr = append ( _afcf . Tr , _baac ) ; return Row { _bbfdg . _aeecb , _baac } ; } ; } ; return _bbfdg . AddRow ( ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// StructuredDocumentTag are a tagged bit of content in a document.
type StructuredDocumentTag struct { _dccf * Document ; _aceg * _edb . CT_SdtBlock ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Paragraphs returns the paragraphs defined in an endnote.
func ( _bceb Endnote ) Paragraphs ( ) [ ] Paragraph { _fcbe := [ ] Paragraph { } ; for _ , _bgff := range _bceb . content ( ) { for _ , _cdfc := range _bgff . P { _fcbe = append ( _fcbe , Paragraph { _bceb . _cdab , _cdfc } ) ; } ; } ; return _fcbe ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetAllCaps sets the run to all caps.
func ( _dbdc RunProperties ) SetAllCaps ( b bool ) { if ! b { _dbdc . _ccbg . Caps = nil ; } else { _dbdc . _ccbg . Caps = _edb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// StructuredDocumentTags returns the structured document tags in the document
// which are commonly used in document templates.
func ( _bga * Document ) StructuredDocumentTags ( ) [ ] StructuredDocumentTag { _dga := [ ] StructuredDocumentTag { } ; for _ , _fgfb := range _bga . _edg . Body . EG_BlockLevelElts { for _ , _dcc := range _fgfb . EG_ContentBlockContent { if _dcc . Sdt != nil { _dga = append ( _dga , StructuredDocumentTag { _bga , _dcc . Sdt } ) ; } ; } ; } ; return _dga ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddDefinition adds a new numbering definition.
func ( _affde Numbering ) AddDefinition ( ) NumberingDefinition { _ccdc := _edb . NewCT_Num ( ) ; _dcdf := int64 ( 1 ) ; for _ , _fbgf := range _affde . Definitions ( ) { if _fbgf . AbstractNumberID ( ) >= _dcdf { _dcdf = _fbgf . AbstractNumberID ( ) + 1 ; } ; } ; _cbdbc := int64 ( 1 ) ; for _ , _aaef := range _affde . X ( ) . Num { if _aaef . NumIdAttr >= _cbdbc { _cbdbc = _aaef . NumIdAttr + 1 ; } ; } ; _ccdc . NumIdAttr = _cbdbc ; _ccdc . AbstractNumId = _edb . NewCT_DecimalNumber ( ) ; _ccdc . AbstractNumId . ValAttr = _dcdf ; _gdfdf := _edb . NewCT_AbstractNum ( ) ; _gdfdf . AbstractNumIdAttr = _dcdf ; _affde . _fbd . AbstractNum = append ( _affde . _fbd . AbstractNum , _gdfdf ) ; _affde . _fbd . Num = append ( _affde . _fbd . Num , _ccdc ) ; return NumberingDefinition { _gdfdf } ; } ;
2020-08-23 14:15:53 +00:00
2020-10-12 13:59:12 +00:00
// Index returns the index of the footer within the document. This is used to
// form its zip packaged filename as well as to match it with its relationship
// ID.
2020-11-09 01:00:18 +00:00
func ( _bbef Footer ) Index ( ) int { for _fefe , _fadb := range _bbef . _aecf . _bcd { if _fadb == _bbef . _dbcd { return _fefe ; } ; } ; return - 1 ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Tables returns the tables defined in the header.
func ( _bdfd Header ) Tables ( ) [ ] Table { _dbef := [ ] Table { } ; if _bdfd . _decf == nil { return nil ; } ; for _ , _ccda := range _bdfd . _decf . EG_ContentBlockContent { for _ , _aedac := range _bdfd . _egbb . tables ( _ccda ) { _dbef = append ( _dbef , _aedac ) ; } ; } ; return _dbef ; } ;
2017-10-03 08:03:24 -05:00
2020-11-09 01:00:18 +00:00
// FormFieldType is the type of the form field.
//go:generate stringer -type=FormFieldType
type FormFieldType byte ;
2017-08-30 21:00:24 -05:00
2020-11-09 01:00:18 +00:00
// SetPageBreakBefore controls if there is a page break before this paragraph.
func ( _aaa ParagraphProperties ) SetPageBreakBefore ( b bool ) { if ! b { _aaa . _beefd . PageBreakBefore = nil ; } else { _aaa . _beefd . PageBreakBefore = _edb . NewCT_OnOff ( ) ; } ; } ;
2017-09-01 18:42:02 -05:00
2020-11-09 01:00:18 +00:00
// SetAlignment controls the paragraph alignment
func ( _gaagd ParagraphStyleProperties ) SetAlignment ( align _edb . ST_Jc ) { if align == _edb . ST_JcUnset { _gaagd . _bggb . Jc = nil ; } else { _gaagd . _bggb . Jc = _edb . NewCT_Jc ( ) ; _gaagd . _bggb . Jc . ValAttr = align ; } ; } ;
2017-09-28 18:12:22 -05:00
2020-11-09 01:00:18 +00:00
// Properties returns the cell properties.
func ( _acc Cell ) Properties ( ) CellProperties { if _acc . _ece . TcPr == nil { _acc . _ece . TcPr = _edb . NewCT_TcPr ( ) ; } ; return CellProperties { _acc . _ece . TcPr } ; } ;
2017-09-28 18:12:22 -05:00
2020-11-09 01:00:18 +00:00
// SetAlignment sets the alignment of a table within the page.
func ( _dcg TableProperties ) SetAlignment ( align _edb . ST_JcTable ) { if align == _edb . ST_JcTableUnset { _dcg . _eebbg . Jc = nil ; } else { _dcg . _eebbg . Jc = _edb . NewCT_JcTable ( ) ; _dcg . _eebbg . Jc . ValAttr = align ; } ; } ;
2020-08-31 22:58:25 +00:00
2020-10-12 13:59:12 +00:00
// SetWidth sets the table with to a specified width.
2020-11-09 01:00:18 +00:00
func ( _ffag TableProperties ) SetWidth ( d _cg . Distance ) { _ffag . _eebbg . TblW = _edb . NewCT_TblWidth ( ) ; _ffag . _eebbg . TblW . TypeAttr = _edb . ST_TblWidthDxa ; _ffag . _eebbg . TblW . WAttr = & _edb . ST_MeasurementOrPercent { } ; _ffag . _eebbg . TblW . WAttr . ST_DecimalNumberOrPercent = & _edb . ST_DecimalNumberOrPercent { } ; _ffag . _eebbg . TblW . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _c . Int64 ( int64 ( d / _cg . Twips ) ) ; } ;
2020-08-31 22:58:25 +00:00
2020-11-09 01:00:18 +00:00
// NewNumbering constructs a new numbering.
func NewNumbering ( ) Numbering { _cfgg := _edb . NewNumbering ( ) ; return Numbering { _cfgg } } ;
2017-10-10 12:40:02 -05:00
2020-11-09 01:00:18 +00:00
// SetTextWrapNone unsets text wrapping so the image can float on top of the
// text. When used in conjunction with X/Y Offset relative to the page it can be
// used to place a logo at the top of a page at an absolute position that
// doesn't interfere with text.
func ( _ad AnchoredDrawing ) SetTextWrapNone ( ) { _ad . _eef . Choice = & _edb . WdEG_WrapTypeChoice { } ; _ad . _eef . Choice . WrapNone = _edb . NewWdCT_WrapNone ( ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// TableLook is the conditional formatting associated with a table style that
// has been assigned to a table.
type TableLook struct { _dddgf * _edb . CT_TblLook } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetOffset sets the offset of the image relative to the origin, which by
// default this is the top-left corner of the page. Offset is incompatible with
// SetAlignment, whichever is called last is applied.
func ( _ecc AnchoredDrawing ) SetOffset ( x , y _cg . Distance ) { _ecc . SetXOffset ( x ) ; _ecc . SetYOffset ( y ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetBasedOn sets the style that this style is based on.
func ( _cdce Style ) SetBasedOn ( name string ) { if name == "" { _cdce . _abcbf . BasedOn = nil ; } else { _cdce . _abcbf . BasedOn = _edb . NewCT_String ( ) ; _cdce . _abcbf . BasedOn . ValAttr = name ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetStrict is a shortcut for document.SetConformance,
// as one of these values from github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes:
// ST_ConformanceClassUnset, ST_ConformanceClassStrict or ST_ConformanceClassTransitional.
func ( _bbff Document ) SetStrict ( strict bool ) { if strict { _bbff . _edg . ConformanceAttr = _cbc . ST_ConformanceClassStrict ; } else { _bbff . _edg . ConformanceAttr = _cbc . ST_ConformanceClassTransitional ; } ; } ; func _cbfe ( _edaa * _edb . CT_Tbl , _eaf map [ string ] string ) { for _ , _eeff := range _edaa . EG_ContentRowContent { for _ , _fdga := range _eeff . Tr { for _ , _bgcd := range _fdga . EG_ContentCellContent { for _ , _gffd := range _bgcd . Tc { for _ , _gdgd := range _gffd . EG_BlockLevelElts { for _ , _ddg := range _gdgd . EG_ContentBlockContent { for _ , _ebbc := range _ddg . P { _dbe ( _ebbc , _eaf ) ; } ; for _ , _gged := range _ddg . Tbl { _cbfe ( _gged , _eaf ) ; } ; } ; } ; } ; } ; } ; } ; } ; func _bacd ( _bdgc * _edb . CT_P , _abcb map [ string ] string ) { for _ , _ffgc := range _bdgc . EG_PContent { if _ffgc . Hyperlink != nil && _ffgc . Hyperlink . IdAttr != nil { if _bgaf , _bdfe := _abcb [ * _ffgc . Hyperlink . IdAttr ] ; _bdfe { * _ffgc . Hyperlink . IdAttr = _bgaf ; } ; } ; } ; } ; func _daeg ( _cbdd * _edb . CT_OnOff ) OnOffValue { if _cbdd == nil { return OnOffValueUnset ; } ; if _cbdd . ValAttr != nil && _cbdd . ValAttr . Bool != nil && * _cbdd . ValAttr . Bool == false { return OnOffValueOff ; } ; return OnOffValueOn ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// GetImageByRelID returns an ImageRef with the associated relation ID in the
// document.
func ( _egf * Document ) GetImageByRelID ( relID string ) ( _da . ImageRef , bool ) { for _ , _dgag := range _egf . Images { if _dgag . RelID ( ) == relID { return _dgag , true ; } ; } ; return _da . ImageRef { } , false ; } ; func ( _cbee * Document ) validateBookmarks ( ) error { _egbe := make ( map [ string ] struct { } ) ; for _ , _dfgd := range _cbee . Bookmarks ( ) { if _ , _bedd := _egbe [ _dfgd . Name ( ) ] ; _bedd { return _cb . Errorf ( "d\u0075\u0070\u006c\u0069\u0063\u0061t\u0065\u0020\u0062\u006f\u006f\u006b\u006d\u0061\u0072k\u0020\u0025\u0073 \u0066o\u0075\u006e\u0064" , _dfgd . Name ( ) ) ; } ; _egbe [ _dfgd . Name ( ) ] = struct { } { } ; } ; return nil ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddHyperlink adds a hyperlink to a document. Adding the hyperlink to a document
// and setting it on a cell is more efficient than setting hyperlinks directly
// on a cell.
func ( _eadb Document ) AddHyperlink ( url string ) _da . Hyperlink { return _eadb . _gcgf . AddHyperlink ( url ) } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Headers returns the headers defined in the document.
func ( _fac * Document ) Headers ( ) [ ] Header { _dge := [ ] Header { } ; for _ , _bg := range _fac . _ccg { _dge = append ( _dge , Header { _fac , _bg } ) ; } ; return _dge ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetWidthPercent sets the table to a width percentage.
func ( _ddba TableProperties ) SetWidthPercent ( pct float64 ) { _ddba . _eebbg . TblW = _edb . NewCT_TblWidth ( ) ; _ddba . _eebbg . TblW . TypeAttr = _edb . ST_TblWidthPct ; _ddba . _eebbg . TblW . WAttr = & _edb . ST_MeasurementOrPercent { } ; _ddba . _eebbg . TblW . WAttr . ST_DecimalNumberOrPercent = & _edb . ST_DecimalNumberOrPercent { } ; _ddba . _eebbg . TblW . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _c . Int64 ( int64 ( pct * 50 ) ) ; } ;
2019-04-03 03:02:32 -07:00
2020-11-09 01:00:18 +00:00
// Styles is the document wide styles contained in styles.xml.
type Styles struct { _fdee * _edb . Styles } ;
2020-05-12 19:07:52 +03:00
2020-11-09 01:00:18 +00:00
// Paragraphs returns the paragraphs defined in the cell.
func ( _aca Cell ) Paragraphs ( ) [ ] Paragraph { _be := [ ] Paragraph { } ; for _ , _ag := range _aca . _ece . EG_BlockLevelElts { for _ , _bbb := range _ag . EG_ContentBlockContent { for _ , _egb := range _bbb . P { _be = append ( _be , Paragraph { _aca . _df , _egb } ) ; } ; } ; } ; return _be ; } ;
2020-06-05 23:38:29 +07:00
2020-11-09 01:00:18 +00:00
// SetCellSpacingPercent sets the cell spacing within a table to a percent width.
func ( _defg TableStyleProperties ) SetCellSpacingPercent ( pct float64 ) { _defg . _caead . TblCellSpacing = _edb . NewCT_TblWidth ( ) ; _defg . _caead . TblCellSpacing . TypeAttr = _edb . ST_TblWidthPct ; _defg . _caead . TblCellSpacing . WAttr = & _edb . ST_MeasurementOrPercent { } ; _defg . _caead . TblCellSpacing . WAttr . ST_DecimalNumberOrPercent = & _edb . ST_DecimalNumberOrPercent { } ; _defg . _caead . TblCellSpacing . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _c . Int64 ( int64 ( pct * 50 ) ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Properties returns the paragraph properties.
func ( _cefb Paragraph ) Properties ( ) ParagraphProperties { _cefb . ensurePPr ( ) ; return ParagraphProperties { _cefb . _debe , _cefb . _ccdca . PPr } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// ParagraphProperties returns the paragraph style properties.
func ( _dabde Style ) ParagraphProperties ( ) ParagraphStyleProperties { if _dabde . _abcbf . PPr == nil { _dabde . _abcbf . PPr = _edb . NewCT_PPrGeneral ( ) ; } ; return ParagraphStyleProperties { _dabde . _abcbf . PPr } ; } ; func _gafb ( _gdfaa * _gg . CT_Blip , _cdagc map [ string ] string ) { if _gdfaa . EmbedAttr != nil { if _bbba , _fgbe := _cdagc [ * _gdfaa . EmbedAttr ] ; _fgbe { * _gdfaa . EmbedAttr = _bbba ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// AddHeader creates a header associated with the document, but doesn't add it
// to the document for display.
func ( _ecg * Document ) AddHeader ( ) Header { _eag := _edb . NewHdr ( ) ; _ecg . _ccg = append ( _ecg . _ccg , _eag ) ; _bca := _cb . Sprintf ( "\u0068\u0065\u0061d\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c" , len ( _ecg . _ccg ) ) ; _ecg . _gcgf . AddRelationship ( _bca , _c . HeaderType ) ; _ecg . ContentTypes . AddOverride ( "\u002f\u0077\u006f\u0072\u0064\u002f" + _bca , "\u0061p\u0070l\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u0076\u006e\u0064.\u006f\u0070\u0065\u006ex\u006d\u006c\u0066\u006f\u0072m\u0061\u0074\u0073\u002d\u006f\u0066\u0066\u0069\u0063\u0065\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0077\u006f\u0072\u0064\u0070\u0072\u006f\u0063\u0065\u0073\u0073\u0069n\u0067\u006d\u006c\u002e\u0068\u0065\u0061\u0064e\u0072\u002b\u0078\u006d\u006c" ) ; _ecg . _dac = append ( _ecg . _dac , _da . NewRelationships ( ) ) ; return Header { _ecg , _eag } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetCellSpacingPercent sets the cell spacing within a table to a percent width.
func ( _dded TableProperties ) SetCellSpacingPercent ( pct float64 ) { _dded . _eebbg . TblCellSpacing = _edb . NewCT_TblWidth ( ) ; _dded . _eebbg . TblCellSpacing . TypeAttr = _edb . ST_TblWidthPct ; _dded . _eebbg . TblCellSpacing . WAttr = & _edb . ST_MeasurementOrPercent { } ; _dded . _eebbg . TblCellSpacing . WAttr . ST_DecimalNumberOrPercent = & _edb . ST_DecimalNumberOrPercent { } ; _dded . _eebbg . TblCellSpacing . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _c . Int64 ( int64 ( pct * 50 ) ) ; } ;
2020-08-31 22:58:25 +00:00
2020-11-09 01:00:18 +00:00
// StyleID returns the style ID.
func ( _egbcb Style ) StyleID ( ) string { if _egbcb . _abcbf . StyleIdAttr == nil { return "" ; } ; return * _egbcb . _abcbf . StyleIdAttr ; } ; func ( _gacd Styles ) initializeDocDefaults ( ) { _gacd . _fdee . DocDefaults = _edb . NewCT_DocDefaults ( ) ; _gacd . _fdee . DocDefaults . RPrDefault = _edb . NewCT_RPrDefault ( ) ; _gacd . _fdee . DocDefaults . RPrDefault . RPr = _edb . NewCT_RPr ( ) ; _cfggg := RunProperties { _gacd . _fdee . DocDefaults . RPrDefault . RPr } ; _cfggg . SetSize ( 12 * _cg . Point ) ; _cfggg . Fonts ( ) . SetASCIITheme ( _edb . ST_ThemeMajorAscii ) ; _cfggg . Fonts ( ) . SetEastAsiaTheme ( _edb . ST_ThemeMajorEastAsia ) ; _cfggg . Fonts ( ) . SetHANSITheme ( _edb . ST_ThemeMajorHAnsi ) ; _cfggg . Fonts ( ) . SetCSTheme ( _edb . ST_ThemeMajorBidi ) ; _cfggg . X ( ) . Lang = _edb . NewCT_Language ( ) ; _cfggg . X ( ) . Lang . ValAttr = _c . String ( "\u0065\u006e\u002dU\u0053" ) ; _cfggg . X ( ) . Lang . EastAsiaAttr = _c . String ( "\u0065\u006e\u002dU\u0053" ) ; _cfggg . X ( ) . Lang . BidiAttr = _c . String ( "\u0061\u0072\u002dS\u0041" ) ; _gacd . _fdee . DocDefaults . PPrDefault = _edb . NewCT_PPrDefault ( ) ; } ;
2020-08-31 22:58:25 +00:00
2020-11-09 01:00:18 +00:00
// CharacterSpacingMeasure returns paragraph characters spacing with its measure which can be mm, cm, in, pt, pc or pi.
func ( _aadd RunProperties ) CharacterSpacingMeasure ( ) string { if _efaa := _aadd . _ccbg . Spacing ; _efaa != nil { _bgacb := _efaa . ValAttr ; if _bgacb . ST_UniversalMeasure != nil { return * _bgacb . ST_UniversalMeasure ; } ; } ; return "" ; } ;
2020-08-31 22:58:25 +00:00
2020-11-09 01:00:18 +00:00
// CharacterSpacingValue returns the value of run's characters spacing in twips (1/20 of point).
func ( _bgfe RunProperties ) CharacterSpacingValue ( ) int64 { if _ebga := _bgfe . _ccbg . Spacing ; _ebga != nil { _cddb := _ebga . ValAttr ; if _cddb . Int64 != nil { return * _cddb . Int64 ; } ; } ; return int64 ( 0 ) ; } ;
2020-08-31 22:58:25 +00:00
2020-11-09 01:00:18 +00:00
// AddRun adds a run of text to a hyperlink. This is the text that will be linked.
func ( _cebe HyperLink ) AddRun ( ) Run { _gcfg := _edb . NewEG_ContentRunContent ( ) ; _cebe . _fffed . EG_ContentRunContent = append ( _cebe . _fffed . EG_ContentRunContent , _gcfg ) ; _fdca := _edb . NewCT_R ( ) ; _gcfg . R = _fdca ; return Run { _cebe . _fegga , _fdca } ; } ;
2020-08-31 22:58:25 +00:00
2020-11-09 01:00:18 +00:00
// SetOutline sets the run to outlined text.
func ( _edbf RunProperties ) SetOutline ( b bool ) { if ! b { _edbf . _ccbg . Outline = nil ; } else { _edbf . _ccbg . Outline = _edb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _geg * Document ) X ( ) * _edb . Document { return _geg . _edg } ; func ( _bad * Document ) insertTable ( _dbg Paragraph , _fdfc bool ) Table { _afc := _bad . _edg . Body ; if _afc == nil { return _bad . AddTable ( ) ; } ; _cgd := _dbg . X ( ) ; for _bee , _bdb := range _afc . EG_BlockLevelElts { for _ , _edf := range _bdb . EG_ContentBlockContent { for _dcf , _fge := range _edf . P { if _fge == _cgd { _gce := _edb . NewCT_Tbl ( ) ; _beec := _edb . NewEG_BlockLevelElts ( ) ; _eaed := _edb . NewEG_ContentBlockContent ( ) ; _beec . EG_ContentBlockContent = append ( _beec . EG_ContentBlockContent , _eaed ) ; _eaed . Tbl = append ( _eaed . Tbl , _gce ) ; _afc . EG_BlockLevelElts = append ( _afc . EG_BlockLevelElts , nil ) ; if _fdfc { copy ( _afc . EG_BlockLevelElts [ _bee + 1 : ] , _afc . EG_BlockLevelElts [ _bee : ] ) ; _afc . EG_BlockLevelElts [ _bee ] = _beec ; if _dcf != 0 { _dgdd := _edb . NewEG_BlockLevelElts ( ) ; _dabeg := _edb . NewEG_ContentBlockContent ( ) ; _dgdd . EG_ContentBlockContent = append ( _dgdd . EG_ContentBlockContent , _dabeg ) ; _dabeg . P = _edf . P [ : _dcf ] ; _afc . EG_BlockLevelElts = append ( _afc . EG_BlockLevelElts , nil ) ; copy ( _afc . EG_BlockLevelElts [ _bee + 1 : ] , _afc . EG_BlockLevelElts [ _bee : ] ) ; _afc . EG_BlockLevelElts [ _bee ] = _dgdd ; } ; _edf . P = _edf . P [ _dcf : ] ; } else { copy ( _afc . EG_BlockLevelElts [ _bee + 2 : ] , _afc . EG_BlockLevelElts [ _bee + 1 : ] ) ; _afc . EG_BlockLevelElts [ _bee + 1 ] = _beec ; if _dcf != len ( _edf . P ) - 1 { _bcaee := _edb . NewEG_BlockLevelElts ( ) ; _adb := _edb . NewEG_ContentBlockContent ( ) ; _bcaee . EG_ContentBlockContent = append ( _bcaee . EG_ContentBlockContent , _adb ) ; _adb . P = _edf . P [ _dcf + 1 : ] ; _afc . EG_BlockLevelElts = append ( _afc . EG_BlockLevelElts , nil ) ; copy ( _afc . EG_BlockLevelElts [ _bee + 3 : ] , _afc . EG_BlockLevelElts [ _bee + 2 : ] ) ; _afc . EG_BlockLevelElts [ _bee + 2 ] = _bcaee ; } ; _edf . P = _edf . P [ : _dcf + 1 ] ; } ; return Table { _bad , _gce } ; } ; } ; for _ , _ebfa := range _edf . Tbl { _gacc := _ggb ( _ebfa , _cgd , _fdfc ) ; if _gacc != nil { return Table { _bad , _gacc } ; } ; } ; } ; } ; return _bad . AddTable ( ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// BodySection returns the default body section used for all preceding
// paragraphs until the previous Section. If there is no previous sections, the
// body section applies to the entire document.
func ( _cgf * Document ) BodySection ( ) Section { if _cgf . _edg . Body . SectPr == nil { _cgf . _edg . Body . SectPr = _edb . NewCT_SectPr ( ) ; } ; return Section { _cgf , _cgf . _edg . Body . SectPr } ; } ;
2020-10-12 13:59:12 +00:00
2020-11-09 01:00:18 +00:00
// Append appends a document d0 to a document d1. All settings, headers and footers remain the same as in the document d0 if they exist there, otherwise they are taken from the d1.
func ( _dbc * Document ) Append ( d1orig * Document ) error { _gadg , _fcef := d1orig . Copy ( ) ; if _fcef != nil { return _fcef ; } ; _dbc . DocBase = _dbc . DocBase . Append ( _gadg . DocBase ) ; if _gadg . _edg . ConformanceAttr != _cbc . ST_ConformanceClassStrict { _dbc . _edg . ConformanceAttr = _gadg . _edg . ConformanceAttr ; } ; _ccc := _dbc . _gcgf . X ( ) . Relationship ; _gbe := _gadg . _gcgf . X ( ) . Relationship ; _fdcf := _gadg . _edg . Body ; _aecc := map [ string ] string { } ; _adf := map [ int64 ] int64 { } ; _eccg := map [ int64 ] int64 { } ; for _ , _cfcf := range _gbe { _efg := true ; _fee := _cfcf . IdAttr ; _cgfg := _cfcf . TargetAttr ; _dff := _cfcf . TypeAttr ; _caba := _dff == _c . ImageType ; _fgg := _dff == _c . HyperLinkType ; var _fefc string ; for _ , _eeb := range _ccc { if _eeb . TypeAttr == _dff && _eeb . TargetAttr == _cgfg { _efg = false ; _fefc = _eeb . IdAttr ; break ; } ; } ; if _caba { _egfd := "\u0077\u006f\u0072d\u002f" + _cgfg ; for _ , _ggf := range _gadg . DocBase . Images { if _ggf . Target ( ) == _egfd { _baed , _afcc := _da . ImageFromStorage ( _ggf . Path ( ) ) ; if _afcc != nil { return _afcc ; } ; _dbgg , _afcc := _dbc . AddImage ( _baed ) ; if _afcc != nil { return _afcc ; } ; _fefc = _dbgg . RelID ( ) ; break ; } ; } ; } else if _efg { if _fgg { _fddef := _dbc . _gcgf . AddHyperlink ( _cgfg ) ; _fefc = _da . Relationship ( _fddef ) . ID ( ) ; } else { _egfa := _dbc . _gcgf . AddRelationship ( _cgfg , _dff ) ; _fefc = _egfa . X ( ) . IdAttr ; } ; } ; if _fee != _fefc { _aecc [ _fee ] = _fefc ; } ; } ; if _fdcf . SectPr != nil { for _ , _daaa := range _fdcf . SectPr . EG_HdrFtrReferences { if _daaa . HeaderReference != nil { if _edgb , _dabeb := _aecc [ _daaa . HeaderReference . IdAttr ] ; _dabeb { _daaa . HeaderReference . IdAttr = _edgb ; _dbc . _dac = append ( _dbc . _dac , _da . NewRelationships ( ) ) ; } ; } else if _daaa . FooterReference != nil { if _gegd , _ccdf := _aecc [ _daaa . FooterReference . IdAttr ] ; _ccdf { _daaa . FooterReference . IdAttr = _gegd ; _dbc . _cbd = append ( _dbc . _cbd , _da . NewRelationships ( ) ) ; } ; } ; } ; } ; _gfca , _eaaa := _dbc . _dacb , _gadg . _dacb ; if _gfca != nil { if _eaaa != nil { if _gfca . Endnote != nil { if _eaaa . Endnote != nil { _bfg := int64 ( len ( _gfca . Endnote ) + 1 ) ; for _ , _gag := range _eaaa . Endnote { _febd := _gag . IdAttr ; if _febd > 0 { _gag . IdAttr = _bfg ; _gfca . Endnote = append ( _gfca . Endnote , _gag ) ; _eccg [ _febd ] = _bfg ; _bfg ++ ; } ; } ; } ; } else { _gfca . Endnote = _eaaa . Endnote ; } ; } ; } else if _eaaa != nil { _gfca = _eaaa ; } ; _dbc . _dacb = _gfca ; _caf , _cacg := _dbc . _fba , _gadg . _fba ; if _caf != nil { if _cacg != nil { if _caf . Footnote != nil { if _cacg . Footnote != nil { _ageb := int64 ( len ( _caf . Footnote ) + 1 ) ; for _ , _dfdg := range _cacg . Footnote { _gfa := _dfdg . IdAttr ; if _gfa > 0 { _dfdg . IdAttr = _ageb ; _caf . Footnote = append ( _caf . Footnote , _dfdg ) ; _adf [ _gfa ] = _ageb ; _ageb ++ ; } ; } ; } ; } else { _caf . Footnote = _cacg . Footnote ; } ; } ; } else if _cacg != nil { _caf = _cacg ; } ; _dbc . _fba = _caf ; for _ , _fafaa := range _fdcf . EG_BlockLevelElts { for _ , _dbdd := range _fafaa . EG_ContentBlockContent { for _ , _dfdb := range _dbdd . P { _dbe ( _dfdb , _aecc ) ; _bacd ( _dfdb , _aecc ) ; _edfg ( _dfdb , _adf , _eccg ) ; } ; for _ , _baeeg := range _dbdd . Tbl { _cbfe ( _baeeg , _aecc ) ; _affg ( _baeeg , _aecc ) ; _fcfc ( _baeeg , _adf , _eccg ) ; } ; } ; } ; _dbc . _edg . Body . EG_BlockLevelElts = append ( _dbc . _edg . Body . EG_BlockLevelElts , _gadg . _edg . Body . EG_BlockLevelElts ... ) ; if _dbc . _edg . Body . SectPr == nil { _dbc . _edg . Body . SectPr = _gadg . _edg . Body . SectPr ; } else { var _cgbd , _cdb bool ; for _ , _cccb := range _dbc . _edg . Body . SectPr . EG_HdrFtrReferences { if _cccb . HeaderReference != nil { _cgbd = true ; } else if _cccb . FooterReference != nil { _cdb = true ; } ; } ; if ! _cgbd { for _ , _acba := range _gadg . _edg . Body . SectPr . EG_HdrFtrReferences { if _acba . HeaderReference != nil { _dbc . _edg . Body . SectPr . EG_HdrFtrReferences = append ( _dbc . _edg . Body . SectPr . EG_HdrFtrReferences , _acba ) ; break ; } ; } ; } ; if ! _cdb { for _ , _adca := range _gadg . _edg . Body . SectPr . EG_HdrFtrReferences { if _adca . FooterReference != nil { _dbc . _edg . Body . SectPr . EG_HdrFtrReferences = append ( _dbc . _edg . Body . SectPr . EG_HdrFtrReferences , _adca ) ; break ; } ; } ; } ; if _dbc . _edg . Body . SectPr . Cols == nil && _gadg . _edg . Body . SectPr . Cols != nil { _dbc . _edg . Body . SectPr . Cols = _gadg . _edg . Body . SectPr . Cols ; } ; } ; _faa := _dbc . Num
2020-10-12 13:59:12 +00:00
2020-11-09 01:00:18 +00:00
// Bold returns true if paragraph font is bold.
func ( _ggfc ParagraphProperties ) Bold ( ) bool { _abgc := _ggfc . _beefd . RPr ; return _bgbe ( _abgc . B ) || _bgbe ( _abgc . BCs ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Section is the beginning of a new section.
type Section struct { _egbea * Document ; _gecd * _edb . CT_SectPr ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// InsertParagraphAfter adds a new empty paragraph after the relativeTo
// paragraph.
func ( _beda * Document ) InsertParagraphAfter ( relativeTo Paragraph ) Paragraph { return _beda . insertParagraph ( relativeTo , false ) ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Numbering is the document wide numbering styles contained in numbering.xml.
type Numbering struct { _fbd * _edb . Numbering } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetConformance sets conformance attribute of the document
// as one of these values from github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes:
// ST_ConformanceClassUnset, ST_ConformanceClassStrict or ST_ConformanceClassTransitional.
func ( _fcbg Document ) SetConformance ( conformanceAttr _cbc . ST_ConformanceClass ) { _fcbg . _edg . ConformanceAttr = conformanceAttr ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _fad Color ) X ( ) * _edb . CT_Color { return _fad . _cff } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetThemeShade sets the shade based off the theme color.
func ( _gbf Color ) SetThemeShade ( s uint8 ) { _geb := _cb . Sprintf ( "\u0025\u0030\u0032\u0078" , s ) ; _gbf . _cff . ThemeShadeAttr = & _geb ; } ;
2020-08-23 14:15:53 +00:00
2020-10-12 13:59:12 +00:00
// CellBorders are the borders for an individual
2020-11-09 01:00:18 +00:00
type CellBorders struct { _gcg * _edb . CT_TcBorders } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _gdc NumberingDefinition ) X ( ) * _edb . CT_AbstractNum { return _gdc . _begd } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// X returns the inner wrapped XML type.
func ( _aecae Paragraph ) X ( ) * _edb . CT_P { return _aecae . _ccdca } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetCellSpacingAuto sets the cell spacing within a table to automatic.
func ( _daegf TableStyleProperties ) SetCellSpacingAuto ( ) { _daegf . _caead . TblCellSpacing = _edb . NewCT_TblWidth ( ) ; _daegf . _caead . TblCellSpacing . TypeAttr = _edb . ST_TblWidthAuto ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Endnote is an individual endnote reference within the document.
type Endnote struct { _cdab * Document ; _cecc * _edb . CT_FtnEdn ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetCSTheme sets the font complex script theme.
func ( _cbae Fonts ) SetCSTheme ( t _edb . ST_Theme ) { _cbae . _adddd . CsthemeAttr = t } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetFirstRow controls the conditional formatting for the first row in a table.
func ( _gaaa TableLook ) SetFirstRow ( on bool ) { if ! on { _gaaa . _dddgf . FirstRowAttr = & _cbc . ST_OnOff { } ; _gaaa . _dddgf . FirstRowAttr . ST_OnOff1 = _cbc . ST_OnOff1Off ; } else { _gaaa . _dddgf . FirstRowAttr = & _cbc . ST_OnOff { } ; _gaaa . _dddgf . FirstRowAttr . ST_OnOff1 = _cbc . ST_OnOff1On ; } ; } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// Type returns the type of the style.
func ( _abdc Style ) Type ( ) _edb . ST_StyleType { return _abdc . _abcbf . TypeAttr } ;
2020-08-23 14:15:53 +00:00
2020-11-09 01:00:18 +00:00
// SetSpacing sets the spacing that comes before and after the paragraph.
func ( _cddg ParagraphStyleProperties ) SetSpacing ( before , after _cg . Distance ) { if _cddg . _bggb . Spacing == nil { _cddg . _bggb . Spacing = _edb . NewCT_Spacing ( ) ; } ; if before == _cg . Zero { _cddg . _bggb . Spacing . BeforeAttr = nil ; } else { _cddg . _bggb . Spacing . BeforeAttr = & _cbc . ST_TwipsMeasure { } ; _cddg . _bggb . Spacing . BeforeAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( before / _cg . Twips ) ) ; } ; if after == _cg . Zero { _cddg . _bggb . Spacing . AfterAttr = nil ; } else { _cddg . _bggb . Spacing . AfterAttr = & _cbc . ST_TwipsMeasure { } ; _cddg . _bggb . Spacing . AfterAttr . ST_UnsignedDecimalNumber = _c . Uint64 ( uint64 ( after / _cg . Twips ) ) ; } ; } ;
2020-08-31 22:58:25 +00:00
2020-11-09 01:00:18 +00:00
// NumberingLevel is the definition for numbering for a particular level within
// a NumberingDefinition.
type NumberingLevel struct { _geaa * _edb . CT_Lvl } ;
// SetColor sets the text color.
func ( _dcef RunProperties ) SetColor ( c _fb . Color ) { _dcef . _ccbg . Color = _edb . NewCT_Color ( ) ; _dcef . _ccbg . Color . ValAttr . ST_HexColorRGB = c . AsRGBString ( ) ; } ; func _fcfc ( _egbcc * _edb . CT_Tbl , _efc , _bag map [ int64 ] int64 ) { for _ , _ebbb := range _egbcc . EG_ContentRowContent { for _ , _eedf := range _ebbb . Tr { for _ , _gdfb := range _eedf . EG_ContentCellContent { for _ , _fgga := range _gdfb . Tc { for _ , _edce := range _fgga . EG_BlockLevelElts { for _ , _fedc := range _edce . EG_ContentBlockContent { for _ , _bgfd := range _fedc . P { _edfg ( _bgfd , _efc , _bag ) ; } ; for _ , _bdac := range _fedc . Tbl { _fcfc ( _bdac , _efc , _bag ) ; } ; } ; } ; } ; } ; } ; } ; } ;