// // 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/ /* Package document provides creation, reading, and writing of ECMA 376 Open Office XML documents. Example: doc := document.New() para := doc.AddParagraph() run := para.AddRun() run.SetText("foo") doc.SaveToFile("foo.docx") */ package document ;import (_da "archive/zip";_gg "bytes";_ab "errors";_bf "fmt";_a "github.com/unidoc/unioffice";_fc "github.com/unidoc/unioffice/color";_df "github.com/unidoc/unioffice/common";_eca "github.com/unidoc/unioffice/common/tempstorage";_fb "github.com/unidoc/unioffice/internal/license";_gga "github.com/unidoc/unioffice/measurement";_bbb "github.com/unidoc/unioffice/schema/schemas.microsoft.com/office/activeX";_be "github.com/unidoc/unioffice/schema/soo/dml";_fd "github.com/unidoc/unioffice/schema/soo/dml/picture";_af "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes";_bb "github.com/unidoc/unioffice/schema/soo/pkg/relationships";_bfc "github.com/unidoc/unioffice/schema/soo/wml";_c "github.com/unidoc/unioffice/zippkg";_ec "image";_f "image/jpeg";_gc "io";_eg "log";_b "math/rand";_d "os";_aa "path/filepath";_g "strings";_bd "unicode";);func (_cgfe Paragraph )addEndBookmark (_cefd int64 )*_bfc .CT_MarkupRange {_cgdd :=_bfc .NewEG_PContent ();_cgfe ._egaag .EG_PContent =append (_cgfe ._egaag .EG_PContent ,_cgdd );_bafb :=_bfc .NewEG_ContentRunContent ();_bffag :=_bfc .NewEG_RunLevelElts ();_egeaa :=_bfc .NewEG_RangeMarkupElements ();_eae :=_bfc .NewCT_MarkupRange ();_eae .IdAttr =_cefd ;_egeaa .BookmarkEnd =_eae ;_cgdd .EG_ContentRunContent =append (_cgdd .EG_ContentRunContent ,_bafb );_bafb .EG_RunLevelElts =append (_bafb .EG_RunLevelElts ,_bffag );_bffag .EG_RangeMarkupElements =append (_bffag .EG_RangeMarkupElements ,_egeaa );return _eae ;}; // SetBottom sets the bottom border to a specified type, color and thickness. func (_de CellBorders )SetBottom (t _bfc .ST_Border ,c _fc .Color ,thickness _gga .Distance ){_de ._efd .Bottom =_bfc .NewCT_Border ();_aebcf (_de ._efd .Bottom ,t ,c ,thickness );}; // Spacing returns the paragraph spacing settings. func (_dfbfc ParagraphProperties )Spacing ()ParagraphSpacing {if _dfbfc ._aeag .Spacing ==nil {_dfbfc ._aeag .Spacing =_bfc .NewCT_Spacing ();};return ParagraphSpacing {_dfbfc ._aeag .Spacing };}; // SetDefaultValue sets the default value of a FormFieldTypeDropDown. For // FormFieldTypeDropDown, the value must be one of the fields possible values. func (_bead FormField )SetDefaultValue (v string ){if _bead ._cdaa .DdList !=nil {for _geed ,_acd :=range _bead .PossibleValues (){if _acd ==v {_bead ._cdaa .DdList .Default =_bfc .NewCT_DecimalNumber ();_bead ._cdaa .DdList .Default .ValAttr =int64 (_geed );break ;};};};}; // GetColor returns the color.Color object representing the run color. func (_ggbfe RunProperties )GetColor ()_fc .Color {if _bafd :=_ggbfe ._afdg .Color ;_bafd !=nil {_eage :=_bafd .ValAttr ;if _eage .ST_HexColorRGB !=nil {return _fc .FromHex (*_eage .ST_HexColorRGB );};};return _fc .Color {};}; // Table is a table within a document. type Table struct{_gaebd *Document ;_caeb *_bfc .CT_Tbl ;}; // 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 (_ccb *Document )Append (d1orig *Document )error {_fbcd ,_eafb :=d1orig .Copy ();if _eafb !=nil {return _eafb ;};_ccb .DocBase =_ccb .DocBase .Append (_fbcd .DocBase );if _fbcd ._bfda .ConformanceAttr !=_af .ST_ConformanceClassStrict {_ccb ._bfda .ConformanceAttr =_fbcd ._bfda .ConformanceAttr ;};_gdc :=_ccb ._fbb .X ().Relationship ;_fda :=_fbcd ._fbb .X ().Relationship ;_cdg :=_fbcd ._bfda .Body ;_baad :=map[string ]string {};_gfeg :=map[int64 ]int64 {};_dbb :=map[int64 ]int64 {};for _ ,_fcgb :=range _fda {_bcd :=true ;_dcag :=_fcgb .IdAttr ;_fcdg :=_fcgb .TargetAttr ;_cddb :=_fcgb .TypeAttr ;_cccae :=_cddb ==_a .ImageType ;_cge :=_cddb ==_a .HyperLinkType ;var _cfd string ;for _ ,_feae :=range _gdc {if _feae .TypeAttr ==_cddb &&_feae .TargetAttr ==_fcdg {_bcd =false ;_cfd =_feae .IdAttr ;break ;};};if _cccae {_dcge :="\u0077\u006f\u0072d\u002f"+_fcdg ;for _ ,_fgcf :=range _fbcd .DocBase .Images {if _fgcf .Target ()==_dcge {_gggf ,_gdef :=_df .ImageFromStorage (_fgcf .Path ());if _gdef !=nil {return _gdef ;};_bgc ,_gdef :=_ccb .AddImage (_gggf );if _gdef !=nil {return _gdef ;};_cfd =_bgc .RelID ();break ;};};}else if _bcd {if _cge {_gdfb :=_ccb ._fbb .AddHyperlink (_fcdg );_cfd =_df .Relationship (_gdfb ).ID ();}else {_cabe :=_ccb ._fbb .AddRelationship (_fcdg ,_cddb );_cfd =_cabe .X ().IdAttr ;};};if _dcag !=_cfd {_baad [_dcag ]=_cfd ;};};if _cdg .SectPr !=nil {for _ ,_fcdb :=range _cdg .SectPr .EG_HdrFtrReferences {if _fcdb .HeaderReference !=nil {if _dgag ,_edfe :=_baad [_fcdb .HeaderReference .IdAttr ];_edfe {_fcdb .HeaderReference .IdAttr =_dgag ;_ccb ._ddc =append (_ccb ._ddc ,_df .NewRelationships ());};}else if _fcdb .FooterReference !=nil {if _dfdd ,_cgg :=_baad [_fcdb .FooterReference .IdAttr ];_cgg {_fcdb .FooterReference .IdAttr =_dfdd ;_ccb ._fcbd =append (_ccb ._fcbd ,_df .NewRelationships ());};};};};_fcab ,_cfde :=_ccb ._aee ,_fbcd ._aee ;if _fcab !=nil {if _cfde !=nil {if _fcab .Endnote !=nil {if _cfde .Endnote !=nil {_agdd :=int64 (len (_fcab .Endnote )+1);for _ ,_bef :=range _cfde .Endnote {_ddcg :=_bef .IdAttr ;if _ddcg > 0{_bef .IdAttr =_agdd ;_fcab .Endnote =append (_fcab .Endnote ,_bef );_dbb [_ddcg ]=_agdd ;_agdd ++;};};};}else {_fcab .Endnote =_cfde .Endnote ;};};}else if _cfde !=nil {_fcab =_cfde ;};_ccb ._aee =_fcab ;_bgbgf ,_bfff :=_ccb ._cd ,_fbcd ._cd ;if _bgbgf !=nil {if _bfff !=nil {if _bgbgf .Footnote !=nil {if _bfff .Footnote !=nil {_fcbdc :=int64 (len (_bgbgf .Footnote )+1);for _ ,_fcfd :=range _bfff .Footnote {_fedf :=_fcfd .IdAttr ;if _fedf > 0{_fcfd .IdAttr =_fcbdc ;_bgbgf .Footnote =append (_bgbgf .Footnote ,_fcfd );_gfeg [_fedf ]=_fcbdc ;_fcbdc ++;};};};}else {_bgbgf .Footnote =_bfff .Footnote ;};};}else if _bfff !=nil {_bgbgf =_bfff ;};_ccb ._cd =_bgbgf ;for _ ,_bege :=range _cdg .EG_BlockLevelElts {for _ ,_bcfg :=range _bege .EG_ContentBlockContent {for _ ,_cged :=range _bcfg .P {_bfbf (_cged ,_baad );_baf (_cged ,_baad );_gfb (_cged ,_gfeg ,_dbb );};for _ ,_acbg :=range _bcfg .Tbl {_efag (_acbg ,_baad );_fdfb (_acbg ,_baad );_ebcg (_acbg ,_gfeg ,_dbb );};};};_ccb ._bfda .Body .EG_BlockLevelElts =append (_ccb ._bfda .Body .EG_BlockLevelElts ,_fbcd ._bfda .Body .EG_BlockLevelElts ...);if _ccb ._bfda .Body .SectPr ==nil {_ccb ._bfda .Body .SectPr =_fbcd ._bfda .Body .SectPr ;}else {var _dgfc ,_fcbf bool ;for _ ,_cbeb :=range _ccb ._bfda .Body .SectPr .EG_HdrFtrReferences {if _cbeb .HeaderReference !=nil {_dgfc =true ;}else if _cbeb .FooterReference !=nil {_fcbf =true ;};};if !_dgfc {for _ ,_ccd :=range _fbcd ._bfda .Body .SectPr .EG_HdrFtrReferences {if _ccd .HeaderReference !=nil {_ccb ._bfda .Body .SectPr .EG_HdrFtrReferences =append (_ccb ._bfda .Body .SectPr .EG_HdrFtrReferences ,_ccd );break ;};};};if !_fcbf {for _ ,_cffg :=range _fbcd ._bfda .Body .SectPr .EG_HdrFtrReferences {if _cffg .FooterReference !=nil {_ccb ._bfda .Body .SectPr .EG_HdrFtrReferences =append (_ccb ._bfda .Body .SectPr .EG_HdrFtrReferences ,_cffg );break ;};};};if _ccb ._bfda .Body .SectPr .Cols ==nil &&_fbcd ._bfda .Body .SectPr .Cols !=nil {_ccb ._bfda .Body .SectPr .Cols =_fbcd ._bfda .Body .SectPr .Cols ;};};_dbgd :=_ccb .Numbering ._bbbf ;_fce :=_fbcd .Numbering ._bbbf ;if _dbgd !=nil {if _fce !=nil {_dbgd .NumPicBullet =append (_dbgd .NumPicBullet ,_fce .NumPicBullet ...);_dbgd .AbstractNum =append (_dbgd .AbstractNum ,_fce .AbstractNum ...);_dbgd .Num =append (_dbgd .Num ,_fce .Num ...);};}else if _fce !=nil {_dbgd =_fce ;};_ccb .Numbering ._bbbf =_dbgd ;if _ccb .Styles ._bcagb ==nil &&_fbcd .Styles ._bcagb !=nil {_ccb .Styles ._bcagb =_fbcd .Styles ._bcagb ;};_ccb ._ebe =append (_ccb ._ebe ,_fbcd ._ebe ...);_ccb ._fgef =append (_ccb ._fgef ,_fbcd ._fgef ...);if len (_ccb ._cfb )==0{_ccb ._cfb =_fbcd ._cfb ;};if len (_ccb ._def )==0{_ccb ._def =_fbcd ._def ;};_bdd :=_ccb ._gb ;_gadg :=_fbcd ._gb ;if _bdd !=nil {if _gadg !=nil {if _bdd .Divs !=nil {if _gadg .Divs !=nil {_bdd .Divs .Div =append (_bdd .Divs .Div ,_gadg .Divs .Div ...);};}else {_bdd .Divs =_gadg .Divs ;};};_bdd .Frameset =nil ;}else if _gadg !=nil {_bdd =_gadg ;_bdd .Frameset =nil ;};_ccb ._gb =_bdd ;_gffb :=_ccb ._dcd ;_cebd :=_fbcd ._dcd ;if _gffb !=nil {if _cebd !=nil {if _gffb .Font !=nil {if _cebd .Font !=nil {for _ ,_edbg :=range _cebd .Font {_befe :=true ;for _ ,_fdbb :=range _gffb .Font {if _fdbb .NameAttr ==_edbg .NameAttr {_befe =false ;break ;};};if _befe {_gffb .Font =append (_gffb .Font ,_edbg );};};};}else {_gffb .Font =_cebd .Font ;};};}else if _cebd !=nil {_gffb =_cebd ;};_ccb ._dcd =_gffb ;return nil ;};var _dfff =[...]uint8 {0,20,37,58,79}; // SetSize sets the size of the displayed image on the page. func (_aaaa InlineDrawing )SetSize (w ,h _gga .Distance ){_aaaa ._dfae .Extent .CxAttr =int64 (float64 (w *_gga .Pixel72 )/_gga .EMU );_aaaa ._dfae .Extent .CyAttr =int64 (float64 (h *_gga .Pixel72 )/_gga .EMU );};const _acga ="\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"; // SetRightPct sets the cell right margin func (_ed CellMargins )SetRightPct (pct float64 ){_ed ._aca .Right =_bfc .NewCT_TblWidth ();_dgf (_ed ._aca .Right ,pct );}; // Footnote is an individual footnote reference within the document. type Footnote struct{_acff *Document ;_gbbd *_bfc .CT_FtnEdn ;}; // SetColor sets the text color. func (_ebbd RunProperties )SetColor (c _fc .Color ){_ebbd ._afdg .Color =_bfc .NewCT_Color ();_ebbd ._afdg .Color .ValAttr .ST_HexColorRGB =c .AsRGBString ();}; // SetSemiHidden controls if the style is hidden in the UI. func (_bace Style )SetSemiHidden (b bool ){if b {_bace ._gdea .SemiHidden =_bfc .NewCT_OnOff ();}else {_bace ._gdea .SemiHidden =nil ;};}; // 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 (_fgbe Settings )SetUpdateFieldsOnOpen (b bool ){if !b {_fgbe ._cgbd .UpdateFields =nil ;}else {_fgbe ._cgbd .UpdateFields =_bfc .NewCT_OnOff ();};}; // GetTargetByRelId returns a target path with the associated relation ID in the // document. func (_bece *Document )GetTargetByRelId (idAttr string )string {return _bece ._fbb .GetTargetByRelId (idAttr );}; // AddField adds a field (automatically computed text) to the document. func (_ddbeg Run )AddField (code string ){_ddbeg .AddFieldWithFormatting (code ,"",true )};func (_aga *Document )insertTable (_acaa Paragraph ,_agad bool )Table {_dcga :=_aga ._bfda .Body ;if _dcga ==nil {return _aga .AddTable ();};_fbbg :=_acaa .X ();for _fcfg ,_efg :=range _dcga .EG_BlockLevelElts {for _ ,_bff :=range _efg .EG_ContentBlockContent {for _ead ,_accd :=range _bff .P {if _accd ==_fbbg {_bab :=_bfc .NewCT_Tbl ();_ecae :=_bfc .NewEG_BlockLevelElts ();_abe :=_bfc .NewEG_ContentBlockContent ();_ecae .EG_ContentBlockContent =append (_ecae .EG_ContentBlockContent ,_abe );_abe .Tbl =append (_abe .Tbl ,_bab );_dcga .EG_BlockLevelElts =append (_dcga .EG_BlockLevelElts ,nil );if _agad {copy (_dcga .EG_BlockLevelElts [_fcfg +1:],_dcga .EG_BlockLevelElts [_fcfg :]);_dcga .EG_BlockLevelElts [_fcfg ]=_ecae ;if _ead !=0{_ebeg :=_bfc .NewEG_BlockLevelElts ();_cea :=_bfc .NewEG_ContentBlockContent ();_ebeg .EG_ContentBlockContent =append (_ebeg .EG_ContentBlockContent ,_cea );_cea .P =_bff .P [:_ead ];_dcga .EG_BlockLevelElts =append (_dcga .EG_BlockLevelElts ,nil );copy (_dcga .EG_BlockLevelElts [_fcfg +1:],_dcga .EG_BlockLevelElts [_fcfg :]);_dcga .EG_BlockLevelElts [_fcfg ]=_ebeg ;};_bff .P =_bff .P [_ead :];}else {copy (_dcga .EG_BlockLevelElts [_fcfg +2:],_dcga .EG_BlockLevelElts [_fcfg +1:]);_dcga .EG_BlockLevelElts [_fcfg +1]=_ecae ;if _ead !=len (_bff .P )-1{_cbbd :=_bfc .NewEG_BlockLevelElts ();_dbg :=_bfc .NewEG_ContentBlockContent ();_cbbd .EG_ContentBlockContent =append (_cbbd .EG_ContentBlockContent ,_dbg );_dbg .P =_bff .P [_ead +1:];_dcga .EG_BlockLevelElts =append (_dcga .EG_BlockLevelElts ,nil );copy (_dcga .EG_BlockLevelElts [_fcfg +3:],_dcga .EG_BlockLevelElts [_fcfg +2:]);_dcga .EG_BlockLevelElts [_fcfg +2]=_cbbd ;};_bff .P =_bff .P [:_ead +1];};return Table {_aga ,_bab };};};for _ ,_abg :=range _bff .Tbl {_aeea :=_ecd (_abg ,_fbbg ,_agad );if _aeea !=nil {return Table {_aga ,_aeea };};};};};return _aga .AddTable ();}; // MultiLevelType returns the multilevel type, or ST_MultiLevelTypeUnset if not set. func (_fef NumberingDefinition )MultiLevelType ()_bfc .ST_MultiLevelType {if _fef ._bcbe .MultiLevelType !=nil {return _fef ._bcbe .MultiLevelType .ValAttr ;}else {return _bfc .ST_MultiLevelTypeUnset ;};}; // RemoveRun removes a child run from a paragraph. func (_ccbd Paragraph )RemoveRun (r Run ){for _ ,_cabdg :=range _ccbd ._egaag .EG_PContent {for _afbc ,_bdfg :=range _cabdg .EG_ContentRunContent {if _bdfg .R ==r ._cdfb {copy (_cabdg .EG_ContentRunContent [_afbc :],_cabdg .EG_ContentRunContent [_afbc +1:]);_cabdg .EG_ContentRunContent =_cabdg .EG_ContentRunContent [0:len (_cabdg .EG_ContentRunContent )-1];};if _bdfg .Sdt !=nil &&_bdfg .Sdt .SdtContent !=nil {for _ecgfg ,_aafe :=range _bdfg .Sdt .SdtContent .EG_ContentRunContent {if _aafe .R ==r ._cdfb {copy (_bdfg .Sdt .SdtContent .EG_ContentRunContent [_ecgfg :],_bdfg .Sdt .SdtContent .EG_ContentRunContent [_ecgfg +1:]);_bdfg .Sdt .SdtContent .EG_ContentRunContent =_bdfg .Sdt .SdtContent .EG_ContentRunContent [0:len (_bdfg .Sdt .SdtContent .EG_ContentRunContent )-1];};};};};};}; // GetImageByRelID returns an ImageRef with the associated relation ID in the // document. func (_gefc *Document )GetImageByRelID (relID string )(_df .ImageRef ,bool ){for _ ,_gfaa :=range _gefc .Images {if _gfaa .RelID ()==relID {return _gfaa ,true ;};};return _df .ImageRef {},false ;}; // GetFooter gets a section Footer for given type func (_fbdd Section )GetFooter (t _bfc .ST_HdrFtr )(Footer ,bool ){for _ ,_cabeg :=range _fbdd ._bbbe .EG_HdrFtrReferences {if _cabeg .FooterReference .TypeAttr ==t {for _ ,_fdfdb :=range _fbdd ._caga .Footers (){_fead :=_fbdd ._caga ._fbb .FindRIDForN (_fdfdb .Index (),_a .FooterType );if _fead ==_cabeg .FooterReference .IdAttr {return _fdfdb ,true ;};};};};return Footer {},false ;}; // BoldValue returns the precise nature of the bold setting (unset, off or on). func (_gcbb RunProperties )BoldValue ()OnOffValue {return _ggbb (_gcbb ._afdg .B )}; // DocText is an array of extracted text items which has some methods for representing extracted text. type DocText struct{Items []TextItem ;}; // Color returns the style's Color. func (_fcefc RunProperties )Color ()Color {if _fcefc ._afdg .Color ==nil {_fcefc ._afdg .Color =_bfc .NewCT_Color ();};return Color {_fcefc ._afdg .Color };}; // AddTable adds a new table to the document body. func (_aaff *Document )AddTable ()Table {_fcf :=_bfc .NewEG_BlockLevelElts ();_aaff ._bfda .Body .EG_BlockLevelElts =append (_aaff ._bfda .Body .EG_BlockLevelElts ,_fcf );_fag :=_bfc .NewEG_ContentBlockContent ();_fcf .EG_ContentBlockContent =append (_fcf .EG_ContentBlockContent ,_fag );_efe :=_bfc .NewCT_Tbl ();_fag .Tbl =append (_fag .Tbl ,_efe );return Table {_aaff ,_efe };};func _baf (_adb *_bfc .CT_P ,_efdd map[string ]string ){for _ ,_bba :=range _adb .EG_PContent {if _bba .Hyperlink !=nil &&_bba .Hyperlink .IdAttr !=nil {if _afe ,_cfeg :=_efdd [*_bba .Hyperlink .IdAttr ];_cfeg {*_bba .Hyperlink .IdAttr =_afe ;};};};}; // AddParagraph adds a paragraph to the endnote. func (_cbeg Endnote )AddParagraph ()Paragraph {_fdae :=_bfc .NewEG_ContentBlockContent ();_becb :=len (_cbeg ._cggg .EG_BlockLevelElts [0].EG_ContentBlockContent );_cbeg ._cggg .EG_BlockLevelElts [0].EG_ContentBlockContent =append (_cbeg ._cggg .EG_BlockLevelElts [0].EG_ContentBlockContent ,_fdae );_gada :=_bfc .NewCT_P ();var _abag *_bfc .CT_String ;if _becb !=0{_debe :=len (_cbeg ._cggg .EG_BlockLevelElts [0].EG_ContentBlockContent [_becb -1].P );_abag =_cbeg ._cggg .EG_BlockLevelElts [0].EG_ContentBlockContent [_becb -1].P [_debe -1].PPr .PStyle ;}else {_abag =_bfc .NewCT_String ();_abag .ValAttr ="\u0045n\u0064\u006e\u006f\u0074\u0065";};_fdae .P =append (_fdae .P ,_gada );_bcag :=Paragraph {_cbeg ._bdab ,_gada };_bcag ._egaag .PPr =_bfc .NewCT_PPr ();_bcag ._egaag .PPr .PStyle =_abag ;_bcag ._egaag .PPr .RPr =_bfc .NewCT_ParaRPr ();return _bcag ;}; // AddParagraph adds a paragraph to the header. func (_begeg Header )AddParagraph ()Paragraph {_ecbe :=_bfc .NewEG_ContentBlockContent ();_begeg ._abff .EG_ContentBlockContent =append (_begeg ._abff .EG_ContentBlockContent ,_ecbe );_bcfb :=_bfc .NewCT_P ();_ecbe .P =append (_ecbe .P ,_bcfb );return Paragraph {_begeg ._aea ,_bcfb };}; // AddFieldWithFormatting adds a field (automatically computed text) to the // document with field specifc formatting. func (_adaa Run )AddFieldWithFormatting (code string ,fmt string ,isDirty bool ){_fcef :=_adaa .newIC ();_fcef .FldChar =_bfc .NewCT_FldChar ();_fcef .FldChar .FldCharTypeAttr =_bfc .ST_FldCharTypeBegin ;if isDirty {_fcef .FldChar .DirtyAttr =&_af .ST_OnOff {};_fcef .FldChar .DirtyAttr .Bool =_a .Bool (true );};_fcef =_adaa .newIC ();_fcef .InstrText =_bfc .NewCT_Text ();if fmt !=""{_fcef .InstrText .Content =code +"\u0020"+fmt ;}else {_fcef .InstrText .Content =code ;};_fcef =_adaa .newIC ();_fcef .FldChar =_bfc .NewCT_FldChar ();_fcef .FldChar .FldCharTypeAttr =_bfc .ST_FldCharTypeEnd ;}; // Text returns the underlying tet in the run. func (_beeb Run )Text ()string {if len (_beeb ._cdfb .EG_RunInnerContent )==0{return "";};_gdaaa :=_gg .Buffer {};for _ ,_cgceb :=range _beeb ._cdfb .EG_RunInnerContent {if _cgceb .T !=nil {_gdaaa .WriteString (_cgceb .T .Content );};if _cgceb .Tab !=nil {_gdaaa .WriteByte ('\t');};};return _gdaaa .String ();}; // SetPageBreakBefore controls if there is a page break before this paragraph. func (_cfdec ParagraphProperties )SetPageBreakBefore (b bool ){if !b {_cfdec ._aeag .PageBreakBefore =nil ;}else {_cfdec ._aeag .PageBreakBefore =_bfc .NewCT_OnOff ();};}; // SetShading controls the cell shading. func (_gcf CellProperties )SetShading (shd _bfc .ST_Shd ,foreground ,fill _fc .Color ){if shd ==_bfc .ST_ShdUnset {_gcf ._bdag .Shd =nil ;}else {_gcf ._bdag .Shd =_bfc .NewCT_Shd ();_gcf ._bdag .Shd .ValAttr =shd ;_gcf ._bdag .Shd .ColorAttr =&_bfc .ST_HexColor {};if foreground .IsAuto (){_gcf ._bdag .Shd .ColorAttr .ST_HexColorAuto =_bfc .ST_HexColorAutoAuto ;}else {_gcf ._bdag .Shd .ColorAttr .ST_HexColorRGB =foreground .AsRGBString ();};_gcf ._bdag .Shd .FillAttr =&_bfc .ST_HexColor {};if fill .IsAuto (){_gcf ._bdag .Shd .FillAttr .ST_HexColorAuto =_bfc .ST_HexColorAutoAuto ;}else {_gcf ._bdag .Shd .FillAttr .ST_HexColorRGB =fill .AsRGBString ();};};}; // TableProperties returns the table style properties. func (_ebff Style )TableProperties ()TableStyleProperties {if _ebff ._gdea .TblPr ==nil {_ebff ._gdea .TblPr =_bfc .NewCT_TblPrBase ();};return TableStyleProperties {_ebff ._gdea .TblPr };}; // RunProperties returns the run style properties. func (_affa Style )RunProperties ()RunProperties {if _affa ._gdea .RPr ==nil {_affa ._gdea .RPr =_bfc .NewCT_RPr ();};return RunProperties {_affa ._gdea .RPr };}; // SetVerticalBanding controls the conditional formatting for vertical banding. func (_fage TableLook )SetVerticalBanding (on bool ){if !on {_fage ._dbeg .NoVBandAttr =&_af .ST_OnOff {};_fage ._dbeg .NoVBandAttr .ST_OnOff1 =_af .ST_OnOff1On ;}else {_fage ._dbeg .NoVBandAttr =&_af .ST_OnOff {};_fage ._dbeg .NoVBandAttr .ST_OnOff1 =_af .ST_OnOff1Off ;};}; // HasEndnotes returns a bool based on the presence or abscence of endnotes within // the document. func (_ceee *Document )HasEndnotes ()bool {return _ceee ._aee !=nil }; // SetRight sets the right border to a specified type, color and thickness. func (_aecg TableBorders )SetRight (t _bfc .ST_Border ,c _fc .Color ,thickness _gga .Distance ){_aecg ._fbaf .Right =_bfc .NewCT_Border ();_aebcf (_aecg ._fbaf .Right ,t ,c ,thickness );}; // SetSpacing sets the spacing that comes before and after the paragraph. // Deprecated: See Spacing() instead which allows finer control. func (_dgfcf ParagraphProperties )SetSpacing (before ,after _gga .Distance ){if _dgfcf ._aeag .Spacing ==nil {_dgfcf ._aeag .Spacing =_bfc .NewCT_Spacing ();};_dgfcf ._aeag .Spacing .BeforeAttr =&_af .ST_TwipsMeasure {};_dgfcf ._aeag .Spacing .BeforeAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (before /_gga .Twips ));_dgfcf ._aeag .Spacing .AfterAttr =&_af .ST_TwipsMeasure {};_dgfcf ._aeag .Spacing .AfterAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (after /_gga .Twips ));}; // AnchoredDrawing is an absolutely positioned image within a document page. type AnchoredDrawing struct{_cf *Document ;_aaf *_bfc .WdAnchor ;}; // RemoveParagraph removes a paragraph from the footnote. func (_aadc Footnote )RemoveParagraph (p Paragraph ){for _ ,_gabc :=range _aadc .content (){for _abf ,_cccd :=range _gabc .P {if _cccd ==p ._egaag {copy (_gabc .P [_abf :],_gabc .P [_abf +1:]);_gabc .P =_gabc .P [0:len (_gabc .P )-1];return ;};};};}; // SetWidthPercent sets the table to a width percentage. func (_dgagg TableProperties )SetWidthPercent (pct float64 ){_dgagg ._fbbfae .TblW =_bfc .NewCT_TblWidth ();_dgagg ._fbbfae .TblW .TypeAttr =_bfc .ST_TblWidthPct ;_dgagg ._fbbfae .TblW .WAttr =&_bfc .ST_MeasurementOrPercent {};_dgagg ._fbbfae .TblW .WAttr .ST_DecimalNumberOrPercent =&_bfc .ST_DecimalNumberOrPercent {};_dgagg ._fbbfae .TblW .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_a .Int64 (int64 (pct *50));}; // SetCSTheme sets the font complex script theme. func (_cagb Fonts )SetCSTheme (t _bfc .ST_Theme ){_cagb ._bgbgff .CsthemeAttr =t }; // X returns the inner wrapped XML type. func (_cbgef Header )X ()*_bfc .Hdr {return _cbgef ._abff }; // SetUnhideWhenUsed controls if a semi hidden style becomes visible when used. func (_ggbcg Style )SetUnhideWhenUsed (b bool ){if b {_ggbcg ._gdea .UnhideWhenUsed =_bfc .NewCT_OnOff ();}else {_ggbcg ._gdea .UnhideWhenUsed =nil ;};};func _edcf (_ebec *_bfc .EG_ContentBlockContent )[]Bookmark {_ddedc :=[]Bookmark {};for _ ,_acgf :=range _ebec .P {for _ ,_agbc :=range _acgf .EG_PContent {for _ ,_egfd :=range _agbc .EG_ContentRunContent {for _ ,_dcgc :=range _egfd .EG_RunLevelElts {for _ ,_ada :=range _dcgc .EG_RangeMarkupElements {if _ada .BookmarkStart !=nil {_ddedc =append (_ddedc ,Bookmark {_ada .BookmarkStart });};};};};};};for _ ,_gafg :=range _ebec .EG_RunLevelElts {for _ ,_ggef :=range _gafg .EG_RangeMarkupElements {if _ggef .BookmarkStart !=nil {_ddedc =append (_ddedc ,Bookmark {_ggef .BookmarkStart });};};};for _ ,_bbd :=range _ebec .Tbl {for _ ,_caefg :=range _bbd .EG_ContentRowContent {for _ ,_ffcf :=range _caefg .Tr {for _ ,_bfb :=range _ffcf .EG_ContentCellContent {for _ ,_fddb :=range _bfb .Tc {for _ ,_adca :=range _fddb .EG_BlockLevelElts {for _ ,_fbce :=range _adca .EG_ContentBlockContent {for _ ,_egag :=range _edcf (_fbce ){_ddedc =append (_ddedc ,_egag );};};};};};};};};return _ddedc ;}; // Name returns the name of the bookmark whcih is the document unique ID that // identifies the bookmark. func (_cab Bookmark )Name ()string {return _cab ._ag .NameAttr }; // StructuredDocumentTag are a tagged bit of content in a document. type StructuredDocumentTag struct{_ceff *Document ;_dfge *_bfc .CT_SdtBlock ;};func (_ebcec Paragraph )addEndFldChar ()*_bfc .CT_FldChar {_dgffd :=_ebcec .addFldChar ();_dgffd .FldCharTypeAttr =_bfc .ST_FldCharTypeEnd ;return _dgffd ;}; // Underline returns the type of paragraph underline. func (_fdbcf ParagraphProperties )Underline ()_bfc .ST_Underline {if _bgeg :=_fdbcf ._aeag .RPr .U ;_bgeg !=nil {return _bgeg .ValAttr ;};return 0;}; // SetNumberingDefinition sets the numbering definition ID via a NumberingDefinition // defined in numbering.xml func (_dcbg Paragraph )SetNumberingDefinition (nd NumberingDefinition ){_dcbg .ensurePPr ();if _dcbg ._egaag .PPr .NumPr ==nil {_dcbg ._egaag .PPr .NumPr =_bfc .NewCT_NumPr ();};_aaca :=_bfc .NewCT_DecimalNumber ();_gagf :=int64 (-1);for _ ,_ffed :=range _dcbg ._gdg .Numbering ._bbbf .Num {if _ffed .AbstractNumId !=nil &&_ffed .AbstractNumId .ValAttr ==nd .AbstractNumberID (){_gagf =_ffed .NumIdAttr ;};};if _gagf ==-1{_gcedg :=_bfc .NewCT_Num ();_dcbg ._gdg .Numbering ._bbbf .Num =append (_dcbg ._gdg .Numbering ._bbbf .Num ,_gcedg );_gcedg .NumIdAttr =int64 (len (_dcbg ._gdg .Numbering ._bbbf .Num ));_gcedg .AbstractNumId =_bfc .NewCT_DecimalNumber ();_gcedg .AbstractNumId .ValAttr =nd .AbstractNumberID ();};_aaca .ValAttr =_gagf ;_dcbg ._egaag .PPr .NumPr .NumId =_aaca ;}; // AddDrawingAnchored adds an anchored (floating) drawing from an ImageRef. func (_cece Run )AddDrawingAnchored (img _df .ImageRef )(AnchoredDrawing ,error ){_cgaaf :=_cece .newIC ();_cgaaf .Drawing =_bfc .NewCT_Drawing ();_bbdg :=_bfc .NewWdAnchor ();_dddag :=AnchoredDrawing {_cece ._dadg ,_bbdg };_bbdg .SimplePosAttr =_a .Bool (false );_bbdg .AllowOverlapAttr =true ;_bbdg .CNvGraphicFramePr =_be .NewCT_NonVisualGraphicFrameProperties ();_cgaaf .Drawing .Anchor =append (_cgaaf .Drawing .Anchor ,_bbdg );_bbdg .Graphic =_be .NewGraphic ();_bbdg .Graphic .GraphicData =_be .NewCT_GraphicalObjectData ();_bbdg .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";_bbdg .SimplePos .XAttr .ST_CoordinateUnqualified =_a .Int64 (0);_bbdg .SimplePos .YAttr .ST_CoordinateUnqualified =_a .Int64 (0);_bbdg .PositionH .RelativeFromAttr =_bfc .WdST_RelFromHPage ;_bbdg .PositionH .Choice =&_bfc .WdCT_PosHChoice {};_bbdg .PositionH .Choice .PosOffset =_a .Int32 (0);_bbdg .PositionV .RelativeFromAttr =_bfc .WdST_RelFromVPage ;_bbdg .PositionV .Choice =&_bfc .WdCT_PosVChoice {};_bbdg .PositionV .Choice .PosOffset =_a .Int32 (0);_bbdg .Extent .CxAttr =int64 (float64 (img .Size ().X *_gga .Pixel72 )/_gga .EMU );_bbdg .Extent .CyAttr =int64 (float64 (img .Size ().Y *_gga .Pixel72 )/_gga .EMU );_bbdg .Choice =&_bfc .WdEG_WrapTypeChoice {};_bbdg .Choice .WrapSquare =_bfc .NewWdCT_WrapSquare ();_bbdg .Choice .WrapSquare .WrapTextAttr =_bfc .WdST_WrapTextBothSides ;_fcfc :=0x7FFFFFFF&_b .Uint32 ();_bbdg .DocPr .IdAttr =_fcfc ;_dggb :=_fd .NewPic ();_dggb .NvPicPr .CNvPr .IdAttr =_fcfc ;_deec :=img .RelID ();if _deec ==""{return _dddag ,_ab .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");};_bbdg .Graphic .GraphicData .Any =append (_bbdg .Graphic .GraphicData .Any ,_dggb );_dggb .BlipFill =_be .NewCT_BlipFillProperties ();_dggb .BlipFill .Blip =_be .NewCT_Blip ();_dggb .BlipFill .Blip .EmbedAttr =&_deec ;_dggb .BlipFill .Stretch =_be .NewCT_StretchInfoProperties ();_dggb .BlipFill .Stretch .FillRect =_be .NewCT_RelativeRect ();_dggb .SpPr =_be .NewCT_ShapeProperties ();_dggb .SpPr .Xfrm =_be .NewCT_Transform2D ();_dggb .SpPr .Xfrm .Off =_be .NewCT_Point2D ();_dggb .SpPr .Xfrm .Off .XAttr .ST_CoordinateUnqualified =_a .Int64 (0);_dggb .SpPr .Xfrm .Off .YAttr .ST_CoordinateUnqualified =_a .Int64 (0);_dggb .SpPr .Xfrm .Ext =_be .NewCT_PositiveSize2D ();_dggb .SpPr .Xfrm .Ext .CxAttr =int64 (img .Size ().X *_gga .Point );_dggb .SpPr .Xfrm .Ext .CyAttr =int64 (img .Size ().Y *_gga .Point );_dggb .SpPr .PrstGeom =_be .NewCT_PresetGeometry2D ();_dggb .SpPr .PrstGeom .PrstAttr =_be .ST_ShapeTypeRect ;return _dddag ,nil ;}; // 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 ){_gafe ,_dfc :=Open (filename );if _dfc !=nil {return nil ,_dfc ;};_gafe ._bfda .Body =_bfc .NewCT_Body ();return _gafe ,nil ;}; // 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 (_efab Document )SetConformance (conformanceAttr _af .ST_ConformanceClass ){_efab ._bfda .ConformanceAttr =conformanceAttr ;}; // SetImprint sets the run to imprinted text. func (_dfbe RunProperties )SetImprint (b bool ){if !b {_dfbe ._afdg .Imprint =nil ;}else {_dfbe ._afdg .Imprint =_bfc .NewCT_OnOff ();};}; // SetInsideVertical sets the interior vertical borders to a specified type, color and thickness. func (_bfdb TableBorders )SetInsideVertical (t _bfc .ST_Border ,c _fc .Color ,thickness _gga .Distance ){_bfdb ._fbaf .InsideV =_bfc .NewCT_Border ();_aebcf (_bfdb ._fbaf .InsideV ,t ,c ,thickness );}; // Shadow returns true if paragraph shadow is on. func (_abaa ParagraphProperties )Shadow ()bool {return _ecab (_abaa ._aeag .RPr .Shadow )}; // X returns the inner wrapped XML type. func (_fcag TableStyleProperties )X ()*_bfc .CT_TblPrBase {return _fcag ._cfbe }; // SetBasedOn sets the style that this style is based on. func (_gadb Style )SetBasedOn (name string ){if name ==""{_gadb ._gdea .BasedOn =nil ;}else {_gadb ._gdea .BasedOn =_bfc .NewCT_String ();_gadb ._gdea .BasedOn .ValAttr =name ;};}; // RStyle returns the name of character style. // It is defined here http://officeopenxml.com/WPstyleCharStyles.php func (_cdda ParagraphProperties )RStyle ()string {if _cdda ._aeag .RPr .RStyle !=nil {return _cdda ._aeag .RPr .RStyle .ValAttr ;};return "";};func _cgff (_cfgda *_be .CT_Blip ,_fdec map[string ]string ){if _cfgda .EmbedAttr !=nil {if _eeca ,_ebcgc :=_fdec [*_cfgda .EmbedAttr ];_ebcgc {*_cfgda .EmbedAttr =_eeca ;};};}; // SetSize sets size attribute for a FormFieldTypeCheckBox in pt. func (_bdee FormField )SetSize (size uint64 ){size *=2;if _bdee ._cdaa .CheckBox !=nil {_bdee ._cdaa .CheckBox .Choice =_bfc .NewCT_FFCheckBoxChoice ();_bdee ._cdaa .CheckBox .Choice .Size =_bfc .NewCT_HpsMeasure ();_bdee ._cdaa .CheckBox .Choice .Size .ValAttr =_bfc .ST_HpsMeasure {ST_UnsignedDecimalNumber :&size };};}; // Caps returns true if run font is capitalized. func (_bafbg RunProperties )Caps ()bool {return _ecab (_bafbg ._afdg .Caps )}; // CellMargins are the margins for an individual cell. type CellMargins struct{_aca *_bfc .CT_TcMar }; // SetItalic sets the run to italic. func (_babe RunProperties )SetItalic (b bool ){if !b {_babe ._afdg .I =nil ;_babe ._afdg .ICs =nil ;}else {_babe ._afdg .I =_bfc .NewCT_OnOff ();_babe ._afdg .ICs =_bfc .NewCT_OnOff ();};}; // SetOrigin sets the origin of the image. It defaults to ST_RelFromHPage and // ST_RelFromVPage func (_dg AnchoredDrawing )SetOrigin (h _bfc .WdST_RelFromH ,v _bfc .WdST_RelFromV ){_dg ._aaf .PositionH .RelativeFromAttr =h ;_dg ._aaf .PositionV .RelativeFromAttr =v ;}; // AddHeader creates a header associated with the document, but doesn't add it // to the document for display. func (_acg *Document )AddHeader ()Header {_dfbf :=_bfc .NewHdr ();_acg ._cfb =append (_acg ._cfb ,_dfbf );_gbb :=_bf .Sprintf ("\u0068\u0065\u0061d\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c",len (_acg ._cfb ));_acg ._fbb .AddRelationship (_gbb ,_a .HeaderType );_acg .ContentTypes .AddOverride ("\u002f\u0077\u006f\u0072\u0064\u002f"+_gbb ,"\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");_acg ._ddc =append (_acg ._ddc ,_df .NewRelationships ());return Header {_acg ,_dfbf };}; // SetASCIITheme sets the font ASCII Theme. func (_abca Fonts )SetASCIITheme (t _bfc .ST_Theme ){_abca ._bgbgff .AsciiThemeAttr =t }; // SetWidthPercent sets the cell to a width percentage. func (_efb CellProperties )SetWidthPercent (pct float64 ){_efb ._bdag .TcW =_bfc .NewCT_TblWidth ();_efb ._bdag .TcW .TypeAttr =_bfc .ST_TblWidthPct ;_efb ._bdag .TcW .WAttr =&_bfc .ST_MeasurementOrPercent {};_efb ._bdag .TcW .WAttr .ST_DecimalNumberOrPercent =&_bfc .ST_DecimalNumberOrPercent {};_efb ._bdag .TcW .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_a .Int64 (int64 (pct *50));}; // Paragraphs returns all of the paragraphs in the document body including tables. func (_gaa *Document )Paragraphs ()[]Paragraph {_acfb :=[]Paragraph {};if _gaa ._bfda .Body ==nil {return nil ;};for _ ,_fgab :=range _gaa ._bfda .Body .EG_BlockLevelElts {for _ ,_ddd :=range _fgab .EG_ContentBlockContent {for _ ,_dbc :=range _ddd .P {_acfb =append (_acfb ,Paragraph {_gaa ,_dbc });};};};for _ ,_cbf :=range _gaa .Tables (){for _ ,_cfbb :=range _cbf .Rows (){for _ ,_beg :=range _cfbb .Cells (){_acfb =append (_acfb ,_beg .Paragraphs ()...);};};};return _acfb ;}; // SetLastColumn controls the conditional formatting for the last column in a table. func (_egaf TableLook )SetLastColumn (on bool ){if !on {_egaf ._dbeg .LastColumnAttr =&_af .ST_OnOff {};_egaf ._dbeg .LastColumnAttr .ST_OnOff1 =_af .ST_OnOff1Off ;}else {_egaf ._dbeg .LastColumnAttr =&_af .ST_OnOff {};_egaf ._dbeg .LastColumnAttr .ST_OnOff1 =_af .ST_OnOff1On ;};}; // AddLevel adds a new numbering level to a NumberingDefinition. func (_dgbd NumberingDefinition )AddLevel ()NumberingLevel {_feaf :=_bfc .NewCT_Lvl ();_feaf .Start =&_bfc .CT_DecimalNumber {ValAttr :1};_feaf .IlvlAttr =int64 (len (_dgbd ._bcbe .Lvl ));_dgbd ._bcbe .Lvl =append (_dgbd ._bcbe .Lvl ,_feaf );return NumberingLevel {_feaf };};func (_fbecg Paragraph )ensurePPr (){if _fbecg ._egaag .PPr ==nil {_fbecg ._egaag .PPr =_bfc .NewCT_PPr ();};}; // Numbering is the document wide numbering styles contained in numbering.xml. type Numbering struct{_bbbf *_bfc .Numbering }; // ParagraphProperties returns the paragraph properties controlling text formatting within the table. func (_edfg TableConditionalFormatting )ParagraphProperties ()ParagraphStyleProperties {if _edfg ._efebb .PPr ==nil {_edfg ._efebb .PPr =_bfc .NewCT_PPrGeneral ();};return ParagraphStyleProperties {_edfg ._efebb .PPr };}; // SetStyle sets the style of a paragraph. func (_dcdad ParagraphProperties )SetStyle (s string ){if s ==""{_dcdad ._aeag .PStyle =nil ;}else {_dcdad ._aeag .PStyle =_bfc .NewCT_String ();_dcdad ._aeag .PStyle .ValAttr =s ;};};func (_dfdb Endnote )id ()int64 {return _dfdb ._cggg .IdAttr }; // ParagraphProperties returns the paragraph style properties. func (_egda Style )ParagraphProperties ()ParagraphStyleProperties {if _egda ._gdea .PPr ==nil {_egda ._gdea .PPr =_bfc .NewCT_PPrGeneral ();};return ParagraphStyleProperties {_egda ._gdea .PPr };}; // StyleID returns the style ID. func (_babd Style )StyleID ()string {if _babd ._gdea .StyleIdAttr ==nil {return "";};return *_babd ._gdea .StyleIdAttr ;}; // SetValue sets the width value. func (_ddaa TableWidth )SetValue (m _gga .Distance ){_ddaa ._dgca .WAttr =&_bfc .ST_MeasurementOrPercent {};_ddaa ._dgca .WAttr .ST_DecimalNumberOrPercent =&_bfc .ST_DecimalNumberOrPercent {};_ddaa ._dgca .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_a .Int64 (int64 (m /_gga .Twips ));_ddaa ._dgca .TypeAttr =_bfc .ST_TblWidthDxa ;}; // SetAfterAuto controls if spacing after a paragraph is automatically determined. func (_ged ParagraphSpacing )SetAfterAuto (b bool ){if b {_ged ._dgad .AfterAutospacingAttr =&_af .ST_OnOff {};_ged ._dgad .AfterAutospacingAttr .Bool =_a .Bool (true );}else {_ged ._dgad .AfterAutospacingAttr =nil ;};}; // Fonts returns the style's Fonts. func (_cgdb RunProperties )Fonts ()Fonts {if _cgdb ._afdg .RFonts ==nil {_cgdb ._afdg .RFonts =_bfc .NewCT_Fonts ();};return Fonts {_cgdb ._afdg .RFonts };}; // SetHeader sets a section header. func (_ddfe Section )SetHeader (h Header ,t _bfc .ST_HdrFtr ){_eccge :=_bfc .NewEG_HdrFtrReferences ();_ddfe ._bbbe .EG_HdrFtrReferences =append (_ddfe ._bbbe .EG_HdrFtrReferences ,_eccge );_eccge .HeaderReference =_bfc .NewCT_HdrFtrRef ();_eccge .HeaderReference .TypeAttr =t ;_bfg :=_ddfe ._caga ._fbb .FindRIDForN (h .Index (),_a .HeaderType );if _bfg ==""{_eg .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");};_eccge .HeaderReference .IdAttr =_bfg ;}; // X returns the inner wrapped XML type. func (_eeda Paragraph )X ()*_bfc .CT_P {return _eeda ._egaag }; // RemoveParagraph removes a paragraph from a footer. func (_gegba Header )RemoveParagraph (p Paragraph ){for _ ,_ebga :=range _gegba ._abff .EG_ContentBlockContent {for _deg ,_cddbf :=range _ebga .P {if _cddbf ==p ._egaag {copy (_ebga .P [_deg :],_ebga .P [_deg +1:]);_ebga .P =_ebga .P [0:len (_ebga .P )-1];return ;};};};}; // X returns the inner wrapped XML type. func (_acc CellProperties )X ()*_bfc .CT_TcPr {return _acc ._bdag }; // SetAll sets all of the borders to a given value. func (_ff CellBorders )SetAll (t _bfc .ST_Border ,c _fc .Color ,thickness _gga .Distance ){_ff .SetBottom (t ,c ,thickness );_ff .SetLeft (t ,c ,thickness );_ff .SetRight (t ,c ,thickness );_ff .SetTop (t ,c ,thickness );_ff .SetInsideHorizontal (t ,c ,thickness );_ff .SetInsideVertical (t ,c ,thickness );}; // NewNumbering constructs a new numbering. func NewNumbering ()Numbering {_ggeae :=_bfc .NewNumbering ();return Numbering {_ggeae }}; // X returns the inner wrapped XML type. func (_abaf Footnote )X ()*_bfc .CT_FtnEdn {return _abaf ._gbbd };func _ebcg (_aaeb *_bfc .CT_Tbl ,_gcfc ,_aagg map[int64 ]int64 ){for _ ,_cbda :=range _aaeb .EG_ContentRowContent {for _ ,_egcc :=range _cbda .Tr {for _ ,_aecc :=range _egcc .EG_ContentCellContent {for _ ,_cdf :=range _aecc .Tc {for _ ,_baca :=range _cdf .EG_BlockLevelElts {for _ ,_cce :=range _baca .EG_ContentBlockContent {for _ ,_gfbf :=range _cce .P {_gfb (_gfbf ,_gcfc ,_aagg );};for _ ,_cga :=range _cce .Tbl {_ebcg (_cga ,_gcfc ,_aagg );};};};};};};};}; // AddParagraph adds a paragraph to the footer. func (_ecga Footer )AddParagraph ()Paragraph {_gece :=_bfc .NewEG_ContentBlockContent ();_ecga ._cgaf .EG_ContentBlockContent =append (_ecga ._cgaf .EG_ContentBlockContent ,_gece );_eegc :=_bfc .NewCT_P ();_gece .P =append (_gece .P ,_eegc );return Paragraph {_ecga ._gdfd ,_eegc };}; // StructuredDocumentTags returns the structured document tags in the document // which are commonly used in document templates. func (_aebf *Document )StructuredDocumentTags ()[]StructuredDocumentTag {_cgf :=[]StructuredDocumentTag {};for _ ,_fbe :=range _aebf ._bfda .Body .EG_BlockLevelElts {for _ ,_bbec :=range _fbe .EG_ContentBlockContent {if _bbec .Sdt !=nil {_cgf =append (_cgf ,StructuredDocumentTag {_aebf ,_bbec .Sdt });};};};return _cgf ;}; // GetImage returns the ImageRef associated with an AnchoredDrawing. func (_gf AnchoredDrawing )GetImage ()(_df .ImageRef ,bool ){_ca :=_gf ._aaf .Graphic .GraphicData .Any ;if len (_ca )> 0{_ggaa ,_dfb :=_ca [0].(*_fd .Pic );if _dfb {if _ggaa .BlipFill !=nil &&_ggaa .BlipFill .Blip !=nil &&_ggaa .BlipFill .Blip .EmbedAttr !=nil {return _gf ._cf .GetImageByRelID (*_ggaa .BlipFill .Blip .EmbedAttr );};};};return _df .ImageRef {},false ;}; // SetPossibleValues sets possible values for a FormFieldTypeDropDown. func (_bbeg FormField )SetPossibleValues (values []string ){if _bbeg ._cdaa .DdList !=nil {for _ ,_gegf :=range values {_aggd :=_bfc .NewCT_String ();_aggd .ValAttr =_gegf ;_bbeg ._cdaa .DdList .ListEntry =append (_bbeg ._cdaa .DdList .ListEntry ,_aggd );};};}; // ItalicValue returns the precise nature of the italic setting (unset, off or on). func (_faefc RunProperties )ItalicValue ()OnOffValue {return _ggbb (_faefc ._afdg .I )}; // SizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi. func (_ggdd ParagraphProperties )SizeMeasure ()string {if _cbca :=_ggdd ._aeag .RPr .Sz ;_cbca !=nil {_caag :=_cbca .ValAttr ;if _caag .ST_PositiveUniversalMeasure !=nil {return *_caag .ST_PositiveUniversalMeasure ;};};return "";}; // Settings controls the document settings. type Settings struct{_cgbd *_bfc .Settings }; // SetEndIndent controls the end indentation. func (_degcd ParagraphProperties )SetEndIndent (m _gga .Distance ){if _degcd ._aeag .Ind ==nil {_degcd ._aeag .Ind =_bfc .NewCT_Ind ();};if m ==_gga .Zero {_degcd ._aeag .Ind .EndAttr =nil ;}else {_degcd ._aeag .Ind .EndAttr =&_bfc .ST_SignedTwipsMeasure {};_degcd ._aeag .Ind .EndAttr .Int64 =_a .Int64 (int64 (m /_gga .Twips ));};}; // ClearContent clears any content in the run (text, tabs, breaks, etc.) func (_acba Run )ClearContent (){_acba ._cdfb .EG_RunInnerContent =nil }; // InsertParagraphBefore adds a new empty paragraph before the relativeTo // paragraph. func (_cbcd *Document )InsertParagraphBefore (relativeTo Paragraph )Paragraph {return _cbcd .insertParagraph (relativeTo ,true );}; // SetKeepOnOnePage controls if all lines in a paragraph are kept on the same // page. func (_babg ParagraphStyleProperties )SetKeepOnOnePage (b bool ){if !b {_babg ._daba .KeepLines =nil ;}else {_babg ._daba .KeepLines =_bfc .NewCT_OnOff ();};};func _fedac (_agab []*_bfc .EG_ContentBlockContent ,_gddb *TableInfo )[]TextItem {_bggb :=[]TextItem {};for _ ,_ccdd :=range _agab {if _beed :=_ccdd .Sdt ;_beed !=nil {if _egdc :=_beed .SdtContent ;_egdc !=nil {_bggb =append (_bggb ,_gecdc (_egdc .P ,_gddb ,nil )...);};};_bggb =append (_bggb ,_gecdc (_ccdd .P ,_gddb ,nil )...);for _ ,_bea :=range _ccdd .Tbl {for _bccd ,_eee :=range _bea .EG_ContentRowContent {for _ ,_dcgac :=range _eee .Tr {for _dfag ,_fddf :=range _dcgac .EG_ContentCellContent {for _ ,_gbed :=range _fddf .Tc {_fad :=&TableInfo {Table :_bea ,Row :_dcgac ,Cell :_gbed ,RowIndex :_bccd ,ColIndex :_dfag };for _ ,_gdag :=range _gbed .EG_BlockLevelElts {_bggb =append (_bggb ,_fedac (_gdag .EG_ContentBlockContent ,_fad )...);};};};};};};};return _bggb ;}; // AddStyle adds a new empty style. func (_aega Styles )AddStyle (styleID string ,t _bfc .ST_StyleType ,isDefault bool )Style {_gcfcd :=_bfc .NewCT_Style ();_gcfcd .TypeAttr =t ;if isDefault {_gcfcd .DefaultAttr =&_af .ST_OnOff {};_gcfcd .DefaultAttr .Bool =_a .Bool (isDefault );};_gcfcd .StyleIdAttr =_a .String (styleID );_aega ._bcagb .Style =append (_aega ._bcagb .Style ,_gcfcd );return Style {_gcfcd };}; // Paragraphs returns the paragraphs defined in a header. func (_adba Header )Paragraphs ()[]Paragraph {_gbcc :=[]Paragraph {};for _ ,_cdbb :=range _adba ._abff .EG_ContentBlockContent {for _ ,_cecf :=range _cdbb .P {_gbcc =append (_gbcc ,Paragraph {_adba ._aea ,_cecf });};};for _ ,_bfea :=range _adba .Tables (){for _ ,_afcg :=range _bfea .Rows (){for _ ,_gaef :=range _afcg .Cells (){_gbcc =append (_gbcc ,_gaef .Paragraphs ()...);};};};return _gbcc ;}; // SetLineSpacing sets the spacing between lines in a paragraph. func (_fcfa ParagraphSpacing )SetLineSpacing (d _gga .Distance ,rule _bfc .ST_LineSpacingRule ){if rule ==_bfc .ST_LineSpacingRuleUnset {_fcfa ._dgad .LineRuleAttr =_bfc .ST_LineSpacingRuleUnset ;_fcfa ._dgad .LineAttr =nil ;}else {_fcfa ._dgad .LineRuleAttr =rule ;_fcfa ._dgad .LineAttr =&_bfc .ST_SignedTwipsMeasure {};_fcfa ._dgad .LineAttr .Int64 =_a .Int64 (int64 (d /_gga .Twips ));};}; // Paragraphs returns the paragraphs within a structured document tag. func (_ddeg StructuredDocumentTag )Paragraphs ()[]Paragraph {if _ddeg ._dfge .SdtContent ==nil {return nil ;};_cbad :=[]Paragraph {};for _ ,_gfbc :=range _ddeg ._dfge .SdtContent .P {_cbad =append (_cbad ,Paragraph {_ddeg ._ceff ,_gfbc });};return _cbad ;}; // CellProperties returns the cell properties. func (_faea TableConditionalFormatting )CellProperties ()CellProperties {if _faea ._efebb .TcPr ==nil {_faea ._efebb .TcPr =_bfc .NewCT_TcPr ();};return CellProperties {_faea ._efebb .TcPr };}; // X returns the inner wrapped XML type. func (_dagaf Settings )X ()*_bfc .Settings {return _dagaf ._cgbd }; // SetHANSITheme sets the font H ANSI Theme. func (_bdcf Fonts )SetHANSITheme (t _bfc .ST_Theme ){_bdcf ._bgbgff .HAnsiThemeAttr =t }; // SetPrimaryStyle marks the style as a primary style. func (_cdgc Style )SetPrimaryStyle (b bool ){if b {_cdgc ._gdea .QFormat =_bfc .NewCT_OnOff ();}else {_cdgc ._gdea .QFormat =nil ;};}; // Properties returns the row properties. func (_bcfbb Row )Properties ()RowProperties {if _bcfbb ._becg .TrPr ==nil {_bcfbb ._becg .TrPr =_bfc .NewCT_TrPr ();};return RowProperties {_bcfbb ._becg .TrPr };}; // 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{_df .DocBase ;_bfda *_bfc .Document ;Settings Settings ;Numbering Numbering ;Styles Styles ;_cfb []*_bfc .Hdr ;_ddc []_df .Relationships ;_def []*_bfc .Ftr ;_fcbd []_df .Relationships ;_fbb _df .Relationships ;_ebe []*_be .Theme ;_gb *_bfc .WebSettings ;_dcd *_bfc .Fonts ;_aee *_bfc .Endnotes ;_cd *_bfc .Footnotes ;_fgef []*_bbb .Ocx ;_gcb string ;}; // ComplexSizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi. func (_fbedf RunProperties )ComplexSizeMeasure ()string {if _cgeb :=_fbedf ._afdg .SzCs ;_cgeb !=nil {_facad :=_cgeb .ValAttr ;if _facad .ST_PositiveUniversalMeasure !=nil {return *_facad .ST_PositiveUniversalMeasure ;};};return "";}; // X returns the internally wrapped *wml.CT_SectPr. func (_dcfd Section )X ()*_bfc .CT_SectPr {return _dcfd ._bbbe }; // New constructs an empty document that content can be added to. func New ()*Document {_ecf :=&Document {_bfda :_bfc .NewDocument ()};_ecf .ContentTypes =_df .NewContentTypes ();_ecf ._bfda .Body =_bfc .NewCT_Body ();_ecf ._bfda .ConformanceAttr =_af .ST_ConformanceClassTransitional ;_ecf ._fbb =_df .NewRelationships ();_ecf .AppProperties =_df .NewAppProperties ();_ecf .CoreProperties =_df .NewCoreProperties ();_ecf .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");_ecf .Settings =NewSettings ();_ecf ._fbb .AddRelationship ("\u0073\u0065\u0074t\u0069\u006e\u0067\u0073\u002e\u0078\u006d\u006c",_a .SettingsType );_ecf .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");_ecf .Rels =_df .NewRelationships ();_ecf .Rels .AddRelationship (_a .RelativeFilename (_a .DocTypeDocument ,"",_a .CorePropertiesType ,0),_a .CorePropertiesType );_ecf .Rels .AddRelationship ("\u0064\u006fc\u0050\u0072\u006fp\u0073\u002f\u0061\u0070\u0070\u002e\u0078\u006d\u006c",_a .ExtendedPropertiesType );_ecf .Rels .AddRelationship ("\u0077\u006f\u0072\u0064\u002f\u0064\u006f\u0063\u0075\u006d\u0065\u006et\u002e\u0078\u006d\u006c",_a .OfficeDocumentType );_ecf .Numbering =NewNumbering ();_ecf .Numbering .InitializeDefault ();_ecf .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");_ecf ._fbb .AddRelationship ("\u006e\u0075\u006d\u0062\u0065\u0072\u0069\u006e\u0067\u002e\u0078\u006d\u006c",_a .NumberingType );_ecf .Styles =NewStyles ();_ecf .Styles .InitializeDefault ();_ecf .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");_ecf ._fbb .AddRelationship ("\u0073\u0074\u0079\u006c\u0065\u0073\u002e\u0078\u006d\u006c",_a .StylesType );_ecf ._bfda .Body =_bfc .NewCT_Body ();return _ecf ;}; // SetEmboss sets the run to embossed text. func (_gfaea RunProperties )SetEmboss (b bool ){if !b {_gfaea ._afdg .Emboss =nil ;}else {_gfaea ._afdg .Emboss =_bfc .NewCT_OnOff ();};}; // SetCellSpacing sets the cell spacing within a table. func (_ffcg TableProperties )SetCellSpacing (m _gga .Distance ){_ffcg ._fbbfae .TblCellSpacing =_bfc .NewCT_TblWidth ();_ffcg ._fbbfae .TblCellSpacing .TypeAttr =_bfc .ST_TblWidthDxa ;_ffcg ._fbbfae .TblCellSpacing .WAttr =&_bfc .ST_MeasurementOrPercent {};_ffcg ._fbbfae .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent =&_bfc .ST_DecimalNumberOrPercent {};_ffcg ._fbbfae .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_a .Int64 (int64 (m /_gga .Dxa ));}; // GetHeader gets a section Header for given type t [ST_HdrFtrDefault, ST_HdrFtrEven, ST_HdrFtrFirst] func (_acge Section )GetHeader (t _bfc .ST_HdrFtr )(Header ,bool ){for _ ,_cgea :=range _acge ._bbbe .EG_HdrFtrReferences {if _cgea .HeaderReference .TypeAttr ==t {for _ ,_aabgd :=range _acge ._caga .Headers (){_bgcf :=_acge ._caga ._fbb .FindRIDForN (_aabgd .Index (),_a .HeaderType );if _bgcf ==_cgea .HeaderReference .IdAttr {return _aabgd ,true ;};};};};return Header {},false ;}; // Strike returns true if paragraph is striked. func (_gcaf ParagraphProperties )Strike ()bool {return _ecab (_gcaf ._aeag .RPr .Strike )}; // SetFirstColumn controls the conditional formatting for the first column in a table. func (_baba TableLook )SetFirstColumn (on bool ){if !on {_baba ._dbeg .FirstColumnAttr =&_af .ST_OnOff {};_baba ._dbeg .FirstColumnAttr .ST_OnOff1 =_af .ST_OnOff1Off ;}else {_baba ._dbeg .FirstColumnAttr =&_af .ST_OnOff {};_baba ._dbeg .FirstColumnAttr .ST_OnOff1 =_af .ST_OnOff1On ;};}; // SetAlignment sets the alignment of a table within the page. func (_egaaa TableProperties )SetAlignment (align _bfc .ST_JcTable ){if align ==_bfc .ST_JcTableUnset {_egaaa ._fbbfae .Jc =nil ;}else {_egaaa ._fbbfae .Jc =_bfc .NewCT_JcTable ();_egaaa ._fbbfae .Jc .ValAttr =align ;};}; // MergeFields returns the list of all mail merge fields found in the document. func (_ccgga Document )MergeFields ()[]string {_cefa :=map[string ]struct{}{};for _ ,_ebgaf :=range _ccgga .mergeFields (){_cefa [_ebgaf ._cbbg ]=struct{}{};};_cbef :=[]string {};for _eeee :=range _cefa {_cbef =append (_cbef ,_eeee );};return _cbef ;}; // RStyle returns the name of character style. // It is defined here http://officeopenxml.com/WPstyleCharStyles.php func (_cggdb RunProperties )RStyle ()string {if _cggdb ._afdg .RStyle !=nil {return _cggdb ._afdg .RStyle .ValAttr ;};return "";}; // RemoveFootnote removes a footnote from both the paragraph and the document // the requested footnote must be anchored on the paragraph being referenced. func (_cgdf Paragraph )RemoveFootnote (id int64 ){_gbfga :=_cgdf ._gdg ._cd ;var _gecde int ;for _ddbdd ,_fdcac :=range _gbfga .CT_Footnotes .Footnote {if _fdcac .IdAttr ==id {_gecde =_ddbdd ;};};_gecde =0;_gbfga .CT_Footnotes .Footnote [_gecde ]=nil ;_gbfga .CT_Footnotes .Footnote [_gecde ]=_gbfga .CT_Footnotes .Footnote [len (_gbfga .CT_Footnotes .Footnote )-1];_gbfga .CT_Footnotes .Footnote =_gbfga .CT_Footnotes .Footnote [:len (_gbfga .CT_Footnotes .Footnote )-1];var _fabe Run ;for _ ,_cedd :=range _cgdf .Runs (){if _fegf ,_bbecc :=_cedd .IsFootnote ();_fegf {if _bbecc ==id {_fabe =_cedd ;};};};_cgdf .RemoveRun (_fabe );}; // CharacterSpacingMeasure returns paragraph characters spacing with its measure which can be mm, cm, in, pt, pc or pi. func (_efgec RunProperties )CharacterSpacingMeasure ()string {if _dgba :=_efgec ._afdg .Spacing ;_dgba !=nil {_dafba :=_dgba .ValAttr ;if _dafba .ST_UniversalMeasure !=nil {return *_dafba .ST_UniversalMeasure ;};};return "";}; // SetKeepOnOnePage controls if all lines in a paragraph are kept on the same // page. func (_dgec ParagraphProperties )SetKeepOnOnePage (b bool ){if !b {_dgec ._aeag .KeepLines =nil ;}else {_dgec ._aeag .KeepLines =_bfc .NewCT_OnOff ();};}; // DrawingInfo is used for keep information about a drawing wrapping a textbox where the text is located. type DrawingInfo struct{Drawing *_bfc .CT_Drawing ;Width int64 ;Height int64 ;}; // SetKerning sets the run's font kerning. func (_fdga RunProperties )SetKerning (size _gga .Distance ){_fdga ._afdg .Kern =_bfc .NewCT_HpsMeasure ();_fdga ._afdg .Kern .ValAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (size /_gga .HalfPoint ));}; // Endnote returns the endnote based on the ID; this can be used nicely with // the run.IsEndnote() functionality. func (_fbab *Document )Endnote (id int64 )Endnote {for _ ,_eaf :=range _fbab .Endnotes (){if _eaf .id ()==id {return _eaf ;};};return Endnote {};}; // SetInsideHorizontal sets the interior horizontal borders to a specified type, color and thickness. func (_dacb TableBorders )SetInsideHorizontal (t _bfc .ST_Border ,c _fc .Color ,thickness _gga .Distance ){_dacb ._fbaf .InsideH =_bfc .NewCT_Border ();_aebcf (_dacb ._fbaf .InsideH ,t ,c ,thickness );}; // RemoveEndnote removes a endnote from both the paragraph and the document // the requested endnote must be anchored on the paragraph being referenced. func (_fabb Paragraph )RemoveEndnote (id int64 ){_bacf :=_fabb ._gdg ._aee ;var _gabb int ;for _cddc ,_dfga :=range _bacf .CT_Endnotes .Endnote {if _dfga .IdAttr ==id {_gabb =_cddc ;};};_gabb =0;_bacf .CT_Endnotes .Endnote [_gabb ]=nil ;_bacf .CT_Endnotes .Endnote [_gabb ]=_bacf .CT_Endnotes .Endnote [len (_bacf .CT_Endnotes .Endnote )-1];_bacf .CT_Endnotes .Endnote =_bacf .CT_Endnotes .Endnote [:len (_bacf .CT_Endnotes .Endnote )-1];var _cagd Run ;for _ ,_bcgcd :=range _fabb .Runs (){if _ccbb ,_cdbc :=_bcgcd .IsEndnote ();_ccbb {if _cdbc ==id {_cagd =_bcgcd ;};};};_fabb .RemoveRun (_cagd );};func (_beae Styles )initializeStyleDefaults (){_becf :=_beae .AddStyle ("\u004e\u006f\u0072\u006d\u0061\u006c",_bfc .ST_StyleTypeParagraph ,true );_becf .SetName ("\u004e\u006f\u0072\u006d\u0061\u006c");_becf .SetPrimaryStyle (true );_dbad :=_beae .AddStyle ("D\u0065f\u0061\u0075\u006c\u0074\u0050\u0061\u0072\u0061g\u0072\u0061\u0070\u0068Fo\u006e\u0074",_bfc .ST_StyleTypeCharacter ,true );_dbad .SetName ("\u0044\u0065\u0066\u0061ul\u0074\u0020\u0050\u0061\u0072\u0061\u0067\u0072\u0061\u0070\u0068\u0020\u0046\u006fn\u0074");_dbad .SetUISortOrder (1);_dbad .SetSemiHidden (true );_dbad .SetUnhideWhenUsed (true );_egeg :=_beae .AddStyle ("\u0054i\u0074\u006c\u0065\u0043\u0068\u0061r",_bfc .ST_StyleTypeCharacter ,false );_egeg .SetName ("\u0054\u0069\u0074\u006c\u0065\u0020\u0043\u0068\u0061\u0072");_egeg .SetBasedOn (_dbad .StyleID ());_egeg .SetLinkedStyle ("\u0054\u0069\u0074l\u0065");_egeg .SetUISortOrder (10);_egeg .RunProperties ().Fonts ().SetASCIITheme (_bfc .ST_ThemeMajorAscii );_egeg .RunProperties ().Fonts ().SetEastAsiaTheme (_bfc .ST_ThemeMajorEastAsia );_egeg .RunProperties ().Fonts ().SetHANSITheme (_bfc .ST_ThemeMajorHAnsi );_egeg .RunProperties ().Fonts ().SetCSTheme (_bfc .ST_ThemeMajorBidi );_egeg .RunProperties ().SetSize (28*_gga .Point );_egeg .RunProperties ().SetKerning (14*_gga .Point );_egeg .RunProperties ().SetCharacterSpacing (-10*_gga .Twips );_adggb :=_beae .AddStyle ("\u0054\u0069\u0074l\u0065",_bfc .ST_StyleTypeParagraph ,false );_adggb .SetName ("\u0054\u0069\u0074l\u0065");_adggb .SetBasedOn (_becf .StyleID ());_adggb .SetNextStyle (_becf .StyleID ());_adggb .SetLinkedStyle (_egeg .StyleID ());_adggb .SetUISortOrder (10);_adggb .SetPrimaryStyle (true );_adggb .ParagraphProperties ().SetContextualSpacing (true );_adggb .RunProperties ().Fonts ().SetASCIITheme (_bfc .ST_ThemeMajorAscii );_adggb .RunProperties ().Fonts ().SetEastAsiaTheme (_bfc .ST_ThemeMajorEastAsia );_adggb .RunProperties ().Fonts ().SetHANSITheme (_bfc .ST_ThemeMajorHAnsi );_adggb .RunProperties ().Fonts ().SetCSTheme (_bfc .ST_ThemeMajorBidi );_adggb .RunProperties ().SetSize (28*_gga .Point );_adggb .RunProperties ().SetKerning (14*_gga .Point );_adggb .RunProperties ().SetCharacterSpacing (-10*_gga .Twips );_ageg :=_beae .AddStyle ("T\u0061\u0062\u006c\u0065\u004e\u006f\u0072\u006d\u0061\u006c",_bfc .ST_StyleTypeTable ,false );_ageg .SetName ("\u004e\u006f\u0072m\u0061\u006c\u0020\u0054\u0061\u0062\u006c\u0065");_ageg .SetUISortOrder (99);_ageg .SetSemiHidden (true );_ageg .SetUnhideWhenUsed (true );_ageg .X ().TblPr =_bfc .NewCT_TblPrBase ();_deeg :=NewTableWidth ();_ageg .X ().TblPr .TblInd =_deeg .X ();_deeg .SetValue (0*_gga .Dxa );_ageg .X ().TblPr .TblCellMar =_bfc .NewCT_TblCellMar ();_deeg =NewTableWidth ();_ageg .X ().TblPr .TblCellMar .Top =_deeg .X ();_deeg .SetValue (0*_gga .Dxa );_deeg =NewTableWidth ();_ageg .X ().TblPr .TblCellMar .Bottom =_deeg .X ();_deeg .SetValue (0*_gga .Dxa );_deeg =NewTableWidth ();_ageg .X ().TblPr .TblCellMar .Left =_deeg .X ();_deeg .SetValue (108*_gga .Dxa );_deeg =NewTableWidth ();_ageg .X ().TblPr .TblCellMar .Right =_deeg .X ();_deeg .SetValue (108*_gga .Dxa );_dadb :=_beae .AddStyle ("\u004e\u006f\u004c\u0069\u0073\u0074",_bfc .ST_StyleTypeNumbering ,false );_dadb .SetName ("\u004eo\u0020\u004c\u0069\u0073\u0074");_dadb .SetUISortOrder (1);_dadb .SetSemiHidden (true );_dadb .SetUnhideWhenUsed (true );_gaed :=[]_gga .Distance {16,13,12,11,11,11,11,11,11};_ffdgd :=[]_gga .Distance {240,40,40,40,40,40,40,40,40};for _fffd :=0;_fffd < 9;_fffd ++{_efbcc :=_bf .Sprintf ("\u0048e\u0061\u0064\u0069\u006e\u0067\u0025d",_fffd +1);_egaab :=_beae .AddStyle (_efbcc +"\u0043\u0068\u0061\u0072",_bfc .ST_StyleTypeCharacter ,false );_egaab .SetName (_bf .Sprintf ("\u0048e\u0061d\u0069\u006e\u0067\u0020\u0025\u0064\u0020\u0043\u0068\u0061\u0072",_fffd +1));_egaab .SetBasedOn (_dbad .StyleID ());_egaab .SetLinkedStyle (_efbcc );_egaab .SetUISortOrder (9+_fffd );_egaab .RunProperties ().SetSize (_gaed [_fffd ]*_gga .Point );_ffeb :=_beae .AddStyle (_efbcc ,_bfc .ST_StyleTypeParagraph ,false );_ffeb .SetName (_bf .Sprintf ("\u0068\u0065\u0061\u0064\u0069\u006e\u0067\u0020\u0025\u0064",_fffd +1));_ffeb .SetNextStyle (_becf .StyleID ());_ffeb .SetLinkedStyle (_ffeb .StyleID ());_ffeb .SetUISortOrder (9+_fffd );_ffeb .SetPrimaryStyle (true );_ffeb .ParagraphProperties ().SetKeepNext (true );_ffeb .ParagraphProperties ().SetSpacing (_ffdgd [_fffd ]*_gga .Twips ,0);_ffeb .ParagraphProperties ().SetOutlineLevel (_fffd );_ffeb .RunProperties ().SetSize (_gaed [_fffd ]*_gga .Point );};}; // Tables returns the tables defined in the footer. func (_cfac Footer )Tables ()[]Table {_dcfa :=[]Table {};if _cfac ._cgaf ==nil {return nil ;};for _ ,_fbfg :=range _cfac ._cgaf .EG_ContentBlockContent {for _ ,_acceg :=range _cfac ._gdfd .tables (_fbfg ){_dcfa =append (_dcfa ,_acceg );};};return _dcfa ;}; // ExtractFromFooter returns text from the document footer as an array of TextItems. func ExtractFromFooter (footer *_bfc .Ftr )[]TextItem {return _fedac (footer .EG_ContentBlockContent ,nil );};func (_cggc Endnote )content ()[]*_bfc .EG_ContentBlockContent {var _eddg []*_bfc .EG_ContentBlockContent ;for _ ,_caaag :=range _cggc ._cggg .EG_BlockLevelElts {_eddg =append (_eddg ,_caaag .EG_ContentBlockContent ...);};return _eddg ;}; // SizeValue returns the value of paragraph font size in points. func (_dccac ParagraphProperties )SizeValue ()float64 {if _fcbfe :=_dccac ._aeag .RPr .Sz ;_fcbfe !=nil {_fbged :=_fcbfe .ValAttr ;if _fbged .ST_UnsignedDecimalNumber !=nil {return float64 (*_fbged .ST_UnsignedDecimalNumber )/2;};};return 0.0;}; // AddFooter creates a Footer associated with the document, but doesn't add it // to the document for display. func (_bbf *Document )AddFooter ()Footer {_aef :=_bfc .NewFtr ();_bbf ._def =append (_bbf ._def ,_aef );_fgea :=_bf .Sprintf ("\u0066\u006f\u006ft\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c",len (_bbf ._def ));_bbf ._fbb .AddRelationship (_fgea ,_a .FooterType );_bbf .ContentTypes .AddOverride ("\u002f\u0077\u006f\u0072\u0064\u002f"+_fgea ,"\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");_bbf ._fcbd =append (_bbf ._fcbd ,_df .NewRelationships ());return Footer {_bbf ,_aef };}; // SetFirstRow controls the conditional formatting for the first row in a table. func (_eeea TableLook )SetFirstRow (on bool ){if !on {_eeea ._dbeg .FirstRowAttr =&_af .ST_OnOff {};_eeea ._dbeg .FirstRowAttr .ST_OnOff1 =_af .ST_OnOff1Off ;}else {_eeea ._dbeg .FirstRowAttr =&_af .ST_OnOff {};_eeea ._dbeg .FirstRowAttr .ST_OnOff1 =_af .ST_OnOff1On ;};};func (_egge FormFieldType )String ()string {if _egge >=FormFieldType (len (_dfff )-1){return _bf .Sprintf ("\u0046\u006f\u0072\u006d\u0046\u0069\u0065\u006c\u0064\u0054\u0079\u0070e\u0028\u0025\u0064\u0029",_egge );};return _acga [_dfff [_egge ]:_dfff [_egge +1]];}; // SetWidth sets the cell width to a specified width. func (_cae CellProperties )SetWidth (d _gga .Distance ){_cae ._bdag .TcW =_bfc .NewCT_TblWidth ();_cae ._bdag .TcW .TypeAttr =_bfc .ST_TblWidthDxa ;_cae ._bdag .TcW .WAttr =&_bfc .ST_MeasurementOrPercent {};_cae ._bdag .TcW .WAttr .ST_DecimalNumberOrPercent =&_bfc .ST_DecimalNumberOrPercent {};_cae ._bdag .TcW .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_a .Int64 (int64 (d /_gga .Twips ));}; // SetHAlignment sets the horizontal alignment for an anchored image. func (_dd AnchoredDrawing )SetHAlignment (h _bfc .WdST_AlignH ){_dd ._aaf .PositionH .Choice =&_bfc .WdCT_PosHChoice {};_dd ._aaf .PositionH .Choice .Align =h ;}; // InsertRowAfter inserts a row after another row func (_edaee Table )InsertRowAfter (r Row )Row {for _aegb ,_eaddfd :=range _edaee ._caeb .EG_ContentRowContent {if len (_eaddfd .Tr )> 0&&r .X ()==_eaddfd .Tr [0]{_bacfg :=_bfc .NewEG_ContentRowContent ();if len (_edaee ._caeb .EG_ContentRowContent )< _aegb +2{return _edaee .AddRow ();};_edaee ._caeb .EG_ContentRowContent =append (_edaee ._caeb .EG_ContentRowContent ,nil );copy (_edaee ._caeb .EG_ContentRowContent [_aegb +2:],_edaee ._caeb .EG_ContentRowContent [_aegb +1:]);_edaee ._caeb .EG_ContentRowContent [_aegb +1]=_bacfg ;_eafd :=_bfc .NewCT_Row ();_bacfg .Tr =append (_bacfg .Tr ,_eafd );return Row {_edaee ._gaebd ,_eafd };};};return _edaee .AddRow ();}; // Caps returns true if paragraph font is capitalized. func (_degd ParagraphProperties )Caps ()bool {return _ecab (_degd ._aeag .RPr .Caps )}; // SetFirstLineIndent controls the indentation of the first line in a paragraph. func (_befc ParagraphProperties )SetFirstLineIndent (m _gga .Distance ){if _befc ._aeag .Ind ==nil {_befc ._aeag .Ind =_bfc .NewCT_Ind ();};if m ==_gga .Zero {_befc ._aeag .Ind .FirstLineAttr =nil ;}else {_befc ._aeag .Ind .FirstLineAttr =&_af .ST_TwipsMeasure {};_befc ._aeag .Ind .FirstLineAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (m /_gga .Twips ));};}; // RemoveParagraph removes a paragraph from a footer. func (_dead Footer )RemoveParagraph (p Paragraph ){for _ ,_agfb :=range _dead ._cgaf .EG_ContentBlockContent {for _dfee ,_acgc :=range _agfb .P {if _acgc ==p ._egaag {copy (_agfb .P [_dfee :],_agfb .P [_dfee +1:]);_agfb .P =_agfb .P [0:len (_agfb .P )-1];return ;};};};}; // SetBottom sets the bottom border to a specified type, color and thickness. func (_edcd TableBorders )SetBottom (t _bfc .ST_Border ,c _fc .Color ,thickness _gga .Distance ){_edcd ._fbaf .Bottom =_bfc .NewCT_Border ();_aebcf (_edcd ._fbaf .Bottom ,t ,c ,thickness );}; // AddCheckBox adds checkbox form field to the paragraph and returns it. func (_adff Paragraph )AddCheckBox (name string )FormField {_ggfe :=_adff .addFldCharsForField (name ,"\u0046\u004f\u0052M\u0043\u0048\u0045\u0043\u004b\u0042\u004f\u0058");_ggfe ._cdaa .CheckBox =_bfc .NewCT_FFCheckBox ();return _ggfe ;}; // X returns the inner wrapped XML type. func (_gbded TableProperties )X ()*_bfc .CT_TblPr {return _gbded ._fbbfae }; // SizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi. func (_ecfgc RunProperties )SizeMeasure ()string {if _bebgf :=_ecfgc ._afdg .Sz ;_bebgf !=nil {_gbdea :=_bebgf .ValAttr ;if _gbdea .ST_PositiveUniversalMeasure !=nil {return *_gbdea .ST_PositiveUniversalMeasure ;};};return "";}; // Underline returns the type of run underline. func (_dfebe RunProperties )Underline ()_bfc .ST_Underline {if _bgcg :=_dfebe ._afdg .U ;_bgcg !=nil {return _bgcg .ValAttr ;};return 0;}; // SetBottomPct sets the cell bottom margin func (_fe CellMargins )SetBottomPct (pct float64 ){_fe ._aca .Bottom =_bfc .NewCT_TblWidth ();_dgf (_fe ._aca .Bottom ,pct );}; // ParagraphSpacing controls the spacing for a paragraph and its lines. type ParagraphSpacing struct{_dgad *_bfc .CT_Spacing }; // TextItem is used for keeping text with references to a paragraph and run or a table, a row and a cell where it is located. type TextItem struct{Text string ;DrawingInfo *DrawingInfo ;Paragraph *_bfc .CT_P ;Hyperlink *_bfc .CT_Hyperlink ;Run *_bfc .CT_R ;TableInfo *TableInfo ;}; // SetEffect sets a text effect on the run. func (_cgca RunProperties )SetEffect (e _bfc .ST_TextEffect ){if e ==_bfc .ST_TextEffectUnset {_cgca ._afdg .Effect =nil ;}else {_cgca ._afdg .Effect =_bfc .NewCT_TextEffect ();_cgca ._afdg .Effect .ValAttr =_bfc .ST_TextEffectShimmer ;};}; // Footnote returns the footnote based on the ID; this can be used nicely with // the run.IsFootnote() functionality. func (_cfa *Document )Footnote (id int64 )Footnote {for _ ,_acae :=range _cfa .Footnotes (){if _acae .id ()==id {return _acae ;};};return Footnote {};}; // AddDropdownList adds dropdown list form field to the paragraph and returns it. func (_aagb Paragraph )AddDropdownList (name string )FormField {_bgd :=_aagb .addFldCharsForField (name ,"\u0046\u004f\u0052M\u0044\u0052\u004f\u0050\u0044\u004f\u0057\u004e");_bgd ._cdaa .DdList =_bfc .NewCT_FFDDList ();return _bgd ;};func _aefg (_fgfe _gc .ReaderAt ,_aacb int64 ,_ecdd string )(*Document ,error ){const _aae ="\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0052\u0065\u0061\u0064";if !_fb .GetLicenseKey ().IsLicensed ()&&!_gba {_bf .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");_bf .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 nil ,_ab .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");};_aec :=New ();_aec .Numbering ._bbbf =nil ;if len (_ecdd )> 0{_aec ._gcb =_ecdd ;}else {_abc ,_gafee :=_fb .GenRefId ("\u0064\u0072");if _gafee !=nil {_a .Log ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0025\u0076\u000a",_gafee );return nil ,_gafee ;};_aec ._gcb =_abc ;};if _fbg :=_fb .Track (_aec ._gcb ,_aae );_fbg !=nil {_bf .Printf ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0025\u0076\u000a",_fbg );return nil ,_fbg ;};_ebb ,_cbge :=_eca .TempDir ("\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065-\u0064\u006f\u0063\u0078");if _cbge !=nil {return nil ,_cbge ;};_aec .TmpPath =_ebb ;_bgg ,_cbge :=_da .NewReader (_fgfe ,_aacb );if _cbge !=nil {return nil ,_bf .Errorf ("\u0070a\u0072s\u0069\u006e\u0067\u0020\u007a\u0069\u0070\u003a\u0020\u0025\u0073",_cbge );};_bcgd :=[]*_da .File {};_bcgd =append (_bcgd ,_bgg .File ...);_dcaf :=false ;for _ ,_ggfd :=range _bcgd {if _ggfd .FileHeader .Name =="\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c"{_dcaf =true ;break ;};};if _dcaf {_aec .CreateCustomProperties ();};_gae :=_aec ._bfda .ConformanceAttr ;_ggcc :=_c .DecodeMap {};_ggcc .SetOnNewRelationshipFunc (_aec .onNewRelationship );_ggcc .AddTarget (_a .ContentTypesFilename ,_aec .ContentTypes .X (),"",0);_ggcc .AddTarget (_a .BaseRelsFilename ,_aec .Rels .X (),"",0);if _ebeb :=_ggcc .Decode (_bcgd );_ebeb !=nil {return nil ,_ebeb ;};_aec ._bfda .ConformanceAttr =_gae ;for _ ,_bae :=range _bcgd {if _bae ==nil {continue ;};if _feba :=_aec .AddExtraFileFromZip (_bae );_feba !=nil {return nil ,_feba ;};};if _dcaf {_cfbg :=false ;for _ ,_ecdb :=range _aec .Rels .X ().Relationship {if _ecdb .TargetAttr =="\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c"{_cfbg =true ;break ;};};if !_cfbg {_aec .AddCustomRelationships ();};};return _aec ,nil ;}; // 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 (_gde *Document )BodySection ()Section {if _gde ._bfda .Body .SectPr ==nil {_gde ._bfda .Body .SectPr =_bfc .NewCT_SectPr ();};return Section {_gde ,_gde ._bfda .Body .SectPr };}; // Paragraphs returns the paragraphs defined in the cell. func (_daf Cell )Paragraphs ()[]Paragraph {_dgb :=[]Paragraph {};for _ ,_eb :=range _daf ._adc .EG_BlockLevelElts {for _ ,_ac :=range _eb .EG_ContentBlockContent {for _ ,_fge :=range _ac .P {_dgb =append (_dgb ,Paragraph {_daf ._gfd ,_fge });};};};return _dgb ;}; // X returns the inner wrapped XML type. func (_bfe Cell )X ()*_bfc .CT_Tc {return _bfe ._adc }; // 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 (_bced Header )AddImage (i _df .Image )(_df .ImageRef ,error ){var _eeeb _df .Relationships ;for _gfca ,_daefc :=range _bced ._aea ._cfb {if _daefc ==_bced ._abff {_eeeb =_bced ._aea ._ddc [_gfca ];};};_fdff :=_df .MakeImageRef (i ,&_bced ._aea .DocBase ,_eeeb );if i .Data ==nil &&i .Path ==""{return _fdff ,_ab .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 _fdff ,_ab .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 _fdff ,_ab .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");};_bced ._aea .Images =append (_bced ._aea .Images ,_fdff );_acab :=_bf .Sprintf ("\u006d\u0065d\u0069\u0061\u002fi\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073",len (_bced ._aea .Images ),i .Format );_dafc :=_eeeb .AddRelationship (_acab ,_a .ImageType );_fdff .SetRelID (_dafc .X ().IdAttr );return _fdff ,nil ;}; // Italic returns true if run font is italic. func (_ggbf RunProperties )Italic ()bool {_fded :=_ggbf ._afdg ;return _ecab (_fded .I )||_ecab (_fded .ICs );}; // SetCharacterSpacing sets the run's Character Spacing Adjustment. func (_ggag RunProperties )SetCharacterSpacing (size _gga .Distance ){_ggag ._afdg .Spacing =_bfc .NewCT_SignedTwipsMeasure ();_ggag ._afdg .Spacing .ValAttr .Int64 =_a .Int64 (int64 (size /_gga .Twips ));}; // SetTopPct sets the cell top margin func (_gge CellMargins )SetTopPct (pct float64 ){_gge ._aca .Top =_bfc .NewCT_TblWidth ();_dgf (_gge ._aca .Top ,pct );}; // SetInsideHorizontal sets the interior horizontal borders to a specified type, color and thickness. func (_afc CellBorders )SetInsideHorizontal (t _bfc .ST_Border ,c _fc .Color ,thickness _gga .Distance ){_afc ._efd .InsideH =_bfc .NewCT_Border ();_aebcf (_afc ._efd .InsideH ,t ,c ,thickness );}; // SetTarget sets the URL target of the hyperlink. func (_dafa HyperLink )SetTarget (url string ){_gbda :=_dafa ._bbbg .AddHyperlink (url );_dafa ._ebdf .IdAttr =_a .String (_df .Relationship (_gbda ).ID ());_dafa ._ebdf .AnchorAttr =nil ;}; // AddHyperLink adds a new hyperlink to a parapgraph. func (_gcfd Paragraph )AddHyperLink ()HyperLink {_beaf :=_bfc .NewEG_PContent ();_gcfd ._egaag .EG_PContent =append (_gcfd ._egaag .EG_PContent ,_beaf );_beaf .Hyperlink =_bfc .NewCT_Hyperlink ();return HyperLink {_gcfd ._gdg ,_beaf .Hyperlink };}; // ClearColor clears the text color. func (_gbfeb RunProperties )ClearColor (){_gbfeb ._afdg .Color =nil }; // AddTextInput adds text input form field to the paragraph and returns it. func (_bgbga Paragraph )AddTextInput (name string )FormField {_cebc :=_bgbga .addFldCharsForField (name ,"\u0046\u004f\u0052\u004d\u0054\u0045\u0058\u0054");_cebc ._cdaa .TextInput =_bfc .NewCT_FFTextInput ();return _cebc ;}; // read reads a document from an io.Reader. func Read (r _gc .ReaderAt ,size int64 )(*Document ,error ){return _aefg (r ,size ,"")}; // SetAlignment controls the paragraph alignment func (_ccdg ParagraphStyleProperties )SetAlignment (align _bfc .ST_Jc ){if align ==_bfc .ST_JcUnset {_ccdg ._daba .Jc =nil ;}else {_ccdg ._daba .Jc =_bfc .NewCT_Jc ();_ccdg ._daba .Jc .ValAttr =align ;};}; // Bold returns true if run font is bold. func (_bbbfa RunProperties )Bold ()bool {_bceb :=_bbbfa ._afdg ;return _ecab (_bceb .B )||_ecab (_bceb .BCs );}; // SetLinkedStyle sets the style that this style is linked to. func (_ceec Style )SetLinkedStyle (name string ){if name ==""{_ceec ._gdea .Link =nil ;}else {_ceec ._gdea .Link =_bfc .NewCT_String ();_ceec ._gdea .Link .ValAttr =name ;};}; // Open opens and reads a document from a file (.docx). func Open (filename string )(*Document ,error ){_dca ,_ggf :=_d .Open (filename );if _ggf !=nil {return nil ,_bf .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,_ggf );};defer _dca .Close ();_fbbf ,_ggf :=_d .Stat (filename );if _ggf !=nil {return nil ,_bf .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,_ggf );};_ =_fbbf ;return Read (_dca ,_fbbf .Size ());};func (_feaed Paragraph )addFldChar ()*_bfc .CT_FldChar {_adad :=_feaed .AddRun ();_abce :=_adad .X ();_cfede :=_bfc .NewEG_RunInnerContent ();_egbb :=_bfc .NewCT_FldChar ();_cfede .FldChar =_egbb ;_abce .EG_RunInnerContent =append (_abce .EG_RunInnerContent ,_cfede );return _egbb ;}; // Clear clears all content within a header func (_beea Header )Clear (){_beea ._abff .EG_ContentBlockContent =nil }; // AbstractNumberID returns the ID that is unique within all numbering // definitions that is used to assign the definition to a paragraph. func (_edag NumberingDefinition )AbstractNumberID ()int64 {return _edag ._bcbe .AbstractNumIdAttr }; // SetHeight allows controlling the height of a row within a table. func (_egee RowProperties )SetHeight (ht _gga .Distance ,rule _bfc .ST_HeightRule ){if rule ==_bfc .ST_HeightRuleUnset {_egee ._eaef .TrHeight =nil ;}else {_acdd :=_bfc .NewCT_Height ();_acdd .HRuleAttr =rule ;_acdd .ValAttr =&_af .ST_TwipsMeasure {};_acdd .ValAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (ht /_gga .Twips ));_egee ._eaef .TrHeight =[]*_bfc .CT_Height {_acdd };};}; // X returns the inner wrapped type func (_ea CellBorders )X ()*_bfc .CT_TcBorders {return _ea ._efd }; // NumberingLevel is the definition for numbering for a particular level within // a NumberingDefinition. type NumberingLevel struct{_befb *_bfc .CT_Lvl };func (_ffgbf Footnote )content ()[]*_bfc .EG_ContentBlockContent {var _gca []*_bfc .EG_ContentBlockContent ;for _ ,_agga :=range _ffgbf ._gbbd .EG_BlockLevelElts {_gca =append (_gca ,_agga .EG_ContentBlockContent ...);};return _gca ;}; // 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 (_fdbcc Run )IsEndnote ()(bool ,int64 ){if _fdbcc ._cdfb .EG_RunInnerContent !=nil {if _fdbcc ._cdfb .EG_RunInnerContent [0].EndnoteReference !=nil {return true ,_fdbcc ._cdfb .EG_RunInnerContent [0].EndnoteReference .IdAttr ;};};return false ,0;}; // X returns the inner wrapped XML type. func (_db Color )X ()*_bfc .CT_Color {return _db ._cffa }; // SetTargetBookmark sets the bookmark target of the hyperlink. func (_dedde HyperLink )SetTargetBookmark (bm Bookmark ){_dedde ._ebdf .AnchorAttr =_a .String (bm .Name ());_dedde ._ebdf .IdAttr =nil ;}; // HyperLink is a link within a document. type HyperLink struct{_bbbg *Document ;_ebdf *_bfc .CT_Hyperlink ;}; // AddParagraph adds a paragraph to the footnote. func (_ccee Footnote )AddParagraph ()Paragraph {_fbaa :=_bfc .NewEG_ContentBlockContent ();_dafbf :=len (_ccee ._gbbd .EG_BlockLevelElts [0].EG_ContentBlockContent );_ccee ._gbbd .EG_BlockLevelElts [0].EG_ContentBlockContent =append (_ccee ._gbbd .EG_BlockLevelElts [0].EG_ContentBlockContent ,_fbaa );_aedaf :=_bfc .NewCT_P ();var _fbcde *_bfc .CT_String ;if _dafbf !=0{_cgfg :=len (_ccee ._gbbd .EG_BlockLevelElts [0].EG_ContentBlockContent [_dafbf -1].P );_fbcde =_ccee ._gbbd .EG_BlockLevelElts [0].EG_ContentBlockContent [_dafbf -1].P [_cgfg -1].PPr .PStyle ;}else {_fbcde =_bfc .NewCT_String ();_fbcde .ValAttr ="\u0046\u006f\u006f\u0074\u006e\u006f\u0074\u0065";};_fbaa .P =append (_fbaa .P ,_aedaf );_cgaad :=Paragraph {_ccee ._acff ,_aedaf };_cgaad ._egaag .PPr =_bfc .NewCT_PPr ();_cgaad ._egaag .PPr .PStyle =_fbcde ;_cgaad ._egaag .PPr .RPr =_bfc .NewCT_ParaRPr ();return _cgaad ;}; // SetKeepNext controls if the paragraph is kept with the next paragraph. func (_ggeg ParagraphStyleProperties )SetKeepNext (b bool ){if !b {_ggeg ._daba .KeepNext =nil ;}else {_ggeg ._daba .KeepNext =_bfc .NewCT_OnOff ();};}; // SetSize sets the font size for a run. func (_cgag RunProperties )SetSize (size _gga .Distance ){_cgag ._afdg .Sz =_bfc .NewCT_HpsMeasure ();_cgag ._afdg .Sz .ValAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (size /_gga .HalfPoint ));_cgag ._afdg .SzCs =_bfc .NewCT_HpsMeasure ();_cgag ._afdg .SzCs .ValAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (size /_gga .HalfPoint ));};func (_bdea Document )mergeFields ()[]mergeFieldInfo {_egbc :=[]Paragraph {};_ffeg :=[]mergeFieldInfo {};for _ ,_aabd :=range _bdea .Tables (){for _ ,_bdff :=range _aabd .Rows (){for _ ,_babb :=range _bdff .Cells (){_egbc =append (_egbc ,_babb .Paragraphs ()...);};};};_egbc =append (_egbc ,_bdea .Paragraphs ()...);for _ ,_bbfd :=range _egbc {_efaf :=_bbfd .Runs ();_gdbd :=-1;_efafa :=-1;_egec :=-1;_ffdb :=mergeFieldInfo {};for _ ,_dbfa :=range _bbfd ._egaag .EG_PContent {for _ ,_adfb :=range _dbfa .FldSimple {if _g .Contains (_adfb .InstrAttr ,"\u004d\u0045\u0052\u0047\u0045\u0046\u0049\u0045\u004c\u0044"){_fdfg :=_bggc (_adfb .InstrAttr );_fdfg ._bgfa =true ;_fdfg ._aeab =_bbfd ;_fdfg ._aefd =_dbfa ;_ffeg =append (_ffeg ,_fdfg );};};};for _agfe :=0;_agfe < len (_efaf );_agfe ++{_afece :=_efaf [_agfe ];for _ ,_bbfgc :=range _afece .X ().EG_RunInnerContent {if _bbfgc .FldChar !=nil {switch _bbfgc .FldChar .FldCharTypeAttr {case _bfc .ST_FldCharTypeBegin :_gdbd =_agfe ;case _bfc .ST_FldCharTypeSeparate :_efafa =_agfe ;case _bfc .ST_FldCharTypeEnd :_egec =_agfe ;if _ffdb ._cbbg !=""{_ffdb ._aeab =_bbfd ;_ffdb ._ebgd =_gdbd ;_ffdb ._fdg =_egec ;_ffdb ._aabb =_efafa ;_ffeg =append (_ffeg ,_ffdb );};_gdbd =-1;_efafa =-1;_egec =-1;_ffdb =mergeFieldInfo {};};}else if _bbfgc .InstrText !=nil &&_g .Contains (_bbfgc .InstrText .Content ,"\u004d\u0045\u0052\u0047\u0045\u0046\u0049\u0045\u004c\u0044"){if _gdbd !=-1&&_egec ==-1{_ffdb =_bggc (_bbfgc .InstrText .Content );};};};};};return _ffeg ;}; // 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 (_afb Header )Index ()int {for _baag ,_cgfa :=range _afb ._aea ._cfb {if _cgfa ==_afb ._abff {return _baag ;};};return -1;}; // SaveToFile writes the document out to a file. func (_eab *Document )SaveToFile (path string )error {_dfbc ,_fff :=_d .Create (path );if _fff !=nil {return _fff ;};defer _dfbc .Close ();return _eab .Save (_dfbc );}; // Italic returns true if paragraph font is italic. func (_ffccc ParagraphProperties )Italic ()bool {_afccd :=_ffccc ._aeag .RPr ;return _ecab (_afccd .I )||_ecab (_afccd .ICs );}; // FormFieldType is the type of the form field. //go:generate stringer -type=FormFieldType type FormFieldType byte ; // ParagraphStyles returns only the paragraph styles. func (_gfga Styles )ParagraphStyles ()[]Style {_facg :=[]Style {};for _ ,_edbeg :=range _gfga ._bcagb .Style {if _edbeg .TypeAttr !=_bfc .ST_StyleTypeParagraph {continue ;};_facg =append (_facg ,Style {_edbeg });};return _facg ;};func (_eace Run )newIC ()*_bfc .EG_RunInnerContent {_bbc :=_bfc .NewEG_RunInnerContent ();_eace ._cdfb .EG_RunInnerContent =append (_eace ._cdfb .EG_RunInnerContent ,_bbc );return _bbc ;}; // RemoveParagraph removes a paragraph from a document. func (_dab *Document )RemoveParagraph (p Paragraph ){if _dab ._bfda .Body ==nil {return ;};for _ ,_ddb :=range _dab ._bfda .Body .EG_BlockLevelElts {for _ ,_gfdc :=range _ddb .EG_ContentBlockContent {for _ddcf ,_bag :=range _gfdc .P {if _bag ==p ._egaag {copy (_gfdc .P [_ddcf :],_gfdc .P [_ddcf +1:]);_gfdc .P =_gfdc .P [0:len (_gfdc .P )-1];return ;};};if _gfdc .Sdt !=nil &&_gfdc .Sdt .SdtContent !=nil &&_gfdc .Sdt .SdtContent .P !=nil {for _bedb ,_ceb :=range _gfdc .Sdt .SdtContent .P {if _ceb ==p ._egaag {copy (_gfdc .P [_bedb :],_gfdc .P [_bedb +1:]);_gfdc .P =_gfdc .P [0:len (_gfdc .P )-1];return ;};};};};};for _ ,_fgd :=range _dab .Tables (){for _ ,_cafc :=range _fgd .Rows (){for _ ,_faf :=range _cafc .Cells (){for _ ,_ffgbe :=range _faf ._adc .EG_BlockLevelElts {for _ ,_agfc :=range _ffgbe .EG_ContentBlockContent {for _ega ,_ggge :=range _agfc .P {if _ggge ==p ._egaag {copy (_agfc .P [_ega :],_agfc .P [_ega +1:]);_agfc .P =_agfc .P [0:len (_agfc .P )-1];return ;};};};};};};};for _ ,_fba :=range _dab .Headers (){_fba .RemoveParagraph (p );};for _ ,_eda :=range _dab .Footers (){_eda .RemoveParagraph (p );};}; // SetRowBandSize sets the number of Rows in the row band func (_gegc TableStyleProperties )SetRowBandSize (rows int64 ){_gegc ._cfbe .TblStyleRowBandSize =_bfc .NewCT_DecimalNumber ();_gegc ._cfbe .TblStyleRowBandSize .ValAttr =rows ;}; // AddBreak adds a line break to a run. func (_ecfdd Run )AddBreak (){_gbfaa :=_ecfdd .newIC ();_gbfaa .Br =_bfc .NewCT_Br ()}; // Clear resets the numbering. func (_adbg Numbering )Clear (){_adbg ._bbbf .AbstractNum =nil ;_adbg ._bbbf .Num =nil ;_adbg ._bbbf .NumIdMacAtCleanup =nil ;_adbg ._bbbf .NumPicBullet =nil ;}; // SetColumnBandSize sets the number of Columns in the column band func (_fafc TableStyleProperties )SetColumnBandSize (cols int64 ){_fafc ._cfbe .TblStyleColBandSize =_bfc .NewCT_DecimalNumber ();_fafc ._cfbe .TblStyleColBandSize .ValAttr =cols ;};func _gfb (_fdde *_bfc .CT_P ,_cbfa ,_fcc map[int64 ]int64 ){for _ ,_aeef :=range _fdde .EG_PContent {for _ ,_bggd :=range _aeef .EG_ContentRunContent {if _bggd .R !=nil {for _ ,_edff :=range _bggd .R .EG_RunInnerContent {_cef :=_edff .EndnoteReference ;if _cef !=nil &&_cef .IdAttr > 0{if _ced ,_fdba :=_fcc [_cef .IdAttr ];_fdba {_cef .IdAttr =_ced ;};};_cfab :=_edff .FootnoteReference ;if _cfab !=nil &&_cfab .IdAttr > 0{if _gbea ,_bagg :=_cbfa [_cfab .IdAttr ];_bagg {_cfab .IdAttr =_gbea ;};};};};};};}; // X returns the inner wrapped XML type. func (_fdfc Style )X ()*_bfc .CT_Style {return _fdfc ._gdea }; // Levels returns all of the numbering levels defined in the definition. func (_acgg NumberingDefinition )Levels ()[]NumberingLevel {_bfcce :=[]NumberingLevel {};for _ ,_dcfb :=range _acgg ._bcbe .Lvl {_bfcce =append (_bfcce ,NumberingLevel {_dcfb });};return _bfcce ;}; // SetWindowControl controls if the first or last line of the paragraph is // allowed to dispay on a separate page. func (_gfcg ParagraphProperties )SetWindowControl (b bool ){if !b {_gfcg ._aeag .WidowControl =nil ;}else {_gfcg ._aeag .WidowControl =_bfc .NewCT_OnOff ();};}; // EastAsiaFont returns the name of run font family for East Asia. func (_fdad RunProperties )EastAsiaFont ()string {if _dccc :=_fdad ._afdg .RFonts ;_dccc !=nil {if _dccc .EastAsiaAttr !=nil {return *_dccc .EastAsiaAttr ;};};return "";}; // X returns the inner wrapped XML type. func (_gdaac InlineDrawing )X ()*_bfc .WdInline {return _gdaac ._dfae }; // InitializeDefault constructs a default numbering. func (_gfcf Numbering )InitializeDefault (){_gbdc :=_bfc .NewCT_AbstractNum ();_gbdc .MultiLevelType =_bfc .NewCT_MultiLevelType ();_gbdc .MultiLevelType .ValAttr =_bfc .ST_MultiLevelTypeHybridMultilevel ;_gfcf ._bbbf .AbstractNum =append (_gfcf ._bbbf .AbstractNum ,_gbdc );_gbdc .AbstractNumIdAttr =1;const _bdef =720;const _bfef =720;const _ggced =360;for _gade :=0;_gade < 9;_gade ++{_abde :=_bfc .NewCT_Lvl ();_abde .IlvlAttr =int64 (_gade );_abde .Start =_bfc .NewCT_DecimalNumber ();_abde .Start .ValAttr =1;_abde .NumFmt =_bfc .NewCT_NumFmt ();_abde .NumFmt .ValAttr =_bfc .ST_NumberFormatBullet ;_abde .Suff =_bfc .NewCT_LevelSuffix ();_abde .Suff .ValAttr =_bfc .ST_LevelSuffixNothing ;_abde .LvlText =_bfc .NewCT_LevelText ();_abde .LvlText .ValAttr =_a .String ("\uf0b7");_abde .LvlJc =_bfc .NewCT_Jc ();_abde .LvlJc .ValAttr =_bfc .ST_JcLeft ;_abde .RPr =_bfc .NewCT_RPr ();_abde .RPr .RFonts =_bfc .NewCT_Fonts ();_abde .RPr .RFonts .AsciiAttr =_a .String ("\u0053\u0079\u006d\u0062\u006f\u006c");_abde .RPr .RFonts .HAnsiAttr =_a .String ("\u0053\u0079\u006d\u0062\u006f\u006c");_abde .RPr .RFonts .HintAttr =_bfc .ST_HintDefault ;_abde .PPr =_bfc .NewCT_PPrGeneral ();_ddecd :=int64 (_gade *_bfef +_bdef );_abde .PPr .Ind =_bfc .NewCT_Ind ();_abde .PPr .Ind .LeftAttr =&_bfc .ST_SignedTwipsMeasure {};_abde .PPr .Ind .LeftAttr .Int64 =_a .Int64 (_ddecd );_abde .PPr .Ind .HangingAttr =&_af .ST_TwipsMeasure {};_abde .PPr .Ind .HangingAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (_ggced ));_gbdc .Lvl =append (_gbdc .Lvl ,_abde );};_egca :=_bfc .NewCT_Num ();_egca .NumIdAttr =1;_egca .AbstractNumId =_bfc .NewCT_DecimalNumber ();_egca .AbstractNumId .ValAttr =1;_gfcf ._bbbf .Num =append (_gfcf ._bbbf .Num ,_egca );}; // SetInsideVertical sets the interior vertical borders to a specified type, color and thickness. func (_gcd CellBorders )SetInsideVertical (t _bfc .ST_Border ,c _fc .Color ,thickness _gga .Distance ){_gcd ._efd .InsideV =_bfc .NewCT_Border ();_aebcf (_gcd ._efd .InsideV ,t ,c ,thickness );}; // SetCellSpacingPercent sets the cell spacing within a table to a percent width. func (_cdab TableStyleProperties )SetCellSpacingPercent (pct float64 ){_cdab ._cfbe .TblCellSpacing =_bfc .NewCT_TblWidth ();_cdab ._cfbe .TblCellSpacing .TypeAttr =_bfc .ST_TblWidthPct ;_cdab ._cfbe .TblCellSpacing .WAttr =&_bfc .ST_MeasurementOrPercent {};_cdab ._cfbe .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent =&_bfc .ST_DecimalNumberOrPercent {};_cdab ._cfbe .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_a .Int64 (int64 (pct *50));}; // AddTab adds tab to a run and can be used with the the Paragraph's tab stops. func (_ddbec Run )AddTab (){_geae :=_ddbec .newIC ();_geae .Tab =_bfc .NewCT_Empty ()}; // SetWidth sets the table with to a specified width. func (_ggbff TableProperties )SetWidth (d _gga .Distance ){_ggbff ._fbbfae .TblW =_bfc .NewCT_TblWidth ();_ggbff ._fbbfae .TblW .TypeAttr =_bfc .ST_TblWidthDxa ;_ggbff ._fbbfae .TblW .WAttr =&_bfc .ST_MeasurementOrPercent {};_ggbff ._fbbfae .TblW .WAttr .ST_DecimalNumberOrPercent =&_bfc .ST_DecimalNumberOrPercent {};_ggbff ._fbbfae .TblW .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_a .Int64 (int64 (d /_gga .Twips ));}; // 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 (_bega *Document )Validate ()error {if _bega ==nil ||_bega ._bfda ==nil {return _ab .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 _ ,_cddd :=range []func ()error {_bega .validateTableCells ,_bega .validateBookmarks }{if _febae :=_cddd ();_febae !=nil {return _febae ;};};if _efc :=_bega ._bfda .Validate ();_efc !=nil {return _efc ;};return nil ;}; // 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 (_fbdf Paragraph )AddBookmark (name string )Bookmark {_bggbc :=_bfc .NewEG_PContent ();_agfcf :=_bfc .NewEG_ContentRunContent ();_bggbc .EG_ContentRunContent =append (_bggbc .EG_ContentRunContent ,_agfcf );_gfcc :=_bfc .NewEG_RunLevelElts ();_agfcf .EG_RunLevelElts =append (_agfcf .EG_RunLevelElts ,_gfcc );_faef :=_bfc .NewEG_RangeMarkupElements ();_eff :=_bfc .NewCT_Bookmark ();_faef .BookmarkStart =_eff ;_gfcc .EG_RangeMarkupElements =append (_gfcc .EG_RangeMarkupElements ,_faef );_faef =_bfc .NewEG_RangeMarkupElements ();_faef .BookmarkEnd =_bfc .NewCT_MarkupRange ();_gfcc .EG_RangeMarkupElements =append (_gfcc .EG_RangeMarkupElements ,_faef );_fbdf ._egaag .EG_PContent =append (_fbdf ._egaag .EG_PContent ,_bggbc );_fgeb :=Bookmark {_eff };_fgeb .SetName (name );return _fgeb ;}; // NewSettings constructs a new empty Settings func NewSettings ()Settings {_bbfc :=_bfc .NewSettings ();_bbfc .Compat =_bfc .NewCT_Compat ();_fbgcf :=_bfc .NewCT_CompatSetting ();_fbgcf .NameAttr =_a .String ("\u0063\u006f\u006d\u0070\u0061\u0074\u0069\u0062\u0069\u006c\u0069\u0074y\u004d\u006f\u0064\u0065");_fbgcf .UriAttr =_a .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");_fbgcf .ValAttr =_a .String ("\u0031\u0035");_bbfc .Compat .CompatSetting =append (_bbfc .Compat .CompatSetting ,_fbgcf );return Settings {_bbfc };}; // Properties returns the numbering level paragraph properties. func (_bfdc NumberingLevel )Properties ()ParagraphStyleProperties {if _bfdc ._befb .PPr ==nil {_bfdc ._befb .PPr =_bfc .NewCT_PPrGeneral ();};return ParagraphStyleProperties {_bfdc ._befb .PPr };}; // SetShadow sets the run to shadowed text. func (_gcgf RunProperties )SetShadow (b bool ){if !b {_gcgf ._afdg .Shadow =nil ;}else {_gcgf ._afdg .Shadow =_bfc .NewCT_OnOff ();};}; // SetTop sets the cell top margin func (_dda CellMargins )SetTop (d _gga .Distance ){_dda ._aca .Top =_bfc .NewCT_TblWidth ();_aff (_dda ._aca .Top ,d );}; // IsItalic returns true if the run has been set to italics. func (_ddedcc RunProperties )IsItalic ()bool {return _ddedcc .ItalicValue ()==OnOffValueOn }; // X returns the inner wrapped XML type. func (_efbc Numbering )X ()*_bfc .Numbering {return _efbc ._bbbf }; // NumberingDefinition defines a numbering definition for a list of pragraphs. type NumberingDefinition struct{_bcbe *_bfc .CT_AbstractNum }; // AddParagraph adds a paragraph to the table cell. func (_fcg Cell )AddParagraph ()Paragraph {_ae :=_bfc .NewEG_BlockLevelElts ();_fcg ._adc .EG_BlockLevelElts =append (_fcg ._adc .EG_BlockLevelElts ,_ae );_aeb :=_bfc .NewEG_ContentBlockContent ();_ae .EG_ContentBlockContent =append (_ae .EG_ContentBlockContent ,_aeb );_dcg :=_bfc .NewCT_P ();_aeb .P =append (_aeb .P ,_dcg );return Paragraph {_fcg ._gfd ,_dcg };}; // X returns the inner wrapped XML type. func (_afag NumberingLevel )X ()*_bfc .CT_Lvl {return _afag ._befb }; // SetThemeColor sets the color from the theme. func (_bfd Color )SetThemeColor (t _bfc .ST_ThemeColor ){_bfd ._cffa .ThemeColorAttr =t }; // 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 (_eeb ParagraphProperties )SetHeadingLevel (idx int ){_eeb .SetStyle (_bf .Sprintf ("\u0048e\u0061\u0064\u0069\u006e\u0067\u0025d",idx ));if _eeb ._aeag .NumPr ==nil {_eeb ._aeag .NumPr =_bfc .NewCT_NumPr ();};_eeb ._aeag .NumPr .Ilvl =_bfc .NewCT_DecimalNumber ();_eeb ._aeag .NumPr .Ilvl .ValAttr =int64 (idx );}; // X returns the inner wrapped XML type. func (_fcfcd Styles )X ()*_bfc .Styles {return _fcfcd ._bcagb }; // RightToLeft returns true if run text goes from right to left. func (_cbgc RunProperties )RightToLeft ()bool {return _ecab (_cbgc ._afdg .Rtl )}; // SetRight sets the right border to a specified type, color and thickness. func (_cff CellBorders )SetRight (t _bfc .ST_Border ,c _fc .Color ,thickness _gga .Distance ){_cff ._efd .Right =_bfc .NewCT_Border ();_aebcf (_cff ._efd .Right ,t ,c ,thickness );}; // X returns the inner wrapped XML type. func (_bagd ParagraphStyleProperties )X ()*_bfc .CT_PPrGeneral {return _bagd ._daba }; // SetLineSpacing sets the spacing between lines in a paragraph. func (_gfae Paragraph )SetLineSpacing (d _gga .Distance ,rule _bfc .ST_LineSpacingRule ){_gfae .ensurePPr ();if _gfae ._egaag .PPr .Spacing ==nil {_gfae ._egaag .PPr .Spacing =_bfc .NewCT_Spacing ();};_ecdbc :=_gfae ._egaag .PPr .Spacing ;if rule ==_bfc .ST_LineSpacingRuleUnset {_ecdbc .LineRuleAttr =_bfc .ST_LineSpacingRuleUnset ;_ecdbc .LineAttr =nil ;}else {_ecdbc .LineRuleAttr =rule ;_ecdbc .LineAttr =&_bfc .ST_SignedTwipsMeasure {};_ecdbc .LineAttr .Int64 =_a .Int64 (int64 (d /_gga .Twips ));};}; // VerticalAlign returns the value of run vertical align. func (_dabed RunProperties )VerticalAlignment ()_af .ST_VerticalAlignRun {if _bfefc :=_dabed ._afdg .VertAlign ;_bfefc !=nil {return _bfefc .ValAttr ;};return 0;}; // TableStyleProperties are table properties as defined in a style. type TableStyleProperties struct{_cfbe *_bfc .CT_TblPrBase }; // 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 (_aggg Paragraph )AddEndnote (text string )Endnote {var _gecda int64 ;if _aggg ._gdg .HasEndnotes (){for _ ,_efagc :=range _aggg ._gdg .Endnotes (){if _efagc .id ()> _gecda {_gecda =_efagc .id ();};};_gecda ++;}else {_gecda =0;_aggg ._gdg ._aee =&_bfc .Endnotes {};};_fbdg :=_bfc .NewCT_FtnEdn ();_bcgfb :=_bfc .NewCT_FtnEdnRef ();_bcgfb .IdAttr =_gecda ;_aggg ._gdg ._aee .CT_Endnotes .Endnote =append (_aggg ._gdg ._aee .CT_Endnotes .Endnote ,_fbdg );_dee :=_aggg .AddRun ();_dbdeb :=_dee .Properties ();_dbdeb .SetStyle ("\u0045\u006e\u0064\u006e\u006f\u0074\u0065\u0041\u006e\u0063\u0068\u006f\u0072");_dee ._cdfb .EG_RunInnerContent =[]*_bfc .EG_RunInnerContent {_bfc .NewEG_RunInnerContent ()};_dee ._cdfb .EG_RunInnerContent [0].EndnoteReference =_bcgfb ;_faga :=Endnote {_aggg ._gdg ,_fbdg };_faga ._cggg .IdAttr =_gecda ;_faga ._cggg .EG_BlockLevelElts =[]*_bfc .EG_BlockLevelElts {_bfc .NewEG_BlockLevelElts ()};_ebge :=_faga .AddParagraph ();_ebge .Properties ().SetStyle ("\u0045n\u0064\u006e\u006f\u0074\u0065");_ebge ._egaag .PPr .RPr =_bfc .NewCT_ParaRPr ();_ageb :=_ebge .AddRun ();_ageb .AddTab ();_ageb .AddText (text );return _faga ;}; // TableLook returns the table look, or conditional formatting applied to a table style. func (_gaece TableProperties )TableLook ()TableLook {if _gaece ._fbbfae .TblLook ==nil {_gaece ._fbbfae .TblLook =_bfc .NewCT_TblLook ();};return TableLook {_gaece ._fbbfae .TblLook };}; // X returns the inner wrapped XML type. func (_eadg Footer )X ()*_bfc .Ftr {return _eadg ._cgaf }; // Outline returns true if paragraph outline is on. func (_gbbbe ParagraphProperties )Outline ()bool {return _ecab (_gbbbe ._aeag .RPr .Outline )}; // Footers returns the footers defined in the document. func (_bbe *Document )Footers ()[]Footer {_dae :=[]Footer {};for _ ,_bg :=range _bbe ._def {_dae =append (_dae ,Footer {_bbe ,_bg });};return _dae ;}; // 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 (_bee AnchoredDrawing )SetOffset (x ,y _gga .Distance ){_bee .SetXOffset (x );_bee .SetYOffset (y )}; // SetStyle sets the table style name. func (_fbecd TableProperties )SetStyle (name string ){if name ==""{_fbecd ._fbbfae .TblStyle =nil ;}else {_fbecd ._fbbfae .TblStyle =_bfc .NewCT_String ();_fbecd ._fbbfae .TblStyle .ValAttr =name ;};}; // X returns the inner wrapped XML type. func (_gfe *Document )X ()*_bfc .Document {return _gfe ._bfda }; // GetImageObjByRelId returns a common.Image with the associated relation ID in the // document. func (_gagg *Document )GetImageObjByRelId (relId string )(_df .Image ,error ){_fbced :=_gagg ._fbb .GetTargetByRelId (relId );return _gagg .DocBase .GetImageBytesByTarget (_fbced );}; // AddRun adds a run to a paragraph. func (_deae Paragraph )AddRun ()Run {_gdbc :=_bfc .NewEG_PContent ();_deae ._egaag .EG_PContent =append (_deae ._egaag .EG_PContent ,_gdbc );_abdc :=_bfc .NewEG_ContentRunContent ();_gdbc .EG_ContentRunContent =append (_gdbc .EG_ContentRunContent ,_abdc );_gbfe :=_bfc .NewCT_R ();_abdc .R =_gbfe ;return Run {_deae ._gdg ,_gbfe };}; // SetKeepWithNext controls if this paragraph should be kept with the next. func (_eadb ParagraphProperties )SetKeepWithNext (b bool ){if !b {_eadb ._aeag .KeepNext =nil ;}else {_eadb ._aeag .KeepNext =_bfc .NewCT_OnOff ();};}; // ParagraphProperties are the properties for a paragraph. type ParagraphProperties struct{_acgff *Document ;_aeag *_bfc .CT_PPr ;}; // RunProperties returns the run properties controlling text formatting within the table. func (_fddbb TableConditionalFormatting )RunProperties ()RunProperties {if _fddbb ._efebb .RPr ==nil {_fddbb ._efebb .RPr =_bfc .NewCT_RPr ();};return RunProperties {_fddbb ._efebb .RPr };}; // InsertRunBefore inserts a run in the paragraph before the relative run. func (_cffff Paragraph )InsertRunBefore (relativeTo Run )Run {return _cffff .insertRun (relativeTo ,true );}; // Bold returns true if paragraph font is bold. func (_beee ParagraphProperties )Bold ()bool {_edbeb :=_beee ._aeag .RPr ;return _ecab (_edbeb .B )||_ecab (_edbeb .BCs );}; // X returns the inner wrapped XML type. func (_bfdaf Fonts )X ()*_bfc .CT_Fonts {return _bfdaf ._bgbgff }; // ComplexSizeValue returns the value of run font size for complex fonts in points. func (_bccg RunProperties )ComplexSizeValue ()float64 {if _bdebd :=_bccg ._afdg .SzCs ;_bdebd !=nil {_fcgbd :=_bdebd .ValAttr ;if _fcgbd .ST_UnsignedDecimalNumber !=nil {return float64 (*_fcgbd .ST_UnsignedDecimalNumber )/2;};};return 0.0;}; // AddRow adds a row to a table. func (_cdbcc Table )AddRow ()Row {_eegdg :=_bfc .NewEG_ContentRowContent ();_cdbcc ._caeb .EG_ContentRowContent =append (_cdbcc ._caeb .EG_ContentRowContent ,_eegdg );_bagc :=_bfc .NewCT_Row ();_eegdg .Tr =append (_eegdg .Tr ,_bagc );return Row {_cdbcc ._gaebd ,_bagc };}; // Endnotes returns the endnotes defined in the document. func (_dbgg *Document )Endnotes ()[]Endnote {_gac :=[]Endnote {};for _ ,_cac :=range _dbgg ._aee .CT_Endnotes .Endnote {_gac =append (_gac ,Endnote {_dbgg ,_cac });};return _gac ;}; // SetCellSpacingAuto sets the cell spacing within a table to automatic. func (_facae TableStyleProperties )SetCellSpacingAuto (){_facae ._cfbe .TblCellSpacing =_bfc .NewCT_TblWidth ();_facae ._cfbe .TblCellSpacing .TypeAttr =_bfc .ST_TblWidthAuto ;}; // GetImage returns the ImageRef associated with an InlineDrawing. func (_ddbd InlineDrawing )GetImage ()(_df .ImageRef ,bool ){_dabbc :=_ddbd ._dfae .Graphic .GraphicData .Any ;if len (_dabbc )> 0{_cgbe ,_degg :=_dabbc [0].(*_fd .Pic );if _degg {if _cgbe .BlipFill !=nil &&_cgbe .BlipFill .Blip !=nil &&_cgbe .BlipFill .Blip .EmbedAttr !=nil {return _ddbd ._ggfdc .GetImageByRelID (*_cgbe .BlipFill .Blip .EmbedAttr );};};};return _df .ImageRef {},false ;}; // AddTabStop adds a tab stop to the paragraph. func (_cacd ParagraphStyleProperties )AddTabStop (position _gga .Distance ,justificaton _bfc .ST_TabJc ,leader _bfc .ST_TabTlc ){if _cacd ._daba .Tabs ==nil {_cacd ._daba .Tabs =_bfc .NewCT_Tabs ();};_ggffd :=_bfc .NewCT_TabStop ();_ggffd .LeaderAttr =leader ;_ggffd .ValAttr =justificaton ;_ggffd .PosAttr .Int64 =_a .Int64 (int64 (position /_gga .Twips ));_cacd ._daba .Tabs .Tab =append (_cacd ._daba .Tabs .Tab ,_ggffd );}; // Clear removes all of the content from within a run. func (_dgdg Run )Clear (){_dgdg ._cdfb .EG_RunInnerContent =nil };var _gba =false ; // Color controls the run or styles color. type Color struct{_cffa *_bfc .CT_Color }; // SetLeftIndent controls the left indent of the paragraph. func (_eabd ParagraphStyleProperties )SetLeftIndent (m _gga .Distance ){if _eabd ._daba .Ind ==nil {_eabd ._daba .Ind =_bfc .NewCT_Ind ();};if m ==_gga .Zero {_eabd ._daba .Ind .LeftAttr =nil ;}else {_eabd ._daba .Ind .LeftAttr =&_bfc .ST_SignedTwipsMeasure {};_eabd ._daba .Ind .LeftAttr .Int64 =_a .Int64 (int64 (m /_gga .Twips ));};}; // SetAlignment positions an anchored image via alignment. Offset is // incompatible with SetOffset, whichever is called last is applied. func (_fcb AnchoredDrawing )SetAlignment (h _bfc .WdST_AlignH ,v _bfc .WdST_AlignV ){_fcb .SetHAlignment (h );_fcb .SetVAlignment (v );}; // Style returns the style for a paragraph, or an empty string if it is unset. func (_afee Paragraph )Style ()string {if _afee ._egaag .PPr !=nil &&_afee ._egaag .PPr .PStyle !=nil {return _afee ._egaag .PPr .PStyle .ValAttr ;};return "";}; // SetEnabled marks a FormField as enabled or disabled. func (_gdaa FormField )SetEnabled (enabled bool ){_egabg :=_bfc .NewCT_OnOff ();_egabg .ValAttr =&_af .ST_OnOff {Bool :&enabled };_gdaa ._cdaa .Enabled =[]*_bfc .CT_OnOff {_egabg };}; // Borders allows manipulation of the table borders. func (_ffca TableStyleProperties )Borders ()TableBorders {if _ffca ._cfbe .TblBorders ==nil {_ffca ._cfbe .TblBorders =_bfc .NewCT_TblBorders ();};return TableBorders {_ffca ._cfbe .TblBorders };}; // SetHighlight highlights text in a specified color. func (_cccad RunProperties )SetHighlight (c _bfc .ST_HighlightColor ){_cccad ._afdg .Highlight =_bfc .NewCT_Highlight ();_cccad ._afdg .Highlight .ValAttr =c ;};func _abgf (_adbc *_bfc .CT_P ,_ggac *_bfc .CT_Hyperlink ,_eggbf *TableInfo ,_gdcg *DrawingInfo ,_cega []*_bfc .EG_ContentRunContent )[]TextItem {_gcg :=[]TextItem {};for _ ,_cggf :=range _cega {if _efec :=_cggf .R ;_efec !=nil {_aedb :=_gg .NewBuffer ([]byte {});for _ ,_ccea :=range _efec .EG_RunInnerContent {if _ccea .T !=nil &&_ccea .T .Content !=""{_aedb .WriteString (_ccea .T .Content );};};_gcg =append (_gcg ,TextItem {Text :_aedb .String (),DrawingInfo :_gdcg ,Paragraph :_adbc ,Hyperlink :_ggac ,Run :_efec ,TableInfo :_eggbf });for _ ,_gbdf :=range _efec .Extra {if _decg ,_ggada :=_gbdf .(*_bfc .AlternateContentRun );_ggada {_bcgf :=&DrawingInfo {Drawing :_decg .Choice .Drawing };for _ ,_bbff :=range _bcgf .Drawing .Anchor {for _ ,_edad :=range _bbff .Graphic .GraphicData .Any {if _fbec ,_gfc :=_edad .(*_bfc .WdWsp );_gfc {if _fbec .WChoice !=nil {if _ddea :=_fbec .SpPr ;_ddea !=nil {if _edea :=_ddea .Xfrm ;_edea !=nil {if _gbc :=_edea .Ext ;_gbc !=nil {_bcgf .Width =_gbc .CxAttr ;_bcgf .Height =_gbc .CyAttr ;};};};for _ ,_acfc :=range _fbec .WChoice .Txbx .TxbxContent .EG_ContentBlockContent {_gcg =append (_gcg ,_gecdc (_acfc .P ,_eggbf ,_bcgf )...);};};};};};};};};};return _gcg ;}; // ComplexSizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi. func (_fcce ParagraphProperties )ComplexSizeMeasure ()string {if _dffgf :=_fcce ._aeag .RPr .SzCs ;_dffgf !=nil {_dgdef :=_dffgf .ValAttr ;if _dgdef .ST_PositiveUniversalMeasure !=nil {return *_dgdef .ST_PositiveUniversalMeasure ;};};return "";}; // SizeValue returns the value of run font size in points. func (_cfedb RunProperties )SizeValue ()float64 {if _ggbc :=_cfedb ._afdg .Sz ;_ggbc !=nil {_cegb :=_ggbc .ValAttr ;if _cegb .ST_UnsignedDecimalNumber !=nil {return float64 (*_cegb .ST_UnsignedDecimalNumber )/2;};};return 0.0;}; // SetWidthAuto sets the the cell width to automatic. func (_gda CellProperties )SetWidthAuto (){_gda ._bdag .TcW =_bfc .NewCT_TblWidth ();_gda ._bdag .TcW .TypeAttr =_bfc .ST_TblWidthAuto ;}; // SetColor sets a specific color or auto. func (_agg Color )SetColor (v _fc .Color ){if v .IsAuto (){_agg ._cffa .ValAttr .ST_HexColorAuto =_bfc .ST_HexColorAutoAuto ;_agg ._cffa .ValAttr .ST_HexColorRGB =nil ;}else {_agg ._cffa .ValAttr .ST_HexColorAuto =_bfc .ST_HexColorAutoUnset ;_agg ._cffa .ValAttr .ST_HexColorRGB =v .AsRGBString ();};};func (_cag *Document )validateBookmarks ()error {_cddf :=make (map[string ]struct{});for _ ,_gff :=range _cag .Bookmarks (){if _ ,_dbde :=_cddf [_gff .Name ()];_dbde {return _bf .Errorf ("d\u0075\u0070\u006c\u0069\u0063\u0061t\u0065\u0020\u0062\u006f\u006f\u006b\u006d\u0061\u0072k\u0020\u0025\u0073 \u0066o\u0075\u006e\u0064",_gff .Name ());};_cddf [_gff .Name ()]=struct{}{};};return nil ;}; // 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 (_daec *Document )FormFields ()[]FormField {_dac :=[]FormField {};for _ ,_dcgbc :=range _daec .Paragraphs (){_fgce :=_dcgbc .Runs ();for _ccca ,_bffg :=range _fgce {for _ ,_ceag :=range _bffg ._cdfb .EG_RunInnerContent {if _ceag .FldChar ==nil ||_ceag .FldChar .FfData ==nil {continue ;};if _ceag .FldChar .FldCharTypeAttr ==_bfc .ST_FldCharTypeBegin {if len (_ceag .FldChar .FfData .Name )==0||_ceag .FldChar .FfData .Name [0].ValAttr ==nil {continue ;};_cba :=FormField {_cdaa :_ceag .FldChar .FfData };if _ceag .FldChar .FfData .TextInput !=nil {for _efdg :=_ccca +1;_efdg < len (_fgce )-1;_efdg ++{if len (_fgce [_efdg ]._cdfb .EG_RunInnerContent )==0{continue ;};_agge :=_fgce [_efdg ]._cdfb .EG_RunInnerContent [0];if _agge .FldChar !=nil &&_agge .FldChar .FldCharTypeAttr ==_bfc .ST_FldCharTypeSeparate {if len (_fgce [_efdg +1]._cdfb .EG_RunInnerContent )==0{continue ;};if _fgce [_efdg +1]._cdfb .EG_RunInnerContent [0].FldChar ==nil {_cba ._fdea =_fgce [_efdg +1]._cdfb .EG_RunInnerContent [0];break ;};};};};_dac =append (_dac ,_cba );};};};};return _dac ;}; // Name returns the name of the field. func (_fbeb FormField )Name ()string {return *_fbeb ._cdaa .Name [0].ValAttr }; // CharacterSpacingMeasure returns paragraph characters spacing with its measure which can be mm, cm, in, pt, pc or pi. func (_gage ParagraphProperties )CharacterSpacingMeasure ()string {if _gdbb :=_gage ._aeag .RPr .Spacing ;_gdbb !=nil {_aabg :=_gdbb .ValAttr ;if _aabg .ST_UniversalMeasure !=nil {return *_aabg .ST_UniversalMeasure ;};};return "";}; // SetDoubleStrikeThrough sets the run to double strike-through. func (_bdfe RunProperties )SetDoubleStrikeThrough (b bool ){if !b {_bdfe ._afdg .Dstrike =nil ;}else {_bdfe ._afdg .Dstrike =_bfc .NewCT_OnOff ();};}; // TableLook is the conditional formatting associated with a table style that // has been assigned to a table. type TableLook struct{_dbeg *_bfc .CT_TblLook }; // HasFootnotes returns a bool based on the presence or abscence of footnotes within // the document. func (_afg *Document )HasFootnotes ()bool {return _afg ._cd !=nil }; // SetLastRow controls the conditional formatting for the last row in a table. // This is called the 'Total' row within Word. func (_gbfd TableLook )SetLastRow (on bool ){if !on {_gbfd ._dbeg .LastRowAttr =&_af .ST_OnOff {};_gbfd ._dbeg .LastRowAttr .ST_OnOff1 =_af .ST_OnOff1Off ;}else {_gbfd ._dbeg .LastRowAttr =&_af .ST_OnOff {};_gbfd ._dbeg .LastRowAttr .ST_OnOff1 =_af .ST_OnOff1On ;};}; // VerticalAlign returns the value of paragraph vertical align. func (_edagb ParagraphProperties )VerticalAlignment ()_af .ST_VerticalAlignRun {if _gbee :=_edagb ._aeag .RPr .VertAlign ;_gbee !=nil {return _gbee .ValAttr ;};return 0;};func (_efeb Paragraph )addBeginFldChar (_dgbe string )*_bfc .CT_FFData {_cacc :=_efeb .addFldChar ();_cacc .FldCharTypeAttr =_bfc .ST_FldCharTypeBegin ;_cacc .FfData =_bfc .NewCT_FFData ();_bdad :=_bfc .NewCT_FFName ();_bdad .ValAttr =&_dgbe ;_cacc .FfData .Name =[]*_bfc .CT_FFName {_bdad };return _cacc .FfData ;}; // SetBefore sets the spacing that comes before the paragraph. func (_gbde ParagraphSpacing )SetBefore (before _gga .Distance ){_gbde ._dgad .BeforeAttr =&_af .ST_TwipsMeasure {};_gbde ._dgad .BeforeAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (before /_gga .Twips ));}; // SetSpacing sets the spacing that comes before and after the paragraph. func (_gccb ParagraphStyleProperties )SetSpacing (before ,after _gga .Distance ){if _gccb ._daba .Spacing ==nil {_gccb ._daba .Spacing =_bfc .NewCT_Spacing ();};if before ==_gga .Zero {_gccb ._daba .Spacing .BeforeAttr =nil ;}else {_gccb ._daba .Spacing .BeforeAttr =&_af .ST_TwipsMeasure {};_gccb ._daba .Spacing .BeforeAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (before /_gga .Twips ));};if after ==_gga .Zero {_gccb ._daba .Spacing .AfterAttr =nil ;}else {_gccb ._daba .Spacing .AfterAttr =&_af .ST_TwipsMeasure {};_gccb ._daba .Spacing .AfterAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (after /_gga .Twips ));};}; // AddPageBreak adds a page break to a run. func (_gggb Run )AddPageBreak (){_aceg :=_gggb .newIC ();_aceg .Br =_bfc .NewCT_Br ();_aceg .Br .TypeAttr =_bfc .ST_BrTypePage ;}; // Text returns text from the document as one string separated with line breaks. func (_ggce *DocText )Text ()string {_edef :=_gg .NewBuffer ([]byte {});for _ ,_gaeb :=range _ggce .Items {if _gaeb .Text !=""{_edef .WriteString (_gaeb .Text );_edef .WriteString ("\u000a");};};return _edef .String ();};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";); // Cells returns the cells defined in the table. func (_eaff Row )Cells ()[]Cell {_febb :=[]Cell {};for _ ,_aacc :=range _eaff ._becg .EG_ContentCellContent {for _ ,_bccc :=range _aacc .Tc {_febb =append (_febb ,Cell {_eaff ._adda ,_bccc });};if _aacc .Sdt !=nil &&_aacc .Sdt .SdtContent !=nil {for _ ,_baea :=range _aacc .Sdt .SdtContent .Tc {_febb =append (_febb ,Cell {_eaff ._adda ,_baea });};};};return _febb ;};func (_dgff *Document )InsertTableBefore (relativeTo Paragraph )Table {return _dgff .insertTable (relativeTo ,true );}; // Run is a run of text within a paragraph that shares the same formatting. type Run struct{_dadg *Document ;_cdfb *_bfc .CT_R ;}; // SetUnderline controls underline for a run style. func (_eegd RunProperties )SetUnderline (style _bfc .ST_Underline ,c _fc .Color ){if style ==_bfc .ST_UnderlineUnset {_eegd ._afdg .U =nil ;}else {_eegd ._afdg .U =_bfc .NewCT_Underline ();_eegd ._afdg .U .ColorAttr =&_bfc .ST_HexColor {};_eegd ._afdg .U .ColorAttr .ST_HexColorRGB =c .AsRGBString ();_eegd ._afdg .U .ValAttr =style ;};}; // SetBeforeAuto controls if spacing before a paragraph is automatically determined. func (_dgfff ParagraphSpacing )SetBeforeAuto (b bool ){if b {_dgfff ._dgad .BeforeAutospacingAttr =&_af .ST_OnOff {};_dgfff ._dgad .BeforeAutospacingAttr .Bool =_a .Bool (true );}else {_dgfff ._dgad .BeforeAutospacingAttr =nil ;};}; // SetLeft sets the left border to a specified type, color and thickness. func (_fdf CellBorders )SetLeft (t _bfc .ST_Border ,c _fc .Color ,thickness _gga .Distance ){_fdf ._efd .Left =_bfc .NewCT_Border ();_aebcf (_fdf ._efd .Left ,t ,c ,thickness );}; // SetToolTip sets the tooltip text for a hyperlink. func (_dffa HyperLink )SetToolTip (text string ){if text ==""{_dffa ._ebdf .TooltipAttr =nil ;}else {_dffa ._ebdf .TooltipAttr =_a .String (text );};}; // ParagraphStyleProperties is the styling information for a paragraph. type ParagraphStyleProperties struct{_daba *_bfc .CT_PPrGeneral }; // Fonts allows manipulating a style or run's fonts. type Fonts struct{_bgbgff *_bfc .CT_Fonts }; // Runs returns all of the runs in a paragraph. func (_ecfd Paragraph )Runs ()[]Run {_eacf :=[]Run {};for _ ,_fbfb :=range _ecfd ._egaag .EG_PContent {for _ ,_eggg :=range _fbfb .EG_ContentRunContent {if _eggg .R !=nil {_eacf =append (_eacf ,Run {_ecfd ._gdg ,_eggg .R });};if _eggg .Sdt !=nil &&_eggg .Sdt .SdtContent !=nil {for _ ,_ecged :=range _eggg .Sdt .SdtContent .EG_ContentRunContent {if _ecged .R !=nil {_eacf =append (_eacf ,Run {_ecfd ._gdg ,_ecged .R });};};};};};return _eacf ;}; // DrawingAnchored returns a slice of AnchoredDrawings. func (_babgc Run )DrawingAnchored ()[]AnchoredDrawing {_ccfc :=[]AnchoredDrawing {};for _ ,_fagdc :=range _babgc ._cdfb .EG_RunInnerContent {if _fagdc .Drawing ==nil {continue ;};for _ ,_edde :=range _fagdc .Drawing .Anchor {_ccfc =append (_ccfc ,AnchoredDrawing {_babgc ._dadg ,_edde });};};return _ccfc ;};func _bfbf (_egff *_bfc .CT_P ,_ddce map[string ]string ){for _ ,_dfdg :=range _egff .EG_PContent {for _ ,_bbbd :=range _dfdg .EG_ContentRunContent {if _bbbd .R !=nil {for _ ,_bbgd :=range _bbbd .R .EG_RunInnerContent {_ebdd :=_bbgd .Drawing ;if _ebdd !=nil {for _ ,_cgce :=range _ebdd .Anchor {for _ ,_bebb :=range _cgce .Graphic .GraphicData .Any {switch _bgfc :=_bebb .(type ){case *_fd .Pic :if _bgfc .BlipFill !=nil &&_bgfc .BlipFill .Blip !=nil {_cgff (_bgfc .BlipFill .Blip ,_ddce );};default:};};};for _ ,_ded :=range _ebdd .Inline {for _ ,_deba :=range _ded .Graphic .GraphicData .Any {switch _eade :=_deba .(type ){case *_fd .Pic :if _eade .BlipFill !=nil &&_eade .BlipFill .Blip !=nil {_cgff (_eade .BlipFill .Blip ,_ddce );};default:};};};};};};};};}; // Font returns the name of paragraph font family. func (_cgad ParagraphProperties )Font ()string {if _accg :=_cgad ._aeag .RPr .RFonts ;_accg !=nil {if _accg .AsciiAttr !=nil {return *_accg .AsciiAttr ;}else if _accg .HAnsiAttr !=nil {return *_accg .HAnsiAttr ;}else if _accg .CsAttr !=nil {return *_accg .CsAttr ;};};return "";}; // SetName marks sets a name attribute for a FormField. func (_cgd FormField )SetName (name string ){_gaea :=_bfc .NewCT_FFName ();_gaea .ValAttr =&name ;_cgd ._cdaa .Name =[]*_bfc .CT_FFName {_gaea };};func _gecdc (_cfda []*_bfc .CT_P ,_aeffb *TableInfo ,_eadf *DrawingInfo )[]TextItem {_gfad :=[]TextItem {};for _ ,_dbe :=range _cfda {_gfad =append (_gfad ,_dafb (_dbe ,nil ,_aeffb ,_eadf ,_dbe .EG_PContent )...);};return _gfad ;}; // GetDocRelTargetByID returns TargetAttr of document relationship given its IdAttr. func (_fcaf *Document )GetDocRelTargetByID (idAttr string )string {for _ ,_gfdb :=range _fcaf ._fbb .X ().Relationship {if _gfdb .IdAttr ==idAttr {return _gfdb .TargetAttr ;};};return "";}; // Header is a header for a document section. type Header struct{_aea *Document ;_abff *_bfc .Hdr ;};func _ecab (_bbdd *_bfc .CT_OnOff )bool {return _bbdd !=nil }; // SetStyle sets the font size. func (_abgeb RunProperties )SetStyle (style string ){if style ==""{_abgeb ._afdg .RStyle =nil ;}else {_abgeb ._afdg .RStyle =_bfc .NewCT_String ();_abgeb ._afdg .RStyle .ValAttr =style ;};}; // SetVerticalAlignment sets the vertical alignment of content within a table cell. func (_egf CellProperties )SetVerticalAlignment (align _bfc .ST_VerticalJc ){if align ==_bfc .ST_VerticalJcUnset {_egf ._bdag .VAlign =nil ;}else {_egf ._bdag .VAlign =_bfc .NewCT_VerticalJc ();_egf ._bdag .VAlign .ValAttr =align ;};}; // Index returns the index of the footer within the document. This is used to // form its zip packaged filename as well as to match it with its relationship // ID. func (_eba Footer )Index ()int {for _fcbg ,_gggd :=range _eba ._gdfd ._def {if _gggd ==_eba ._cgaf {return _fcbg ;};};return -1;}; // Footer is a footer for a document section. type Footer struct{_gdfd *Document ;_cgaf *_bfc .Ftr ;}; // Clear clears the styes. func (_fabg Styles )Clear (){_fabg ._bcagb .DocDefaults =nil ;_fabg ._bcagb .LatentStyles =nil ;_fabg ._bcagb .Style =nil ;}; // X returns the inner wrapped XML type. func (_fdfa Row )X ()*_bfc .CT_Row {return _fdfa ._becg }; // SetThemeShade sets the shade based off the theme color. func (_abb Color )SetThemeShade (s uint8 ){_bfca :=_bf .Sprintf ("\u0025\u0030\u0032\u0078",s );_abb ._cffa .ThemeShadeAttr =&_bfca ;}; // SetFirstLineIndent controls the indentation of the first line in a paragraph. func (_badf Paragraph )SetFirstLineIndent (m _gga .Distance ){_badf .ensurePPr ();_ecbd :=_badf ._egaag .PPr ;if _ecbd .Ind ==nil {_ecbd .Ind =_bfc .NewCT_Ind ();};if m ==_gga .Zero {_ecbd .Ind .FirstLineAttr =nil ;}else {_ecbd .Ind .FirstLineAttr =&_af .ST_TwipsMeasure {};_ecbd .Ind .FirstLineAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (m /_gga .Twips ));};}; // CharacterSpacingValue returns the value of characters spacing in twips (1/20 of point). func (_cddfa ParagraphProperties )CharacterSpacingValue ()int64 {if _gfbe :=_cddfa ._aeag .RPr .Spacing ;_gfbe !=nil {_dbge :=_gfbe .ValAttr ;if _dbge .Int64 !=nil {return *_dbge .Int64 ;};};return int64 (0);}; // SetEastAsiaTheme sets the font East Asia Theme. func (_cgb Fonts )SetEastAsiaTheme (t _bfc .ST_Theme ){_cgb ._bgbgff .EastAsiaThemeAttr =t }; // SetAll sets all of the borders to a given value. func (_geee TableBorders )SetAll (t _bfc .ST_Border ,c _fc .Color ,thickness _gga .Distance ){_geee .SetBottom (t ,c ,thickness );_geee .SetLeft (t ,c ,thickness );_geee .SetRight (t ,c ,thickness );_geee .SetTop (t ,c ,thickness );_geee .SetInsideHorizontal (t ,c ,thickness );_geee .SetInsideVertical (t ,c ,thickness );}; // SetAllCaps sets the run to all caps. func (_cbaa RunProperties )SetAllCaps (b bool ){if !b {_cbaa ._afdg .Caps =nil ;}else {_cbaa ._afdg .Caps =_bfc .NewCT_OnOff ();};}; // Borders allows manipulation of the table borders. func (_dbaa TableProperties )Borders ()TableBorders {if _dbaa ._fbbfae .TblBorders ==nil {_dbaa ._fbbfae .TblBorders =_bfc .NewCT_TblBorders ();};return TableBorders {_dbaa ._fbbfae .TblBorders };}; // AddCell adds a cell to a row and returns it func (_fadd Row )AddCell ()Cell {_cbed :=_bfc .NewEG_ContentCellContent ();_fadd ._becg .EG_ContentCellContent =append (_fadd ._becg .EG_ContentCellContent ,_cbed );_eebd :=_bfc .NewCT_Tc ();_cbed .Tc =append (_cbed .Tc ,_eebd );return Cell {_fadd ._adda ,_eebd };}; // SetName sets the name of the image, visible in the properties of the image // within Word. func (_bda AnchoredDrawing )SetName (name string ){_bda ._aaf .DocPr .NameAttr =name ;for _ ,_ggc :=range _bda ._aaf .Graphic .GraphicData .Any {if _egd ,_ba :=_ggc .(*_fd .Pic );_ba {_egd .NvPicPr .CNvPr .DescrAttr =_a .String (name );};};}; // NewTableWidth returns a newly intialized TableWidth func NewTableWidth ()TableWidth {return TableWidth {_bfc .NewCT_TblWidth ()}}; // SetText sets the text to be used in bullet mode. func (_feab NumberingLevel )SetText (t string ){if t ==""{_feab ._befb .LvlText =nil ;}else {_feab ._befb .LvlText =_bfc .NewCT_LevelText ();_feab ._befb .LvlText .ValAttr =_a .String (t );};}; // AddTable adds a table to the table cell. func (_bc Cell )AddTable ()Table {_ga :=_bfc .NewEG_BlockLevelElts ();_bc ._adc .EG_BlockLevelElts =append (_bc ._adc .EG_BlockLevelElts ,_ga );_bbg :=_bfc .NewEG_ContentBlockContent ();_ga .EG_ContentBlockContent =append (_ga .EG_ContentBlockContent ,_bbg );_agf :=_bfc .NewCT_Tbl ();_bbg .Tbl =append (_bbg .Tbl ,_agf );return Table {_bc ._gfd ,_agf };}; // 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 (_faeg Document )AddHyperlink (url string )_df .Hyperlink {return _faeg ._fbb .AddHyperlink (url )}; // SetRight sets the cell right margin func (_bdf CellMargins )SetRight (d _gga .Distance ){_bdf ._aca .Right =_bfc .NewCT_TblWidth ();_aff (_bdf ._aca .Right ,d );}; // SetChecked marks a FormFieldTypeCheckBox as checked or unchecked. func (_addgb FormField )SetChecked (b bool ){if _addgb ._cdaa .CheckBox ==nil {return ;};if !b {_addgb ._cdaa .CheckBox .Checked =nil ;}else {_addgb ._cdaa .CheckBox .Checked =_bfc .NewCT_OnOff ();};};func _bggc (_gebf string )mergeFieldInfo {_aaad :=[]string {};_degc :=_gg .Buffer {};_cbac :=-1;for _ebcaa ,_ebbff :=range _gebf {switch _ebbff {case ' ':if _degc .Len ()!=0{_aaad =append (_aaad ,_degc .String ());};_degc .Reset ();case '"':if _cbac !=-1{_aaad =append (_aaad ,_gebf [_cbac +1:_ebcaa ]);_cbac =-1;}else {_cbac =_ebcaa ;};default:_degc .WriteRune (_ebbff );};};if _degc .Len ()!=0{_aaad =append (_aaad ,_degc .String ());};_abeb :=mergeFieldInfo {};for _ceaa :=0;_ceaa < len (_aaad )-1;_ceaa ++{_aada :=_aaad [_ceaa ];switch _aada {case "\u004d\u0045\u0052\u0047\u0045\u0046\u0049\u0045\u004c\u0044":_abeb ._cbbg =_aaad [_ceaa +1];_ceaa ++;case "\u005c\u0066":_abeb ._dffc =_aaad [_ceaa +1];_ceaa ++;case "\u005c\u0062":_abeb ._edac =_aaad [_ceaa +1];_ceaa ++;case "\u005c\u002a":switch _aaad [_ceaa +1]{case "\u0055\u0070\u0070e\u0072":_abeb ._dcca =true ;case "\u004c\u006f\u0077e\u0072":_abeb ._dgfbe =true ;case "\u0043\u0061\u0070\u0073":_abeb ._bge =true ;case "\u0046\u0069\u0072\u0073\u0074\u0043\u0061\u0070":_abeb ._bdge =true ;};_ceaa ++;};};return _abeb ;}; // UnderlineColor returns the hex color value of run underline. func (_cgedd RunProperties )UnderlineColor ()string {if _acde :=_cgedd ._afdg .U ;_acde !=nil {_acgbd :=_acde .ColorAttr ;if _acgbd !=nil &&_acgbd .ST_HexColorRGB !=nil {return *_acgbd .ST_HexColorRGB ;};};return "";}; // SetHangingIndent controls the hanging indent of the paragraph. func (_fcga ParagraphStyleProperties )SetHangingIndent (m _gga .Distance ){if _fcga ._daba .Ind ==nil {_fcga ._daba .Ind =_bfc .NewCT_Ind ();};if m ==_gga .Zero {_fcga ._daba .Ind .HangingAttr =nil ;}else {_fcga ._daba .Ind .HangingAttr =&_af .ST_TwipsMeasure {};_fcga ._daba .Ind .HangingAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (m /_gga .Twips ));};}; // DoubleStrike returns true if run is double striked. func (_bdfee RunProperties )DoubleStrike ()bool {return _ecab (_bdfee ._afdg .Dstrike )}; // ExtractText returns text from the document as a DocText object. func (_bcdd *Document )ExtractText ()*DocText {_ebgc :=[]TextItem {};for _ ,_ddda :=range _bcdd ._bfda .Body .EG_BlockLevelElts {_ebgc =append (_ebgc ,_fedac (_ddda .EG_ContentBlockContent ,nil )...);};return &DocText {Items :_ebgc };}; // SetNumberingLevel sets the numbering level of a paragraph. If used, then the // NumberingDefinition must also be set via SetNumberingDefinition or // SetNumberingDefinitionByID. func (_gbcf Paragraph )SetNumberingLevel (listLevel int ){_gbcf .ensurePPr ();if _gbcf ._egaag .PPr .NumPr ==nil {_gbcf ._egaag .PPr .NumPr =_bfc .NewCT_NumPr ();};_eege :=_bfc .NewCT_DecimalNumber ();_eege .ValAttr =int64 (listLevel );_gbcf ._egaag .PPr .NumPr .Ilvl =_eege ;}; // AddDrawingInline adds an inline drawing from an ImageRef. func (_ffdg Run )AddDrawingInline (img _df .ImageRef )(InlineDrawing ,error ){_gaac :=_ffdg .newIC ();_gaac .Drawing =_bfc .NewCT_Drawing ();_cgced :=_bfc .NewWdInline ();_fefg :=InlineDrawing {_ffdg ._dadg ,_cgced };_cgced .CNvGraphicFramePr =_be .NewCT_NonVisualGraphicFrameProperties ();_gaac .Drawing .Inline =append (_gaac .Drawing .Inline ,_cgced );_cgced .Graphic =_be .NewGraphic ();_cgced .Graphic .GraphicData =_be .NewCT_GraphicalObjectData ();_cgced .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";_cgced .DistTAttr =_a .Uint32 (0);_cgced .DistLAttr =_a .Uint32 (0);_cgced .DistBAttr =_a .Uint32 (0);_cgced .DistRAttr =_a .Uint32 (0);_cgced .Extent .CxAttr =int64 (float64 (img .Size ().X *_gga .Pixel72 )/_gga .EMU );_cgced .Extent .CyAttr =int64 (float64 (img .Size ().Y *_gga .Pixel72 )/_gga .EMU );_befd :=0x7FFFFFFF&_b .Uint32 ();_cgced .DocPr .IdAttr =_befd ;_edbd :=_fd .NewPic ();_edbd .NvPicPr .CNvPr .IdAttr =_befd ;_eedb :=img .RelID ();if _eedb ==""{return _fefg ,_ab .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");};_cgced .Graphic .GraphicData .Any =append (_cgced .Graphic .GraphicData .Any ,_edbd );_edbd .BlipFill =_be .NewCT_BlipFillProperties ();_edbd .BlipFill .Blip =_be .NewCT_Blip ();_edbd .BlipFill .Blip .EmbedAttr =&_eedb ;_edbd .BlipFill .Stretch =_be .NewCT_StretchInfoProperties ();_edbd .BlipFill .Stretch .FillRect =_be .NewCT_RelativeRect ();_edbd .SpPr =_be .NewCT_ShapeProperties ();_edbd .SpPr .Xfrm =_be .NewCT_Transform2D ();_edbd .SpPr .Xfrm .Off =_be .NewCT_Point2D ();_edbd .SpPr .Xfrm .Off .XAttr .ST_CoordinateUnqualified =_a .Int64 (0);_edbd .SpPr .Xfrm .Off .YAttr .ST_CoordinateUnqualified =_a .Int64 (0);_edbd .SpPr .Xfrm .Ext =_be .NewCT_PositiveSize2D ();_edbd .SpPr .Xfrm .Ext .CxAttr =int64 (img .Size ().X *_gga .Point );_edbd .SpPr .Xfrm .Ext .CyAttr =int64 (img .Size ().Y *_gga .Point );_edbd .SpPr .PrstGeom =_be .NewCT_PresetGeometry2D ();_edbd .SpPr .PrstGeom .PrstAttr =_be .ST_ShapeTypeRect ;return _fefg ,nil ;}; // RemoveParagraph removes a paragraph from the endnote. func (_cggd Endnote )RemoveParagraph (p Paragraph ){for _ ,_cacf :=range _cggd .content (){for _afec ,_eddd :=range _cacf .P {if _eddd ==p ._egaag {copy (_cacf .P [_afec :],_cacf .P [_afec +1:]);_cacf .P =_cacf .P [0:len (_cacf .P )-1];return ;};};};}; // SetBold sets the run to bold. func (_fedb RunProperties )SetBold (b bool ){if !b {_fedb ._afdg .B =nil ;_fedb ._afdg .BCs =nil ;}else {_fedb ._afdg .B =_bfc .NewCT_OnOff ();_fedb ._afdg .BCs =_bfc .NewCT_OnOff ();};}; // SetName sets the name of the bookmark. This is the name that is used to // reference the bookmark from hyperlinks. func (_dgd Bookmark )SetName (name string ){_dgd ._ag .NameAttr =name }; // Paragraphs returns the paragraphs defined in a footnote. func (_cdddd Footnote )Paragraphs ()[]Paragraph {_afcc :=[]Paragraph {};for _ ,_fbag :=range _cdddd .content (){for _ ,_egcdd :=range _fbag .P {_afcc =append (_afcc ,Paragraph {_cdddd ._acff ,_egcdd });};};return _afcc ;}; // SetVerticalMerge controls the vertical merging of cells. func (_fga CellProperties )SetVerticalMerge (mergeVal _bfc .ST_Merge ){if mergeVal ==_bfc .ST_MergeUnset {_fga ._bdag .VMerge =nil ;}else {_fga ._bdag .VMerge =_bfc .NewCT_VMerge ();_fga ._bdag .VMerge .ValAttr =mergeVal ;};};func (_bdba *Document )validateTableCells ()error {for _ ,_gffe :=range _bdba ._bfda .Body .EG_BlockLevelElts {for _ ,_edbe :=range _gffe .EG_ContentBlockContent {for _ ,_gege :=range _edbe .Tbl {for _ ,_gab :=range _gege .EG_ContentRowContent {for _ ,_agac :=range _gab .Tr {_eag :=false ;for _ ,_gef :=range _agac .EG_ContentCellContent {_aaa :=false ;for _ ,_afcb :=range _gef .Tc {_eag =true ;for _ ,_fca :=range _afcb .EG_BlockLevelElts {for _ ,_ebbg :=range _fca .EG_ContentBlockContent {if len (_ebbg .P )> 0{_aaa =true ;break ;};};};};if !_aaa {return _ab .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 !_eag {return _ab .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 ;}; // SetCellSpacingAuto sets the cell spacing within a table to automatic. func (_gdgdc TableProperties )SetCellSpacingAuto (){_gdgdc ._fbbfae .TblCellSpacing =_bfc .NewCT_TblWidth ();_gdgdc ._fbbfae .TblCellSpacing .TypeAttr =_bfc .ST_TblWidthAuto ;}; // 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 (_deb *Document )AddImage (i _df .Image )(_df .ImageRef ,error ){_ebce :=_df .MakeImageRef (i ,&_deb .DocBase ,_deb ._fbb );if i .Data ==nil &&i .Path ==""{return _ebce ,_ab .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 _ebce ,_ab .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 _ebce ,_ab .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 !=""{_dcgab :=_eca .Add (i .Path );if _dcgab !=nil {return _ebce ,_dcgab ;};};_deb .Images =append (_deb .Images ,_ebce );_dgcb :=_bf .Sprintf ("\u006d\u0065d\u0069\u0061\u002fi\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073",len (_deb .Images ),i .Format );_fgg :=_deb ._fbb .AddRelationship (_dgcb ,_a .ImageType );_deb .ContentTypes .EnsureDefault ("\u0070\u006e\u0067","\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg");_deb .ContentTypes .EnsureDefault ("\u006a\u0070\u0065\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_deb .ContentTypes .EnsureDefault ("\u006a\u0070\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_deb .ContentTypes .EnsureDefault ("\u0077\u006d\u0066","i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066");_deb .ContentTypes .EnsureDefault (i .Format ,"\u0069\u006d\u0061\u0067\u0065\u002f"+i .Format );_ebce .SetRelID (_fgg .X ().IdAttr );_ebce .SetTarget (_dgcb );return _ebce ,nil ;}; // X returns the inner wrapped XML type. func (_ef AnchoredDrawing )X ()*_bfc .WdAnchor {return _ef ._aaf }; // TableConditionalFormatting controls the conditional formatting within a table // style. type TableConditionalFormatting struct{_efebb *_bfc .CT_TblStylePr }; // X returns the inner wrapped XML type. func (_dfdde RunProperties )X ()*_bfc .CT_RPr {return _dfdde ._afdg }; // Emboss returns true if paragraph emboss is on. func (_cgbef ParagraphProperties )Emboss ()bool {return _ecab (_cgbef ._aeag .RPr .Emboss )}; // SetFontFamily sets the Ascii & HAnsi fonly family for a run. func (_gdcc RunProperties )SetFontFamily (family string ){if _gdcc ._afdg .RFonts ==nil {_gdcc ._afdg .RFonts =_bfc .NewCT_Fonts ();};_gdcc ._afdg .RFonts .AsciiAttr =_a .String (family );_gdcc ._afdg .RFonts .HAnsiAttr =_a .String (family );_gdcc ._afdg .RFonts .EastAsiaAttr =_a .String (family );}; // 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 (_efcd Paragraph )AddFootnote (text string )Footnote {var _cedc int64 ;if _efcd ._gdg .HasFootnotes (){for _ ,_cgge :=range _efcd ._gdg .Footnotes (){if _cgge .id ()> _cedc {_cedc =_cgge .id ();};};_cedc ++;}else {_cedc =0;_efcd ._gdg ._cd =&_bfc .Footnotes {};_efcd ._gdg ._cd .CT_Footnotes =_bfc .CT_Footnotes {};_efcd ._gdg ._cd .Footnote =make ([]*_bfc .CT_FtnEdn ,0);};_ggec :=_bfc .NewCT_FtnEdn ();_faca :=_bfc .NewCT_FtnEdnRef ();_faca .IdAttr =_cedc ;_efcd ._gdg ._cd .CT_Footnotes .Footnote =append (_efcd ._gdg ._cd .CT_Footnotes .Footnote ,_ggec );_fgcc :=_efcd .AddRun ();_bbffe :=_fgcc .Properties ();_bbffe .SetStyle ("\u0046\u006f\u006f\u0074\u006e\u006f\u0074\u0065\u0041n\u0063\u0068\u006f\u0072");_fgcc ._cdfb .EG_RunInnerContent =[]*_bfc .EG_RunInnerContent {_bfc .NewEG_RunInnerContent ()};_fgcc ._cdfb .EG_RunInnerContent [0].FootnoteReference =_faca ;_dfbb :=Footnote {_efcd ._gdg ,_ggec };_dfbb ._gbbd .IdAttr =_cedc ;_dfbb ._gbbd .EG_BlockLevelElts =[]*_bfc .EG_BlockLevelElts {_bfc .NewEG_BlockLevelElts ()};_deadc :=_dfbb .AddParagraph ();_deadc .Properties ().SetStyle ("\u0046\u006f\u006f\u0074\u006e\u006f\u0074\u0065");_deadc ._egaag .PPr .RPr =_bfc .NewCT_ParaRPr ();_ebaa :=_deadc .AddRun ();_ebaa .AddTab ();_ebaa .AddText (text );return _dfbb ;}; // SetAfter sets the spacing that comes after the paragraph. func (_ffa ParagraphSpacing )SetAfter (after _gga .Distance ){_ffa ._dgad .AfterAttr =&_af .ST_TwipsMeasure {};_ffa ._dgad .AfterAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (after /_gga .Twips ));}; // 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 (_cege Run )IsFootnote ()(bool ,int64 ){if _cege ._cdfb .EG_RunInnerContent !=nil {if _cege ._cdfb .EG_RunInnerContent [0].FootnoteReference !=nil {return true ,_cege ._cdfb .EG_RunInnerContent [0].FootnoteReference .IdAttr ;};};return false ,0;}; // X returns the inner wrapped XML type. func (_fbfa NumberingDefinition )X ()*_bfc .CT_AbstractNum {return _fbfa ._bcbe }; // Font returns the name of run font family. func (_dgcde RunProperties )Font ()string {if _edaf :=_dgcde ._afdg .RFonts ;_edaf !=nil {if _edaf .AsciiAttr !=nil {return *_edaf .AsciiAttr ;}else if _edaf .HAnsiAttr !=nil {return *_edaf .HAnsiAttr ;}else if _edaf .CsAttr !=nil {return *_edaf .CsAttr ;};};return "";}; // Styles returns all styles. func (_fecf Styles )Styles ()[]Style {_gefb :=[]Style {};for _ ,_bgge :=range _fecf ._bcagb .Style {_gefb =append (_gefb ,Style {_bgge });};return _gefb ;}; // AddTabStop adds a tab stop to the paragraph. It controls the position of text when using Run.AddTab() func (_cagde ParagraphProperties )AddTabStop (position _gga .Distance ,justificaton _bfc .ST_TabJc ,leader _bfc .ST_TabTlc ){if _cagde ._aeag .Tabs ==nil {_cagde ._aeag .Tabs =_bfc .NewCT_Tabs ();};_caaaf :=_bfc .NewCT_TabStop ();_caaaf .LeaderAttr =leader ;_caaaf .ValAttr =justificaton ;_caaaf .PosAttr .Int64 =_a .Int64 (int64 (position /_gga .Twips ));_cagde ._aeag .Tabs .Tab =append (_cagde ._aeag .Tabs .Tab ,_caaaf );}; // IsBold returns true if the run has been set to bold. func (_gdfc RunProperties )IsBold ()bool {return _gdfc .BoldValue ()==OnOffValueOn };func (_cbde Paragraph )addSeparateFldChar ()*_bfc .CT_FldChar {_adge :=_cbde .addFldChar ();_adge .FldCharTypeAttr =_bfc .ST_FldCharTypeSeparate ;return _adge ;}; // Properties returns the table properties. func (_egffd Table )Properties ()TableProperties {if _egffd ._caeb .TblPr ==nil {_egffd ._caeb .TblPr =_bfc .NewCT_TblPr ();};return TableProperties {_egffd ._caeb .TblPr };}; // IsChecked returns true if a FormFieldTypeCheckBox is checked. func (_dcb FormField )IsChecked ()bool {if _dcb ._cdaa .CheckBox ==nil {return false ;};if _dcb ._cdaa .CheckBox .Checked !=nil {return true ;};return false ;}; // Borders allows controlling individual cell borders. func (_fgf CellProperties )Borders ()CellBorders {if _fgf ._bdag .TcBorders ==nil {_fgf ._bdag .TcBorders =_bfc .NewCT_TcBorders ();};return CellBorders {_fgf ._bdag .TcBorders };}; // Tables returns the tables defined in the document. func (_bbbb *Document )Tables ()[]Table {_aabe :=[]Table {};if _bbbb ._bfda .Body ==nil {return nil ;};for _ ,_add :=range _bbbb ._bfda .Body .EG_BlockLevelElts {for _ ,_cdd :=range _add .EG_ContentBlockContent {for _ ,_feb :=range _bbbb .tables (_cdd ){_aabe =append (_aabe ,_feb );};};};return _aabe ;}; // SetColumnSpan sets the number of Grid Columns Spanned by the Cell. This is used // to give the appearance of merged cells. func (_adg CellProperties )SetColumnSpan (cols int ){if cols ==0{_adg ._bdag .GridSpan =nil ;}else {_adg ._bdag .GridSpan =_bfc .NewCT_DecimalNumber ();_adg ._bdag .GridSpan .ValAttr =int64 (cols );};}; // X returns the inner wrapped XML type. func (_gcbbf Table )X ()*_bfc .CT_Tbl {return _gcbbf ._caeb }; // InitializeDefault constructs the default styles. func (_abdef Styles )InitializeDefault (){_abdef .initializeDocDefaults ();_abdef .initializeStyleDefaults ();}; // SetYOffset sets the Y offset for an image relative to the origin. func (_dgc AnchoredDrawing )SetYOffset (y _gga .Distance ){_dgc ._aaf .PositionV .Choice =&_bfc .WdCT_PosVChoice {};_dgc ._aaf .PositionV .Choice .PosOffset =_a .Int32 (int32 (y /_gga .EMU ));}; // SetSize sets the size of the displayed image on the page. func (_gd AnchoredDrawing )SetSize (w ,h _gga .Distance ){_gd ._aaf .Extent .CxAttr =int64 (float64 (w *_gga .Pixel72 )/_gga .EMU );_gd ._aaf .Extent .CyAttr =int64 (float64 (h *_gga .Pixel72 )/_gga .EMU );}; // Name returns the name of the style if set. func (_agddb Style )Name ()string {if _agddb ._gdea .Name ==nil {return "";};return _agddb ._gdea .Name .ValAttr ;};func _dgf (_bdg *_bfc .CT_TblWidth ,_ggb float64 ){_bdg .TypeAttr =_bfc .ST_TblWidthPct ;_bdg .WAttr =&_bfc .ST_MeasurementOrPercent {};_bdg .WAttr .ST_DecimalNumberOrPercent =&_bfc .ST_DecimalNumberOrPercent {};_bdg .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_a .Int64 (int64 (_ggb *50));}; // Row is a row within a table within a document. type Row struct{_adda *Document ;_becg *_bfc .CT_Row ;}; // SetVerticalAlignment controls the vertical alignment of the run, this is used // to control if text is superscript/subscript. func (_ddfd RunProperties )SetVerticalAlignment (v _af .ST_VerticalAlignRun ){if v ==_af .ST_VerticalAlignRunUnset {_ddfd ._afdg .VertAlign =nil ;}else {_ddfd ._afdg .VertAlign =_bfc .NewCT_VerticalAlignRun ();_ddfd ._afdg .VertAlign .ValAttr =v ;};}; // Style returns the style for a paragraph, or an empty string if it is unset. func (_gbagc ParagraphProperties )Style ()string {if _gbagc ._aeag .PStyle !=nil {return _gbagc ._aeag .PStyle .ValAttr ;};return "";}; // TableConditionalFormatting returns a conditional formatting object of a given // type. Calling this method repeatedly will return the same object. func (_daea Style )TableConditionalFormatting (typ _bfc .ST_TblStyleOverrideType )TableConditionalFormatting {for _ ,_bfad :=range _daea ._gdea .TblStylePr {if _bfad .TypeAttr ==typ {return TableConditionalFormatting {_bfad };};};_fbecf :=_bfc .NewCT_TblStylePr ();_fbecf .TypeAttr =typ ;_daea ._gdea .TblStylePr =append (_daea ._gdea .TblStylePr ,_fbecf );return TableConditionalFormatting {_fbecf };}; // DoubleStrike returns true if paragraph is double striked. func (_daeda ParagraphProperties )DoubleStrike ()bool {return _ecab (_daeda ._aeag .RPr .Dstrike )}; // AddDefinition adds a new numbering definition. func (_gfdbc Numbering )AddDefinition ()NumberingDefinition {_gafeea :=_bfc .NewCT_Num ();_eaddf :=int64 (1);for _ ,_cgegb :=range _gfdbc .Definitions (){if _cgegb .AbstractNumberID ()>=_eaddf {_eaddf =_cgegb .AbstractNumberID ()+1;};};_abge :=int64 (1);for _ ,_cegc :=range _gfdbc .X ().Num {if _cegc .NumIdAttr >=_abge {_abge =_cegc .NumIdAttr +1;};};_gafeea .NumIdAttr =_abge ;_gafeea .AbstractNumId =_bfc .NewCT_DecimalNumber ();_gafeea .AbstractNumId .ValAttr =_eaddf ;_gaeg :=_bfc .NewCT_AbstractNum ();_gaeg .AbstractNumIdAttr =_eaddf ;_gfdbc ._bbbf .AbstractNum =append (_gfdbc ._bbbf .AbstractNum ,_gaeg );_gfdbc ._bbbf .Num =append (_gfdbc ._bbbf .Num ,_gafeea );return NumberingDefinition {_gaeg };}; // GetColor returns the color.Color object representing the run color. func (_feeg ParagraphProperties )GetColor ()_fc .Color {if _aggad :=_feeg ._aeag .RPr .Color ;_aggad !=nil {_cfdd :=_aggad .ValAttr ;if _cfdd .ST_HexColorRGB !=nil {return _fc .FromHex (*_cfdd .ST_HexColorRGB );};};return _fc .Color {};}; // CellBorders are the borders for an individual type CellBorders struct{_efd *_bfc .CT_TcBorders }; // 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 (_bdcbd TableProperties )SetLayout (l _bfc .ST_TblLayoutType ){if l ==_bfc .ST_TblLayoutTypeUnset ||l ==_bfc .ST_TblLayoutTypeAutofit {_bdcbd ._fbbfae .TblLayout =nil ;}else {_bdcbd ._fbbfae .TblLayout =_bfc .NewCT_TblLayoutType ();_bdcbd ._fbbfae .TblLayout .TypeAttr =l ;};}; // Styles is the document wide styles contained in styles.xml. type Styles struct{_bcagb *_bfc .Styles }; // SetCalcOnExit marks if a FormField should be CalcOnExit or not. func (_ggd FormField )SetCalcOnExit (calcOnExit bool ){_efeg :=_bfc .NewCT_OnOff ();_efeg .ValAttr =&_af .ST_OnOff {Bool :&calcOnExit };_ggd ._cdaa .CalcOnExit =[]*_bfc .CT_OnOff {_efeg };}; // TableInfo is used for keep information about a table, a row and a cell where the text is located. type TableInfo struct{Table *_bfc .CT_Tbl ;Row *_bfc .CT_Row ;Cell *_bfc .CT_Tc ;RowIndex int ;ColIndex int ;}; // ComplexSizeValue returns the value of paragraph font size for complex fonts in points. func (_cbcgd ParagraphProperties )ComplexSizeValue ()float64 {if _dgea :=_cbcgd ._aeag .RPr .SzCs ;_dgea !=nil {_bbfa :=_dgea .ValAttr ;if _bbfa .ST_UnsignedDecimalNumber !=nil {return float64 (*_bbfa .ST_UnsignedDecimalNumber )/2;};};return 0.0;}; // 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 (_fdfd Footer )AddImage (i _df .Image )(_df .ImageRef ,error ){var _eed _df .Relationships ;for _ggfda ,_fafd :=range _fdfd ._gdfd ._def {if _fafd ==_fdfd ._cgaf {_eed =_fdfd ._gdfd ._fcbd [_ggfda ];};};_ggff :=_df .MakeImageRef (i ,&_fdfd ._gdfd .DocBase ,_eed );if i .Data ==nil &&i .Path ==""{return _ggff ,_ab .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 _ggff ,_ab .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 _ggff ,_ab .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");};_fdfd ._gdfd .Images =append (_fdfd ._gdfd .Images ,_ggff );_agef :=_bf .Sprintf ("\u006d\u0065d\u0069\u0061\u002fi\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073",len (_fdfd ._gdfd .Images ),i .Format );_egea :=_eed .AddRelationship (_agef ,_a .ImageType );_ggff .SetRelID (_egea .X ().IdAttr );return _ggff ,nil ;}; // 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 (_bdb AnchoredDrawing )SetTextWrapNone (){_bdb ._aaf .Choice =&_bfc .WdEG_WrapTypeChoice {};_bdb ._aaf .Choice .WrapNone =_bfc .NewWdCT_WrapNone ();};func _ggbb (_ecgd *_bfc .CT_OnOff )OnOffValue {if _ecgd ==nil {return OnOffValueUnset ;};if _ecgd .ValAttr !=nil &&_ecgd .ValAttr .Bool !=nil &&*_ecgd .ValAttr .Bool ==false {return OnOffValueOff ;};return OnOffValueOn ;}; // SetValue sets the value of a FormFieldTypeText or FormFieldTypeDropDown. For // FormFieldTypeDropDown, the value must be one of the fields possible values. func (_cadb FormField )SetValue (v string ){if _cadb ._cdaa .DdList !=nil {for _fffa ,_aeeb :=range _cadb .PossibleValues (){if _aeeb ==v {_cadb ._cdaa .DdList .Result =_bfc .NewCT_DecimalNumber ();_cadb ._cdaa .DdList .Result .ValAttr =int64 (_fffa );break ;};};}else if _cadb ._cdaa .TextInput !=nil {_cadb ._fdea .T =_bfc .NewCT_Text ();_cadb ._fdea .T .Content =v ;};};func _dafb (_ggad *_bfc .CT_P ,_fbcf *_bfc .CT_Hyperlink ,_geea *TableInfo ,_fbf *DrawingInfo ,_fbbfd []*_bfc .EG_PContent )[]TextItem {if len (_fbbfd )==0{return []TextItem {TextItem {Text :"",DrawingInfo :_fbf ,Paragraph :_ggad ,Hyperlink :_fbcf ,Run :nil ,TableInfo :_geea }};};_edffd :=[]TextItem {};for _ ,_ccgg :=range _fbbfd {for _ ,_fdbg :=range _ccgg .FldSimple {if _fdbg !=nil {_edffd =append (_edffd ,_dafb (_ggad ,_fbcf ,_geea ,_fbf ,_fdbg .EG_PContent )...);};};if _bfa :=_ccgg .Hyperlink ;_bfa !=nil {_edffd =append (_edffd ,_abgf (_ggad ,_bfa ,_geea ,_fbf ,_bfa .EG_ContentRunContent )...);};_edffd =append (_edffd ,_abgf (_ggad ,nil ,_geea ,_fbf ,_ccgg .EG_ContentRunContent )...);};return _edffd ;}; // Paragraph is a paragraph within a document. type Paragraph struct{_gdg *Document ;_egaag *_bfc .CT_P ;}; // Headers returns the headers defined in the document. func (_affc *Document )Headers ()[]Header {_cdc :=[]Header {};for _ ,_gcfb :=range _affc ._cfb {_cdc =append (_cdc ,Header {_affc ,_gcfb });};return _cdc ;}; // GetStyleByID returns Style by it's IdAttr. func (_ecfa *Document )GetStyleByID (id string )Style {for _ ,_ccad :=range _ecfa .Styles ._bcagb .Style {if _ccad .StyleIdAttr !=nil &&*_ccad .StyleIdAttr ==id {return Style {_ccad };};};return Style {};}; // Section is the beginning of a new section. type Section struct{_caga *Document ;_bbbe *_bfc .CT_SectPr ;}; // Properties returns the paragraph properties. func (_adgg Paragraph )Properties ()ParagraphProperties {_adgg .ensurePPr ();return ParagraphProperties {_adgg ._gdg ,_adgg ._egaag .PPr };}; // SetLeftPct sets the cell left margin func (_baa CellMargins )SetLeftPct (pct float64 ){_baa ._aca .Left =_bfc .NewCT_TblWidth ();_dgf (_baa ._aca .Left ,pct );}; // SetTop sets the top border to a specified type, color and thickness. func (_cbae TableBorders )SetTop (t _bfc .ST_Border ,c _fc .Color ,thickness _gga .Distance ){_cbae ._fbaf .Top =_bfc .NewCT_Border ();_aebcf (_cbae ._fbaf .Top ,t ,c ,thickness );}; // SetContextualSpacing controls whether to Ignore Spacing Above and Below When // Using Identical Styles func (_abcdb ParagraphStyleProperties )SetContextualSpacing (b bool ){if !b {_abcdb ._daba .ContextualSpacing =nil ;}else {_abcdb ._daba .ContextualSpacing =_bfc .NewCT_OnOff ();};}; // SetOutline sets the run to outlined text. func (_efdfa RunProperties )SetOutline (b bool ){if !b {_efdfa ._afdg .Outline =nil ;}else {_efdfa ._afdg .Outline =_bfc .NewCT_OnOff ();};}; // SetTableIndent sets the Table Indent from the Leading Margin func (_begd TableStyleProperties )SetTableIndent (ind _gga .Distance ){_begd ._cfbe .TblInd =_bfc .NewCT_TblWidth ();_begd ._cfbe .TblInd .TypeAttr =_bfc .ST_TblWidthDxa ;_begd ._cfbe .TblInd .WAttr =&_bfc .ST_MeasurementOrPercent {};_begd ._cfbe .TblInd .WAttr .ST_DecimalNumberOrPercent =&_bfc .ST_DecimalNumberOrPercent {};_begd ._cfbe .TblInd .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_a .Int64 (int64 (ind /_gga .Dxa ));}; // Value returns the tring value of a FormFieldTypeText or FormFieldTypeDropDown. func (_daed FormField )Value ()string {if _daed ._cdaa .TextInput !=nil &&_daed ._fdea .T !=nil {return _daed ._fdea .T .Content ;}else if _daed ._cdaa .DdList !=nil &&_daed ._cdaa .DdList .Result !=nil {_efgee :=_daed .PossibleValues ();_fgff :=int (_daed ._cdaa .DdList .Result .ValAttr );if _fgff < len (_efgee ){return _efgee [_fgff ];};}else if _daed ._cdaa .CheckBox !=nil {if _daed .IsChecked (){return "\u0074\u0072\u0075\u0065";};return "\u0066\u0061\u006cs\u0065";};return "";}; // SetMultiLevelType sets the multilevel type. func (_gaebc NumberingDefinition )SetMultiLevelType (t _bfc .ST_MultiLevelType ){if t ==_bfc .ST_MultiLevelTypeUnset {_gaebc ._bcbe .MultiLevelType =nil ;}else {_gaebc ._bcbe .MultiLevelType =_bfc .NewCT_MultiLevelType ();_gaebc ._bcbe .MultiLevelType .ValAttr =t ;};}; // RightToLeft returns true if paragraph text goes from right to left. func (_aaec ParagraphProperties )RightToLeft ()bool {return _ecab (_aaec ._aeag .RPr .Rtl )}; // NewStyles constructs a new empty Styles func NewStyles ()Styles {return Styles {_bfc .NewStyles ()}}; // X returns the inner wrapped XML type. func (_ddbe ParagraphProperties )X ()*_bfc .CT_PPr {return _ddbe ._aeag }; // SetXOffset sets the X offset for an image relative to the origin. func (_dc AnchoredDrawing )SetXOffset (x _gga .Distance ){_dc ._aaf .PositionH .Choice =&_bfc .WdCT_PosHChoice {};_dc ._aaf .PositionH .Choice .PosOffset =_a .Int32 (int32 (x /_gga .EMU ));}; // RowProperties are the properties for a row within a table type RowProperties struct{_eaef *_bfc .CT_TrPr };func _aebcf (_ffgc *_bfc .CT_Border ,_deegb _bfc .ST_Border ,_gded _fc .Color ,_agcc _gga .Distance ){_ffgc .ValAttr =_deegb ;_ffgc .ColorAttr =&_bfc .ST_HexColor {};if _gded .IsAuto (){_ffgc .ColorAttr .ST_HexColorAuto =_bfc .ST_HexColorAutoAuto ;}else {_ffgc .ColorAttr .ST_HexColorRGB =_gded .AsRGBString ();};if _agcc !=_gga .Zero {_ffgc .SzAttr =_a .Uint64 (uint64 (_agcc /_gga .Point *8));};}; // TableBorders allows manipulation of borders on a table. type TableBorders struct{_fbaf *_bfc .CT_TblBorders }; // Shadow returns true if run shadow is on. func (_bdebg RunProperties )Shadow ()bool {return _ecab (_bdebg ._afdg .Shadow )}; // InsertParagraphAfter adds a new empty paragraph after the relativeTo // paragraph. func (_dafd *Document )InsertParagraphAfter (relativeTo Paragraph )Paragraph {return _dafd .insertParagraph (relativeTo ,false );}; // EastAsiaFont returns the name of paragraph font family for East Asia. func (_debfb ParagraphProperties )EastAsiaFont ()string {if _ebf :=_debfb ._aeag .RPr .RFonts ;_ebf !=nil {if _ebf .EastAsiaAttr !=nil {return *_ebf .EastAsiaAttr ;};};return "";}; // InsertRowBefore inserts a row before another row func (_egfe Table )InsertRowBefore (r Row )Row {for _fbabd ,_dabg :=range _egfe ._caeb .EG_ContentRowContent {if len (_dabg .Tr )> 0&&r .X ()==_dabg .Tr [0]{_cbbf :=_bfc .NewEG_ContentRowContent ();_egfe ._caeb .EG_ContentRowContent =append (_egfe ._caeb .EG_ContentRowContent ,nil );copy (_egfe ._caeb .EG_ContentRowContent [_fbabd +1:],_egfe ._caeb .EG_ContentRowContent [_fbabd :]);_egfe ._caeb .EG_ContentRowContent [_fbabd ]=_cbbf ;_dgadc :=_bfc .NewCT_Row ();_cbbf .Tr =append (_cbbf .Tr ,_dgadc );return Row {_egfe ._gaebd ,_dgadc };};};return _egfe .AddRow ();}; // SetStrikeThrough sets the run to strike-through. func (_edbc RunProperties )SetStrikeThrough (b bool ){if !b {_edbc ._afdg .Strike =nil ;}else {_edbc ._afdg .Strike =_bfc .NewCT_OnOff ();};};func (_cgbac Paragraph )addStartBookmark (_ccga int64 ,_fbeg string )*_bfc .CT_Bookmark {_acffc :=_bfc .NewEG_PContent ();_cgbac ._egaag .EG_PContent =append (_cgbac ._egaag .EG_PContent ,_acffc );_cbfag :=_bfc .NewEG_ContentRunContent ();_efgg :=_bfc .NewEG_RunLevelElts ();_dcbe :=_bfc .NewEG_RangeMarkupElements ();_gdcb :=_bfc .NewCT_Bookmark ();_gdcb .NameAttr =_fbeg ;_gdcb .IdAttr =_ccga ;_dcbe .BookmarkStart =_gdcb ;_acffc .EG_ContentRunContent =append (_acffc .EG_ContentRunContent ,_cbfag );_cbfag .EG_RunLevelElts =append (_cbfag .EG_RunLevelElts ,_efgg );_efgg .EG_RangeMarkupElements =append (_efgg .EG_RangeMarkupElements ,_dcbe );return _gdcb ;}; // 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 (_cbbc *Document )MailMerge (mergeContent map[string ]string ){_dcaa :=_cbbc .mergeFields ();_fbcc :=map[Paragraph ][]Run {};for _ ,_beaa :=range _dcaa {_fbcfb ,_fggg :=mergeContent [_beaa ._cbbg ];if _fggg {if _beaa ._dcca {_fbcfb =_g .ToUpper (_fbcfb );}else if _beaa ._dgfbe {_fbcfb =_g .ToLower (_fbcfb );}else if _beaa ._bge {_fbcfb =_g .Title (_fbcfb );}else if _beaa ._bdge {_aeed :=_gg .Buffer {};for _eddda ,_dfba :=range _fbcfb {if _eddda ==0{_aeed .WriteRune (_bd .ToUpper (_dfba ));}else {_aeed .WriteRune (_dfba );};};_fbcfb =_aeed .String ();};if _fbcfb !=""&&_beaa ._edac !=""{_fbcfb =_beaa ._edac +_fbcfb ;};if _fbcfb !=""&&_beaa ._dffc !=""{_fbcfb =_fbcfb +_beaa ._dffc ;};};if _beaa ._bgfa {if len (_beaa ._aefd .FldSimple )==1&&len (_beaa ._aefd .FldSimple [0].EG_PContent )==1&&len (_beaa ._aefd .FldSimple [0].EG_PContent [0].EG_ContentRunContent )==1{_gcc :=&_bfc .EG_ContentRunContent {};_gcc .R =_beaa ._aefd .FldSimple [0].EG_PContent [0].EG_ContentRunContent [0].R ;_beaa ._aefd .FldSimple =nil ;_efafb :=Run {_cbbc ,_gcc .R };_efafb .ClearContent ();_efafb .AddText (_fbcfb );_beaa ._aefd .EG_ContentRunContent =append (_beaa ._aefd .EG_ContentRunContent ,_gcc );};}else {_gbag :=_beaa ._aeab .Runs ();for _cgeg :=_beaa ._ebgd ;_cgeg <=_beaa ._fdg ;_cgeg ++{if _cgeg ==_beaa ._aabb +1{_gbag [_cgeg ].ClearContent ();_gbag [_cgeg ].AddText (_fbcfb );}else {_fbcc [_beaa ._aeab ]=append (_fbcc [_beaa ._aeab ],_gbag [_cgeg ]);};};};};for _gbcd ,_ebbfd :=range _fbcc {for _ ,_bdae :=range _ebbfd {_gbcd .RemoveRun (_bdae );};};_cbbc .Settings .RemoveMailMerge ();};func _aff (_gag *_bfc .CT_TblWidth ,_dcf _gga .Distance ){_gag .TypeAttr =_bfc .ST_TblWidthDxa ;_gag .WAttr =&_bfc .ST_MeasurementOrPercent {};_gag .WAttr .ST_DecimalNumberOrPercent =&_bfc .ST_DecimalNumberOrPercent {};_gag .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_a .Int64 (int64 (_dcf /_gga .Dxa ));};func (_bac *Document )InsertTableAfter (relativeTo Paragraph )Table {return _bac .insertTable (relativeTo ,false );}; // X returns the inner wml.CT_TblBorders func (_bafbf TableBorders )X ()*_bfc .CT_TblBorders {return _bafbf ._fbaf }; // SetStartIndent controls the start indent of the paragraph. func (_bbege ParagraphStyleProperties )SetStartIndent (m _gga .Distance ){if _bbege ._daba .Ind ==nil {_bbege ._daba .Ind =_bfc .NewCT_Ind ();};if m ==_gga .Zero {_bbege ._daba .Ind .StartAttr =nil ;}else {_bbege ._daba .Ind .StartAttr =&_bfc .ST_SignedTwipsMeasure {};_bbege ._daba .Ind .StartAttr .Int64 =_a .Int64 (int64 (m /_gga .Twips ));};}; // X returns the inner wrapped XML type. func (_fbaaf TableLook )X ()*_bfc .CT_TblLook {return _fbaaf ._dbeg }; // RemoveMailMerge removes any mail merge settings func (_gaced Settings )RemoveMailMerge (){_gaced ._cgbd .MailMerge =nil }; // SetHangingIndent controls the indentation of the non-first lines in a paragraph. func (_ebcgg ParagraphProperties )SetHangingIndent (m _gga .Distance ){if _ebcgg ._aeag .Ind ==nil {_ebcgg ._aeag .Ind =_bfc .NewCT_Ind ();};if m ==_gga .Zero {_ebcgg ._aeag .Ind .HangingAttr =nil ;}else {_ebcgg ._aeag .Ind .HangingAttr =&_af .ST_TwipsMeasure {};_ebcgg ._aeag .Ind .HangingAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (m /_gga .Twips ));};}; // 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 (_fbed *Document )Copy ()(*Document ,error ){_bdeb :=_gg .NewBuffer ([]byte {});_aag :=_fbed .save (_bdeb ,_fbed ._gcb );if _aag !=nil {return nil ,_aag ;};_faed :=_bdeb .Bytes ();_caaa :=_gg .NewReader (_faed );return _aefg (_caaa ,int64 (_caaa .Len ()),_fbed ._gcb );}; // UnderlineColor returns the hex color value of paragraph underline. func (_gecc ParagraphProperties )UnderlineColor ()string {if _eccgd :=_gecc ._aeag .RPr .U ;_eccgd !=nil {_bddb :=_eccgd .ColorAttr ;if _bddb !=nil &&_bddb .ST_HexColorRGB !=nil {return *_bddb .ST_HexColorRGB ;};};return "";}; // SetTextWrapSquare sets the text wrap to square with a given wrap type. func (_cb AnchoredDrawing )SetTextWrapSquare (t _bfc .WdST_WrapText ){_cb ._aaf .Choice =&_bfc .WdEG_WrapTypeChoice {};_cb ._aaf .Choice .WrapSquare =_bfc .NewWdCT_WrapSquare ();_cb ._aaf .Choice .WrapSquare .WrapTextAttr =t ;};type mergeFieldInfo struct{_cbbg string ;_dffc string ;_edac string ;_dcca bool ;_dgfbe bool ;_bdge bool ;_bge bool ;_aeab Paragraph ;_ebgd ,_aabb ,_fdg int ;_aefd *_bfc .EG_PContent ;_bgfa bool ;}; // AddParagraph adds a new paragraph to the document body. func (_eggb *Document )AddParagraph ()Paragraph {_fbc :=_bfc .NewEG_BlockLevelElts ();_eggb ._bfda .Body .EG_BlockLevelElts =append (_eggb ._bfda .Body .EG_BlockLevelElts ,_fbc );_cfe :=_bfc .NewEG_ContentBlockContent ();_fbc .EG_ContentBlockContent =append (_fbc .EG_ContentBlockContent ,_cfe );_ffgb :=_bfc .NewCT_P ();_cfe .P =append (_cfe .P ,_ffgb );return Paragraph {_eggb ,_ffgb };}; // SetName sets the name of the style. func (_ddac Style )SetName (name string ){_ddac ._gdea .Name =_bfc .NewCT_String ();_ddac ._gdea .Name .ValAttr =name ;}; // 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 (_gbga Document )SetStrict (strict bool ){if strict {_gbga ._bfda .ConformanceAttr =_af .ST_ConformanceClassStrict ;}else {_gbga ._bfda .ConformanceAttr =_af .ST_ConformanceClassTransitional ;};}; // CellProperties are a table cells properties within a document. type CellProperties struct{_bdag *_bfc .CT_TcPr };func _ecd (_ddg *_bfc .CT_Tbl ,_edd *_bfc .CT_P ,_faa bool )*_bfc .CT_Tbl {for _ ,_bcg :=range _ddg .EG_ContentRowContent {for _ ,_fdca :=range _bcg .Tr {for _ ,_fcbb :=range _fdca .EG_ContentCellContent {for _ ,_ee :=range _fcbb .Tc {for _ece ,_ebg :=range _ee .EG_BlockLevelElts {for _ ,_egb :=range _ebg .EG_ContentBlockContent {for _fgae ,_defb :=range _egb .P {if _defb ==_edd {_ffg :=_bfc .NewEG_BlockLevelElts ();_caa :=_bfc .NewEG_ContentBlockContent ();_ffg .EG_ContentBlockContent =append (_ffg .EG_ContentBlockContent ,_caa );_egdfb :=_bfc .NewCT_Tbl ();_caa .Tbl =append (_caa .Tbl ,_egdfb );_ee .EG_BlockLevelElts =append (_ee .EG_BlockLevelElts ,nil );if _faa {copy (_ee .EG_BlockLevelElts [_ece +1:],_ee .EG_BlockLevelElts [_ece :]);_ee .EG_BlockLevelElts [_ece ]=_ffg ;if _fgae !=0{_dfeb :=_bfc .NewEG_BlockLevelElts ();_ebd :=_bfc .NewEG_ContentBlockContent ();_dfeb .EG_ContentBlockContent =append (_dfeb .EG_ContentBlockContent ,_ebd );_ebd .P =_egb .P [:_fgae ];_ee .EG_BlockLevelElts =append (_ee .EG_BlockLevelElts ,nil );copy (_ee .EG_BlockLevelElts [_ece +1:],_ee .EG_BlockLevelElts [_ece :]);_ee .EG_BlockLevelElts [_ece ]=_dfeb ;};_egb .P =_egb .P [_fgae :];}else {copy (_ee .EG_BlockLevelElts [_ece +2:],_ee .EG_BlockLevelElts [_ece +1:]);_ee .EG_BlockLevelElts [_ece +1]=_ffg ;if _fgae !=len (_egb .P )-1{_ebc :=_bfc .NewEG_BlockLevelElts ();_eddc :=_bfc .NewEG_ContentBlockContent ();_ebc .EG_ContentBlockContent =append (_ebc .EG_ContentBlockContent ,_eddc );_eddc .P =_egb .P [_fgae +1:];_ee .EG_BlockLevelElts =append (_ee .EG_BlockLevelElts ,nil );copy (_ee .EG_BlockLevelElts [_ece +3:],_ee .EG_BlockLevelElts [_ece +2:]);_ee .EG_BlockLevelElts [_ece +2]=_ebc ;}else {_ddf :=_bfc .NewEG_BlockLevelElts ();_ddae :=_bfc .NewEG_ContentBlockContent ();_ddf .EG_ContentBlockContent =append (_ddf .EG_ContentBlockContent ,_ddae );_ddae .P =[]*_bfc .CT_P {_bfc .NewCT_P ()};_ee .EG_BlockLevelElts =append (_ee .EG_BlockLevelElts ,nil );copy (_ee .EG_BlockLevelElts [_ece +3:],_ee .EG_BlockLevelElts [_ece +2:]);_ee .EG_BlockLevelElts [_ece +2]=_ddf ;};_egb .P =_egb .P [:_fgae +1];};return _egdfb ;};};for _ ,_fgc :=range _egb .Tbl {_gad :=_ecd (_fgc ,_edd ,_faa );if _gad !=nil {return _gad ;};};};};};};};};return nil ;}; // X returns the inner wrapped XML type. func (_dfe Bookmark )X ()*_bfc .CT_Bookmark {return _dfe ._ag }; // Footnotes returns the footnotes defined in the document. func (_bebg *Document )Footnotes ()[]Footnote {_gee :=[]Footnote {};for _ ,_ecgea :=range _bebg ._cd .CT_Footnotes .Footnote {_gee =append (_gee ,Footnote {_bebg ,_ecgea });};return _gee ;}; // InsertRunAfter inserts a run in the paragraph after the relative run. func (_gagd Paragraph )InsertRunAfter (relativeTo Run )Run {return _gagd .insertRun (relativeTo ,false )}; // SetHorizontalBanding controls the conditional formatting for horizontal banding. func (_ebad TableLook )SetHorizontalBanding (on bool ){if !on {_ebad ._dbeg .NoHBandAttr =&_af .ST_OnOff {};_ebad ._dbeg .NoHBandAttr .ST_OnOff1 =_af .ST_OnOff1On ;}else {_ebad ._dbeg .NoHBandAttr =&_af .ST_OnOff {};_ebad ._dbeg .NoHBandAttr .ST_OnOff1 =_af .ST_OnOff1Off ;};}; // CharacterSpacingValue returns the value of run's characters spacing in twips (1/20 of point). func (_badda RunProperties )CharacterSpacingValue ()int64 {if _ddaf :=_badda ._afdg .Spacing ;_ddaf !=nil {_gbbbb :=_ddaf .ValAttr ;if _gbbbb .Int64 !=nil {return *_gbbbb .Int64 ;};};return int64 (0);}; // ExtractFromHeader returns text from the document header as an array of TextItems. func ExtractFromHeader (header *_bfc .Hdr )[]TextItem {return _fedac (header .EG_ContentBlockContent ,nil );}; // AddSection adds a new document section with an optional section break. If t // is ST_SectionMarkUnset, then no break will be inserted. func (_cbec ParagraphProperties )AddSection (t _bfc .ST_SectionMark )Section {_cbec ._aeag .SectPr =_bfc .NewCT_SectPr ();if t !=_bfc .ST_SectionMarkUnset {_cbec ._aeag .SectPr .Type =_bfc .NewCT_SectType ();_cbec ._aeag .SectPr .Type .ValAttr =t ;};return Section {_cbec ._acgff ,_cbec ._aeag .SectPr };}; // Rows returns the rows defined in the table. func (_dcbea Table )Rows ()[]Row {_gaca :=[]Row {};for _ ,_degb :=range _dcbea ._caeb .EG_ContentRowContent {for _ ,_dce :=range _degb .Tr {_gaca =append (_gaca ,Row {_dcbea ._gaebd ,_dce });};if _degb .Sdt !=nil &&_degb .Sdt .SdtContent !=nil {for _ ,_dcfbg :=range _degb .Sdt .SdtContent .Tr {_gaca =append (_gaca ,Row {_dcbea ._gaebd ,_dcfbg });};};};return _gaca ;};func (_edee Paragraph )addInstrText (_ecaf string )*_bfc .CT_Text {_afgd :=_edee .AddRun ();_dfaeb :=_afgd .X ();_gcfdg :=_bfc .NewEG_RunInnerContent ();_ccbdc :=_bfc .NewCT_Text ();_fffaf :="\u0070\u0072\u0065\u0073\u0065\u0072\u0076\u0065";_ccbdc .SpaceAttr =&_fffaf ;_ccbdc .Content ="\u0020"+_ecaf +"\u0020";_gcfdg .InstrText =_ccbdc ;_dfaeb .EG_RunInnerContent =append (_dfaeb .EG_RunInnerContent ,_gcfdg );return _ccbdc ;}; // SetNextStyle sets the style that the next paragraph will use. func (_abef Style )SetNextStyle (name string ){if name ==""{_abef ._gdea .Next =nil ;}else {_abef ._gdea .Next =_bfc .NewCT_String ();_abef ._gdea .Next .ValAttr =name ;};}; // Style is a style within the styles.xml file. type Style struct{_gdea *_bfc .CT_Style }; // Endnote is an individual endnote reference within the document. type Endnote struct{_bdab *Document ;_cggg *_bfc .CT_FtnEdn ;}; // AddRun adds a run of text to a hyperlink. This is the text that will be linked. func (_ecaa HyperLink )AddRun ()Run {_cbegg :=_bfc .NewEG_ContentRunContent ();_ecaa ._ebdf .EG_ContentRunContent =append (_ecaa ._ebdf .EG_ContentRunContent ,_cbegg );_fggb :=_bfc .NewCT_R ();_cbegg .R =_fggb ;return Run {_ecaa ._bbbg ,_fggb };}; // Type returns the type of the style. func (_fdaa Style )Type ()_bfc .ST_StyleType {return _fdaa ._gdea .TypeAttr }; // Paragraphs returns the paragraphs defined in a footer. func (_addg Footer )Paragraphs ()[]Paragraph {_abd :=[]Paragraph {};for _ ,_caed :=range _addg ._cgaf .EG_ContentBlockContent {for _ ,_ecdf :=range _caed .P {_abd =append (_abd ,Paragraph {_addg ._gdfd ,_ecdf });};};for _ ,_dgcf :=range _addg .Tables (){for _ ,_eadd :=range _dgcf .Rows (){for _ ,_gdcgc :=range _eadd .Cells (){_abd =append (_abd ,_gdcgc .Paragraphs ()...);};};};return _abd ;}; // X returns the inner wrapped XML type. func (_efee Run )X ()*_bfc .CT_R {return _efee ._cdfb }; // SetOutlineLevel sets the outline level of this style. func (_fgdg ParagraphStyleProperties )SetOutlineLevel (lvl int ){_fgdg ._daba .OutlineLvl =_bfc .NewCT_DecimalNumber ();_fgdg ._daba .OutlineLvl .ValAttr =int64 (lvl );}; // SetWidthAuto sets the the table width to automatic. func (_dcee TableProperties )SetWidthAuto (){_dcee ._fbbfae .TblW =_bfc .NewCT_TblWidth ();_dcee ._fbbfae .TblW .TypeAttr =_bfc .ST_TblWidthAuto ;};func _fdfb (_dcfg *_bfc .CT_Tbl ,_baec map[string ]string ){for _ ,_efae :=range _dcfg .EG_ContentRowContent {for _ ,_eagd :=range _efae .Tr {for _ ,_edae :=range _eagd .EG_ContentCellContent {for _ ,_bada :=range _edae .Tc {for _ ,_cfgdg :=range _bada .EG_BlockLevelElts {for _ ,_bdbf :=range _cfgdg .EG_ContentBlockContent {for _ ,_cdb :=range _bdbf .P {_baf (_cdb ,_baec );};for _ ,_febc :=range _bdbf .Tbl {_fdfb (_febc ,_baec );};};};};};};};}; // SetNumberingDefinitionByID sets the numbering definition ID directly, which must // match an ID defined in numbering.xml func (_geff Paragraph )SetNumberingDefinitionByID (abstractNumberID int64 ){_geff .ensurePPr ();if _geff ._egaag .PPr .NumPr ==nil {_geff ._egaag .PPr .NumPr =_bfc .NewCT_NumPr ();};_ecba :=_bfc .NewCT_DecimalNumber ();_ecba .ValAttr =int64 (abstractNumberID );_geff ._egaag .PPr .NumPr .NumId =_ecba ;}; // Save writes the document to an io.Writer in the Zip package format. func (_bcb *Document )Save (w _gc .Writer )error {return _bcb .save (w ,_bcb ._gcb )}; // SetTop sets the top border to a specified type, color and thickness. func (_bfcc CellBorders )SetTop (t _bfc .ST_Border ,c _fc .Color ,thickness _gga .Distance ){_bfcc ._efd .Top =_bfc .NewCT_Border ();_aebcf (_bfcc ._efd .Top ,t ,c ,thickness );}; // Cell is a table cell within a document (not a spreadsheet) type Cell struct{_gfd *Document ;_adc *_bfc .CT_Tc ;};func (_aecd Paragraph )insertRun (_befed Run ,_abfa bool )Run {for _ ,_ddbda :=range _aecd ._egaag .EG_PContent {for _fagb ,_gbfc :=range _ddbda .EG_ContentRunContent {if _gbfc .R ==_befed .X (){_fbbfa :=_bfc .NewCT_R ();_ddbda .EG_ContentRunContent =append (_ddbda .EG_ContentRunContent ,nil );if _abfa {copy (_ddbda .EG_ContentRunContent [_fagb +1:],_ddbda .EG_ContentRunContent [_fagb :]);_ddbda .EG_ContentRunContent [_fagb ]=_bfc .NewEG_ContentRunContent ();_ddbda .EG_ContentRunContent [_fagb ].R =_fbbfa ;}else {copy (_ddbda .EG_ContentRunContent [_fagb +2:],_ddbda .EG_ContentRunContent [_fagb +1:]);_ddbda .EG_ContentRunContent [_fagb +1]=_bfc .NewEG_ContentRunContent ();_ddbda .EG_ContentRunContent [_fagb +1].R =_fbbfa ;};return Run {_aecd ._gdg ,_fbbfa };};if _gbfc .Sdt !=nil &&_gbfc .Sdt .SdtContent !=nil {for _ ,_afdf :=range _gbfc .Sdt .SdtContent .EG_ContentRunContent {if _afdf .R ==_befed .X (){_cgbc :=_bfc .NewCT_R ();_gbfc .Sdt .SdtContent .EG_ContentRunContent =append (_gbfc .Sdt .SdtContent .EG_ContentRunContent ,nil );if _abfa {copy (_gbfc .Sdt .SdtContent .EG_ContentRunContent [_fagb +1:],_gbfc .Sdt .SdtContent .EG_ContentRunContent [_fagb :]);_gbfc .Sdt .SdtContent .EG_ContentRunContent [_fagb ]=_bfc .NewEG_ContentRunContent ();_gbfc .Sdt .SdtContent .EG_ContentRunContent [_fagb ].R =_cgbc ;}else {copy (_gbfc .Sdt .SdtContent .EG_ContentRunContent [_fagb +2:],_gbfc .Sdt .SdtContent .EG_ContentRunContent [_fagb +1:]);_gbfc .Sdt .SdtContent .EG_ContentRunContent [_fagb +1]=_bfc .NewEG_ContentRunContent ();_gbfc .Sdt .SdtContent .EG_ContentRunContent [_fagb +1].R =_cgbc ;};return Run {_aecd ._gdg ,_cgbc };};};};};};return _aecd .AddRun ();}; // AddText adds tet to a run. func (_gea Run )AddText (s string ){_cggb :=_bfc .NewEG_RunInnerContent ();_gea ._cdfb .EG_RunInnerContent =append (_gea ._cdfb .EG_RunInnerContent ,_cggb );_cggb .T =_bfc .NewCT_Text ();if _a .NeedsSpacePreserve (s ){_febf :="\u0070\u0072\u0065\u0073\u0065\u0072\u0076\u0065";_cggb .T .SpaceAttr =&_febf ;};_cggb .T .Content =s ;}; // Properties returns the cell properties. func (_fdc Cell )Properties ()CellProperties {if _fdc ._adc .TcPr ==nil {_fdc ._adc .TcPr =_bfc .NewCT_TcPr ();};return CellProperties {_fdc ._adc .TcPr };}; // Tables returns the tables defined in the header. func (_egaa Header )Tables ()[]Table {_fcba :=[]Table {};if _egaa ._abff ==nil {return nil ;};for _ ,_fbedd :=range _egaa ._abff .EG_ContentBlockContent {for _ ,_begef :=range _egaa ._aea .tables (_fbedd ){_fcba =append (_fcba ,_begef );};};return _fcba ;}; // OnOffValue represents an on/off value that can also be unset type OnOffValue byte ; // RunProperties returns the RunProperties controlling numbering level font, etc. func (_aggc NumberingLevel )RunProperties ()RunProperties {if _aggc ._befb .RPr ==nil {_aggc ._befb .RPr =_bfc .NewCT_RPr ();};return RunProperties {_aggc ._befb .RPr };};func (_cda *Document )tables (_ddec *_bfc .EG_ContentBlockContent )[]Table {_dgce :=[]Table {};for _ ,_fde :=range _ddec .Tbl {_dgce =append (_dgce ,Table {_cda ,_fde });for _ ,_dec :=range _fde .EG_ContentRowContent {for _ ,_aebd :=range _dec .Tr {for _ ,_fbd :=range _aebd .EG_ContentCellContent {for _ ,_cfgd :=range _fbd .Tc {for _ ,_cca :=range _cfgd .EG_BlockLevelElts {for _ ,_daff :=range _cca .EG_ContentBlockContent {for _ ,_dgde :=range _cda .tables (_daff ){_dgce =append (_dgce ,_dgde );};};};};};};};};return _dgce ;};const (FormFieldTypeUnknown FormFieldType =iota ;FormFieldTypeText ;FormFieldTypeCheckBox ;FormFieldTypeDropDown ;); // Margins allows controlling individual cell margins. func (_gaf CellProperties )Margins ()CellMargins {if _gaf ._bdag .TcMar ==nil {_gaf ._bdag .TcMar =_bfc .NewCT_TcMar ();};return CellMargins {_gaf ._bdag .TcMar };}; // TableProperties are the properties for a table within a document type TableProperties struct{_fbbfae *_bfc .CT_TblPr };func (_gdb *Document )onNewRelationship (_gdd *_c .DecodeMap ,_edeb ,_ddab string ,_fdbc []*_da .File ,_gegb *_bb .Relationship ,_aebc _c .Target )error {_addf :=_a .DocTypeDocument ;switch _ddab {case _a .OfficeDocumentType ,_a .OfficeDocumentTypeStrict :_gdb ._bfda =_bfc .NewDocument ();_gdd .AddTarget (_edeb ,_gdb ._bfda ,_ddab ,0);_gdd .AddTarget (_c .RelationsPathFor (_edeb ),_gdb ._fbb .X (),_ddab ,0);_gegb .TargetAttr =_a .RelativeFilename (_addf ,_aebc .Typ ,_ddab ,0);case _a .CorePropertiesType :_gdd .AddTarget (_edeb ,_gdb .CoreProperties .X (),_ddab ,0);_gegb .TargetAttr =_a .RelativeFilename (_addf ,_aebc .Typ ,_ddab ,0);case _a .CustomPropertiesType :_gdd .AddTarget (_edeb ,_gdb .CustomProperties .X (),_ddab ,0);_gegb .TargetAttr =_a .RelativeFilename (_addf ,_aebc .Typ ,_ddab ,0);case _a .ExtendedPropertiesType ,_a .ExtendedPropertiesTypeStrict :_gdd .AddTarget (_edeb ,_gdb .AppProperties .X (),_ddab ,0);_gegb .TargetAttr =_a .RelativeFilename (_addf ,_aebc .Typ ,_ddab ,0);case _a .ThumbnailType ,_a .ThumbnailTypeStrict :for _cddfg ,_cad :=range _fdbc {if _cad ==nil {continue ;};if _cad .Name ==_edeb {_gfag ,_cabb :=_cad .Open ();if _cabb !=nil {return _bf .Errorf ("e\u0072\u0072\u006f\u0072\u0020\u0072e\u0061\u0064\u0069\u006e\u0067\u0020\u0074\u0068\u0075m\u0062\u006e\u0061i\u006c:\u0020\u0025\u0073",_cabb );};_gdb .Thumbnail ,_ ,_cabb =_ec .Decode (_gfag );_gfag .Close ();if _cabb !=nil {return _bf .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",_cabb );};_fdbc [_cddfg ]=nil ;};};case _a .SettingsType ,_a .SettingsTypeStrict :_gdd .AddTarget (_edeb ,_gdb .Settings .X (),_ddab ,0);_gegb .TargetAttr =_a .RelativeFilename (_addf ,_aebc .Typ ,_ddab ,0);case _a .NumberingType ,_a .NumberingTypeStrict :_gdb .Numbering =NewNumbering ();_gdd .AddTarget (_edeb ,_gdb .Numbering .X (),_ddab ,0);_gegb .TargetAttr =_a .RelativeFilename (_addf ,_aebc .Typ ,_ddab ,0);case _a .StylesType ,_a .StylesTypeStrict :_gdb .Styles .Clear ();_gdd .AddTarget (_edeb ,_gdb .Styles .X (),_ddab ,0);_gegb .TargetAttr =_a .RelativeFilename (_addf ,_aebc .Typ ,_ddab ,0);case _a .HeaderType ,_a .HeaderTypeStrict :_afd :=_bfc .NewHdr ();_gdd .AddTarget (_edeb ,_afd ,_ddab ,uint32 (len (_gdb ._cfb )));_gdb ._cfb =append (_gdb ._cfb ,_afd );_gegb .TargetAttr =_a .RelativeFilename (_addf ,_aebc .Typ ,_ddab ,len (_gdb ._cfb ));_feda :=_df .NewRelationships ();_gdd .AddTarget (_c .RelationsPathFor (_edeb ),_feda .X (),_ddab ,0);_gdb ._ddc =append (_gdb ._ddc ,_feda );case _a .FooterType ,_a .FooterTypeStrict :_bcgdb :=_bfc .NewFtr ();_gdd .AddTarget (_edeb ,_bcgdb ,_ddab ,uint32 (len (_gdb ._def )));_gdb ._def =append (_gdb ._def ,_bcgdb );_gegb .TargetAttr =_a .RelativeFilename (_addf ,_aebc .Typ ,_ddab ,len (_gdb ._def ));_accdg :=_df .NewRelationships ();_gdd .AddTarget (_c .RelationsPathFor (_edeb ),_accdg .X (),_ddab ,0);_gdb ._fcbd =append (_gdb ._fcbd ,_accdg );case _a .ThemeType ,_a .ThemeTypeStrict :_ebbe :=_be .NewTheme ();_gdd .AddTarget (_edeb ,_ebbe ,_ddab ,uint32 (len (_gdb ._ebe )));_gdb ._ebe =append (_gdb ._ebe ,_ebbe );_gegb .TargetAttr =_a .RelativeFilename (_addf ,_aebc .Typ ,_ddab ,len (_gdb ._ebe ));case _a .WebSettingsType ,_a .WebSettingsTypeStrict :_gdb ._gb =_bfc .NewWebSettings ();_gdd .AddTarget (_edeb ,_gdb ._gb ,_ddab ,0);_gegb .TargetAttr =_a .RelativeFilename (_addf ,_aebc .Typ ,_ddab ,0);case _a .FontTableType ,_a .FontTableTypeStrict :_gdb ._dcd =_bfc .NewFonts ();_gdd .AddTarget (_edeb ,_gdb ._dcd ,_ddab ,0);_gegb .TargetAttr =_a .RelativeFilename (_addf ,_aebc .Typ ,_ddab ,0);case _a .EndNotesType ,_a .EndNotesTypeStrict :_gdb ._aee =_bfc .NewEndnotes ();_gdd .AddTarget (_edeb ,_gdb ._aee ,_ddab ,0);_gegb .TargetAttr =_a .RelativeFilename (_addf ,_aebc .Typ ,_ddab ,0);case _a .FootNotesType ,_a .FootNotesTypeStrict :_gdb ._cd =_bfc .NewFootnotes ();_gdd .AddTarget (_edeb ,_gdb ._cd ,_ddab ,0);_gegb .TargetAttr =_a .RelativeFilename (_addf ,_aebc .Typ ,_ddab ,0);case _a .ImageType ,_a .ImageTypeStrict :var _bca _df .ImageRef ;for _bbfg ,_cfbce :=range _fdbc {if _cfbce ==nil {continue ;};if _cfbce .Name ==_edeb {_bebc ,_gdbg :=_c .ExtractToDiskTmp (_cfbce ,_gdb .TmpPath );if _gdbg !=nil {return _gdbg ;};_ecb ,_gdbg :=_df .ImageFromStorage (_bebc );if _gdbg !=nil {return _gdbg ;};_bca =_df .MakeImageRef (_ecb ,&_gdb .DocBase ,_gdb ._fbb );_fdbc [_bbfg ]=nil ;};};_edec :="\u002e"+_g .ToLower (_bca .Format ());_gegb .TargetAttr =_a .RelativeFilename (_addf ,_aebc .Typ ,_ddab ,len (_gdb .Images )+1);if _bad :=_aa .Ext (_gegb .TargetAttr );_bad !=_edec {_gegb .TargetAttr =_gegb .TargetAttr [0:len (_gegb .TargetAttr )-len (_bad )]+_edec ;};_bca .SetTarget ("\u0077\u006f\u0072d\u002f"+_gegb .TargetAttr );_gdb .Images =append (_gdb .Images ,_bca );case _a .ControlType ,_a .ControlTypeStrict :_eeg :=_bbb .NewOcx ();_gdd .AddTarget (_edeb ,_eeg ,_ddab ,uint32 (len (_gdb ._fgef )));_gdb ._fgef =append (_gdb ._fgef ,_eeg );_gegb .TargetAttr =_a .RelativeFilename (_addf ,_aebc .Typ ,_ddab ,len (_gdb ._fgef ));default:_a .Log ("\u0075\u006e\u0073\u0075\u0070p\u006f\u0072\u0074\u0065\u0064\u0020\u0072\u0065\u006c\u0061\u0074\u0069\u006fn\u0073\u0068\u0069\u0070\u0020\u0074\u0079\u0070\u0065\u003a\u0020\u0025\u0073\u0020\u0074\u0067\u0074\u003a\u0020\u0025\u0073",_ddab ,_edeb );};return nil ;}; // PossibleValues returns the possible values for a FormFieldTypeDropDown. func (_cdaf FormField )PossibleValues ()[]string {if _cdaf ._cdaa .DdList ==nil {return nil ;};_deff :=[]string {};for _ ,_becbe :=range _cdaf ._cdaa .DdList .ListEntry {if _becbe ==nil {continue ;};_deff =append (_deff ,_becbe .ValAttr );};return _deff ;}; // SetFooter sets a section footer. func (_fgebd Section )SetFooter (f Footer ,t _bfc .ST_HdrFtr ){_dffe :=_bfc .NewEG_HdrFtrReferences ();_fgebd ._bbbe .EG_HdrFtrReferences =append (_fgebd ._bbbe .EG_HdrFtrReferences ,_dffe );_dffe .FooterReference =_bfc .NewCT_HdrFtrRef ();_dffe .FooterReference .TypeAttr =t ;_aecdg :=_fgebd ._caga ._fbb .FindRIDForN (f .Index (),_a .FooterType );if _aecdg ==""{_eg .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");};_dffe .FooterReference .IdAttr =_aecdg ;};const (OnOffValueUnset OnOffValue =iota ;OnOffValueOff ;OnOffValueOn ;); // X returns the inner wrapped XML type. func (_abda TableConditionalFormatting )X ()*_bfc .CT_TblStylePr {return _abda ._efebb }; // SetLeft sets the cell left margin func (_fa CellMargins )SetLeft (d _gga .Distance ){_fa ._aca .Left =_bfc .NewCT_TblWidth ();_aff (_fa ._aca .Left ,d );}; // Clear clears all content within a footer func (_fbac Footer )Clear (){_fbac ._cgaf .EG_ContentBlockContent =nil }; // Emboss returns true if run emboss is on. func (_aebb RunProperties )Emboss ()bool {return _ecab (_aebb ._afdg .Emboss )};func (_ccbg Styles )initializeDocDefaults (){_ccbg ._bcagb .DocDefaults =_bfc .NewCT_DocDefaults ();_ccbg ._bcagb .DocDefaults .RPrDefault =_bfc .NewCT_RPrDefault ();_ccbg ._bcagb .DocDefaults .RPrDefault .RPr =_bfc .NewCT_RPr ();_bafc :=RunProperties {_ccbg ._bcagb .DocDefaults .RPrDefault .RPr };_bafc .SetSize (12*_gga .Point );_bafc .Fonts ().SetASCIITheme (_bfc .ST_ThemeMajorAscii );_bafc .Fonts ().SetEastAsiaTheme (_bfc .ST_ThemeMajorEastAsia );_bafc .Fonts ().SetHANSITheme (_bfc .ST_ThemeMajorHAnsi );_bafc .Fonts ().SetCSTheme (_bfc .ST_ThemeMajorBidi );_bafc .X ().Lang =_bfc .NewCT_Language ();_bafc .X ().Lang .ValAttr =_a .String ("\u0065\u006e\u002dU\u0053");_bafc .X ().Lang .EastAsiaAttr =_a .String ("\u0065\u006e\u002dU\u0053");_bafc .X ().Lang .BidiAttr =_a .String ("\u0061\u0072\u002dS\u0041");_ccbg ._bcagb .DocDefaults .PPrDefault =_bfc .NewCT_PPrDefault ();};func (_aabc Footnote )id ()int64 {return _aabc ._gbbd .IdAttr }; // RunProperties controls run styling properties type RunProperties struct{_afdg *_bfc .CT_RPr }; // InlineDrawing is an inlined image within a run. type InlineDrawing struct{_ggfdc *Document ;_dfae *_bfc .WdInline ;}; // X returns the inner wrapped XML type. func (_gfbfc TableWidth )X ()*_bfc .CT_TblWidth {return _gfbfc ._dgca }; // SetStyle sets the style of a paragraph and is identical to setting it on the // paragraph's Properties() func (_eaddg Paragraph )SetStyle (s string ){_eaddg .ensurePPr ();if s ==""{_eaddg ._egaag .PPr .PStyle =nil ;}else {_eaddg ._egaag .PPr .PStyle =_bfc .NewCT_String ();_eaddg ._egaag .PPr .PStyle .ValAttr =s ;};}; // SetAlignment controls the paragraph alignment func (_fbee ParagraphProperties )SetAlignment (align _bfc .ST_Jc ){if align ==_bfc .ST_JcUnset {_fbee ._aeag .Jc =nil ;}else {_fbee ._aeag .Jc =_bfc .NewCT_Jc ();_fbee ._aeag .Jc .ValAttr =align ;};}; // SetStartPct sets the cell start margin func (_ffe CellMargins )SetStartPct (pct float64 ){_ffe ._aca .Start =_bfc .NewCT_TblWidth ();_dgf (_ffe ._aca .Start ,pct );}; // SetUISortOrder controls the order the style is displayed in the UI. func (_adfc Style )SetUISortOrder (order int ){_adfc ._gdea .UiPriority =_bfc .NewCT_DecimalNumber ();_adfc ._gdea .UiPriority .ValAttr =int64 (order );};func (_fedc Paragraph )addFldCharsForField (_fcdf ,_efaeg string )FormField {_ecdbf :=_fedc .addBeginFldChar (_fcdf );_bgga :=FormField {_cdaa :_ecdbf };_ggbbf :=_fedc ._gdg .Bookmarks ();_dddb :=int64 (len (_ggbbf ));if _fcdf !=""{_fedc .addStartBookmark (_dddb ,_fcdf );};_fedc .addInstrText (_efaeg );_fedc .addSeparateFldChar ();if _efaeg =="\u0046\u004f\u0052\u004d\u0054\u0045\u0058\u0054"{_cabg :=_fedc .AddRun ();_dbbf :=_bfc .NewEG_RunInnerContent ();_cabg ._cdfb .EG_RunInnerContent =[]*_bfc .EG_RunInnerContent {_dbbf };_bgga ._fdea =_dbbf ;};_fedc .addEndFldChar ();if _fcdf !=""{_fedc .addEndBookmark (_dddb );};return _bgga ;}; // Outline returns true if run outline is on. func (_edebb RunProperties )Outline ()bool {return _ecab (_edebb ._afdg .Outline )}; // SetCellSpacingPercent sets the cell spacing within a table to a percent width. func (_fdcaf TableProperties )SetCellSpacingPercent (pct float64 ){_fdcaf ._fbbfae .TblCellSpacing =_bfc .NewCT_TblWidth ();_fdcaf ._fbbfae .TblCellSpacing .TypeAttr =_bfc .ST_TblWidthPct ;_fdcaf ._fbbfae .TblCellSpacing .WAttr =&_bfc .ST_MeasurementOrPercent {};_fdcaf ._fbbfae .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent =&_bfc .ST_DecimalNumberOrPercent {};_fdcaf ._fbbfae .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_a .Int64 (int64 (pct *50));}; // Properties returns the run properties. func (_dgfec Run )Properties ()RunProperties {if _dgfec ._cdfb .RPr ==nil {_dgfec ._cdfb .RPr =_bfc .NewCT_RPr ();};return RunProperties {_dgfec ._cdfb .RPr };}; // SetStartIndent controls the start indentation. func (_egdfd ParagraphProperties )SetStartIndent (m _gga .Distance ){if _egdfd ._aeag .Ind ==nil {_egdfd ._aeag .Ind =_bfc .NewCT_Ind ();};if m ==_gga .Zero {_egdfd ._aeag .Ind .StartAttr =nil ;}else {_egdfd ._aeag .Ind .StartAttr =&_bfc .ST_SignedTwipsMeasure {};_egdfd ._aeag .Ind .StartAttr .Int64 =_a .Int64 (int64 (m /_gga .Twips ));};}; // Bookmark is a bookmarked location within a document that can be referenced // with a hyperlink. type Bookmark struct{_ag *_bfc .CT_Bookmark }; // Type returns the type of the field. func (_ccfd FormField )Type ()FormFieldType {if _ccfd ._cdaa .TextInput !=nil {return FormFieldTypeText ;}else if _ccfd ._cdaa .CheckBox !=nil {return FormFieldTypeCheckBox ;}else if _ccfd ._cdaa .DdList !=nil {return FormFieldTypeDropDown ;};return FormFieldTypeUnknown ;}; // TableWidth controls width values in table settings. type TableWidth struct{_dgca *_bfc .CT_TblWidth }; // SetFormat sets the numbering format. func (_fbfc NumberingLevel )SetFormat (f _bfc .ST_NumberFormat ){if _fbfc ._befb .NumFmt ==nil {_fbfc ._befb .NumFmt =_bfc .NewCT_NumFmt ();};_fbfc ._befb .NumFmt .ValAttr =f ;}; // SetBottom sets the cell bottom margin func (_cbb CellMargins )SetBottom (d _gga .Distance ){_cbb ._aca .Bottom =_bfc .NewCT_TblWidth ();_aff (_cbb ._aca .Bottom ,d );}; // SetVAlignment sets the vertical alignment for an anchored image. func (_ege AnchoredDrawing )SetVAlignment (v _bfc .WdST_AlignV ){_ege ._aaf .PositionV .Choice =&_bfc .WdCT_PosVChoice {};_ege ._aaf .PositionV .Choice .Align =v ;}; // 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{_cdaa *_bfc .CT_FFData ;_fdea *_bfc .EG_RunInnerContent ;};func _efag (_dedd *_bfc .CT_Tbl ,_ccf map[string ]string ){for _ ,_adgd :=range _dedd .EG_ContentRowContent {for _ ,_ebca :=range _adgd .Tr {for _ ,_gace :=range _ebca .EG_ContentCellContent {for _ ,_dgdeg :=range _gace .Tc {for _ ,_acbb :=range _dgdeg .EG_BlockLevelElts {for _ ,_egdg :=range _acbb .EG_ContentBlockContent {for _ ,_dcdd :=range _egdg .P {_bfbf (_dcdd ,_ccf );};for _ ,_begec :=range _egdg .Tbl {_efag (_begec ,_ccf );};};};};};};};}; // SetLeft sets the left border to a specified type, color and thickness. func (_gdgd TableBorders )SetLeft (t _bfc .ST_Border ,c _fc .Color ,thickness _gga .Distance ){_gdgd ._fbaf .Left =_bfc .NewCT_Border ();_aebcf (_gdgd ._fbaf .Left ,t ,c ,thickness );}; // SetAlignment sets the paragraph alignment func (_bdaf NumberingLevel )SetAlignment (j _bfc .ST_Jc ){if j ==_bfc .ST_JcUnset {_bdaf ._befb .LvlJc =nil ;}else {_bdaf ._befb .LvlJc =_bfc .NewCT_Jc ();_bdaf ._befb .LvlJc .ValAttr =j ;};}; // SetTargetByRef sets the URL target of the hyperlink and is more efficient if a link // destination will be used many times. func (_cfcg HyperLink )SetTargetByRef (link _df .Hyperlink ){_cfcg ._ebdf .IdAttr =_a .String (_df .Relationship (link ).ID ());_cfcg ._ebdf .AnchorAttr =nil ;}; // SetStart sets the cell start margin func (_dde CellMargins )SetStart (d _gga .Distance ){_dde ._aca .Start =_bfc .NewCT_TblWidth ();_aff (_dde ._aca .Start ,d );}; // SetSmallCaps sets the run to small caps. func (_dgbec RunProperties )SetSmallCaps (b bool ){if !b {_dgbec ._afdg .SmallCaps =nil ;}else {_dgbec ._afdg .SmallCaps =_bfc .NewCT_OnOff ();};}; // SetPageMargins sets the page margins for a section func (_daga Section )SetPageMargins (top ,right ,bottom ,left ,header ,footer ,gutter _gga .Distance ){_egad :=_bfc .NewCT_PageMar ();_egad .TopAttr .Int64 =_a .Int64 (int64 (top /_gga .Twips ));_egad .BottomAttr .Int64 =_a .Int64 (int64 (bottom /_gga .Twips ));_egad .RightAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (right /_gga .Twips ));_egad .LeftAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (left /_gga .Twips ));_egad .HeaderAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (header /_gga .Twips ));_egad .FooterAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (footer /_gga .Twips ));_egad .GutterAttr .ST_UnsignedDecimalNumber =_a .Uint64 (uint64 (gutter /_gga .Twips ));_daga ._bbbe .PgMar =_egad ;}; // X returns the inner wrapped XML type. func (_fbge Endnote )X ()*_bfc .CT_FtnEdn {return _fbge ._cggg };func (_bec *Document )save (_ge _gc .Writer ,_dcgb string )error {const _egdf ="\u0064o\u0063u\u006d\u0065\u006e\u0074\u003a\u0064\u002e\u0053\u0061\u0076\u0065";if _cbe :=_bec ._bfda .Validate ();_cbe !=nil {_a .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",_cbe );};_fae :=_a .DocTypeDocument ;if !_fb .GetLicenseKey ().IsLicensed ()&&!_gba {_bf .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");_bf .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 _ab .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");};if len (_bec ._gcb )==0{if len (_dcgb )> 0{_bec ._gcb =_dcgb ;}else {_gbg ,_bed :=_fb .GenRefId ("\u0064\u0077");if _bed !=nil {_a .Log ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0025\u0076\u000a",_bed );return _bed ;};_bec ._gcb =_gbg ;};};if _egg :=_fb .Track (_bec ._gcb ,_egdf );_egg !=nil {_bf .Printf ("\u0045\u0052\u0052\u004f\u0052\u003a\u0020\u0025\u0076\u000a",_egg );return _egg ;};_ce :=_da .NewWriter (_ge );defer _ce .Close ();if _cfg :=_c .MarshalXML (_ce ,_a .BaseRelsFilename ,_bec .Rels .X ());_cfg !=nil {return _cfg ;};if _bcf :=_c .MarshalXMLByType (_ce ,_fae ,_a .ExtendedPropertiesType ,_bec .AppProperties .X ());_bcf !=nil {return _bcf ;};if _bbga :=_c .MarshalXMLByType (_ce ,_fae ,_a .CorePropertiesType ,_bec .CoreProperties .X ());_bbga !=nil {return _bbga ;};if _bec .CustomProperties .X ()!=nil {if _gbe :=_c .MarshalXMLByType (_ce ,_fae ,_a .CustomPropertiesType ,_bec .CustomProperties .X ());_gbe !=nil {return _gbe ;};};if _bec .Thumbnail !=nil {_aed ,_afa :=_ce .Create ("\u0064\u006f\u0063Pr\u006f\u0070\u0073\u002f\u0074\u0068\u0075\u006d\u0062\u006e\u0061\u0069\u006c\u002e\u006a\u0070\u0065\u0067");if _afa !=nil {return _afa ;};if _ecc :=_f .Encode (_aed ,_bec .Thumbnail ,nil );_ecc !=nil {return _ecc ;};};if _ccc :=_c .MarshalXMLByType (_ce ,_fae ,_a .SettingsType ,_bec .Settings .X ());_ccc !=nil {return _ccc ;};_gbf :=_a .AbsoluteFilename (_fae ,_a .OfficeDocumentType ,0);if _ccg :=_c .MarshalXML (_ce ,_gbf ,_bec ._bfda );_ccg !=nil {return _ccg ;};if _dea :=_c .MarshalXML (_ce ,_c .RelationsPathFor (_gbf ),_bec ._fbb .X ());_dea !=nil {return _dea ;};if _bec .Numbering .X ()!=nil {if _agc :=_c .MarshalXMLByType (_ce ,_fae ,_a .NumberingType ,_bec .Numbering .X ());_agc !=nil {return _agc ;};};if _bcfd :=_c .MarshalXMLByType (_ce ,_fae ,_a .StylesType ,_bec .Styles .X ());_bcfd !=nil {return _bcfd ;};if _bec ._gb !=nil {if _dge :=_c .MarshalXMLByType (_ce ,_fae ,_a .WebSettingsType ,_bec ._gb );_dge !=nil {return _dge ;};};if _bec ._dcd !=nil {if _ecg :=_c .MarshalXMLByType (_ce ,_fae ,_a .FontTableType ,_bec ._dcd );_ecg !=nil {return _ecg ;};};if _bec ._aee !=nil {if _aab :=_c .MarshalXMLByType (_ce ,_fae ,_a .EndNotesType ,_bec ._aee );_aab !=nil {return _aab ;};};if _bec ._cd !=nil {if _bde :=_c .MarshalXMLByType (_ce ,_fae ,_a .FootNotesType ,_bec ._cd );_bde !=nil {return _bde ;};};for _cbd ,_ebee :=range _bec ._ebe {if _cde :=_c .MarshalXMLByTypeIndex (_ce ,_fae ,_a .ThemeType ,_cbd +1,_ebee );_cde !=nil {return _cde ;};};for _fgb ,_aad :=range _bec ._fgef {if _aac :=_c .MarshalXMLByTypeIndex (_ce ,_fae ,_a .ControlType ,_fgb +1,_aad );_aac !=nil {return _aac ;};};for _cbc ,_gfef :=range _bec ._cfb {_aeff :=_a .AbsoluteFilename (_fae ,_a .HeaderType ,_cbc +1);if _cg :=_c .MarshalXML (_ce ,_aeff ,_gfef );_cg !=nil {return _cg ;};if !_bec ._ddc [_cbc ].IsEmpty (){_c .MarshalXML (_ce ,_c .RelationsPathFor (_aeff ),_bec ._ddc [_cbc ].X ());};};for _gfab ,_afaa :=range _bec ._def {_ceg :=_a .AbsoluteFilename (_fae ,_a .FooterType ,_gfab +1);if _bgb :=_c .MarshalXMLByTypeIndex (_ce ,_fae ,_a .FooterType ,_gfab +1,_afaa );_bgb !=nil {return _bgb ;};if !_bec ._fcbd [_gfab ].IsEmpty (){_c .MarshalXML (_ce ,_c .RelationsPathFor (_ceg ),_bec ._fcbd [_gfab ].X ());};};for _dbd ,_dbf :=range _bec .Images {if _cec :=_df .AddImageToZip (_ce ,_dbf ,_dbd +1,_a .DocTypeDocument );_cec !=nil {return _cec ;};};if _eac :=_c .MarshalXML (_ce ,_a .ContentTypesFilename ,_bec .ContentTypes .X ());_eac !=nil {return _eac ;};if _fed :=_bec .WriteExtraFiles (_ce );_fed !=nil {return _fed ;};return _ce .Close ();}; // X returns the inner wrapped XML type. func (_bagb HyperLink )X ()*_bfc .CT_Hyperlink {return _bagb ._ebdf }; // Close closes the document, removing any temporary files that might have been // created when opening a document. func (_daca *Document )Close ()error {if _daca .TmpPath !=""{return _eca .RemoveAll (_daca .TmpPath );};return nil ;};func (_edce *Document )insertParagraph (_cdee Paragraph ,_dga bool )Paragraph {if _edce ._bfda .Body ==nil {return _edce .AddParagraph ();};_gbfa :=_cdee .X ();for _ ,_dbgf :=range _edce ._bfda .Body .EG_BlockLevelElts {for _ ,_ebbf :=range _dbgf .EG_ContentBlockContent {for _gec ,_gecd :=range _ebbf .P {if _gecd ==_gbfa {_eccd :=_bfc .NewCT_P ();_ebbf .P =append (_ebbf .P ,nil );if _dga {copy (_ebbf .P [_gec +1:],_ebbf .P [_gec :]);_ebbf .P [_gec ]=_eccd ;}else {copy (_ebbf .P [_gec +2:],_ebbf .P [_gec +1:]);_ebbf .P [_gec +1]=_eccd ;};return Paragraph {_edce ,_eccd };};};for _ ,_debb :=range _ebbf .Tbl {for _ ,_dag :=range _debb .EG_ContentRowContent {for _ ,_ddfb :=range _dag .Tr {for _ ,_dddg :=range _ddfb .EG_ContentCellContent {for _ ,_ecfg :=range _dddg .Tc {for _ ,_ffc :=range _ecfg .EG_BlockLevelElts {for _ ,_gfgc :=range _ffc .EG_ContentBlockContent {for _egc ,_gefcd :=range _gfgc .P {if _gefcd ==_gbfa {_baeb :=_bfc .NewCT_P ();_gfgc .P =append (_gfgc .P ,nil );if _dga {copy (_gfgc .P [_egc +1:],_gfgc .P [_egc :]);_gfgc .P [_egc ]=_baeb ;}else {copy (_gfgc .P [_egc +2:],_gfgc .P [_egc +1:]);_gfgc .P [_egc +1]=_baeb ;};return Paragraph {_edce ,_baeb };};};};};};};};};};if _ebbf .Sdt !=nil &&_ebbf .Sdt .SdtContent !=nil &&_ebbf .Sdt .SdtContent .P !=nil {for _ggbd ,_bcbd :=range _ebbf .Sdt .SdtContent .P {if _bcbd ==_gbfa {_fgaef :=_bfc .NewCT_P ();_ebbf .Sdt .SdtContent .P =append (_ebbf .Sdt .SdtContent .P ,nil );if _dga {copy (_ebbf .Sdt .SdtContent .P [_ggbd +1:],_ebbf .Sdt .SdtContent .P [_ggbd :]);_ebbf .Sdt .SdtContent .P [_ggbd ]=_fgaef ;}else {copy (_ebbf .Sdt .SdtContent .P [_ggbd +2:],_ebbf .Sdt .SdtContent .P [_ggbd +1:]);_ebbf .Sdt .SdtContent .P [_ggbd +1]=_fgaef ;};return Paragraph {_edce ,_fgaef };};};};};};return _edce .AddParagraph ();}; // Bookmarks returns all of the bookmarks defined in the document. func (_afaf Document )Bookmarks ()[]Bookmark {if _afaf ._bfda .Body ==nil {return nil ;};_bffb :=[]Bookmark {};for _ ,_cfff :=range _afaf ._bfda .Body .EG_BlockLevelElts {for _ ,_egae :=range _cfff .EG_ContentBlockContent {for _ ,_adf :=range _edcf (_egae ){_bffb =append (_bffb ,_adf );};};};return _bffb ;}; // Strike returns true if run is striked. func (_bbbdb RunProperties )Strike ()bool {return _ecab (_bbbdb ._afdg .Strike )}; // Definitions returns the defined numbering definitions. func (_bffbg Numbering )Definitions ()[]NumberingDefinition {_ffee :=[]NumberingDefinition {};for _ ,_afdd :=range _bffbg ._bbbf .AbstractNum {_ffee =append (_ffee ,NumberingDefinition {_afdd });};return _ffee ;}; // Paragraphs returns the paragraphs defined in an endnote. func (_aefc Endnote )Paragraphs ()[]Paragraph {_dff :=[]Paragraph {};for _ ,_cgaa :=range _aefc .content (){for _ ,_fbgc :=range _cgaa .P {_dff =append (_dff ,Paragraph {_aefc ._bdab ,_fbgc });};};return _dff ;};