2017-08-28 20:56:18 -05:00
//
2020-08-23 14:15:53 +00:00
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/
2017-08-28 20:56:18 -05:00
2020-08-23 14:15:53 +00:00
/ *
Package document provides creation , reading , and writing of ECMA 376 Open
Office XML documents .
2017-09-01 16:12:59 -05:00
2020-08-23 14:15:53 +00:00
Example :
2018-01-24 18:59:09 -06:00
2020-08-23 14:15:53 +00:00
doc := document . New ( )
para := doc . AddParagraph ( )
run := para . AddRun ( )
run . SetText ( "foo" )
doc . SaveToFile ( "foo.docx" )
* /
2024-09-16 09:59:58 +00:00
package document ; import ( _fa "archive/zip" ; _fc "bytes" ; _cb "errors" ; _gb "fmt" ; _f "github.com/unidoc/unioffice" ; _gbc "github.com/unidoc/unioffice/color" ; _cc "github.com/unidoc/unioffice/common" ; _ac "github.com/unidoc/unioffice/common/axcontrol" ; _fe "github.com/unidoc/unioffice/common/logger" ;
_abd "github.com/unidoc/unioffice/common/tempstorage" ; _df "github.com/unidoc/unioffice/internal/formatutils" ; _fd "github.com/unidoc/unioffice/internal/license" ; _dg "github.com/unidoc/unioffice/measurement" ; _dc "github.com/unidoc/unioffice/schema/schemas.microsoft.com/office/activeX" ;
_dcb "github.com/unidoc/unioffice/schema/soo/dml" ; _gbd "github.com/unidoc/unioffice/schema/soo/dml/chart" ; _ef "github.com/unidoc/unioffice/schema/soo/dml/picture" ; _de "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes" ; _ggd "github.com/unidoc/unioffice/schema/soo/pkg/relationships" ;
_gdb "github.com/unidoc/unioffice/schema/soo/wml" ; _eb "github.com/unidoc/unioffice/schema/urn/schemas_microsoft_com/vml" ; _gg "github.com/unidoc/unioffice/vmldrawing" ; _gd "github.com/unidoc/unioffice/zippkg" ; _bd "image" ; _e "image/jpeg" ; _g "io" ; _b "math/rand" ;
_ag "os" ; _ae "path/filepath" ; _d "regexp" ; _ab "strings" ; _c "unicode" ; ) ; func _cecf ( _babg * _gdb . CT_Tbl , _cbfgb , _ccf map [ int64 ] int64 ) { for _ , _geda := range _babg . EG_ContentRowContent { for _ , _gadb := range _geda . Tr { for _ , _dec := range _gadb . EG_ContentCellContent { for _ , _bcee := range _dec . Tc { for _ , _dcfbc := range _bcee . EG_BlockLevelElts { for _ , _ddee := range _dcfbc . EG_ContentBlockContent { for _ , _ggagd := range _ddee . P { _dbfc ( _ggagd , _cbfgb , _ccf ) ;
} ; for _ , _edef := range _ddee . Tbl { _cecf ( _edef , _cbfgb , _ccf ) ; } ; } ; } ; } ; } ; } ; } ; } ;
2022-01-15 21:17:38 +00:00
2024-09-16 09:59:58 +00:00
// AddSection adds a new document section with an optional section break. If t
// is ST_SectionMarkUnset, then no break will be inserted.
func ( _cfcb ParagraphProperties ) AddSection ( t _gdb . ST_SectionMark ) Section { _cfcb . _egbf . SectPr = _gdb . NewCT_SectPr ( ) ; if t != _gdb . ST_SectionMarkUnset { _cfcb . _egbf . SectPr . Type = _gdb . NewCT_SectType ( ) ; _cfcb . _egbf . SectPr . Type . ValAttr = t ; } ; return Section { _cfcb . _gddf , _cfcb . _egbf . SectPr } ;
2024-06-20 13:33:45 +00:00
} ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// InsertRowAfter inserts a row after another row
func ( _afbb Table ) InsertRowAfter ( r Row ) Row { for _edeg , _gbgeg := range _afbb . _afabf . EG_ContentRowContent { if len ( _gbgeg . Tr ) > 0 && r . X ( ) == _gbgeg . Tr [ 0 ] { _decd := _gdb . NewEG_ContentRowContent ( ) ; if len ( _afbb . _afabf . EG_ContentRowContent ) < _edeg + 2 { return _afbb . AddRow ( ) ;
} ; _afbb . _afabf . EG_ContentRowContent = append ( _afbb . _afabf . EG_ContentRowContent , nil ) ; copy ( _afbb . _afabf . EG_ContentRowContent [ _edeg + 2 : ] , _afbb . _afabf . EG_ContentRowContent [ _edeg + 1 : ] ) ; _afbb . _afabf . EG_ContentRowContent [ _edeg + 1 ] = _decd ; _deefd := _gdb . NewCT_Row ( ) ;
_decd . Tr = append ( _decd . Tr , _deefd ) ; return Row { _afbb . _feaf , _deefd } ; } ; } ; return _afbb . AddRow ( ) ; } ;
2023-05-26 09:49:04 +00:00
2024-09-16 09:59:58 +00:00
// SetTop sets the top border to a specified type, color and thickness.
func ( _eeaf ParagraphBorders ) SetTop ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _eeaf . _ecade . Top = _gdb . NewCT_Border ( ) ; _fada ( _eeaf . _ecade . Top , t , c , thickness ) ; } ; func _gffbe ( _fdde * _gdb . CT_Tbl , _cebg map [ string ] string ) { for _ , _cacd := range _fdde . EG_ContentRowContent { for _ , _bedgf := range _cacd . Tr { for _ , _cfdg := range _bedgf . EG_ContentCellContent { for _ , _fcf := range _cfdg . Tc { for _ , _dcba := range _fcf . EG_BlockLevelElts { for _ , _cgbda := range _dcba . EG_ContentBlockContent { for _ , _ccde := range _cgbda . P { _dage ( _ccde , _cebg ) ;
} ; for _ , _fcfb := range _cgbda . Tbl { _gffbe ( _fcfb , _cebg ) ; } ; } ; } ; } ; } ; } ; } ; } ;
2023-03-01 18:42:44 +00:00
2024-09-16 09:59:58 +00:00
// NewStyles constructs a new empty Styles
func NewStyles ( ) Styles { return Styles { _gdb . NewStyles ( ) } } ;
2024-07-28 07:48:26 +00:00
2024-09-16 09:59:58 +00:00
// Underline returns the type of paragraph underline.
func ( _dgdac ParagraphProperties ) Underline ( ) _gdb . ST_Underline { if _fgdc := _dgdac . _egbf . RPr . U ; _fgdc != nil { return _fgdc . ValAttr ; } ; return 0 ; } ;
2024-07-28 07:48:26 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _gabd * Document ) X ( ) * _gdb . Document { return _gabd . _dbc } ;
2024-07-28 07:48:26 +00:00
2024-09-16 09:59:58 +00:00
// SetVerticalAlignment controls the vertical alignment of the run, this is used
// to control if text is superscript/subscript.
func ( _ddgae RunProperties ) SetVerticalAlignment ( v _de . ST_VerticalAlignRun ) { if v == _de . ST_VerticalAlignRunUnset { _ddgae . _bace . VertAlign = nil ; } else { _ddgae . _bace . VertAlign = _gdb . NewCT_VerticalAlignRun ( ) ; _ddgae . _bace . VertAlign . ValAttr = v ; } ;
} ;
2023-03-01 18:42:44 +00:00
2024-09-16 09:59:58 +00:00
// Spacing returns the paragraph spacing settings.
func ( _bdbed ParagraphProperties ) Spacing ( ) ParagraphSpacing { if _bdbed . _egbf . Spacing == nil { _bdbed . _egbf . Spacing = _gdb . NewCT_Spacing ( ) ; } ; return ParagraphSpacing { _bdbed . _egbf . Spacing } ; } ;
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
// SetInsideHorizontal sets the interior horizontal borders to a specified type, color and thickness.
func ( _ddcff TableBorders ) SetInsideHorizontal ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _ddcff . _gfgae . InsideH = _gdb . NewCT_Border ( ) ; _beggg ( _ddcff . _gfgae . InsideH , t , c , thickness ) ; } ;
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _bf Cell ) X ( ) * _gdb . CT_Tc { return _bf . _dbf } ;
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
// Close closes the document, removing any temporary files that might have been
// created when opening a document.
func ( _cdeeg * Document ) Close ( ) error { if _cdeeg . TmpPath != "" { return _abd . RemoveAll ( _cdeeg . TmpPath ) ; } ; return nil ; } ;
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
// Properties returns the cell properties.
func ( _dgc Cell ) Properties ( ) CellProperties { if _dgc . _dbf . TcPr == nil { _dgc . _dbf . TcPr = _gdb . NewCT_TcPr ( ) ; } ; return CellProperties { _dgc . _dbf . TcPr } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Clear clears all content within a footer
func ( _gdbeg Footer ) Clear ( ) { _gdbeg . _dbdg . EG_ContentBlockContent = nil } ;
2022-12-06 11:56:49 +00:00
2024-09-16 09:59:58 +00:00
// SetDoubleStrikeThrough sets the run to double strike-through.
func ( _aaaef RunProperties ) SetDoubleStrikeThrough ( b bool ) { if ! b { _aaaef . _bace . Dstrike = nil ; } else { _aaaef . _bace . Dstrike = _gdb . NewCT_OnOff ( ) ; } ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// NumberingDefinition defines a numbering definition for a list of pragraphs.
type NumberingDefinition struct { _gged * _gdb . CT_AbstractNum } ;
2022-12-06 11:56:49 +00:00
2024-09-16 09:59:58 +00:00
// X returns the internally wrapped *wml.CT_SectPr.
func ( _cgbb Section ) X ( ) * _gdb . CT_SectPr { return _cgbb . _bcgc } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetTop sets the cell top margin
func ( _eed CellMargins ) SetTop ( d _dg . Distance ) { _eed . _cf . Top = _gdb . NewCT_TblWidth ( ) ; _dgf ( _eed . _cf . Top , d ) ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetOutlineLevel sets the outline level of this style.
func ( _cbge ParagraphStyleProperties ) SetOutlineLevel ( lvl int ) { _cbge . _cdeed . OutlineLvl = _gdb . NewCT_DecimalNumber ( ) ; _cbge . _cdeed . OutlineLvl . ValAttr = int64 ( lvl ) ; } ;
2020-10-12 13:59:12 +00:00
2024-09-16 09:59:58 +00:00
// SetThemeShade sets the shade based off the theme color.
func ( _cge Color ) SetThemeShade ( s uint8 ) { _bddb := _gb . Sprintf ( "\u0025\u0030\u0032\u0078" , s ) ; _cge . _ffe . ThemeShadeAttr = & _bddb ; } ;
2023-07-04 11:04:03 +00:00
2024-09-16 09:59:58 +00:00
// ParagraphProperties returns the paragraph properties controlling text formatting within the table.
func ( _cfbc TableConditionalFormatting ) ParagraphProperties ( ) ParagraphStyleProperties { if _cfbc . _bfcgg . PPr == nil { _cfbc . _bfcgg . PPr = _gdb . NewCT_PPrGeneral ( ) ; } ; return ParagraphStyleProperties { _cfbc . _bfcgg . PPr } ; } ; func ( _bgfdd * Document ) insertParagraph ( _gdag Paragraph , _cbad bool ) Paragraph { if _bgfdd . _dbc . Body == nil { return _bgfdd . AddParagraph ( ) ;
} ; _fgbg := _gdag . X ( ) ; for _ , _bdge := range _bgfdd . _dbc . Body . EG_BlockLevelElts { for _ , _bgee := range _bdge . EG_ContentBlockContent { for _gccbe , _ffc := range _bgee . P { if _ffc == _fgbg { _afga := _gdb . NewCT_P ( ) ; _bgee . P = append ( _bgee . P , nil ) ; if _cbad { copy ( _bgee . P [ _gccbe + 1 : ] , _bgee . P [ _gccbe : ] ) ;
_bgee . P [ _gccbe ] = _afga ; } else { copy ( _bgee . P [ _gccbe + 2 : ] , _bgee . P [ _gccbe + 1 : ] ) ; _bgee . P [ _gccbe + 1 ] = _afga ; } ; return Paragraph { _bgfdd , _afga } ; } ; } ; for _ , _acbb := range _bgee . Tbl { for _ , _cgge := range _acbb . EG_ContentRowContent { for _ , _bacfb := range _cgge . Tr { for _ , _affe := range _bacfb . EG_ContentCellContent { for _ , _feeb := range _affe . Tc { for _ , _agbde := range _feeb . EG_BlockLevelElts { for _ , _ggde := range _agbde . EG_ContentBlockContent { for _ggcc , _edf := range _ggde . P { if _edf == _fgbg { _ccea := _gdb . NewCT_P ( ) ;
_ggde . P = append ( _ggde . P , nil ) ; if _cbad { copy ( _ggde . P [ _ggcc + 1 : ] , _ggde . P [ _ggcc : ] ) ; _ggde . P [ _ggcc ] = _ccea ; } else { copy ( _ggde . P [ _ggcc + 2 : ] , _ggde . P [ _ggcc + 1 : ] ) ; _ggde . P [ _ggcc + 1 ] = _ccea ; } ; return Paragraph { _bgfdd , _ccea } ; } ; } ; } ; } ; } ; } ; } ; } ; } ;
if _bgee . Sdt != nil && _bgee . Sdt . SdtContent != nil && _bgee . Sdt . SdtContent . P != nil { for _cgbf , _gccbg := range _bgee . Sdt . SdtContent . P { if _gccbg == _fgbg { _dbgd := _gdb . NewCT_P ( ) ; _bgee . Sdt . SdtContent . P = append ( _bgee . Sdt . SdtContent . P , nil ) ; if _cbad { copy ( _bgee . Sdt . SdtContent . P [ _cgbf + 1 : ] , _bgee . Sdt . SdtContent . P [ _cgbf : ] ) ;
_bgee . Sdt . SdtContent . P [ _cgbf ] = _dbgd ; } else { copy ( _bgee . Sdt . SdtContent . P [ _cgbf + 2 : ] , _bgee . Sdt . SdtContent . P [ _cgbf + 1 : ] ) ; _bgee . Sdt . SdtContent . P [ _cgbf + 1 ] = _dbgd ; } ; return Paragraph { _bgfdd , _dbgd } ; } ; } ; } ; } ; } ; return _bgfdd . AddParagraph ( ) ;
2024-07-28 07:48:26 +00:00
} ;
2023-07-04 11:04:03 +00:00
2024-09-16 09:59:58 +00:00
// GetImage returns the ImageRef associated with an InlineDrawing.
func ( _fcfcd InlineDrawing ) GetImage ( ) ( _cc . ImageRef , bool ) { _eddd := _fcfcd . _eeed . Graphic . GraphicData . Any ; if len ( _eddd ) > 0 { _gfgc , _dagdc := _eddd [ 0 ] . ( * _ef . Pic ) ; if _dagdc { if _gfgc . BlipFill != nil && _gfgc . BlipFill . Blip != nil && _gfgc . BlipFill . Blip . EmbedAttr != nil { return _fcfcd . _ddba . GetImageByRelID ( * _gfgc . BlipFill . Blip . EmbedAttr ) ;
} ; } ; } ; return _cc . ImageRef { } , false ; } ;
2020-12-17 22:07:08 +00:00
2024-09-16 09:59:58 +00:00
// SetInsideVertical sets the interior vertical borders to a specified type, color and thickness.
func ( _eeb CellBorders ) SetInsideVertical ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _eeb . _ebf . InsideV = _gdb . NewCT_Border ( ) ; _beggg ( _eeb . _ebf . InsideV , t , c , thickness ) ; } ; func ( _dac * Document ) tables ( _fgg * _gdb . EG_ContentBlockContent ) [ ] Table { _fgb := [ ] Table { } ;
for _ , _bfcg := range _fgg . Tbl { _fgb = append ( _fgb , Table { _dac , _bfcg } ) ; for _ , _ceeb := range _bfcg . EG_ContentRowContent { for _ , _bfa := range _ceeb . Tr { for _ , _cace := range _bfa . EG_ContentCellContent { for _ , _eff := range _cace . Tc { for _ , _ada := range _eff . EG_BlockLevelElts { for _ , _dfad := range _ada . EG_ContentBlockContent { for _ , _ceg := range _dac . tables ( _dfad ) { _fgb = append ( _fgb , _ceg ) ;
} ; } ; } ; } ; } ; } ; } ; } ; return _fgb ; } ;
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
// SetStyle sets the style of a paragraph.
func ( _eabf ParagraphProperties ) SetStyle ( s string ) { if s == "" { _eabf . _egbf . PStyle = nil ; } else { _eabf . _egbf . PStyle = _gdb . NewCT_String ( ) ; _eabf . _egbf . PStyle . ValAttr = s ; } ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// AddHyperlink adds a hyperlink to a document. Adding the hyperlink to a document
// and setting it on a cell is more efficient than setting hyperlinks directly
// on a cell.
func ( _cgc Document ) AddHyperlink ( url string ) _cc . Hyperlink { return _cgc . _aed . AddHyperlink ( url ) } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// SetName sets the name of the bookmark. This is the name that is used to
// reference the bookmark from hyperlinks.
func ( _gcf Bookmark ) SetName ( name string ) { _gcf . _ad . NameAttr = name } ; var ( FootnoteTextStyleId = "\u0046\u006f\u006ft\u006e\u006f\u0074\u0065\u0054\u0065\u0078\u0074" ; _gfc = "\u0046\u006f\u006f\u0074\u006e\u006f\u0074\u0065\u0052\u0065\u0066\u0065r\u0065\u006e\u0063\u0065" ;
EndnoteTextStyleId = "E\u006e\u0064\u006e\u006f\u0074\u0065\u0054\u0065\u0078\u0074" ; _acd = "\u0045\u006ed\u006e\u006f\u0074e\u0052\u0065\u0066\u0065\u0072\u0065\u006e\u0063\u0065" ; _fbf = uint64 ( 20 ) ; ) ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// ComplexSizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.
func ( _fabbe ParagraphProperties ) ComplexSizeMeasure ( ) string { if _fcdc := _fabbe . _egbf . RPr . SzCs ; _fcdc != nil { _ddcfc := _fcdc . ValAttr ; if _ddcfc . ST_PositiveUniversalMeasure != nil { return * _ddcfc . ST_PositiveUniversalMeasure ; } ; } ; return "" ; } ;
2021-11-10 11:45:21 +00:00
2024-07-28 07:48:26 +00:00
// SetTopPct sets the cell top margin
2024-09-16 09:59:58 +00:00
func ( _fde CellMargins ) SetTopPct ( pct float64 ) { _fde . _cf . Top = _gdb . NewCT_TblWidth ( ) ; _cca ( _fde . _cf . Top , pct ) ; } ;
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
// SetHighlight highlights text in a specified color.
func ( _acfa RunProperties ) SetHighlight ( c _gdb . ST_HighlightColor ) { _acfa . _bace . Highlight = _gdb . NewCT_Highlight ( ) ; _acfa . _bace . Highlight . ValAttr = c ; } ;
2022-01-15 21:17:38 +00:00
2024-09-16 09:59:58 +00:00
// Footnotes returns the footnotes defined in the document.
func ( _fdea * Document ) Footnotes ( ) [ ] Footnote { _ebfg := [ ] Footnote { } ; for _ , _fge := range _fdea . _bgg . CT_Footnotes . Footnote { _ebfg = append ( _ebfg , Footnote { _fdea , _fge } ) ; } ; return _ebfg ; } ;
2022-01-15 21:17:38 +00:00
2024-09-16 09:59:58 +00:00
// Margins allows controlling individual cell margins.
func ( _ed CellProperties ) Margins ( ) CellMargins { if _ed . _debd . TcMar == nil { _ed . _debd . TcMar = _gdb . NewCT_TcMar ( ) ; } ; return CellMargins { _ed . _debd . TcMar } ; } ;
2020-12-17 22:07:08 +00:00
2024-09-16 09:59:58 +00:00
// HyperLink is a link within a document.
type HyperLink struct { _cggbd * Document ; _ffed * _gdb . CT_Hyperlink ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetTargetByRef sets the URL target of the hyperlink and is more efficient if a link
// destination will be used many times.
func ( _eeba HyperLink ) SetTargetByRef ( link _cc . Hyperlink ) { _eeba . _ffed . IdAttr = _f . String ( _cc . Relationship ( link ) . ID ( ) ) ; _eeba . _ffed . AnchorAttr = nil ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetVerticalBanding controls the conditional formatting for vertical banding.
func ( _cagd TableLook ) SetVerticalBanding ( on bool ) { if ! on { _cagd . _cdag . NoVBandAttr = & _de . ST_OnOff { } ; _cagd . _cdag . NoVBandAttr . ST_OnOff1 = _de . ST_OnOff1On ; } else { _cagd . _cdag . NoVBandAttr = & _de . ST_OnOff { } ; _cagd . _cdag . NoVBandAttr . ST_OnOff1 = _de . ST_OnOff1Off ;
2024-07-28 07:48:26 +00:00
} ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _fbeb Numbering ) X ( ) * _gdb . Numbering { return _fbeb . _cgbg } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// NewNumbering constructs a new numbering.
func NewNumbering ( ) Numbering { _eaee := _gdb . NewNumbering ( ) ; return Numbering { _eaee } } ;
2021-05-31 16:22:30 +00:00
2024-09-16 09:59:58 +00:00
// SetThemeColor sets the color from the theme.
func ( _acg Color ) SetThemeColor ( t _gdb . ST_ThemeColor ) { _acg . _ffe . ThemeColorAttr = t } ;
2021-07-30 17:03:26 +00:00
2024-07-28 07:48:26 +00:00
// Headers returns the headers defined in the document.
2024-09-16 09:59:58 +00:00
func ( _bbd * Document ) Headers ( ) [ ] Header { _ffb := [ ] Header { } ; for _ , _ce := range _bbd . _agfcg { _ffb = append ( _ffb , Header { _bbd , _ce } ) ; } ; return _ffb ; } ;
2023-05-26 09:49:04 +00:00
2024-09-16 09:59:58 +00:00
// X return element of Node as interface, can be either *Paragraph, *Table and Run.
func ( _fbbea * Node ) X ( ) interface { } { return _fbbea . _dbca } ; func ( _fed * chart ) RelId ( ) string { return _fed . _eea } ;
2021-07-30 17:03:26 +00:00
2024-09-16 09:59:58 +00:00
// ClearColor clears the text color.
func ( _cfcbe RunProperties ) ClearColor ( ) { _cfcbe . _bace . Color = nil } ;
2021-07-30 17:03:26 +00:00
2024-09-16 09:59:58 +00:00
// PossibleValues returns the possible values for a FormFieldTypeDropDown.
func ( _dgfg FormField ) PossibleValues ( ) [ ] string { if _dgfg . _eebdg . DdList == nil { return nil ; } ; _baeff := [ ] string { } ; for _ , _cffbf := range _dgfg . _eebdg . DdList . ListEntry { if _cffbf == nil { continue ; } ; _baeff = append ( _baeff , _cffbf . ValAttr ) ; } ; return _baeff ;
2024-07-28 07:48:26 +00:00
} ;
2023-03-01 18:42:44 +00:00
2024-09-16 09:59:58 +00:00
// AppendNode append node to document element.
func ( _aaac * Document ) AppendNode ( node Node ) { _aaac . insertImageFromNode ( node ) ; _aaac . insertStyleFromNode ( node ) ; for _ , _fdfb := range node . Children { _aaac . insertImageFromNode ( _fdfb ) ; _aaac . insertStyleFromNode ( _fdfb ) ; } ; switch _afbe := node . X ( ) . ( type ) { case * Paragraph : _aaac . appendParagraph ( nil , * _afbe , false ) ;
case * Table : _aaac . appendTable ( nil , * _afbe , false ) ; } ; if node . _eabe != nil { if node . _eabe . _aaf != nil { if _cfbg := _aaac . _aed . FindRIDForN ( 0 , _f . ThemeType ) ; _cfbg == "" { if _gbdc := node . _eabe . _aed . FindRIDForN ( 0 , _f . ThemeType ) ; _gbdc != "" { _aaac . _aaf = append ( _aaac . _aaf , node . _eabe . _aaf ... ) ;
_afeae := node . _eabe . _aed . GetTargetByRelId ( _gbdc ) ; _aaac . ContentTypes . AddOverride ( "\u002f\u0077\u006f\u0072\u0064\u002f" + _afeae , "\u0061\u0070\u0070\u006c\u0069\u0063\u0061t\u0069\u006f\u006e/\u0076\u006e\u0064.\u006f\u0070e\u006e\u0078\u006d\u006c\u0066\u006fr\u006dat\u0073\u002d\u006f\u0066\u0066\u0069\u0063\u0065\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0074\u0068\u0065\u006d\u0065\u002b\u0078\u006d\u006c" ) ;
_aaac . _aed . AddRelationship ( _afeae , _f . ThemeType ) ; } ; } ; } ; _fbbf := _aaac . _cdee ; _ffcf := node . _eabe . _cdee ; if _fbbf != nil { if _ffcf != nil { if _fbbf . Font != nil { if _ffcf . Font != nil { for _ , _fbad := range _ffcf . Font { _bbcc := true ; for _ , _abad := range _fbbf . Font { if _abad . NameAttr == _fbad . NameAttr { _bbcc = false ;
break ; } ; } ; if _bbcc { _fbbf . Font = append ( _fbbf . Font , _fbad ) ; } ; } ; } ; } else { _fbbf . Font = _ffcf . Font ; } ; } ; } else if _ffcf != nil { _fbbf = _ffcf ; } ; _aaac . _cdee = _fbbf ; if _cbcb := _aaac . _aed . FindRIDForN ( 0 , _f . FontTableType ) ; _cbcb == "" { _aaac . ContentTypes . AddOverride ( "\u002f\u0077\u006f\u0072d/\u0066\u006f\u006e\u0074\u0054\u0061\u0062\u006c\u0065\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\u0066\u006f\u006e\u0074T\u0061\u0062\u006c\u0065\u002b\u0078m\u006c" ) ;
_aaac . _aed . AddRelationship ( "\u0066\u006f\u006e\u0074\u0054\u0061\u0062\u006c\u0065\u002e\u0078\u006d\u006c" , _f . FontTableType ) ; } ; } ; } ;
2021-07-30 17:03:26 +00:00
2024-09-16 09:59:58 +00:00
// AddTabStop adds a tab stop to the paragraph.
func ( _fadd ParagraphStyleProperties ) AddTabStop ( position _dg . Distance , justificaton _gdb . ST_TabJc , leader _gdb . ST_TabTlc ) { if _fadd . _cdeed . Tabs == nil { _fadd . _cdeed . Tabs = _gdb . NewCT_Tabs ( ) ; } ; _ecbdb := _gdb . NewCT_TabStop ( ) ; _ecbdb . LeaderAttr = leader ;
_ecbdb . ValAttr = justificaton ; _ecbdb . PosAttr . Int64 = _f . Int64 ( int64 ( position / _dg . Twips ) ) ; _fadd . _cdeed . Tabs . Tab = append ( _fadd . _cdeed . Tabs . Tab , _ecbdb ) ; } ;
2021-07-30 17:03:26 +00:00
2024-09-16 09:59:58 +00:00
// RemoveParagraph removes a paragraph from the endnote.
func ( _ddag Endnote ) RemoveParagraph ( p Paragraph ) { for _ , _bgge := range _ddag . content ( ) { for _bccga , _dbfcb := range _bgge . P { if _dbfcb == p . _gbaee { copy ( _bgge . P [ _bccga : ] , _bgge . P [ _bccga + 1 : ] ) ; _bgge . P = _bgge . P [ 0 : len ( _bgge . P ) - 1 ] ; return ; } ; } ;
} ; } ;
2021-07-30 17:03:26 +00:00
2024-09-16 09:59:58 +00:00
// SetValue sets the value of a FormFieldTypeText or FormFieldTypeDropDown. For
// FormFieldTypeDropDown, the value must be one of the fields possible values.
func ( _gdeed FormField ) SetValue ( v string ) { if _gdeed . _eebdg . DdList != nil { for _debg , _caega := range _gdeed . PossibleValues ( ) { if _caega == v { _gdeed . _eebdg . DdList . Result = _gdb . NewCT_DecimalNumber ( ) ; _gdeed . _eebdg . DdList . Result . ValAttr = int64 ( _debg ) ;
break ; } ; } ; } else if _gdeed . _eebdg . TextInput != nil { _gdeed . _eaggc . T = _gdb . NewCT_Text ( ) ; _gdeed . _eaggc . T . Content = v ; } ; } ; func _acadg ( ) * _eb . Path { _fafe := _eb . NewPath ( ) ; _fafe . TextpathokAttr = _de . ST_TrueFalseTrue ; _fafe . ConnecttypeAttr = _eb . OfcST_ConnectTypeCustom ;
_fecdb := "\u0040\u0039\u002c0;\u0040\u0031\u0030\u002c\u0031\u0030\u0038\u0030\u0030;\u00401\u0031,\u00321\u0036\u0030\u0030\u003b\u0040\u0031\u0032\u002c\u0031\u0030\u0038\u0030\u0030" ; _fafe . ConnectlocsAttr = & _fecdb ; _fgced := "\u0032\u0037\u0030,\u0031\u0038\u0030\u002c\u0039\u0030\u002c\u0030" ;
_fafe . ConnectanglesAttr = & _fgced ; return _fafe ; } ;
2021-07-30 17:03:26 +00:00
2024-09-16 09:59:58 +00:00
// SetContextualSpacing controls whether to Ignore Spacing Above and Below When
// Using Identical Styles
func ( _cbaga ParagraphStyleProperties ) SetContextualSpacing ( b bool ) { if ! b { _cbaga . _cdeed . ContextualSpacing = nil ; } else { _cbaga . _cdeed . ContextualSpacing = _gdb . NewCT_OnOff ( ) ; } ; } ;
2024-07-28 07:48:26 +00:00
2024-09-16 09:59:58 +00:00
// AddTOC adds a table of contents to the document and customize it according to TOCOptions if necessary.
func ( _ecgfg Run ) AddTOC ( options * TOCOptions ) { _ebdc := "" ; if options != nil { if options . UseHyperlinks { _ebdc += "\u0020\u005c\u0068\u0020" ; } ; if options . OmitPageNumbers { _ebdc += "\u0020\u005c\u006e\u0020" ; } ; if options . HeadingLevel != "" { _ebdc += "\u0020\u005c\u006f \u0027" + options . HeadingLevel + "\u0027" ;
} ; } ; _ecgfg . AddFieldWithFormatting ( FieldTOC , _ebdc , true ) ; } ;
2021-07-30 17:03:26 +00:00
2024-09-16 09:59:58 +00:00
// OnOffValue represents an on/off value that can also be unset
type OnOffValue byte ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// MailMerge finds mail merge fields and replaces them with the text provided. It also removes
// the mail merge source info from the document settings.
func ( _egec * Document ) MailMerge ( mergeContent map [ string ] string ) { _gdcb := _egec . mergeFields ( ) ; _ffce := map [ Paragraph ] [ ] Run { } ; for _ , _abab := range _gdcb { _egdc , _fbbe := mergeContent [ _abab . _ecgf ] ; if _fbbe { if _abab . _ddbad { _egdc = _ab . ToUpper ( _egdc ) ;
} else if _abab . _feddcc { _egdc = _ab . ToLower ( _egdc ) ; } else if _abab . _fddca { _egdc = _ab . Title ( _egdc ) ; } else if _abab . _bfde { _abbff := _fc . Buffer { } ; for _afd , _dddf := range _egdc { if _afd == 0 { _abbff . WriteRune ( _c . ToUpper ( _dddf ) ) ; } else { _abbff . WriteRune ( _dddf ) ;
} ; } ; _egdc = _abbff . String ( ) ; } ; if _egdc != "" && _abab . _bccgb != "" { _egdc = _abab . _bccgb + _egdc ; } ; if _egdc != "" && _abab . _fdccb != "" { _egdc = _egdc + _abab . _fdccb ; } ; } ; if _abab . _deafg { if len ( _abab . _ceae . FldSimple ) == 1 && len ( _abab . _ceae . FldSimple [ 0 ] . EG_PContent ) == 1 && len ( _abab . _ceae . FldSimple [ 0 ] . EG_PContent [ 0 ] . EG_ContentRunContent ) == 1 { _bdbgd := & _gdb . EG_ContentRunContent { } ;
_bdbgd . R = _abab . _ceae . FldSimple [ 0 ] . EG_PContent [ 0 ] . EG_ContentRunContent [ 0 ] . R ; _abab . _ceae . FldSimple = nil ; _dbagg := Run { _egec , _bdbgd . R } ; _dbagg . ClearContent ( ) ; _dbagg . AddText ( _egdc ) ; _abab . _ceae . EG_ContentRunContent = append ( _abab . _ceae . EG_ContentRunContent , _bdbgd ) ;
} ; } else { _bcdfc := _abab . _fdag . Runs ( ) ; for _agbc := _abab . _bgdg ; _agbc <= _abab . _ffda ; _agbc ++ { if _agbc == _abab . _bfbf + 1 { _bcdfc [ _agbc ] . ClearContent ( ) ; _bcdfc [ _agbc ] . AddText ( _egdc ) ; } else { _ffce [ _abab . _fdag ] = append ( _ffce [ _abab . _fdag ] , _bcdfc [ _agbc ] ) ;
} ; } ; } ; } ; for _fbfd , _abde := range _ffce { for _ , _dcaa := range _abde { _fbfd . RemoveRun ( _dcaa ) ; } ; } ; _egec . Settings . RemoveMailMerge ( ) ; } ;
2022-01-15 21:17:38 +00:00
2024-09-16 09:59:58 +00:00
// AddImage adds an image to the document package, returning a reference that
// can be used to add the image to a run and place it in the document contents.
func ( _gecb * Document ) AddImage ( i _cc . Image ) ( _cc . ImageRef , error ) { _gegb := _cc . MakeImageRef ( i , & _gecb . DocBase , _gecb . _aed ) ; if i . Data == nil && i . Path == "" { return _gegb , _cb . 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 _gegb , _cb . 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 _gegb , _cb . 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 != "" { _ecc := _abd . Add ( i . Path ) ; if _ecc != nil { return _gegb , _ecc ; } ; } ; _gecb . Images = append ( _gecb . Images , _gegb ) ; _agfgf := _gb . Sprintf ( "\u006d\u0065d\u0069\u0061\u002fi\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073" , len ( _gecb . Images ) , i . Format ) ;
_egfc := _gecb . _aed . AddRelationship ( _agfgf , _f . ImageType ) ; _gecb . ContentTypes . EnsureDefault ( "\u0070\u006e\u0067" , "\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg" ) ; _gecb . ContentTypes . EnsureDefault ( "\u006a\u0070\u0065\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ;
_gecb . ContentTypes . EnsureDefault ( "\u006a\u0070\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _gecb . ContentTypes . EnsureDefault ( "\u0077\u006d\u0066" , "i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066" ) ; _gecb . ContentTypes . EnsureDefault ( i . Format , "\u0069\u006d\u0061\u0067\u0065\u002f" + i . Format ) ;
_gegb . SetRelID ( _egfc . X ( ) . IdAttr ) ; _gegb . SetTarget ( _agfgf ) ; return _gegb , nil ; } ;
2023-12-28 15:53:06 +00:00
2024-09-16 09:59:58 +00:00
// AddFooter creates a Footer associated with the document, but doesn't add it
// to the document for display.
func ( _gbb * Document ) AddFooter ( ) Footer { _aca := _gdb . NewFtr ( ) ; _gbb . _dea = append ( _gbb . _dea , _aca ) ; _dfag := _gb . Sprintf ( "\u0066\u006f\u006ft\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c" , len ( _gbb . _dea ) ) ; _gbb . _aed . AddRelationship ( _dfag , _f . FooterType ) ;
_gbb . ContentTypes . AddOverride ( "\u002f\u0077\u006f\u0072\u0064\u002f" + _dfag , "\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" ) ;
_gbb . _gaf = append ( _gbb . _gaf , _cc . NewRelationships ( ) ) ; return Footer { _gbb , _aca } ; } ;
2023-12-28 15:53:06 +00:00
2024-09-16 09:59:58 +00:00
// AbstractNumberID returns the ID that is unique within all numbering
// definitions that is used to assign the definition to a paragraph.
func ( _afgg NumberingDefinition ) AbstractNumberID ( ) int64 { return _afgg . _gged . AbstractNumIdAttr } ; func _acacd ( _agaa * _gdb . CT_P , _eegf * _gdb . CT_Hyperlink , _gfff * TableInfo , _bebfg * DrawingInfo , _fdbcg [ ] * _gdb . EG_ContentRunContent ) [ ] TextItem { _fcbc := [ ] TextItem { } ;
for _ , _aaaec := range _fdbcg { if _dfdd := _aaaec . Sdt ; _dfdd != nil { if _aacg := _dfdd . SdtContent ; _aacg != nil { _fcbc = append ( _fcbc , _acacd ( _agaa , _eegf , _gfff , _bebfg , _aacg . EG_ContentRunContent ) ... ) ; } ; } ; if _gfe := _aaaec . R ; _gfe != nil { _cfeb := _fc . NewBuffer ( [ ] byte { } ) ;
for _ , _dfdg := range _gfe . EG_RunInnerContent { if _dfdg . Br != nil { _cfeb . WriteString ( "\u000a" ) ; } ; if _dfdg . Tab != nil { _cfeb . WriteString ( "\u0009" ) ; } ; if _dfdg . T != nil { _cfeb . WriteString ( _dfdg . T . Content ) ; } ; if _dfdg . Pict != nil && len ( _dfdg . Pict . Any ) > 0 { for _ , _eefa := range _dfdg . Pict . Any { if _cceg , _gacc := _eefa . ( * _eb . Shape ) ;
_gacc { for _ , _ccegg := range _cceg . EG_ShapeElements { if _dfee := _ccegg . Textbox ; _dfee != nil { if _dfee . TxbxContent != nil { _fcbc = append ( _fcbc , _ddcc ( _dfee . TxbxContent . EG_ContentBlockContent , nil ) ... ) ; } ; } ; } ; } ; } ; } ; } ; _fcbc = append ( _fcbc , TextItem { Text : _cfeb . String ( ) , DrawingInfo : _bebfg , Paragraph : _agaa , Hyperlink : _eegf , Run : _gfe , TableInfo : _gfff } ) ;
for _ , _eeaaf := range _gfe . Extra { if _aggb , _cadf := _eeaaf . ( * _gdb . AlternateContentRun ) ; _cadf { _bfea := & DrawingInfo { Drawing : _aggb . Choice . Drawing } ; for _ , _fbce := range _bfea . Drawing . Anchor { for _ , _gbge := range _fbce . Graphic . GraphicData . Any { if _dbdc , _cfcc := _gbge . ( * _gdb . WdWsp ) ;
_cfcc { if _dbdc . WChoice != nil { if _gffca := _dbdc . SpPr ; _gffca != nil { if _caad := _gffca . Xfrm ; _caad != nil { if _baeg := _caad . Ext ; _baeg != nil { _bfea . Width = _baeg . CxAttr ; _bfea . Height = _baeg . CyAttr ; } ; } ; } ; for _ , _aafbe := range _dbdc . WChoice . Txbx . TxbxContent . EG_ContentBlockContent { _fcbc = append ( _fcbc , _bgab ( _aafbe . P , _gfff , _bfea ) ... ) ;
} ; } ; } ; } ; } ; } ; } ; } ; } ; return _fcbc ; } ;
2023-12-28 15:53:06 +00:00
2024-09-16 09:59:58 +00:00
// SetFirstRow controls the conditional formatting for the first row in a table.
func ( _aabe TableLook ) SetFirstRow ( on bool ) { if ! on { _aabe . _cdag . FirstRowAttr = & _de . ST_OnOff { } ; _aabe . _cdag . FirstRowAttr . ST_OnOff1 = _de . ST_OnOff1Off ; } else { _aabe . _cdag . FirstRowAttr = & _de . ST_OnOff { } ; _aabe . _cdag . FirstRowAttr . ST_OnOff1 = _de . ST_OnOff1On ;
} ; } ;
2022-01-15 21:17:38 +00:00
2024-09-16 09:59:58 +00:00
// SetLayout controls the table layout. wml.ST_TblLayoutTypeAutofit corresponds
// to "Automatically resize to fit contents" being checked, while
// wml.ST_TblLayoutTypeFixed corresponds to it being unchecked.
func ( _bfbd TableProperties ) SetLayout ( l _gdb . ST_TblLayoutType ) { if l == _gdb . ST_TblLayoutTypeUnset || l == _gdb . ST_TblLayoutTypeAutofit { _bfbd . _affd . TblLayout = nil ; } else { _bfbd . _affd . TblLayout = _gdb . NewCT_TblLayoutType ( ) ; _bfbd . _affd . TblLayout . TypeAttr = l ;
} ; } ;
2021-07-30 17:03:26 +00:00
2024-09-16 09:59:58 +00:00
// Footer is a footer for a document section.
type Footer struct { _dgbc * Document ; _dbdg * _gdb . Ftr ; } ;
2021-07-30 17:03:26 +00:00
2024-09-16 09:59:58 +00:00
// SetAfter sets the spacing that comes after the paragraph.
func ( _babgf ParagraphSpacing ) SetAfter ( after _dg . Distance ) { _babgf . _fggcd . AfterAttr = & _de . ST_TwipsMeasure { } ; _babgf . _fggcd . AfterAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( after / _dg . Twips ) ) ; } ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// SetTarget sets the URL target of the hyperlink.
func ( _eacd HyperLink ) SetTarget ( url string ) { _bcae := _eacd . _cggbd . AddHyperlink ( url ) ; _eacd . _ffed . IdAttr = _f . String ( _cc . Relationship ( _bcae ) . ID ( ) ) ; _eacd . _ffed . AnchorAttr = nil ; } ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// SetTop sets the top border to a specified type, color and thickness.
func ( _feb CellBorders ) SetTop ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _feb . _ebf . Top = _gdb . NewCT_Border ( ) ; _beggg ( _feb . _ebf . Top , t , c , thickness ) ; } ;
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
// SetCellSpacingPercent sets the cell spacing within a table to a percent width.
func ( _cebd TableStyleProperties ) SetCellSpacingPercent ( pct float64 ) { _cebd . _addgf . TblCellSpacing = _gdb . NewCT_TblWidth ( ) ; _cebd . _addgf . TblCellSpacing . TypeAttr = _gdb . ST_TblWidthPct ; _cebd . _addgf . TblCellSpacing . WAttr = & _gdb . ST_MeasurementOrPercent { } ;
_cebd . _addgf . TblCellSpacing . WAttr . ST_DecimalNumberOrPercent = & _gdb . ST_DecimalNumberOrPercent { } ; _cebd . _addgf . TblCellSpacing . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _f . Int64 ( int64 ( pct * 50 ) ) ; } ;
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _dbfd Color ) X ( ) * _gdb . CT_Color { return _dbfd . _ffe } ;
2017-08-28 20:56:18 -05:00
2024-09-16 09:59:58 +00:00
// UnderlineColor returns the hex color value of run underline.
func ( _ddage RunProperties ) UnderlineColor ( ) string { if _agdcc := _ddage . _bace . U ; _agdcc != nil { _gcbee := _agdcc . ColorAttr ; if _gcbee != nil && _gcbee . ST_HexColorRGB != nil { return * _gcbee . ST_HexColorRGB ; } ; } ; return "" ; } ; func ( _dafg Footnote ) content ( ) [ ] * _gdb . EG_ContentBlockContent { var _agdc [ ] * _gdb . EG_ContentBlockContent ;
for _ , _bdbcd := range _dafg . _eacb . EG_BlockLevelElts { _agdc = append ( _agdc , _bdbcd . EG_ContentBlockContent ... ) ; } ; return _agdc ; } ; func ( _gagc * Document ) addEndnotes ( ) { _gagc . _gde = _gdb . NewEndnotes ( ) ; _gagc . ContentTypes . AddOverride ( "\u002fw\u006fr\u0064\u002f\u0065\u006e\u0064n\u006f\u0074e\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.\u0065\u006e\u0064\u006e\u006f\u0074\u0065\u0073\u002b\u0078\u006d\u006c" ) ;
_gagc . _aed . AddRelationship ( "\u002fw\u006fr\u0064\u002f\u0065\u006e\u0064n\u006f\u0074e\u0073\u002e\u0078\u006d\u006c" , _f . EndNotesType ) ; _bbe := _gagc . Styles . AddStyle ( EndnoteTextStyleId , _gdb . ST_StyleTypeParagraph , false ) ; _bbe . SetName ( "\u0045\u006e\u0064n\u006f\u0074\u0065\u0020\u0054\u0065\u0078\u0074" ) ;
_bbe . SetBasedOn ( "\u004e\u006f\u0072\u006d\u0061\u006c" ) ; _aag := _bbe . ParagraphProperties ( ) ; _aag . X ( ) . SuppressLineNumbers = & _gdb . CT_OnOff { } ; _eedd := _bbe . RunProperties ( ) ; _eedd . X ( ) . Sz = & _gdb . CT_HpsMeasure { ValAttr : _gdb . ST_HpsMeasure { ST_UnsignedDecimalNumber : & _fbf } } ;
_eedd . X ( ) . SzCs = & _gdb . CT_HpsMeasure { ValAttr : _gdb . ST_HpsMeasure { ST_UnsignedDecimalNumber : & _fbf } } ; _dddc := _gagc . Styles . AddStyle ( _acd , _gdb . ST_StyleTypeCharacter , false ) ; _dddc . SetName ( "\u0045\u006e\u0064\u006e\u006f\u0074\u0065\u0020\u0052\u0065\u0066\u0065r\u0065\u006e\u0063\u0065" ) ;
_abec := _dddc . RunProperties ( ) ; _abec . X ( ) . VertAlign = & _gdb . CT_VerticalAlignRun { ValAttr : _de . ST_VerticalAlignRunSuperscript } ; _gagc . addEndnoteSeparator ( ) ; } ;
2017-08-28 20:56:18 -05:00
2024-09-16 09:59:58 +00:00
// ParagraphBorders allows manipulation of borders on a paragraph.
type ParagraphBorders struct { _dfbfa * Document ; _ecade * _gdb . CT_PBdr ; } ;
2023-09-16 17:56:36 +00:00
2024-09-16 09:59:58 +00:00
// SetRight sets the right border to a specified type, color and thickness.
func ( _cbf CellBorders ) SetRight ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _cbf . _ebf . Right = _gdb . NewCT_Border ( ) ; _beggg ( _cbf . _ebf . Right , t , c , thickness ) ; } ;
2023-09-16 17:56:36 +00:00
2024-09-16 09:59:58 +00:00
// SetVerticalMerge controls the vertical merging of cells.
func ( _gfa CellProperties ) SetVerticalMerge ( mergeVal _gdb . ST_Merge ) { if mergeVal == _gdb . ST_MergeUnset { _gfa . _debd . VMerge = nil ; } else { _gfa . _debd . VMerge = _gdb . NewCT_VMerge ( ) ; _gfa . _debd . VMerge . ValAttr = mergeVal ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetTextStyleItalic set text style of watermark to italic.
func ( _affde * WatermarkText ) SetTextStyleItalic ( value bool ) { if _affde . _ddcag != nil { _fcae := _affde . GetStyle ( ) ; _fcae . SetItalic ( value ) ; _affde . SetStyle ( _fcae ) ; } ; } ; func ( _eegd Endnote ) id ( ) int64 { return _eegd . _baab . IdAttr } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Strike returns true if paragraph is striked.
func ( _eggd ParagraphProperties ) Strike ( ) bool { return _cefe ( _eggd . _egbf . RPr . Strike ) } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetDefaultValue sets the default value of a FormFieldTypeDropDown. For
// FormFieldTypeDropDown, the value must be one of the fields possible values.
func ( _fdeaf FormField ) SetDefaultValue ( v string ) { if _fdeaf . _eebdg . DdList != nil { for _aacgg , _addf := range _fdeaf . PossibleValues ( ) { if _addf == v { _fdeaf . _eebdg . DdList . Default = _gdb . NewCT_DecimalNumber ( ) ; _fdeaf . _eebdg . DdList . Default . ValAttr = int64 ( _aacgg ) ;
break ; } ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Table is a table within a document.
type Table struct { _feaf * Document ; _afabf * _gdb . CT_Tbl ; } ;
2021-07-30 17:03:26 +00:00
2024-09-16 09:59:58 +00:00
// Emboss returns true if paragraph emboss is on.
func ( _aegga ParagraphProperties ) Emboss ( ) bool { return _cefe ( _aegga . _egbf . RPr . Emboss ) } ;
2021-07-30 17:03:26 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _cbdb NumberingLevel ) X ( ) * _gdb . CT_Lvl { return _cbdb . _ggagc } ;
2021-07-30 17:03:26 +00:00
2024-09-16 09:59:58 +00:00
// SetWidth sets the table with to a specified width.
func ( _gaad TableProperties ) SetWidth ( d _dg . Distance ) { _gaad . _affd . TblW = _gdb . NewCT_TblWidth ( ) ; _gaad . _affd . TblW . TypeAttr = _gdb . ST_TblWidthDxa ; _gaad . _affd . TblW . WAttr = & _gdb . ST_MeasurementOrPercent { } ; _gaad . _affd . TblW . WAttr . ST_DecimalNumberOrPercent = & _gdb . ST_DecimalNumberOrPercent { } ;
_gaad . _affd . TblW . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _f . Int64 ( int64 ( d / _dg . Twips ) ) ; } ; func ( _abbbc * Document ) insertTable ( _abdf Paragraph , _cdb bool ) Table { _gce := _abbbc . _dbc . Body ; if _gce == nil { return _abbbc . AddTable ( ) ;
} ; _fca := _abdf . X ( ) ; for _eaea , _bbbg := range _gce . EG_BlockLevelElts { for _ , _aea := range _bbbg . EG_ContentBlockContent { for _fecd , _aff := range _aea . P { if _aff == _fca { _gcd := _gdb . NewCT_Tbl ( ) ; _ggeg := _gdb . NewEG_BlockLevelElts ( ) ; _bcg := _gdb . NewEG_ContentBlockContent ( ) ;
_ggeg . EG_ContentBlockContent = append ( _ggeg . EG_ContentBlockContent , _bcg ) ; _bcg . Tbl = append ( _bcg . Tbl , _gcd ) ; _gce . EG_BlockLevelElts = append ( _gce . EG_BlockLevelElts , nil ) ; if _cdb { copy ( _gce . EG_BlockLevelElts [ _eaea + 1 : ] , _gce . EG_BlockLevelElts [ _eaea : ] ) ;
_gce . EG_BlockLevelElts [ _eaea ] = _ggeg ; if _fecd != 0 { _fgc := _gdb . NewEG_BlockLevelElts ( ) ; _ccg := _gdb . NewEG_ContentBlockContent ( ) ; _fgc . EG_ContentBlockContent = append ( _fgc . EG_ContentBlockContent , _ccg ) ; _ccg . P = _aea . P [ : _fecd ] ; _gce . EG_BlockLevelElts = append ( _gce . EG_BlockLevelElts , nil ) ;
copy ( _gce . EG_BlockLevelElts [ _eaea + 1 : ] , _gce . EG_BlockLevelElts [ _eaea : ] ) ; _gce . EG_BlockLevelElts [ _eaea ] = _fgc ; } ; _aea . P = _aea . P [ _fecd : ] ; } else { copy ( _gce . EG_BlockLevelElts [ _eaea + 2 : ] , _gce . EG_BlockLevelElts [ _eaea + 1 : ] ) ; _gce . EG_BlockLevelElts [ _eaea + 1 ] = _ggeg ;
if _fecd != len ( _aea . P ) - 1 { _cabb := _gdb . NewEG_BlockLevelElts ( ) ; _acgb := _gdb . NewEG_ContentBlockContent ( ) ; _cabb . EG_ContentBlockContent = append ( _cabb . EG_ContentBlockContent , _acgb ) ; _acgb . P = _aea . P [ _fecd + 1 : ] ; _gce . EG_BlockLevelElts = append ( _gce . EG_BlockLevelElts , nil ) ;
copy ( _gce . EG_BlockLevelElts [ _eaea + 3 : ] , _gce . EG_BlockLevelElts [ _eaea + 2 : ] ) ; _gce . EG_BlockLevelElts [ _eaea + 2 ] = _cabb ; } ; _aea . P = _aea . P [ : _fecd + 1 ] ; } ; return Table { _abbbc , _gcd } ; } ; } ; for _ , _bbde := range _aea . Tbl { _aad := _fda ( _bbde , _fca , _cdb ) ;
if _aad != nil { return Table { _abbbc , _aad } ; } ; } ; } ; } ; return _abbbc . AddTable ( ) ; } ;
2021-05-31 16:22:30 +00:00
2024-09-16 09:59:58 +00:00
// SetKeepNext controls if the paragraph is kept with the next paragraph.
func ( _dbbd ParagraphStyleProperties ) SetKeepNext ( b bool ) { if ! b { _dbbd . _cdeed . KeepNext = nil ; } else { _dbbd . _cdeed . KeepNext = _gdb . NewCT_OnOff ( ) ; } ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// RemoveFootnote removes a footnote from both the paragraph and the document
// the requested footnote must be anchored on the paragraph being referenced.
//
// After each removal, the rest of the footnote ids would be reordered.
func ( _cafgd Paragraph ) RemoveFootnote ( id int64 ) { for _ , _fgad := range _cafgd . Runs ( ) { if _bdggd , _bggde := _fgad . IsFootnote ( ) ; _bdggd { if _bggde == id { _cafgd . RemoveRun ( _fgad ) ; break ; } ; } ; } ; _cafgd . _fdec . removeFootnote ( id ) ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// SetChecked marks a FormFieldTypeCheckBox as checked or unchecked.
func ( _cgea FormField ) SetChecked ( b bool ) { if _cgea . _eebdg . CheckBox == nil { return ; } ; if ! b { _cgea . _eebdg . CheckBox . Checked = nil ; } else { _cgea . _eebdg . CheckBox . Checked = _gdb . NewCT_OnOff ( ) ; } ; } ;
2023-12-28 15:53:06 +00:00
2024-09-16 09:59:58 +00:00
// Emboss returns true if run emboss is on.
func ( _ebbcc RunProperties ) Emboss ( ) bool { return _cefe ( _ebbcc . _bace . Emboss ) } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// New constructs an empty document that content can be added to.
func New ( ) * Document { _abf := & Document { _dbc : _gdb . NewDocument ( ) } ; _abf . ContentTypes = _cc . NewContentTypes ( ) ; _abf . _dbc . Body = _gdb . NewCT_Body ( ) ; _abf . _dbc . ConformanceAttr = _de . ST_ConformanceClassTransitional ; _abf . _aed = _cc . NewRelationships ( ) ;
_abf . _gef = _cc . NewRelationships ( ) ; _abf . AppProperties = _cc . NewAppProperties ( ) ; _abf . CoreProperties = _cc . NewCoreProperties ( ) ; _abf . 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" ) ;
_abf . Settings = NewSettings ( ) ; _abf . _aed . AddRelationship ( "\u0073\u0065\u0074t\u0069\u006e\u0067\u0073\u002e\u0078\u006d\u006c" , _f . SettingsType ) ; _abf . 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" ) ;
_abf . Rels = _cc . NewRelationships ( ) ; _abf . Rels . AddRelationship ( _f . RelativeFilename ( _f . DocTypeDocument , "" , _f . CorePropertiesType , 0 ) , _f . CorePropertiesType ) ; _abf . Rels . AddRelationship ( "\u0064\u006fc\u0050\u0072\u006fp\u0073\u002f\u0061\u0070\u0070\u002e\u0078\u006d\u006c" , _f . ExtendedPropertiesType ) ;
_abf . Rels . AddRelationship ( "\u0077\u006f\u0072\u0064\u002f\u0064\u006f\u0063\u0075\u006d\u0065\u006et\u002e\u0078\u006d\u006c" , _f . OfficeDocumentType ) ; _abf . Numbering = NewNumbering ( ) ; _abf . Numbering . InitializeDefault ( ) ; _abf . 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" ) ;
_abf . _aed . AddRelationship ( "\u006e\u0075\u006d\u0062\u0065\u0072\u0069\u006e\u0067\u002e\u0078\u006d\u006c" , _f . NumberingType ) ; _abf . Styles = NewStyles ( ) ; _abf . Styles . InitializeDefault ( ) ; _abf . 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" ) ;
_abf . _aed . AddRelationship ( "\u0073\u0074\u0079\u006c\u0065\u0073\u002e\u0078\u006d\u006c" , _f . StylesType ) ; _abf . _dbc . Body = _gdb . NewCT_Body ( ) ; return _abf ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// Style returns the style for a paragraph, or an empty string if it is unset.
func ( _aeba ParagraphProperties ) Style ( ) string { if _aeba . _egbf . PStyle != nil { return _aeba . _egbf . PStyle . ValAttr ; } ; return "" ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// SetStartIndent controls the start indent of the paragraph.
func ( _dbdge ParagraphStyleProperties ) SetStartIndent ( m _dg . Distance ) { if _dbdge . _cdeed . Ind == nil { _dbdge . _cdeed . Ind = _gdb . NewCT_Ind ( ) ; } ; if m == _dg . Zero { _dbdge . _cdeed . Ind . StartAttr = nil ; } else { _dbdge . _cdeed . Ind . StartAttr = & _gdb . ST_SignedTwipsMeasure { } ;
_dbdge . _cdeed . Ind . StartAttr . Int64 = _f . Int64 ( int64 ( m / _dg . Twips ) ) ; } ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// SetColor sets a specific color or auto.
func ( _dbg Color ) SetColor ( v _gbc . Color ) { if v . IsAuto ( ) { _dbg . _ffe . ValAttr . ST_HexColorAuto = _gdb . ST_HexColorAutoAuto ; _dbg . _ffe . ValAttr . ST_HexColorRGB = nil ; } else { _dbg . _ffe . ValAttr . ST_HexColorAuto = _gdb . ST_HexColorAutoUnset ; _dbg . _ffe . ValAttr . ST_HexColorRGB = v . AsRGBString ( ) ;
} ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// SetPageSizeAndOrientation sets the page size and orientation for a section.
func ( _gdde Section ) SetPageSizeAndOrientation ( w , h _dg . Distance , orientation _gdb . ST_PageOrientation ) { if _gdde . _bcgc . PgSz == nil { _gdde . _bcgc . PgSz = _gdb . NewCT_PageSz ( ) ; } ; _gdde . _bcgc . PgSz . OrientAttr = orientation ; if orientation == _gdb . ST_PageOrientationLandscape { _gdde . _bcgc . PgSz . WAttr = & _de . ST_TwipsMeasure { } ;
_gdde . _bcgc . PgSz . WAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( h / _dg . Twips ) ) ; _gdde . _bcgc . PgSz . HAttr = & _de . ST_TwipsMeasure { } ; _gdde . _bcgc . PgSz . HAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( w / _dg . Twips ) ) ; } else { _gdde . _bcgc . PgSz . WAttr = & _de . ST_TwipsMeasure { } ;
_gdde . _bcgc . PgSz . WAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( w / _dg . Twips ) ) ; _gdde . _bcgc . PgSz . HAttr = & _de . ST_TwipsMeasure { } ; _gdde . _bcgc . PgSz . HAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( h / _dg . Twips ) ) ; } ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// SetLastColumn controls the conditional formatting for the last column in a table.
func ( _efagd TableLook ) SetLastColumn ( on bool ) { if ! on { _efagd . _cdag . LastColumnAttr = & _de . ST_OnOff { } ; _efagd . _cdag . LastColumnAttr . ST_OnOff1 = _de . ST_OnOff1Off ; } else { _efagd . _cdag . LastColumnAttr = & _de . ST_OnOff { } ; _efagd . _cdag . LastColumnAttr . ST_OnOff1 = _de . ST_OnOff1On ;
} ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// GetText returns text in the watermark.
func ( _egbgb * WatermarkText ) GetText ( ) string { _bfaa := _egbgb . getShape ( ) ; if _egbgb . _ddcag != nil { _ecdfe := _egbgb . _ddcag . EG_ShapeElements ; if len ( _ecdfe ) > 0 && _ecdfe [ 0 ] . Textpath != nil { return * _ecdfe [ 0 ] . Textpath . StringAttr ; } ; } else { _fbfgb := _egbgb . findNode ( _bfaa , "\u0074\u0065\u0078\u0074\u0070\u0061\u0074\u0068" ) ;
for _ , _gcbg := range _fbfgb . Attrs { if _gcbg . Name . Local == "\u0073\u0074\u0072\u0069\u006e\u0067" { return _gcbg . Value ; } ; } ; } ; return "" ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// RStyle returns the name of character style.
// It is defined here http://officeopenxml.com/WPstyleCharStyles.php
func ( _gbcd RunProperties ) RStyle ( ) string { if _gbcd . _bace . RStyle != nil { return _gbcd . _bace . RStyle . ValAttr ; } ; return "" ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// ParagraphStyleProperties is the styling information for a paragraph.
type ParagraphStyleProperties struct { _cdeed * _gdb . CT_PPrGeneral } ; func ( _gabc Endnote ) content ( ) [ ] * _gdb . EG_ContentBlockContent { var _acee [ ] * _gdb . EG_ContentBlockContent ; for _ , _dcbb := range _gabc . _baab . EG_BlockLevelElts { _acee = append ( _acee , _dcbb . EG_ContentBlockContent ... ) ;
} ; return _acee ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// UnderlineColor returns the hex color value of paragraph underline.
func ( _ccgdd ParagraphProperties ) UnderlineColor ( ) string { if _gefg := _ccgdd . _egbf . RPr . U ; _gefg != nil { _ebaa := _gefg . ColorAttr ; if _ebaa != nil && _ebaa . ST_HexColorRGB != nil { return * _ebaa . ST_HexColorRGB ; } ; } ; return "" ; } ; func ( _cecbbf * WatermarkPicture ) getShape ( ) * _f . XSDAny { return _cecbbf . getInnerElement ( "\u0073\u0068\u0061p\u0065" ) ;
} ; func ( _edgb Paragraph ) addFldCharsForField ( _dgcd , _baca string ) FormField { _agagd := _edgb . addBeginFldChar ( _dgcd ) ; _bbgef := FormField { _eebdg : _agagd } ; _gcgd := _edgb . _fdec . Bookmarks ( ) ; _dcda := int64 ( len ( _gcgd ) ) ; if _dgcd != "" { _edgb . addStartBookmark ( _dcda , _dgcd ) ;
} ; _edgb . addInstrText ( _baca ) ; _edgb . addSeparateFldChar ( ) ; if _baca == "\u0046\u004f\u0052\u004d\u0054\u0045\u0058\u0054" { _eeddb := _edgb . AddRun ( ) ; _dabb := _gdb . NewEG_RunInnerContent ( ) ; _eeddb . _feebb . EG_RunInnerContent = [ ] * _gdb . EG_RunInnerContent { _dabb } ;
_bbgef . _eaggc = _dabb ; } ; _edgb . addEndFldChar ( ) ; if _dgcd != "" { _edgb . addEndBookmark ( _dcda ) ; } ; return _bbgef ; } ; func _gbfb ( _ccabe * Document , _fdafab Paragraph ) listItemInfo { if _ccabe . Numbering . X ( ) == nil { return listItemInfo { } ; } ; if len ( _ccabe . Numbering . Definitions ( ) ) < 1 { return listItemInfo { } ;
} ; _adfc := _adaba ( _fdafab ) ; if _adfc == nil { return listItemInfo { } ; } ; _cagg := _ccabe . GetNumberingLevelByIds ( _adfc . NumId . ValAttr , _adfc . Ilvl . ValAttr ) ; if _bcbaa := _cagg . X ( ) ; _bcbaa == nil { return listItemInfo { } ; } ; _egba := int64 ( 0 ) ; for _ , _ddaa := range _ccabe . Numbering . _cgbg . Num { if _ddaa != nil && _ddaa . NumIdAttr == _adfc . NumId . ValAttr { _egba = _ddaa . AbstractNumId . ValAttr ;
} ; } ; return listItemInfo { FromParagraph : & _fdafab , AbstractNumId : & _egba , NumberingLevel : & _cagg } ; } ; 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" ; ) ;
2021-05-31 16:22:30 +00:00
2024-09-16 09:59:58 +00:00
// Footnote is an individual footnote reference within the document.
type Footnote struct { _cfee * Document ; _eacb * _gdb . CT_FtnEdn ; } ; func ( _bed * Document ) addFootnotes ( ) { _bed . _bgg = _gdb . NewFootnotes ( ) ; _bed . _bgg . CT_Footnotes = _gdb . CT_Footnotes { } ; _bed . _bgg . Footnote = make ( [ ] * _gdb . CT_FtnEdn , 0 ) ; _bed . ContentTypes . AddOverride ( "\u002f\u0077\u006f\u0072d/\u0066\u006f\u006f\u0074\u006e\u006f\u0074\u0065\u0073\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\u0066\u006f\u006f\u0074n\u006f\u0074\u0065\u0073\u002b\u0078m\u006c" ) ;
_bed . _aed . AddRelationship ( "\u002f\u0077\u006f\u0072d/\u0066\u006f\u006f\u0074\u006e\u006f\u0074\u0065\u0073\u002e\u0078\u006d\u006c" , _f . FootNotesType ) ; _cdab := _bed . Styles . AddStyle ( FootnoteTextStyleId , _gdb . ST_StyleTypeParagraph , false ) ; _cdab . SetName ( "\u0046\u006f\u006f\u0074\u006e\u006f\u0074\u0065\u0020\u0054\u0065\u0078\u0074" ) ;
_cdab . SetBasedOn ( "\u004e\u006f\u0072\u006d\u0061\u006c" ) ; _fbc := _cdab . ParagraphProperties ( ) ; _fbc . X ( ) . SuppressLineNumbers = & _gdb . CT_OnOff { } ; _adab := _cdab . RunProperties ( ) ; _adab . X ( ) . Sz = & _gdb . CT_HpsMeasure { ValAttr : _gdb . ST_HpsMeasure { ST_UnsignedDecimalNumber : & _fbf } } ;
_adab . X ( ) . SzCs = & _gdb . CT_HpsMeasure { ValAttr : _gdb . ST_HpsMeasure { ST_UnsignedDecimalNumber : & _fbf } } ; _dbeb := _bed . Styles . AddStyle ( _gfc , _gdb . ST_StyleTypeCharacter , false ) ; _dbeb . SetName ( "\u0046o\u006ft\u006e\u006f\u0074\u0065\u0020R\u0065\u0066e\u0072\u0065\u006e\u0063\u0065" ) ;
_daf := _dbeb . RunProperties ( ) ; _daf . X ( ) . VertAlign = & _gdb . CT_VerticalAlignRun { ValAttr : _de . ST_VerticalAlignRunSuperscript } ; _bed . addFootnoteSeparator ( ) ; } ;
2021-09-22 16:41:01 +00:00
2024-09-16 09:59:58 +00:00
// SetHangingIndent controls the indentation of the non-first lines in a paragraph.
func ( _badaf ParagraphProperties ) SetHangingIndent ( m _dg . Distance ) { if _badaf . _egbf . Ind == nil { _badaf . _egbf . Ind = _gdb . NewCT_Ind ( ) ; } ; if m == _dg . Zero { _badaf . _egbf . Ind . HangingAttr = nil ; } else { _badaf . _egbf . Ind . HangingAttr = & _de . ST_TwipsMeasure { } ;
_badaf . _egbf . Ind . HangingAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( m / _dg . Twips ) ) ; } ; } ;
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
// AddRun adds a run to a paragraph.
func ( _eegfe Paragraph ) AddRun ( ) Run { _baefb := _gdb . NewEG_PContent ( ) ; _eegfe . _gbaee . EG_PContent = append ( _eegfe . _gbaee . EG_PContent , _baefb ) ; _aeaa := _gdb . NewEG_ContentRunContent ( ) ; _baefb . EG_ContentRunContent = append ( _baefb . EG_ContentRunContent , _aeaa ) ;
_edee := _gdb . NewCT_R ( ) ; _aeaa . R = _edee ; return Run { _eegfe . _fdec , _edee } ; } ; func ( _dfdb * Document ) addFootnoteSeparator ( ) { _dce := _gdb . NewCT_FtnEdn ( ) ; _dce . IdAttr = - 1 ; _dce . TypeAttr = _gdb . ST_FtnEdnSeparator ; _agd := Footnote { _dfdb , _dce } ; _agd . X ( ) . EG_BlockLevelElts = [ ] * _gdb . EG_BlockLevelElts { _gdb . NewEG_BlockLevelElts ( ) } ;
_bab := _agd . AddParagraph ( ) ; _bab . X ( ) . PPr = nil ; _edd := _bab . AddRun ( ) ; _cgef := _edd . newIC ( ) ; _cgef . Separator = _gdb . NewCT_Empty ( ) ; _dfdb . _bgg . CT_Footnotes . Footnote = append ( _dfdb . _bgg . CT_Footnotes . Footnote , _dce ) ; _dce = _gdb . NewCT_FtnEdn ( ) ;
_dce . IdAttr = 0 ; _dce . TypeAttr = _gdb . ST_FtnEdnContinuationSeparator ; _agd = Footnote { _dfdb , _dce } ; _agd . X ( ) . EG_BlockLevelElts = [ ] * _gdb . EG_BlockLevelElts { _gdb . NewEG_BlockLevelElts ( ) } ; _bab = _agd . AddParagraph ( ) ; _bab . X ( ) . PPr = nil ; _edd = _bab . AddRun ( ) ;
_cgef = _edd . newIC ( ) ; _cgef . ContinuationSeparator = _gdb . NewCT_Empty ( ) ; _dfdb . _bgg . CT_Footnotes . Footnote = append ( _dfdb . _bgg . CT_Footnotes . Footnote , _dce ) ; } ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// Style return the table style.
func ( _cbddb Table ) Style ( ) string { if _cbddb . _afabf . TblPr != nil && _cbddb . _afabf . TblPr . TblStyle != nil { return _cbddb . _afabf . TblPr . TblStyle . ValAttr ; } ; return "" ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// SetAlignment positions an anchored image via alignment. Offset is
// incompatible with SetOffset, whichever is called last is applied.
func ( _ca AnchoredDrawing ) SetAlignment ( h _gdb . WdST_AlignH , v _gdb . WdST_AlignV ) { _ca . SetHAlignment ( h ) ; _ca . SetVAlignment ( v ) ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// SetUpdateFieldsOnOpen controls if fields are recalculated upon opening the
// document. This is useful for things like a table of contents as the library
// only adds the field code and relies on Word/LibreOffice to actually compute
// the content.
func ( _cefed Settings ) SetUpdateFieldsOnOpen ( b bool ) { if ! b { _cefed . _bggce . UpdateFields = nil ; } else { _cefed . _bggce . UpdateFields = _gdb . NewCT_OnOff ( ) ; } ; } ;
2024-02-17 03:37:07 +00:00
2024-09-16 09:59:58 +00:00
// SetRight sets the right border to a specified type, color and thickness.
func ( _efbc TableBorders ) SetRight ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _efbc . _gfgae . Right = _gdb . NewCT_Border ( ) ; _beggg ( _efbc . _gfgae . Right , t , c , thickness ) ; } ;
2021-05-31 16:22:30 +00:00
2024-09-16 09:59:58 +00:00
// AddRow adds a row to a table.
func ( _eeace Table ) AddRow ( ) Row { _bgacf := _gdb . NewEG_ContentRowContent ( ) ; _eeace . _afabf . EG_ContentRowContent = append ( _eeace . _afabf . EG_ContentRowContent , _bgacf ) ; _bafbe := _gdb . NewCT_Row ( ) ; _bgacf . Tr = append ( _bgacf . Tr , _bafbe ) ; return Row { _eeace . _feaf , _bafbe } ;
} ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Style returns the style for a paragraph, or an empty string if it is unset.
func ( _ffae Paragraph ) Style ( ) string { if _ffae . _gbaee . PPr != nil && _ffae . _gbaee . PPr . PStyle != nil { return _ffae . _gbaee . PPr . PStyle . ValAttr ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Pict returns the pict object.
func ( _cfgbd * WatermarkPicture ) Pict ( ) * _gdb . CT_Picture { return _cfgbd . _gfaa } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetRight sets the cell right margin
func ( _cda CellMargins ) SetRight ( d _dg . Distance ) { _cda . _cf . Right = _gdb . NewCT_TblWidth ( ) ; _dgf ( _cda . _cf . Right , d ) ; } ; func ( _ggbd * WatermarkPicture ) getShapeType ( ) * _f . XSDAny { return _ggbd . getInnerElement ( "\u0073h\u0061\u0070\u0065\u0074\u0079\u0070e" ) ;
} ; func _geff ( _accd _g . ReaderAt , _ccae int64 , _ebd string ) ( * Document , error ) { const _dbgf = "\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0052\u0065\u0061\u0064" ; if ! _fd . GetLicenseKey ( ) . IsLicensed ( ) && ! _febg { _gb . 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" ) ;
_gb . 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 , _cb . 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" ) ; } ; _bge := "\u0075n\u006b\u006e\u006f\u0077\u006e" ; if _accf , _dgfe := _accd . ( * _ag . File ) ;
_dgfe { _bge = _accf . Name ( ) ; } ; _bdae := New ( ) ; _bdae . Numbering . _cgbg = nil ; if len ( _ebd ) > 0 { _bdae . _edg = _ebd ; } else { _cggb , _agee := _fd . GenRefId ( "\u0064\u0072" ) ; if _agee != nil { _fe . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _agee ) ;
return nil , _agee ; } ; _bdae . _edg = _cggb ; } ; if _ageg := _fd . Track ( _bdae . _edg , _dbgf , _bge ) ; _ageg != nil { _fe . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _ageg ) ; return nil , _ageg ; } ; _gba , _cea := _abd . TempDir ( "\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065-\u0064\u006f\u0063\u0078" ) ;
if _cea != nil { return nil , _cea ; } ; _bdae . TmpPath = _gba ; _afag , _cea := _fa . NewReader ( _accd , _ccae ) ; if _cea != nil { return nil , _gb . Errorf ( "\u0070a\u0072s\u0069\u006e\u0067\u0020\u007a\u0069\u0070\u003a\u0020\u0025\u0073" , _cea ) ; } ; _fabd := [ ] * _fa . File { } ;
_fabd = append ( _fabd , _afag . File ... ) ; _cdfe := false ; for _ , _efeb := range _fabd { if _efeb . FileHeader . Name == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _cdfe = true ; break ; } ; } ; if _cdfe { _bdae . CreateCustomProperties ( ) ;
} ; _fggf := _bdae . _dbc . ConformanceAttr ; _eagg := _gd . DecodeMap { } ; _eagg . SetOnNewRelationshipFunc ( _bdae . onNewRelationship ) ; _eagg . AddTarget ( _f . ContentTypesFilename , _bdae . ContentTypes . X ( ) , "" , 0 ) ; _eagg . AddTarget ( _f . BaseRelsFilename , _bdae . Rels . X ( ) , "" , 0 ) ;
if _fbgc := _eagg . Decode ( _fabd ) ; _fbgc != nil { return nil , _fbgc ; } ; _bdae . _dbc . ConformanceAttr = _fggf ; for _ , _eggb := range _fabd { if _eggb == nil { continue ; } ; if _effe := _bdae . AddExtraFileFromZip ( _eggb ) ; _effe != nil { return nil , _effe ; } ; } ; if _cdfe { _bbced := false ;
for _ , _ggg := range _bdae . Rels . X ( ) . Relationship { if _ggg . TargetAttr == "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" { _bbced = true ; break ; } ; } ; if ! _bbced { _bdae . AddCustomRelationships ( ) ; } ;
} ; return _bdae , nil ; } ; func ( _abba Footnote ) id ( ) int64 { return _abba . _eacb . IdAttr } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetOrigin sets the origin of the image. It defaults to ST_RelFromHPage and
// ST_RelFromVPage
func ( _geb AnchoredDrawing ) SetOrigin ( h _gdb . WdST_RelFromH , v _gdb . WdST_RelFromV ) { _geb . _bc . PositionH . RelativeFromAttr = h ; _geb . _bc . PositionV . RelativeFromAttr = v ; } ; type chart struct { _ffd * _gbd . ChartSpace ; _eea string ; _eec string ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetRightToLeft sets the run text goes from right to left.
func ( _abedea RunProperties ) SetRightToLeft ( b bool ) { if ! b { _abedea . _bace . Rtl = nil ; } else { _abedea . _bace . Rtl = _gdb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetTextWrapNone unsets text wrapping so the image can float on top of the
// text. When used in conjunction with X/Y Offset relative to the page it can be
// used to place a logo at the top of a page at an absolute position that
// doesn't interfere with text.
func ( _bbb AnchoredDrawing ) SetTextWrapNone ( ) { _bbb . _bc . Choice = & _gdb . WdEG_WrapTypeChoice { } ; _bbb . _bc . Choice . WrapNone = _gdb . NewWdCT_WrapNone ( ) ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetBetween sets the between border to a specified type, color and thickness between paragraph.
func ( _aaacb ParagraphBorders ) SetBetween ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _aaacb . _ecade . Between = _gdb . NewCT_Border ( ) ; _fada ( _aaacb . _ecade . Between , t , c , thickness ) ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetLinkedStyle sets the style that this style is linked to.
func ( _efga Style ) SetLinkedStyle ( name string ) { if name == "" { _efga . _gfdb . Link = nil ; } else { _efga . _gfdb . Link = _gdb . NewCT_String ( ) ; _efga . _gfdb . Link . ValAttr = name ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// RemoveParagraph removes a paragraph from a document.
func ( _fcd * Document ) RemoveParagraph ( p Paragraph ) { if _fcd . _dbc . Body == nil { return ; } ; for _ , _gdab := range _fcd . _dbc . Body . EG_BlockLevelElts { for _ , _ccda := range _gdab . EG_ContentBlockContent { for _edge , _cegd := range _ccda . P { if _cegd == p . _gbaee { copy ( _ccda . P [ _edge : ] , _ccda . P [ _edge + 1 : ] ) ;
_ccda . P = _ccda . P [ 0 : len ( _ccda . P ) - 1 ] ; return ; } ; } ; if _ccda . Sdt != nil && _ccda . Sdt . SdtContent != nil && _ccda . Sdt . SdtContent . P != nil { for _aecb , _fafb := range _ccda . Sdt . SdtContent . P { if _fafb == p . _gbaee { copy ( _ccda . P [ _aecb : ] , _ccda . P [ _aecb + 1 : ] ) ;
_ccda . P = _ccda . P [ 0 : len ( _ccda . P ) - 1 ] ; return ; } ; } ; } ; } ; } ; for _ , _aefc := range _fcd . Tables ( ) { for _ , _deba := range _aefc . Rows ( ) { for _ , _abbf := range _deba . Cells ( ) { for _ , _fgcb := range _abbf . _dbf . EG_BlockLevelElts { for _ , _dba := range _fgcb . EG_ContentBlockContent { for _eeec , _cdge := range _dba . P { if _cdge == p . _gbaee { copy ( _dba . P [ _eeec : ] , _dba . P [ _eeec + 1 : ] ) ;
_dba . P = _dba . P [ 0 : len ( _dba . P ) - 1 ] ; return ; } ; } ; } ; } ; } ; } ; } ; for _ , _ccga := range _fcd . Headers ( ) { _ccga . RemoveParagraph ( p ) ; } ; for _ , _dcdd := range _fcd . Footers ( ) { _dcdd . RemoveParagraph ( p ) ; } ; } ;
2022-09-02 11:46:53 +00:00
2024-09-16 09:59:58 +00:00
// SetAll sets all of the borders to a given value.
func ( _eaaa ParagraphBorders ) SetAll ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _eaaa . SetBottom ( t , c , thickness ) ; _eaaa . SetLeft ( t , c , thickness ) ; _eaaa . SetRight ( t , c , thickness ) ; _eaaa . SetTop ( t , c , thickness ) ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SearchStyleByName return style by its name.
func ( _gegeee Styles ) SearchStyleByName ( name string ) ( Style , bool ) { for _ , _babde := range _gegeee . _cadcge . Style { if _babde . Name != nil { if _babde . Name . ValAttr == name { return Style { _babde } , true ; } ; } ; } ; return Style { } , false ; } ; func ( _deaf * Document ) insertStyleFromNode ( _egbe Node ) { if _egbe . Style . X ( ) != nil { if _ , _afegc := _deaf . Styles . SearchStyleById ( _egbe . Style . StyleID ( ) ) ;
! _afegc { _deaf . Styles . InsertStyle ( _egbe . Style ) ; _feadf := _egbe . Style . ParagraphProperties ( ) ; _deaf . insertNumberingFromStyleProperties ( _egbe . _eabe . Numbering , _feadf ) ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Fonts returns the style's Fonts.
func ( _agbbb RunProperties ) Fonts ( ) Fonts { if _agbbb . _bace . RFonts == nil { _agbbb . _bace . RFonts = _gdb . NewCT_Fonts ( ) ; } ; return Fonts { _agbbb . _bace . RFonts } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetHAlignment sets the horizontal alignment for an anchored image.
func ( _abb AnchoredDrawing ) SetHAlignment ( h _gdb . WdST_AlignH ) { _abb . _bc . PositionH . Choice = & _gdb . WdCT_PosHChoice { } ; _abb . _bc . PositionH . Choice . Align = h ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetTextWrapSquare sets the text wrap to square with a given wrap type.
func ( _ccc AnchoredDrawing ) SetTextWrapSquare ( t _gdb . WdST_WrapText ) { _ccc . _bc . Choice = & _gdb . WdEG_WrapTypeChoice { } ; _ccc . _bc . Choice . WrapSquare = _gdb . NewWdCT_WrapSquare ( ) ; _ccc . _bc . Choice . WrapSquare . WrapTextAttr = t ; } ;
2021-04-23 20:00:00 +00:00
2024-07-28 07:48:26 +00:00
// RStyle returns the name of character style.
// It is defined here http://officeopenxml.com/WPstyleCharStyles.php
2024-09-16 09:59:58 +00:00
func ( _beea ParagraphProperties ) RStyle ( ) string { if _beea . _egbf . RPr . RStyle != nil { return _beea . _egbf . RPr . RStyle . ValAttr ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetWidthAuto sets the the table width to automatic.
func ( _ddegd TableProperties ) SetWidthAuto ( ) { _ddegd . _affd . TblW = _gdb . NewCT_TblWidth ( ) ; _ddegd . _affd . TblW . TypeAttr = _gdb . ST_TblWidthAuto ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetNumberingLevel sets the numbering level of a paragraph. If used, then the
// NumberingDefinition must also be set via SetNumberingDefinition or
// SetNumberingDefinitionByID.
func ( _eafd Paragraph ) SetNumberingLevel ( listLevel int ) { _eafd . ensurePPr ( ) ; if _eafd . _gbaee . PPr . NumPr == nil { _eafd . _gbaee . PPr . NumPr = _gdb . NewCT_NumPr ( ) ; } ; _eefb := _gdb . NewCT_DecimalNumber ( ) ; _eefb . ValAttr = int64 ( listLevel ) ; _eafd . _gbaee . PPr . NumPr . Ilvl = _eefb ;
2024-07-28 07:48:26 +00:00
} ;
2023-03-01 18:42:44 +00:00
2024-09-16 09:59:58 +00:00
// AddField adds a field (automatically computed text) to the document.
func ( _dgcde Run ) AddField ( code string ) { _dgcde . AddFieldWithFormatting ( code , "" , true ) } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// TextWithOptions extract text with options.
func ( _aaaac * DocText ) TextWithOptions ( options ExtractTextOptions ) string { _gaac := make ( map [ int64 ] map [ int64 ] int64 , 0 ) ; _ffge := _fc . NewBuffer ( [ ] byte { } ) ; _aaad := int64 ( 0 ) ; _fcbb := int64 ( 0 ) ; _gbff := int64 ( 0 ) ; for _bbcf , _cebfe := range _aaaac . Items { _geeb := false ;
if _cebfe . Text != "" { if _bbcf > 0 { if _cebfe . Paragraph != _aaaac . Items [ _bbcf - 1 ] . Paragraph { _geeb = true ; } ; if ! options . RunsOnNewLine && _geeb { _ffge . WriteString ( "\u000a" ) ; } else if options . RunsOnNewLine { _ffge . WriteString ( "\u000a" ) ; } ; } else { _geeb = true ;
} ; if options . WithNumbering { if _geeb { for _ , _bfg := range _aaaac . _cdbd { if _bfg . FromParagraph == nil { continue ; } ; if _bfg . FromParagraph . X ( ) == _cebfe . Paragraph { if _cdacg := _bfg . NumberingLevel . X ( ) ; _cdacg != nil { if _bfg . AbstractNumId != nil && _aaaac . _eddbf [ * _bfg . AbstractNumId ] [ _cdacg . IlvlAttr ] > 0 { if _ , _abbg := _gaac [ * _bfg . AbstractNumId ] ;
_abbg { if _ , _agddb := _gaac [ * _bfg . AbstractNumId ] [ _cdacg . IlvlAttr ] ; _agddb { _gaac [ * _bfg . AbstractNumId ] [ _cdacg . IlvlAttr ] ++ ; } else { _gaac [ * _bfg . AbstractNumId ] [ _cdacg . IlvlAttr ] = 1 ; } ; } else { _gaac [ * _bfg . AbstractNumId ] = map [ int64 ] int64 { _cdacg . IlvlAttr : 1 } ;
} ; if _aaad == _bfg . NumberingLevel . X ( ) . IlvlAttr && _cdacg . IlvlAttr > 0 { _fcbb ++ ; } else { _fcbb = _gaac [ * _bfg . AbstractNumId ] [ _cdacg . IlvlAttr ] ; if _cdacg . IlvlAttr > _aaad && _gbff == * _bfg . AbstractNumId { _fcbb = 1 ; } ; } ; _dcdge := "" ; if _cdacg . LvlText . ValAttr != nil { _dcdge = * _cdacg . LvlText . ValAttr ;
} ; _fbga := _df . FormatNumberingText ( _fcbb , _cdacg . IlvlAttr , _dcdge , _cdacg . NumFmt , _gaac [ * _bfg . AbstractNumId ] ) ; _ffge . WriteString ( _fbga ) ; _aaaac . _eddbf [ * _bfg . AbstractNumId ] [ _cdacg . IlvlAttr ] -- ; _aaad = _cdacg . IlvlAttr ; _gbff = * _bfg . AbstractNumId ;
if options . NumberingIndent != "" { _ffge . WriteString ( options . NumberingIndent ) ; } ; } ; } ; break ; } ; } ; } ; } ; _ffge . WriteString ( _cebfe . Text ) ; } ; } ; return _ffge . String ( ) ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// ExtractFromHeader returns text from the document header as an array of TextItems.
func ExtractFromHeader ( header * _gdb . Hdr ) [ ] TextItem { return _ddcc ( header . EG_ContentBlockContent , nil ) } ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// Nodes return the document's element as nodes.
func ( _dfef * Document ) Nodes ( ) Nodes { _eaga := [ ] Node { } ; for _ , _abfg := range _dfef . _dbc . Body . EG_BlockLevelElts { _eaga = append ( _eaga , _ggcd ( _dfef , _abfg . EG_ContentBlockContent , nil ) ... ) ; } ; if _dfef . _dbc . Body . SectPr != nil { _eaga = append ( _eaga , Node { _dbca : _dfef . _dbc . Body . SectPr } ) ;
} ; _ggaf := Nodes { _gegee : _eaga } ; return _ggaf ; } ; func ( _acedd Paragraph ) ensurePPr ( ) { if _acedd . _gbaee . PPr == nil { _acedd . _gbaee . PPr = _gdb . NewCT_PPr ( ) ; } ; } ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// SetStyle sets style to the text in watermark.
func ( _cddc * WatermarkText ) SetStyle ( style _gg . TextpathStyle ) { _cacac := _cddc . getShape ( ) ; if _cddc . _ddcag != nil { _dfba := _cddc . _ddcag . EG_ShapeElements ; if len ( _dfba ) > 0 && _dfba [ 0 ] . Textpath != nil { var _bfdc = style . String ( ) ; _dfba [ 0 ] . Textpath . StyleAttr = & _bfdc ;
} ; return ; } ; _cgbfe := _cddc . findNode ( _cacac , "\u0074\u0065\u0078\u0074\u0070\u0061\u0074\u0068" ) ; for _gdcbd , _cbbde := range _cgbfe . Attrs { if _cbbde . Name . Local == "\u0073\u0074\u0079l\u0065" { _cgbfe . Attrs [ _gdcbd ] . Value = style . String ( ) ; } ; } ; } ; func ( _dfea * Document ) GetFontBytesByRelId ( relID string ) ( [ ] byte , error ) { if relID == "" { return nil , nil ;
} ; _cbag := _dfea . _gef . GetTargetByRelId ( relID ) ; _cbag = "\u0077\u006f\u0072d\u002f" + _cbag ; for _ , _gbga := range _dfea . ExtraFiles { if _gbga . ZipPath == _cbag { _gfcc , _cegf := _ag . ReadFile ( _gbga . DiskPath ) ; if _cegf != nil { return nil , _gb . Errorf ( "e\u0072r\u006f\u0072\u0020\u0072\u0065\u0061\u0064\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , _gbga . DiskPath , _cegf ) ;
} ; return _gfcc , nil ; } ; } ; return nil , _gb . Errorf ( "\u0066\u006fn\u0074\u0020\u006e\u006f\u0074\u0020\u0066\u006f\u0075\u006e\u0064\u0020\u0069\u006e\u0020\u0073\u0074\u006f\u0072\u0061\u0067\u0065: \u0025\u0073" , _cbag ) ; } ; func ( _aeeg * Document ) insertImageFromNode ( _afbd Node ) { for _ , _ebgbf := range _afbd . AnchoredDrawings { if _fdgff , _bbabd := _ebgbf . GetImage ( ) ;
_bbabd { _ecfe , _fbcf := _cc . ImageFromFile ( _fdgff . Path ( ) ) ; if _fbcf != nil { _fe . Log . Debug ( "\u0075\u006e\u0061\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0063r\u0065\u0061\u0074\u0065\u0020\u0069\u006d\u0061\u0067\u0065:\u0020\u0025\u0073" , _fbcf ) ; } ;
_dagfc , _fbcf := _aeeg . AddImage ( _ecfe ) ; if _fbcf != nil { _fe . Log . Debug ( "u\u006e\u0061\u0062\u006c\u0065\u0020t\u006f\u0020\u0061\u0064\u0064\u0020i\u006d\u0061\u0067\u0065\u0020\u0074\u006f \u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u003a\u0020%\u0073" , _fbcf ) ;
} ; _adgb := _aeeg . _aed . GetByRelId ( _dagfc . RelID ( ) ) ; _adgb . SetID ( _fdgff . RelID ( ) ) ; } ; } ; for _ , _edca := range _afbd . InlineDrawings { if _gdea , _aacfd := _edca . GetImage ( ) ; _aacfd { _fbbd , _bdbea := _cc . ImageFromFile ( _gdea . Path ( ) ) ; if _bdbea != nil { _fe . Log . Debug ( "\u0075\u006e\u0061\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0063r\u0065\u0061\u0074\u0065\u0020\u0069\u006d\u0061\u0067\u0065:\u0020\u0025\u0073" , _bdbea ) ;
} ; _dbff , _bdbea := _aeeg . AddImage ( _fbbd ) ; if _bdbea != nil { _fe . Log . Debug ( "u\u006e\u0061\u0062\u006c\u0065\u0020t\u006f\u0020\u0061\u0064\u0064\u0020i\u006d\u0061\u0067\u0065\u0020\u0074\u006f \u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u003a\u0020%\u0073" , _bdbea ) ;
} ; _eaafb := _aeeg . _aed . GetByRelId ( _dbff . RelID ( ) ) ; _eaafb . SetID ( _gdea . RelID ( ) ) ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetMultiLevelType sets the multilevel type.
func ( _bggf NumberingDefinition ) SetMultiLevelType ( t _gdb . ST_MultiLevelType ) { if t == _gdb . ST_MultiLevelTypeUnset { _bggf . _gged . MultiLevelType = nil ; } else { _bggf . _gged . MultiLevelType = _gdb . NewCT_MultiLevelType ( ) ; _bggf . _gged . MultiLevelType . ValAttr = t ;
2024-07-28 07:48:26 +00:00
} ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Clear resets the numbering.
func ( _cdbb Numbering ) Clear ( ) { _cdbb . _cgbg . AbstractNum = nil ; _cdbb . _cgbg . Num = nil ; _cdbb . _cgbg . NumIdMacAtCleanup = nil ; _cdbb . _cgbg . NumPicBullet = nil ; } ;
2021-04-23 20:00:00 +00:00
2024-09-16 09:59:58 +00:00
// RemoveMailMerge removes any mail merge settings
func ( _cgcc Settings ) RemoveMailMerge ( ) { _cgcc . _bggce . MailMerge = nil } ;
2021-04-23 20:00:00 +00:00
2024-09-16 09:59:58 +00:00
// DocRels returns document relationship.
func ( _cccb * Document ) DocRels ( ) _cc . Relationships { return _cccb . _aed } ;
2021-07-30 17:03:26 +00:00
2024-09-16 09:59:58 +00:00
// Caps returns true if run font is capitalized.
func ( _abce RunProperties ) Caps ( ) bool { return _cefe ( _abce . _bace . Caps ) } ;
2022-02-05 13:05:36 +00:00
2024-09-16 09:59:58 +00:00
// AddFootnoteReference adds a footnote reference to a run.
func ( _acgf Run ) AddFootnoteReference ( ) { _aagcg := _acgf . newIC ( ) ; _aagcg . FootnoteRef = & _gdb . CT_Empty { } ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// SetWidthAuto sets the the cell width to automatic.
func ( _aced CellProperties ) SetWidthAuto ( ) { _aced . _debd . TcW = _gdb . NewCT_TblWidth ( ) ; _aced . _debd . TcW . TypeAttr = _gdb . ST_TblWidthAuto ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// GetHeader gets a section Header for given type t [ST_HdrFtrDefault, ST_HdrFtrEven, ST_HdrFtrFirst]
func ( _cfae Section ) GetHeader ( t _gdb . ST_HdrFtr ) ( Header , bool ) { for _ , _ffbga := range _cfae . _bcgc . EG_HdrFtrReferences { if _ffbga . HeaderReference . TypeAttr == t { for _ , _aagdc := range _cfae . _aaaeb . Headers ( ) { _ebbd := _cfae . _aaaeb . _aed . FindRIDForN ( _aagdc . Index ( ) , _f . HeaderType ) ;
if _ebbd == _ffbga . HeaderReference . IdAttr { return _aagdc , true ; } ; } ; } ; } ; return Header { } , false ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// SetLeft sets the left border to a specified type, color and thickness.
func ( _agb CellBorders ) SetLeft ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _agb . _ebf . Left = _gdb . NewCT_Border ( ) ; _beggg ( _agb . _ebf . Left , t , c , thickness ) ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// Paragraphs returns the paragraphs defined in a footer.
func ( _gaee Footer ) Paragraphs ( ) [ ] Paragraph { _ebgd := [ ] Paragraph { } ; for _ , _eedg := range _gaee . _dbdg . EG_ContentBlockContent { for _ , _dcge := range _eedg . P { _ebgd = append ( _ebgd , Paragraph { _gaee . _dgbc , _dcge } ) ; } ; } ; for _ , _bfd := range _gaee . Tables ( ) { for _ , _fecdc := range _bfd . Rows ( ) { for _ , _befe := range _fecdc . Cells ( ) { _ebgd = append ( _ebgd , _befe . Paragraphs ( ) ... ) ;
} ; } ; } ; return _ebgd ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _bdgea Settings ) X ( ) * _gdb . Settings { return _bdgea . _bggce } ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// SetBottom sets the cell bottom margin
func ( _bgf CellMargins ) SetBottom ( d _dg . Distance ) { _bgf . _cf . Bottom = _gdb . NewCT_TblWidth ( ) ; _dgf ( _bgf . _cf . Bottom , d ) ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// SetCantSplit set row properties for Can't Split value.
func ( _gfaee RowProperties ) SetCantSplit ( val bool ) { if ! val { _gfaee . _aggd . CantSplit = nil ; } else { _bbaec := _gdb . NewCT_OnOff ( ) ; _gfaee . _aggd . CantSplit = [ ] * _gdb . CT_OnOff { _bbaec } ; } ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _bgdcf ParagraphProperties ) X ( ) * _gdb . CT_PPr { return _bgdcf . _egbf } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// IsFootnote returns a bool based on whether the run has a
// footnote or not. Returns both a bool as to whether it has
// a footnote as well as the ID of the footnote.
func ( _cafab Run ) IsFootnote ( ) ( bool , int64 ) { if _cafab . _feebb . EG_RunInnerContent != nil { if _cafab . _feebb . EG_RunInnerContent [ 0 ] . FootnoteReference != nil { return true , _cafab . _feebb . EG_RunInnerContent [ 0 ] . FootnoteReference . IdAttr ; } ; } ; return false , 0 ;
2024-07-28 07:48:26 +00:00
} ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// Properties returns the run properties.
func ( _babb Run ) Properties ( ) RunProperties { if _babb . _feebb . RPr == nil { _babb . _feebb . RPr = _gdb . NewCT_RPr ( ) ; } ; return RunProperties { _babb . _feebb . RPr } ; } ; func _dgf ( _aeg * _gdb . CT_TblWidth , _gdga _dg . Distance ) { _aeg . TypeAttr = _gdb . ST_TblWidthDxa ;
_aeg . WAttr = & _gdb . ST_MeasurementOrPercent { } ; _aeg . WAttr . ST_DecimalNumberOrPercent = & _gdb . ST_DecimalNumberOrPercent { } ; _aeg . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _f . Int64 ( int64 ( _gdga / _dg . Dxa ) ) ; } ;
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
// AddTable adds a table to the table cell.
func ( _ec Cell ) AddTable ( ) Table { _agf := _gdb . NewEG_BlockLevelElts ( ) ; _ec . _dbf . EG_BlockLevelElts = append ( _ec . _dbf . EG_BlockLevelElts , _agf ) ; _dcdg := _gdb . NewEG_ContentBlockContent ( ) ; _agf . EG_ContentBlockContent = append ( _agf . EG_ContentBlockContent , _dcdg ) ;
_acc := _gdb . NewCT_Tbl ( ) ; _dcdg . Tbl = append ( _dcdg . Tbl , _acc ) ; return Table { _ec . _age , _acc } ; } ;
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
// Numbering is the document wide numbering styles contained in numbering.xml.
type Numbering struct { _cgbg * _gdb . Numbering } ;
2024-05-04 18:48:06 +00:00
2024-09-16 09:59:58 +00:00
// TableWidth controls width values in table settings.
type TableWidth struct { _fcfca * _gdb . CT_TblWidth } ;
2022-01-15 21:17:38 +00:00
2024-09-16 09:59:58 +00:00
// AddParagraph adds a paragraph to the footnote.
func ( _bgag Footnote ) AddParagraph ( ) Paragraph { _gfbb := _gdb . NewEG_ContentBlockContent ( ) ; _bfacd := len ( _bgag . _eacb . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent ) ; _bgag . _eacb . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent = append ( _bgag . _eacb . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent , _gfbb ) ;
_cgae := _gdb . NewCT_P ( ) ; var _fcbad * _gdb . CT_String ; if _bfacd != 0 { _ggeae := len ( _bgag . _eacb . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent [ _bfacd - 1 ] . P ) ; _fcbad = _bgag . _eacb . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent [ _bfacd - 1 ] . P [ _ggeae - 1 ] . PPr . PStyle ;
} else { _fcbad = _gdb . NewCT_String ( ) ; _fcbad . ValAttr = FootnoteTextStyleId ; } ; _gfbb . P = append ( _gfbb . P , _cgae ) ; _adggf := Paragraph { _bgag . _cfee , _cgae } ; _adggf . _gbaee . PPr = _gdb . NewCT_PPr ( ) ; _adggf . _gbaee . PPr . PStyle = _fcbad ; _adggf . _gbaee . PPr . RPr = _gdb . NewCT_ParaRPr ( ) ;
return _adggf ; } ;
2021-04-23 20:00:00 +00:00
2024-09-16 09:59:58 +00:00
// Copy makes a deep copy of the document by saving and reading it back.
// It can be useful to avoid sharing common data between two documents.
func ( _fedc * Document ) Copy ( ) ( * Document , error ) { _bccb := _fc . NewBuffer ( [ ] byte { } ) ; _eggg := _fedc . save ( _bccb , _fedc . _edg ) ; if _eggg != nil { return nil , _eggg ; } ; _cbded := _bccb . Bytes ( ) ; _acga := _fc . NewReader ( _cbded ) ; return _geff ( _acga , int64 ( _acga . Len ( ) ) , _fedc . _edg ) ;
} ;
2021-04-23 20:00:00 +00:00
2024-09-16 09:59:58 +00:00
// IsChecked returns true if a FormFieldTypeCheckBox is checked.
func ( _fgcf FormField ) IsChecked ( ) bool { if _fgcf . _eebdg . CheckBox == nil { return false ; } ; if _fgcf . _eebdg . CheckBox . Checked != nil { return true ; } ; return false ; } ;
2022-09-02 11:46:53 +00:00
2024-09-16 09:59:58 +00:00
// AddParagraph adds a paragraph to the header.
func ( _dfbf Header ) AddParagraph ( ) Paragraph { _feege := _gdb . NewEG_ContentBlockContent ( ) ; _dfbf . _eeee . EG_ContentBlockContent = append ( _dfbf . _eeee . EG_ContentBlockContent , _feege ) ; _ggab := _gdb . NewCT_P ( ) ; _feege . P = append ( _feege . P , _ggab ) ; return Paragraph { _dfbf . _ddgg , _ggab } ;
} ; func ( _bbcfc Styles ) initializeDocDefaults ( ) { _bbcfc . _cadcge . DocDefaults = _gdb . NewCT_DocDefaults ( ) ; _bbcfc . _cadcge . DocDefaults . RPrDefault = _gdb . NewCT_RPrDefault ( ) ; _bbcfc . _cadcge . DocDefaults . RPrDefault . RPr = _gdb . NewCT_RPr ( ) ; _eefe := RunProperties { _bbcfc . _cadcge . DocDefaults . RPrDefault . RPr } ;
_eefe . SetSize ( 12 * _dg . Point ) ; _eefe . Fonts ( ) . SetASCIITheme ( _gdb . ST_ThemeMajorAscii ) ; _eefe . Fonts ( ) . SetEastAsiaTheme ( _gdb . ST_ThemeMajorEastAsia ) ; _eefe . Fonts ( ) . SetHANSITheme ( _gdb . ST_ThemeMajorHAnsi ) ; _eefe . Fonts ( ) . SetCSTheme ( _gdb . ST_ThemeMajorBidi ) ;
_eefe . X ( ) . Lang = _gdb . NewCT_Language ( ) ; _eefe . X ( ) . Lang . ValAttr = _f . String ( "\u0065\u006e\u002dU\u0053" ) ; _eefe . X ( ) . Lang . EastAsiaAttr = _f . String ( "\u0065\u006e\u002dU\u0053" ) ; _eefe . X ( ) . Lang . BidiAttr = _f . String ( "\u0061\u0072\u002dS\u0041" ) ;
_bbcfc . _cadcge . DocDefaults . PPrDefault = _gdb . NewCT_PPrDefault ( ) ; } ;
2021-04-23 20:00:00 +00:00
2024-09-16 09:59:58 +00:00
// ParagraphStyles returns only the paragraph styles.
func ( _dccgf Styles ) ParagraphStyles ( ) [ ] Style { _ccaed := [ ] Style { } ; for _ , _eacac := range _dccgf . _cadcge . Style { if _eacac . TypeAttr != _gdb . ST_StyleTypeParagraph { continue ; } ; _ccaed = append ( _ccaed , Style { _eacac } ) ; } ; return _ccaed ; } ;
2023-07-04 11:04:03 +00:00
2024-09-16 09:59:58 +00:00
// Runs returns all of the runs in a paragraph.
func ( _efbgc Paragraph ) Runs ( ) [ ] Run { _fgbff := [ ] Run { } ; for _ , _beaa := range _efbgc . _gbaee . EG_PContent { if _beaa . Hyperlink != nil && _beaa . Hyperlink . EG_ContentRunContent != nil { for _ , _febd := range _beaa . Hyperlink . EG_ContentRunContent { if _febd . R != nil { _fgbff = append ( _fgbff , Run { _efbgc . _fdec , _febd . R } ) ;
} ; } ; } ; for _ , _ddeg := range _beaa . EG_ContentRunContent { if _ddeg . R != nil { _fgbff = append ( _fgbff , Run { _efbgc . _fdec , _ddeg . R } ) ; } ; if _ddeg . Sdt != nil && _ddeg . Sdt . SdtContent != nil { for _ , _cadcg := range _ddeg . Sdt . SdtContent . EG_ContentRunContent { if _cadcg . R != nil { _fgbff = append ( _fgbff , Run { _efbgc . _fdec , _cadcg . R } ) ;
} ; } ; } ; } ; } ; return _fgbff ; } ;
2021-04-23 20:00:00 +00:00
2024-09-16 09:59:58 +00:00
// SetStrikeThrough sets the run to strike-through.
func ( _fgef RunProperties ) SetStrikeThrough ( b bool ) { if ! b { _fgef . _bace . Strike = nil ; } else { _fgef . _bace . Strike = _gdb . NewCT_OnOff ( ) ; } ; } ; func _dedc ( _baga * _gdb . CT_P , _bdfdc * _gdb . CT_Hyperlink , _gafc * TableInfo , _dabe * DrawingInfo , _gcdf [ ] * _gdb . EG_PContent ) [ ] TextItem { if len ( _gcdf ) == 0 { return [ ] TextItem { TextItem { Text : "" , DrawingInfo : _dabe , Paragraph : _baga , Hyperlink : _bdfdc , Run : nil , TableInfo : _gafc } } ;
} ; _cdcgg := [ ] TextItem { } ; for _ , _gecbf := range _gcdf { for _ , _cabd := range _gecbf . FldSimple { if _cabd != nil { _cdcgg = append ( _cdcgg , _dedc ( _baga , _bdfdc , _gafc , _dabe , _cabd . EG_PContent ) ... ) ; } ; } ; if _cgga := _gecbf . Hyperlink ; _cgga != nil { _cdcgg = append ( _cdcgg , _acacd ( _baga , _cgga , _gafc , _dabe , _cgga . EG_ContentRunContent ) ... ) ;
} ; _cdcgg = append ( _cdcgg , _acacd ( _baga , nil , _gafc , _dabe , _gecbf . EG_ContentRunContent ) ... ) ; } ; return _cdcgg ; } ;
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
// AddBreak adds a line break to a run.
func ( _dedg Run ) AddBreak ( ) { _dgcf := _dedg . newIC ( ) ; _dgcf . Br = _gdb . NewCT_Br ( ) } ;
2023-08-06 17:57:53 +00:00
2024-09-16 09:59:58 +00:00
// InsertRunAfter inserts a run in the paragraph after the relative run.
func ( _fadf Paragraph ) InsertRunAfter ( relativeTo Run ) Run { return _fadf . insertRun ( relativeTo , false ) } ;
2021-04-23 20:00:00 +00:00
2024-09-16 09:59:58 +00:00
// Nodes contains slice of Node element.
type Nodes struct { _gegee [ ] Node } ;
2023-06-10 07:12:37 +00:00
2024-09-16 09:59:58 +00:00
// SetBehindDoc sets the behindDoc attribute of anchor.
func ( _bgc AnchoredDrawing ) SetBehindDoc ( val bool ) { _bgc . _bc . BehindDocAttr = val } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _gadg Footer ) X ( ) * _gdb . Ftr { return _gadg . _dbdg } ;
2024-05-04 18:48:06 +00:00
2024-09-16 09:59:58 +00:00
// SetFooter sets a section footer.
func ( _cddd Section ) SetFooter ( f Footer , t _gdb . ST_HdrFtr ) { _gffcag := _gdb . NewEG_HdrFtrReferences ( ) ; _cddd . _bcgc . EG_HdrFtrReferences = append ( _cddd . _bcgc . EG_HdrFtrReferences , _gffcag ) ; _gffcag . FooterReference = _gdb . NewCT_HdrFtrRef ( ) ; _gffcag . FooterReference . TypeAttr = t ;
_befg := _cddd . _aaaeb . _aed . FindRIDForN ( f . Index ( ) , _f . FooterType ) ; if _befg == "" { _fe . Log . Debug ( "\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" ) ;
} ; _gffcag . FooterReference . IdAttr = _befg ; } ;
2024-05-04 18:48:06 +00:00
2024-09-16 09:59:58 +00:00
// SetBottom sets the bottom border to a specified type, color and thickness.
func ( _cce CellBorders ) SetBottom ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _cce . _ebf . Bottom = _gdb . NewCT_Border ( ) ; _beggg ( _cce . _ebf . Bottom , t , c , thickness ) ; } ;
2022-01-15 21:17:38 +00:00
2024-09-16 09:59:58 +00:00
// SetCellSpacingPercent sets the cell spacing within a table to a percent width.
func ( _adac TableProperties ) SetCellSpacingPercent ( pct float64 ) { _adac . _affd . TblCellSpacing = _gdb . NewCT_TblWidth ( ) ; _adac . _affd . TblCellSpacing . TypeAttr = _gdb . ST_TblWidthPct ; _adac . _affd . TblCellSpacing . WAttr = & _gdb . ST_MeasurementOrPercent { } ;
_adac . _affd . TblCellSpacing . WAttr . ST_DecimalNumberOrPercent = & _gdb . ST_DecimalNumberOrPercent { } ; _adac . _affd . TblCellSpacing . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _f . Int64 ( int64 ( pct * 50 ) ) ; } ;
2022-01-15 21:17:38 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _feadg Row ) X ( ) * _gdb . CT_Row { return _feadg . _begf } ;
2022-01-15 21:17:38 +00:00
2024-09-16 09:59:58 +00:00
// SetLeft sets the cell left margin
func ( _dbb CellMargins ) SetLeft ( d _dg . Distance ) { _dbb . _cf . Left = _gdb . NewCT_TblWidth ( ) ; _dgf ( _dbb . _cf . Left , d ) ; } ;
2022-01-15 21:17:38 +00:00
2024-09-16 09:59:58 +00:00
// GetColor returns the color.Color object representing the run color.
func ( _dedcb ParagraphProperties ) GetColor ( ) _gbc . Color { if _eagcb := _dedcb . _egbf . RPr . Color ; _eagcb != nil { _cfbf := _eagcb . ValAttr ; if _cfbf . ST_HexColorRGB != nil { return _gbc . FromHex ( * _cfbf . ST_HexColorRGB ) ; } ; } ; return _gbc . Color { } ; } ;
2022-01-15 21:17:38 +00:00
2024-09-16 09:59:58 +00:00
// RunProperties controls run styling properties.
type RunProperties struct { _bace * _gdb . CT_RPr } ;
2022-01-15 21:17:38 +00:00
2024-09-16 09:59:58 +00:00
// Value returns the tring value of a FormFieldTypeText or FormFieldTypeDropDown.
func ( _dadc FormField ) Value ( ) string { if _dadc . _eebdg . TextInput != nil && _dadc . _eaggc . T != nil { return _dadc . _eaggc . T . Content ; } else if _dadc . _eebdg . DdList != nil && _dadc . _eebdg . DdList . Result != nil { _cece := _dadc . PossibleValues ( ) ; _bffd := int ( _dadc . _eebdg . DdList . Result . ValAttr ) ;
if _bffd < len ( _cece ) { return _cece [ _bffd ] ; } ; } else if _dadc . _eebdg . CheckBox != nil { if _dadc . IsChecked ( ) { return "\u0074\u0072\u0075\u0065" ; } ; return "\u0066\u0061\u006cs\u0065" ; } ; return "" ; } ;
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
// Node is document element node,
// contains Paragraph or Table element.
type Node struct { _eabe * Document ; _dbca interface { } ; Style Style ; AnchoredDrawings [ ] AnchoredDrawing ; InlineDrawings [ ] InlineDrawing ; Children [ ] Node ; } ;
2021-08-23 20:44:48 +00:00
2024-09-16 09:59:58 +00:00
// SetLeft sets the left border to a specified type, color and thickness.
func ( _afgb ParagraphBorders ) SetLeft ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _afgb . _ecade . Left = _gdb . NewCT_Border ( ) ; _fada ( _afgb . _ecade . Left , t , c , thickness ) ; } ;
2022-02-25 19:20:45 +00:00
2024-09-16 09:59:58 +00:00
// TableProperties returns the table style properties.
func ( _cabf Style ) TableProperties ( ) TableStyleProperties { if _cabf . _gfdb . TblPr == nil { _cabf . _gfdb . TblPr = _gdb . NewCT_TblPrBase ( ) ; } ; return TableStyleProperties { _cabf . _gfdb . TblPr } ; } ;
2022-02-25 19:20:45 +00:00
2024-09-16 09:59:58 +00:00
// AddImageRef add ImageRef to header as relationship, returning ImageRef
// that can be used to be placed as header content.
func ( _fdcc Header ) AddImageRef ( r _cc . ImageRef ) ( _cc . ImageRef , error ) { var _eebcd _cc . Relationships ; for _geee , _bfda := range _fdcc . _ddgg . _agfcg { if _bfda == _fdcc . _eeee { _eebcd = _fdcc . _ddgg . _fgd [ _geee ] ; } ; } ; _bddfc := _eebcd . AddRelationship ( r . Target ( ) , _f . ImageType ) ;
r . SetRelID ( _bddfc . X ( ) . IdAttr ) ; return r , nil ; } ;
2022-02-25 19:20:45 +00:00
2024-09-16 09:59:58 +00:00
// Type returns the type of the field.
func ( _ffeb FormField ) Type ( ) FormFieldType { if _ffeb . _eebdg . TextInput != nil { return FormFieldTypeText ; } else if _ffeb . _eebdg . CheckBox != nil { return FormFieldTypeCheckBox ; } else if _ffeb . _eebdg . DdList != nil { return FormFieldTypeDropDown ; } ; return FormFieldTypeUnknown ;
} ;
2023-09-16 17:56:36 +00:00
2024-09-16 09:59:58 +00:00
// SetValue sets the width value.
func ( _gffd TableWidth ) SetValue ( m _dg . Distance ) { _gffd . _fcfca . WAttr = & _gdb . ST_MeasurementOrPercent { } ; _gffd . _fcfca . WAttr . ST_DecimalNumberOrPercent = & _gdb . ST_DecimalNumberOrPercent { } ; _gffd . _fcfca . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _f . Int64 ( int64 ( m / _dg . Twips ) ) ;
_gffd . _fcfca . TypeAttr = _gdb . ST_TblWidthDxa ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// X return slice of node.
func ( _abgg * Nodes ) X ( ) [ ] Node { return _abgg . _gegee } ; type listItemInfo struct { FromStyle * Style ; FromParagraph * Paragraph ; AbstractNumId * int64 ; NumberingLevel * NumberingLevel ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Text return node and its child text,
func ( _dadbb * Node ) Text ( ) string { _gcgc := _fc . NewBuffer ( [ ] byte { } ) ; switch _gaeea := _dadbb . X ( ) . ( type ) { case * Paragraph : for _ , _fggb := range _gaeea . Runs ( ) { if _fggb . Text ( ) != "" { _gcgc . WriteString ( _fggb . Text ( ) ) ; _gcgc . WriteString ( "\u000a" ) ; } ; } ;
} ; for _ , _cfda := range _dadbb . Children { _gcgc . WriteString ( _cfda . Text ( ) ) ; } ; return _gcgc . String ( ) ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// 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 * _gdb . CT_P ; Hyperlink * _gdb . CT_Hyperlink ; Run * _gdb . CT_R ; TableInfo * TableInfo ; } ; func _fegg ( ) * _eb . Textpath { _fgcea := _eb . NewTextpath ( ) ; _fgcea . OnAttr = _de . ST_TrueFalseTrue ;
_fgcea . FitshapeAttr = _de . ST_TrueFalseTrue ; return _fgcea ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Underline returns the type of run underline.
func ( _ccec RunProperties ) Underline ( ) _gdb . ST_Underline { if _egaea := _ccec . _bace . U ; _egaea != nil { return _egaea . ValAttr ; } ; return 0 ; } ; func ( _edfb Styles ) initializeStyleDefaults ( ) { _fcge := _edfb . AddStyle ( "\u004e\u006f\u0072\u006d\u0061\u006c" , _gdb . ST_StyleTypeParagraph , true ) ;
_fcge . SetName ( "\u004e\u006f\u0072\u006d\u0061\u006c" ) ; _fcge . SetPrimaryStyle ( true ) ; _bgffd := _edfb . AddStyle ( "D\u0065f\u0061\u0075\u006c\u0074\u0050\u0061\u0072\u0061g\u0072\u0061\u0070\u0068Fo\u006e\u0074" , _gdb . ST_StyleTypeCharacter , true ) ; _bgffd . SetName ( "\u0044\u0065\u0066\u0061ul\u0074\u0020\u0050\u0061\u0072\u0061\u0067\u0072\u0061\u0070\u0068\u0020\u0046\u006fn\u0074" ) ;
_bgffd . SetUISortOrder ( 1 ) ; _bgffd . SetSemiHidden ( true ) ; _bgffd . SetUnhideWhenUsed ( true ) ; _feede := _edfb . AddStyle ( "\u0054i\u0074\u006c\u0065\u0043\u0068\u0061r" , _gdb . ST_StyleTypeCharacter , false ) ; _feede . SetName ( "\u0054\u0069\u0074\u006c\u0065\u0020\u0043\u0068\u0061\u0072" ) ;
_feede . SetBasedOn ( _bgffd . StyleID ( ) ) ; _feede . SetLinkedStyle ( "\u0054\u0069\u0074l\u0065" ) ; _feede . SetUISortOrder ( 10 ) ; _feede . RunProperties ( ) . Fonts ( ) . SetASCIITheme ( _gdb . ST_ThemeMajorAscii ) ; _feede . RunProperties ( ) . Fonts ( ) . SetEastAsiaTheme ( _gdb . ST_ThemeMajorEastAsia ) ;
_feede . RunProperties ( ) . Fonts ( ) . SetHANSITheme ( _gdb . ST_ThemeMajorHAnsi ) ; _feede . RunProperties ( ) . Fonts ( ) . SetCSTheme ( _gdb . ST_ThemeMajorBidi ) ; _feede . RunProperties ( ) . SetSize ( 28 * _dg . Point ) ; _feede . RunProperties ( ) . SetKerning ( 14 * _dg . Point ) ; _feede . RunProperties ( ) . SetCharacterSpacing ( - 10 * _dg . Twips ) ;
_adbaa := _edfb . AddStyle ( "\u0054\u0069\u0074l\u0065" , _gdb . ST_StyleTypeParagraph , false ) ; _adbaa . SetName ( "\u0054\u0069\u0074l\u0065" ) ; _adbaa . SetBasedOn ( _fcge . StyleID ( ) ) ; _adbaa . SetNextStyle ( _fcge . StyleID ( ) ) ; _adbaa . SetLinkedStyle ( _feede . StyleID ( ) ) ;
_adbaa . SetUISortOrder ( 10 ) ; _adbaa . SetPrimaryStyle ( true ) ; _adbaa . ParagraphProperties ( ) . SetContextualSpacing ( true ) ; _adbaa . RunProperties ( ) . Fonts ( ) . SetASCIITheme ( _gdb . ST_ThemeMajorAscii ) ; _adbaa . RunProperties ( ) . Fonts ( ) . SetEastAsiaTheme ( _gdb . ST_ThemeMajorEastAsia ) ;
_adbaa . RunProperties ( ) . Fonts ( ) . SetHANSITheme ( _gdb . ST_ThemeMajorHAnsi ) ; _adbaa . RunProperties ( ) . Fonts ( ) . SetCSTheme ( _gdb . ST_ThemeMajorBidi ) ; _adbaa . RunProperties ( ) . SetSize ( 28 * _dg . Point ) ; _adbaa . RunProperties ( ) . SetKerning ( 14 * _dg . Point ) ; _adbaa . RunProperties ( ) . SetCharacterSpacing ( - 10 * _dg . Twips ) ;
_dfeaf := _edfb . AddStyle ( "T\u0061\u0062\u006c\u0065\u004e\u006f\u0072\u006d\u0061\u006c" , _gdb . ST_StyleTypeTable , false ) ; _dfeaf . SetName ( "\u004e\u006f\u0072m\u0061\u006c\u0020\u0054\u0061\u0062\u006c\u0065" ) ; _dfeaf . SetUISortOrder ( 99 ) ; _dfeaf . SetSemiHidden ( true ) ;
_dfeaf . SetUnhideWhenUsed ( true ) ; _dfeaf . X ( ) . TblPr = _gdb . NewCT_TblPrBase ( ) ; _ddbgd := NewTableWidth ( ) ; _dfeaf . X ( ) . TblPr . TblInd = _ddbgd . X ( ) ; _ddbgd . SetValue ( 0 * _dg . Dxa ) ; _dfeaf . X ( ) . TblPr . TblCellMar = _gdb . NewCT_TblCellMar ( ) ; _ddbgd = NewTableWidth ( ) ;
_dfeaf . X ( ) . TblPr . TblCellMar . Top = _ddbgd . X ( ) ; _ddbgd . SetValue ( 0 * _dg . Dxa ) ; _ddbgd = NewTableWidth ( ) ; _dfeaf . X ( ) . TblPr . TblCellMar . Bottom = _ddbgd . X ( ) ; _ddbgd . SetValue ( 0 * _dg . Dxa ) ; _ddbgd = NewTableWidth ( ) ; _dfeaf . X ( ) . TblPr . TblCellMar . Left = _ddbgd . X ( ) ;
_ddbgd . SetValue ( 108 * _dg . Dxa ) ; _ddbgd = NewTableWidth ( ) ; _dfeaf . X ( ) . TblPr . TblCellMar . Right = _ddbgd . X ( ) ; _ddbgd . SetValue ( 108 * _dg . Dxa ) ; _adfea := _edfb . AddStyle ( "\u004e\u006f\u004c\u0069\u0073\u0074" , _gdb . ST_StyleTypeNumbering , false ) ; _adfea . SetName ( "\u004eo\u0020\u004c\u0069\u0073\u0074" ) ;
_adfea . SetUISortOrder ( 1 ) ; _adfea . SetSemiHidden ( true ) ; _adfea . SetUnhideWhenUsed ( true ) ; _eefc := [ ] _dg . Distance { 16 , 13 , 12 , 11 , 11 , 11 , 11 , 11 , 11 } ; _efbb := [ ] _dg . Distance { 240 , 40 , 40 , 40 , 40 , 40 , 40 , 40 , 40 } ; for _edede := 0 ; _edede < 9 ; _edede ++ { _cffgc := _gb . Sprintf ( "\u0048e\u0061\u0064\u0069\u006e\u0067\u0025d" , _edede + 1 ) ;
_aeff := _edfb . AddStyle ( _cffgc + "\u0043\u0068\u0061\u0072" , _gdb . ST_StyleTypeCharacter , false ) ; _aeff . SetName ( _gb . Sprintf ( "\u0048e\u0061d\u0069\u006e\u0067\u0020\u0025\u0064\u0020\u0043\u0068\u0061\u0072" , _edede + 1 ) ) ; _aeff . SetBasedOn ( _bgffd . StyleID ( ) ) ;
_aeff . SetLinkedStyle ( _cffgc ) ; _aeff . SetUISortOrder ( 9 + _edede ) ; _aeff . RunProperties ( ) . SetSize ( _eefc [ _edede ] * _dg . Point ) ; _dgac := _edfb . AddStyle ( _cffgc , _gdb . ST_StyleTypeParagraph , false ) ; _dgac . SetName ( _gb . Sprintf ( "\u0068\u0065\u0061\u0064\u0069\u006e\u0067\u0020\u0025\u0064" , _edede + 1 ) ) ;
_dgac . SetNextStyle ( _fcge . StyleID ( ) ) ; _dgac . SetLinkedStyle ( _dgac . StyleID ( ) ) ; _dgac . SetUISortOrder ( 9 + _edede ) ; _dgac . SetPrimaryStyle ( true ) ; _dgac . ParagraphProperties ( ) . SetKeepNext ( true ) ; _dgac . ParagraphProperties ( ) . SetSpacing ( _efbb [ _edede ] * _dg . Twips , 0 ) ;
_dgac . ParagraphProperties ( ) . SetOutlineLevel ( _edede ) ; _dgac . RunProperties ( ) . SetSize ( _eefc [ _edede ] * _dg . Point ) ; } ; } ;
2023-09-16 17:56:36 +00:00
2024-09-16 09:59:58 +00:00
// SetLineSpacing sets the spacing between lines in a paragraph.
func ( _bgfe ParagraphSpacing ) SetLineSpacing ( d _dg . Distance , rule _gdb . ST_LineSpacingRule ) { if rule == _gdb . ST_LineSpacingRuleUnset { _bgfe . _fggcd . LineRuleAttr = _gdb . ST_LineSpacingRuleUnset ; _bgfe . _fggcd . LineAttr = nil ; } else { _bgfe . _fggcd . LineRuleAttr = rule ;
_bgfe . _fggcd . LineAttr = & _gdb . ST_SignedTwipsMeasure { } ; _bgfe . _fggcd . LineAttr . Int64 = _f . Int64 ( int64 ( d / _dg . Twips ) ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// ReplaceTextByRegexp replace the text within node using regexp expression.
func ( _adaa * Node ) ReplaceTextByRegexp ( rgx * _d . Regexp , newText string ) { switch _cfce := _adaa . X ( ) . ( type ) { case * Paragraph : for _ , _dceea := range _cfce . Runs ( ) { for _ , _bedbf := range _dceea . _feebb . EG_RunInnerContent { if _bedbf . T != nil { _ebcf := _bedbf . T . Content ;
_ebcf = rgx . ReplaceAllString ( _ebcf , newText ) ; _bedbf . T . Content = _ebcf ; } ; } ; } ; } ; for _ , _ddec := range _adaa . Children { _ddec . ReplaceTextByRegexp ( rgx , newText ) ; } ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// DrawingInline return a slice of InlineDrawings.
func ( _edde Run ) DrawingInline ( ) [ ] InlineDrawing { _agadc := [ ] InlineDrawing { } ; for _ , _bbac := range _edde . _feebb . EG_RunInnerContent { if _bbac . Drawing == nil { continue ; } ; for _ , _facgf := range _bbac . Drawing . Inline { _agadc = append ( _agadc , InlineDrawing { _edde . _ecda , _facgf } ) ;
} ; } ; return _agadc ; } ; func ( _acfb Document ) mergeFields ( ) [ ] mergeFieldInfo { _ceff := [ ] Paragraph { } ; _cdea := [ ] mergeFieldInfo { } ; for _ , _bfeb := range _acfb . Tables ( ) { for _ , _aggfg := range _bfeb . Rows ( ) { for _ , _facd := range _aggfg . Cells ( ) { _ceff = append ( _ceff , _facd . Paragraphs ( ) ... ) ;
} ; } ; } ; _ceff = append ( _ceff , _acfb . Paragraphs ( ) ... ) ; for _ , _bebc := range _acfb . Headers ( ) { _ceff = append ( _ceff , _bebc . Paragraphs ( ) ... ) ; for _ , _ddaaa := range _bebc . Tables ( ) { for _ , _eegfd := range _ddaaa . Rows ( ) { for _ , _efag := range _eegfd . Cells ( ) { _ceff = append ( _ceff , _efag . Paragraphs ( ) ... ) ;
} ; } ; } ; } ; for _ , _cabdc := range _acfb . Footers ( ) { _ceff = append ( _ceff , _cabdc . Paragraphs ( ) ... ) ; for _ , _bbgae := range _cabdc . Tables ( ) { for _ , _dcfg := range _bbgae . Rows ( ) { for _ , _bbfe := range _dcfg . Cells ( ) { _ceff = append ( _ceff , _bbfe . Paragraphs ( ) ... ) ;
} ; } ; } ; } ; for _ , _ebc := range _ceff { _cacc := _ebc . Runs ( ) ; _dddd := - 1 ; _cbfee := - 1 ; _fbdb := - 1 ; _gbcb := mergeFieldInfo { } ; for _ , _feab := range _ebc . _gbaee . EG_PContent { for _ , _dfbg := range _feab . FldSimple { if _ab . Contains ( _dfbg . InstrAttr , "\u004d\u0045\u0052\u0047\u0045\u0046\u0049\u0045\u004c\u0044" ) { _gafb := _ecff ( _dfbg . InstrAttr ) ;
_gafb . _deafg = true ; _gafb . _fdag = _ebc ; _gafb . _ceae = _feab ; _cdea = append ( _cdea , _gafb ) ; } ; } ; } ; for _dbcb := 0 ; _dbcb < len ( _cacc ) ; _dbcb ++ { _ebgf := _cacc [ _dbcb ] ; for _ , _gcee := range _ebgf . X ( ) . EG_RunInnerContent { if _gcee . FldChar != nil { switch _gcee . FldChar . FldCharTypeAttr { case _gdb . ST_FldCharTypeBegin : _dddd = _dbcb ;
case _gdb . ST_FldCharTypeSeparate : _cbfee = _dbcb ; case _gdb . ST_FldCharTypeEnd : _fbdb = _dbcb ; if _gbcb . _ecgf != "" { _gbcb . _fdag = _ebc ; _gbcb . _bgdg = _dddd ; _gbcb . _ffda = _fbdb ; _gbcb . _bfbf = _cbfee ; _cdea = append ( _cdea , _gbcb ) ; } ; _dddd = - 1 ; _cbfee = - 1 ;
_fbdb = - 1 ; _gbcb = mergeFieldInfo { } ; } ; } else if _gcee . InstrText != nil && _ab . Contains ( _gcee . InstrText . Content , "\u004d\u0045\u0052\u0047\u0045\u0046\u0049\u0045\u004c\u0044" ) { if _dddd != - 1 && _fbdb == - 1 { _gbcb = _ecff ( _gcee . InstrText . Content ) ; } ; } ; } ; } ;
} ; return _cdea ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// ExtractTextOptions extraction text options.
type ExtractTextOptions struct {
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// WithNumbering extract numbering elements if set to `true`.
WithNumbering bool ;
2023-06-10 07:12:37 +00:00
2024-09-16 09:59:58 +00:00
// NumberingIndent default value of numbering indent.
NumberingIndent string ;
2023-08-06 17:57:53 +00:00
2024-09-16 09:59:58 +00:00
// RunsOnNewLine write each of runs text on new line if set to `true`.
RunsOnNewLine bool ; } ;
2023-08-06 17:57:53 +00:00
2024-09-16 09:59:58 +00:00
// GetHighlight returns the HighlightColor.
func ( _ebed RunProperties ) GetHighlight ( ) _gdb . ST_HighlightColor { if _ebed . _bace . Highlight != nil { return _ebed . _bace . Highlight . ValAttr ; } ; return _gdb . ST_HighlightColorNone ; } ; func _fda ( _ebag * _gdb . CT_Tbl , _dfed * _gdb . CT_P , _afea bool ) * _gdb . CT_Tbl { for _ , _dcg := range _ebag . EG_ContentRowContent { for _ , _bbbf := range _dcg . Tr { for _ , _ccd := range _bbbf . EG_ContentCellContent { for _ , _ecf := range _ccd . Tc { for _aeab , _bbc := range _ecf . EG_BlockLevelElts { for _ , _fdbd := range _bbc . EG_ContentBlockContent { for _bad , _geg := range _fdbd . P { if _geg == _dfed { _dga := _gdb . NewEG_BlockLevelElts ( ) ;
_bea := _gdb . NewEG_ContentBlockContent ( ) ; _dga . EG_ContentBlockContent = append ( _dga . EG_ContentBlockContent , _bea ) ; _cgb := _gdb . NewCT_Tbl ( ) ; _bea . Tbl = append ( _bea . Tbl , _cgb ) ; _ecf . EG_BlockLevelElts = append ( _ecf . EG_BlockLevelElts , nil ) ; if _afea { copy ( _ecf . EG_BlockLevelElts [ _aeab + 1 : ] , _ecf . EG_BlockLevelElts [ _aeab : ] ) ;
_ecf . EG_BlockLevelElts [ _aeab ] = _dga ; if _bad != 0 { _gfd := _gdb . NewEG_BlockLevelElts ( ) ; _agfcgf := _gdb . NewEG_ContentBlockContent ( ) ; _gfd . EG_ContentBlockContent = append ( _gfd . EG_ContentBlockContent , _agfcgf ) ; _agfcgf . P = _fdbd . P [ : _bad ] ; _ecf . EG_BlockLevelElts = append ( _ecf . EG_BlockLevelElts , nil ) ;
copy ( _ecf . EG_BlockLevelElts [ _aeab + 1 : ] , _ecf . EG_BlockLevelElts [ _aeab : ] ) ; _ecf . EG_BlockLevelElts [ _aeab ] = _gfd ; } ; _fdbd . P = _fdbd . P [ _bad : ] ; } else { copy ( _ecf . EG_BlockLevelElts [ _aeab + 2 : ] , _ecf . EG_BlockLevelElts [ _aeab + 1 : ] ) ; _ecf . EG_BlockLevelElts [ _aeab + 1 ] = _dga ;
if _bad != len ( _fdbd . P ) - 1 { _edc := _gdb . NewEG_BlockLevelElts ( ) ; _fbg := _gdb . NewEG_ContentBlockContent ( ) ; _edc . EG_ContentBlockContent = append ( _edc . EG_ContentBlockContent , _fbg ) ; _fbg . P = _fdbd . P [ _bad + 1 : ] ; _ecf . EG_BlockLevelElts = append ( _ecf . EG_BlockLevelElts , nil ) ;
copy ( _ecf . EG_BlockLevelElts [ _aeab + 3 : ] , _ecf . EG_BlockLevelElts [ _aeab + 2 : ] ) ; _ecf . EG_BlockLevelElts [ _aeab + 2 ] = _edc ; } else { _gdd := _gdb . NewEG_BlockLevelElts ( ) ; _accg := _gdb . NewEG_ContentBlockContent ( ) ; _gdd . EG_ContentBlockContent = append ( _gdd . EG_ContentBlockContent , _accg ) ;
_accg . P = [ ] * _gdb . CT_P { _gdb . NewCT_P ( ) } ; _ecf . EG_BlockLevelElts = append ( _ecf . EG_BlockLevelElts , nil ) ; copy ( _ecf . EG_BlockLevelElts [ _aeab + 3 : ] , _ecf . EG_BlockLevelElts [ _aeab + 2 : ] ) ; _ecf . EG_BlockLevelElts [ _aeab + 2 ] = _gdd ; } ; _fdbd . P = _fdbd . P [ : _bad + 1 ] ;
} ; return _cgb ; } ; } ; for _ , _ccb := range _fdbd . Tbl { _bce := _fda ( _ccb , _dfed , _afea ) ; if _bce != nil { return _bce ; } ; } ; } ; } ; } ; } ; } ; } ; return nil ; } ;
2020-11-09 01:00:18 +00:00
2024-09-16 09:59:58 +00:00
// SetKeepWithNext controls if this paragraph should be kept with the next.
func ( _deca ParagraphProperties ) SetKeepWithNext ( b bool ) { if ! b { _deca . _egbf . KeepNext = nil ; } else { _deca . _egbf . KeepNext = _gdb . NewCT_OnOff ( ) ; } ; } ;
2020-11-09 01:00:18 +00:00
2024-09-16 09:59:58 +00:00
// Save writes the document to an io.Writer in the Zip package format.
func ( _acdf * Document ) Save ( w _g . Writer ) error { return _acdf . save ( w , _acdf . _edg ) } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetLayoutInCell sets the layoutInCell attribute of anchor.
func ( _eae AnchoredDrawing ) SetLayoutInCell ( val bool ) { _eae . _bc . LayoutInCellAttr = val } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Endnotes returns the endnotes defined in the document.
func ( _ecgac * Document ) Endnotes ( ) [ ] Endnote { _facc := [ ] Endnote { } ; for _ , _adg := range _ecgac . _gde . CT_Endnotes . Endnote { _facc = append ( _facc , Endnote { _ecgac , _adg } ) ; } ; return _facc ; } ;
2023-07-04 11:04:03 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _fgae Header ) X ( ) * _gdb . Hdr { return _fgae . _eeee } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetAlignment controls the paragraph alignment
func ( _deaaa ParagraphStyleProperties ) SetAlignment ( align _gdb . ST_Jc ) { if align == _gdb . ST_JcUnset { _deaaa . _cdeed . Jc = nil ; } else { _deaaa . _cdeed . Jc = _gdb . NewCT_Jc ( ) ; _deaaa . _cdeed . Jc . ValAttr = align ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetShadow sets the run to shadowed text.
func ( _gggc RunProperties ) SetShadow ( b bool ) { if ! b { _gggc . _bace . Shadow = nil ; } else { _gggc . _bace . Shadow = _gdb . NewCT_OnOff ( ) ; } ; } ; func _ddcdc ( ) * _eb . Handles { _bceed := _eb . NewHandles ( ) ; _ecdagf := _eb . NewCT_H ( ) ; _ggeaf := "\u0023\u0030\u002c\u0062\u006f\u0074\u0074\u006f\u006dR\u0069\u0067\u0068\u0074" ;
_ecdagf . PositionAttr = & _ggeaf ; _gccbge := "\u0036\u0036\u0032\u0039\u002c\u0031\u0034\u0039\u0037\u0031" ; _ecdagf . XrangeAttr = & _gccbge ; _bceed . H = [ ] * _eb . CT_H { _ecdagf } ; return _bceed ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// 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 ( _ddbb Paragraph ) AddFootnote ( text string ) Footnote { var _fgabc int64 ; if _ddbb . _fdec . HasFootnotes ( ) { for _ , _cbfbg := range _ddbb . _fdec . Footnotes ( ) { if _cbfbg . id ( ) > _fgabc { _fgabc = _cbfbg . id ( ) ; } ; } ; _fgabc ++ ; } else { _ddbb . _fdec . addFootnotes ( ) ;
_fgabc = 1 ; } ; _edbb := _gdb . NewCT_FtnEdn ( ) ; _bggd := _gdb . NewCT_FtnEdnRef ( ) ; _bggd . IdAttr = _fgabc ; _ddbb . _fdec . _bgg . CT_Footnotes . Footnote = append ( _ddbb . _fdec . _bgg . CT_Footnotes . Footnote , _edbb ) ; _adgbd := _ddbb . AddRun ( ) ; _bddbf := _adgbd . Properties ( ) ;
_bddbf . SetStyle ( _gfc ) ; _adgbd . _feebb . EG_RunInnerContent = [ ] * _gdb . EG_RunInnerContent { _gdb . NewEG_RunInnerContent ( ) } ; _adgbd . _feebb . EG_RunInnerContent [ 0 ] . FootnoteReference = _bggd ; _fage := Footnote { _ddbb . _fdec , _edbb } ; _fage . _eacb . IdAttr = _fgabc ;
_fage . _eacb . EG_BlockLevelElts = [ ] * _gdb . EG_BlockLevelElts { _gdb . NewEG_BlockLevelElts ( ) } ; _bcfc := _fage . AddParagraph ( ) ; _bcfc . Properties ( ) . SetStyle ( FootnoteTextStyleId ) ; _bcfc . _gbaee . PPr . RPr = _gdb . NewCT_ParaRPr ( ) ; _fceb := _bcfc . AddRun ( ) ; _bbcb := _fceb . Properties ( ) ;
_bbcb . SetStyle ( _gfc ) ; _fceb . AddFootnoteReference ( ) ; _adcff := _bcfc . AddRun ( ) ; _adcff . AddText ( "\u0020" ) ; _adcff = _bcfc . AddRun ( ) ; _adcff . AddText ( text ) ; return _fage ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetWindowControl controls if the first or last line of the paragraph is
// allowed to display on a separate page.
func ( _gbdd ParagraphProperties ) SetWindowControl ( b bool ) { if ! b { _gbdd . _egbf . WidowControl = nil ; } else { _gbdd . _egbf . WidowControl = _gdb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetText sets the text to be used in bullet mode.
func ( _ecaee NumberingLevel ) SetText ( t string ) { if t == "" { _ecaee . _ggagc . LvlText = nil ; } else { _ecaee . _ggagc . LvlText = _gdb . NewCT_LevelText ( ) ; _ecaee . _ggagc . LvlText . ValAttr = _f . String ( t ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// TableProperties are the properties for a table within a document
type TableProperties struct { _affd * _gdb . CT_TblPr } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetUnhideWhenUsed controls if a semi hidden style becomes visible when used.
func ( _debba Style ) SetUnhideWhenUsed ( b bool ) { if b { _debba . _gfdb . UnhideWhenUsed = _gdb . NewCT_OnOff ( ) ; } else { _debba . _gfdb . UnhideWhenUsed = nil ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _cdgg TableLook ) X ( ) * _gdb . CT_TblLook { return _cdgg . _cdag } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// InsertRowBefore inserts a row before another row
func ( _aaega Table ) InsertRowBefore ( r Row ) Row { for _cagba , _cdfcd := range _aaega . _afabf . EG_ContentRowContent { if len ( _cdfcd . Tr ) > 0 && r . X ( ) == _cdfcd . Tr [ 0 ] { _dcadc := _gdb . NewEG_ContentRowContent ( ) ; _aaega . _afabf . EG_ContentRowContent = append ( _aaega . _afabf . EG_ContentRowContent , nil ) ;
copy ( _aaega . _afabf . EG_ContentRowContent [ _cagba + 1 : ] , _aaega . _afabf . EG_ContentRowContent [ _cagba : ] ) ; _aaega . _afabf . EG_ContentRowContent [ _cagba ] = _dcadc ; _dddef := _gdb . NewCT_Row ( ) ; _dcadc . Tr = append ( _dcadc . Tr , _dddef ) ; return Row { _aaega . _feaf , _dddef } ;
} ; } ; return _aaega . AddRow ( ) ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetVAlignment sets the vertical alignment for an anchored image.
func ( _bb AnchoredDrawing ) SetVAlignment ( v _gdb . WdST_AlignV ) { _bb . _bc . PositionV . Choice = & _gdb . WdCT_PosVChoice { } ; _bb . _bc . PositionV . Choice . Align = v ; } ;
2021-01-04 16:11:39 +00:00
2024-09-16 09:59:58 +00:00
// Pict returns the pict object.
func ( _acedg * WatermarkText ) Pict ( ) * _gdb . CT_Picture { return _acedg . _aabdf } ;
2021-01-04 16:11:39 +00:00
2024-09-16 09:59:58 +00:00
// SetOutlineLvl sets outline level of paragraph.
func ( _aagdf Paragraph ) SetOutlineLvl ( lvl int64 ) { _aagdf . ensurePPr ( ) ; if _aagdf . _gbaee . PPr . OutlineLvl == nil { _aagdf . _gbaee . PPr . OutlineLvl = _gdb . NewCT_DecimalNumber ( ) ; } ; _eefd := lvl - 1 ; _aagdf . _gbaee . PPr . OutlineLvl . ValAttr = _eefd ; } ; func ( _aafcc Paragraph ) addInstrText ( _dffg string ) * _gdb . CT_Text { _fdfaa := _aafcc . AddRun ( ) ;
_eege := _fdfaa . X ( ) ; _cagec := _gdb . NewEG_RunInnerContent ( ) ; _egdcd := _gdb . NewCT_Text ( ) ; _bbefe := "\u0070\u0072\u0065\u0073\u0065\u0072\u0076\u0065" ; _egdcd . SpaceAttr = & _bbefe ; _egdcd . Content = "\u0020" + _dffg + "\u0020" ; _cagec . InstrText = _egdcd ; _eege . EG_RunInnerContent = append ( _eege . EG_RunInnerContent , _cagec ) ;
return _egdcd ; } ;
2024-07-28 07:48:26 +00:00
// FormFieldType is the type of the form field.
2024-06-20 13:33:45 +00:00
//
2024-07-28 07:48:26 +00:00
//go:generate stringer -type=FormFieldType
type FormFieldType byte ;
2022-01-15 21:17:38 +00:00
2024-09-16 09:59:58 +00:00
// SetFontFamily sets the Ascii & HAnsi fonly family for a run.
func ( _dgab RunProperties ) SetFontFamily ( family string ) { if _dgab . _bace . RFonts == nil { _dgab . _bace . RFonts = _gdb . NewCT_Fonts ( ) ; } ; _dgab . _bace . RFonts . AsciiAttr = _f . String ( family ) ; _dgab . _bace . RFonts . HAnsiAttr = _f . String ( family ) ; _dgab . _bace . RFonts . EastAsiaAttr = _f . String ( family ) ;
} ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Themes returns document's themes.
func ( _effc * Document ) Themes ( ) [ ] * _dcb . Theme { return _effc . _aaf } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetAlignment sets the paragraph alignment
func ( _bbge NumberingLevel ) SetAlignment ( j _gdb . ST_Jc ) { if j == _gdb . ST_JcUnset { _bbge . _ggagc . LvlJc = nil ; } else { _bbge . _ggagc . LvlJc = _gdb . NewCT_Jc ( ) ; _bbge . _ggagc . LvlJc . ValAttr = j ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetBeforeAuto controls if spacing before a paragraph is automatically determined.
func ( _befc ParagraphSpacing ) SetBeforeAuto ( b bool ) { if b { _befc . _fggcd . BeforeAutospacingAttr = & _de . ST_OnOff { } ; _befc . _fggcd . BeforeAutospacingAttr . Bool = _f . Bool ( true ) ; } else { _befc . _fggcd . BeforeAutospacingAttr = nil ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetBold sets the run to bold.
func ( _gecd RunProperties ) SetBold ( b bool ) { if ! b { _gecd . _bace . B = nil ; _gecd . _bace . BCs = nil ; } else { _gecd . _bace . B = _gdb . NewCT_OnOff ( ) ; _gecd . _bace . BCs = _gdb . NewCT_OnOff ( ) ; } ; } ;
2022-02-05 13:05:36 +00:00
2024-09-16 09:59:58 +00:00
// SetEnabled marks a FormField as enabled or disabled.
func ( _fcfc FormField ) SetEnabled ( enabled bool ) { _adee := _gdb . NewCT_OnOff ( ) ; _adee . ValAttr = & _de . ST_OnOff { Bool : & enabled } ; _fcfc . _eebdg . Enabled = [ ] * _gdb . CT_OnOff { _adee } ; } ;
2021-04-23 20:00:00 +00:00
2024-09-16 09:59:58 +00:00
// Clear clears all content within a header
func ( _bcccb Header ) Clear ( ) { _bcccb . _eeee . EG_ContentBlockContent = nil } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// ComplexSizeValue returns the value of run font size for complex fonts in points.
func ( _gdbb RunProperties ) ComplexSizeValue ( ) float64 { if _gdaab := _gdbb . _bace . SzCs ; _gdaab != nil { _cabde := _gdaab . ValAttr ; if _cabde . ST_UnsignedDecimalNumber != nil { return float64 ( * _cabde . ST_UnsignedDecimalNumber ) / 2 ; } ; } ; return 0.0 ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// RunProperties returns the run properties controlling text formatting within the table.
func ( _eedgd TableConditionalFormatting ) RunProperties ( ) RunProperties { if _eedgd . _bfcgg . RPr == nil { _eedgd . _bfcgg . RPr = _gdb . NewCT_RPr ( ) ; } ; return RunProperties { _eedgd . _bfcgg . RPr } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// NumberingLevel is the definition for numbering for a particular level within
// a NumberingDefinition.
type NumberingLevel struct { _ggagc * _gdb . CT_Lvl } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Shadow returns true if paragraph shadow is on.
func ( _egae ParagraphProperties ) Shadow ( ) bool { return _cefe ( _egae . _egbf . RPr . Shadow ) } ; const _deef = "\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" ;
2017-09-26 18:18:59 -05:00
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// TableBorders allows manipulation of borders on a table.
type TableBorders struct { _gfgae * _gdb . CT_TblBorders } ; func _gbfg ( ) * _eb . OfcLock { _dbdcg := _eb . NewOfcLock ( ) ; _dbdcg . ExtAttr = _eb . ST_ExtEdit ; _dbdcg . AspectratioAttr = _de . ST_TrueFalseTrue ; return _dbdcg ; } ; func ( _egc * Document ) removeFootnote ( _cegc int64 ) { _fgbb := _egc . _bgg ;
var _dddb int ; for _adedc , _gcc := range _fgbb . CT_Footnotes . Footnote { if _gcc . IdAttr == _cegc { _dddb = _adedc ; break ; } ; } ; _fgbb . CT_Footnotes . Footnote [ _dddb ] = nil ; _fgbb . CT_Footnotes . Footnote [ _dddb ] = _fgbb . CT_Footnotes . Footnote [ len ( _fgbb . CT_Footnotes . Footnote ) - 1 ] ;
_fgbb . CT_Footnotes . Footnote = _fgbb . CT_Footnotes . Footnote [ : len ( _fgbb . CT_Footnotes . Footnote ) - 1 ] ; _egc . reorderFootnote ( ) ; _egc . syncFootnoteSettings ( ) ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// OpenTemplate opens a document, removing all content so it can be used as a
// template. Since Word removes unused styles from a document upon save, to
// create a template in Word add a paragraph with every style of interest. When
// opened with OpenTemplate the document's styles will be available but the
// content will be gone.
func OpenTemplate ( filename string ) ( * Document , error ) { _bgfd , _gebe := Open ( filename ) ; if _gebe != nil { return nil , _gebe ; } ; _bgfd . _dbc . Body = _gdb . NewCT_Body ( ) ; return _bgfd , nil ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetAlignment sets the alignment of a table within the page.
func ( _bgfaa TableProperties ) SetAlignment ( align _gdb . ST_JcTable ) { if align == _gdb . ST_JcTableUnset { _bgfaa . _affd . Jc = nil ; } else { _bgfaa . _affd . Jc = _gdb . NewCT_JcTable ( ) ; _bgfaa . _affd . Jc . ValAttr = align ; } ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// Italic returns true if paragraph font is italic.
func ( _eecb ParagraphProperties ) Italic ( ) bool { _aead := _eecb . _egbf . RPr ; return _cefe ( _aead . I ) || _cefe ( _aead . ICs ) ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// SetInsideVertical sets the interior vertical borders to a specified type, color and thickness.
func ( _fdga TableBorders ) SetInsideVertical ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _fdga . _gfgae . InsideV = _gdb . NewCT_Border ( ) ; _beggg ( _fdga . _gfgae . InsideV , t , c , thickness ) ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// WatermarkPicture is watermark picture within document.
type WatermarkPicture struct { _gfaa * _gdb . CT_Picture ; _bgdbbg * _gg . ShapeStyle ; _adabf * _eb . Shape ; _fcdb * _eb . Shapetype ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// SetAfterLineSpacing sets spacing below paragraph in line units.
func ( _eeacg Paragraph ) SetAfterLineSpacing ( d _dg . Distance ) { _eeacg . ensurePPr ( ) ; if _eeacg . _gbaee . PPr . Spacing == nil { _eeacg . _gbaee . PPr . Spacing = _gdb . NewCT_Spacing ( ) ; } ; _agdba := _eeacg . _gbaee . PPr . Spacing ; _agdba . AfterLinesAttr = _f . Int64 ( int64 ( d / _dg . Twips ) ) ;
} ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// SetToolTip sets the tooltip text for a hyperlink.
func ( _aegg HyperLink ) SetToolTip ( text string ) { if text == "" { _aegg . _ffed . TooltipAttr = nil ; } else { _aegg . _ffed . TooltipAttr = _f . String ( text ) ; } ; } ;
// SetFormat sets the numbering format.
func ( _fbcga NumberingLevel ) SetFormat ( f _gdb . ST_NumberFormat ) { if _fbcga . _ggagc . NumFmt == nil { _fbcga . _ggagc . NumFmt = _gdb . NewCT_NumFmt ( ) ; } ; _fbcga . _ggagc . NumFmt . ValAttr = f ; } ;
// SetText sets the watermark text.
func ( _bdbd * WatermarkText ) SetText ( text string ) { _abadd := _bdbd . getShape ( ) ; if _bdbd . _ddcag != nil { _begc := _bdbd . _ddcag . EG_ShapeElements ; if len ( _begc ) > 0 && _begc [ 0 ] . Textpath != nil { _begc [ 0 ] . Textpath . StringAttr = & text ; } ; } else { _bcgcf := _bdbd . findNode ( _abadd , "\u0074\u0065\u0078\u0074\u0070\u0061\u0074\u0068" ) ;
for _bgdd , _bebce := range _bcgcf . Attrs { if _bebce . Name . Local == "\u0073\u0074\u0072\u0069\u006e\u0067" { _bcgcf . Attrs [ _bgdd ] . Value = text ; } ; } ; } ; } ; func ( _bada Paragraph ) insertRun ( _dafgf Run , _egaad bool ) Run { for _ , _ceddb := range _bada . _gbaee . EG_PContent { for _cdacb , _edba := range _ceddb . EG_ContentRunContent { if _edba . R == _dafgf . X ( ) { _fccb := _gdb . NewCT_R ( ) ;
_ceddb . EG_ContentRunContent = append ( _ceddb . EG_ContentRunContent , nil ) ; if _egaad { copy ( _ceddb . EG_ContentRunContent [ _cdacb + 1 : ] , _ceddb . EG_ContentRunContent [ _cdacb : ] ) ; _ceddb . EG_ContentRunContent [ _cdacb ] = _gdb . NewEG_ContentRunContent ( ) ; _ceddb . EG_ContentRunContent [ _cdacb ] . R = _fccb ;
} else { copy ( _ceddb . EG_ContentRunContent [ _cdacb + 2 : ] , _ceddb . EG_ContentRunContent [ _cdacb + 1 : ] ) ; _ceddb . EG_ContentRunContent [ _cdacb + 1 ] = _gdb . NewEG_ContentRunContent ( ) ; _ceddb . EG_ContentRunContent [ _cdacb + 1 ] . R = _fccb ; } ; return Run { _bada . _fdec , _fccb } ;
} ; if _edba . Sdt != nil && _edba . Sdt . SdtContent != nil { for _ , _edbe := range _edba . Sdt . SdtContent . EG_ContentRunContent { if _edbe . R == _dafgf . X ( ) { _fdfda := _gdb . NewCT_R ( ) ; _edba . Sdt . SdtContent . EG_ContentRunContent = append ( _edba . Sdt . SdtContent . EG_ContentRunContent , nil ) ;
if _egaad { copy ( _edba . Sdt . SdtContent . EG_ContentRunContent [ _cdacb + 1 : ] , _edba . Sdt . SdtContent . EG_ContentRunContent [ _cdacb : ] ) ; _edba . Sdt . SdtContent . EG_ContentRunContent [ _cdacb ] = _gdb . NewEG_ContentRunContent ( ) ; _edba . Sdt . SdtContent . EG_ContentRunContent [ _cdacb ] . R = _fdfda ;
} else { copy ( _edba . Sdt . SdtContent . EG_ContentRunContent [ _cdacb + 2 : ] , _edba . Sdt . SdtContent . EG_ContentRunContent [ _cdacb + 1 : ] ) ; _edba . Sdt . SdtContent . EG_ContentRunContent [ _cdacb + 1 ] = _gdb . NewEG_ContentRunContent ( ) ; _edba . Sdt . SdtContent . EG_ContentRunContent [ _cdacb + 1 ] . R = _fdfda ;
} ; return Run { _bada . _fdec , _fdfda } ; } ; } ; } ; } ; } ; return _bada . AddRun ( ) ; } ;
// SizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.
func ( _effd ParagraphProperties ) SizeMeasure ( ) string { if _gcbdb := _effd . _egbf . RPr . Sz ; _gcbdb != nil { _bacab := _gcbdb . ValAttr ; if _bacab . ST_PositiveUniversalMeasure != nil { return * _bacab . ST_PositiveUniversalMeasure ; } ; } ; return "" ; } ;
2024-04-03 00:10:23 +07:00
2024-07-28 07:48:26 +00:00
// CharacterSpacingValue returns the value of characters spacing in twips (1/20 of point).
2024-09-16 09:59:58 +00:00
func ( _cgac ParagraphProperties ) CharacterSpacingValue ( ) int64 { if _gedcba := _cgac . _egbf . RPr . Spacing ; _gedcba != nil { _ecgb := _gedcba . ValAttr ; if _ecgb . Int64 != nil { return * _ecgb . Int64 ; } ; } ; return int64 ( 0 ) ; } ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// AddFieldWithFormatting adds a field (automatically computed text) to the
// document with field specifc formatting.
func ( _aada Run ) AddFieldWithFormatting ( code string , fmt string , isDirty bool ) { _ecfbd := _aada . newIC ( ) ; _ecfbd . FldChar = _gdb . NewCT_FldChar ( ) ; _ecfbd . FldChar . FldCharTypeAttr = _gdb . ST_FldCharTypeBegin ; if isDirty { _ecfbd . FldChar . DirtyAttr = & _de . ST_OnOff { } ;
_ecfbd . FldChar . DirtyAttr . Bool = _f . Bool ( true ) ; } ; _ecfbd = _aada . newIC ( ) ; _ecfbd . InstrText = _gdb . NewCT_Text ( ) ; if fmt != "" { _ecfbd . InstrText . Content = code + "\u0020" + fmt ; } else { _ecfbd . InstrText . Content = code ; } ; _ecfbd = _aada . newIC ( ) ; _ecfbd . FldChar = _gdb . NewCT_FldChar ( ) ;
_ecfbd . FldChar . FldCharTypeAttr = _gdb . ST_FldCharTypeEnd ; } ; var _gaaf = [ ... ] uint8 { 0 , 20 , 37 , 58 , 79 } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// GetColor returns the color.Color object representing the run color.
func ( _fadgd RunProperties ) GetColor ( ) _gbc . Color { if _gfag := _fadgd . _bace . Color ; _gfag != nil { _aabd := _gfag . ValAttr ; if _aabd . ST_HexColorRGB != nil { return _gbc . FromHex ( * _aabd . ST_HexColorRGB ) ; } ; } ; return _gbc . Color { } ; } ;
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
// SetConformance sets conformance attribute of the document
// as one of these values from github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes:
// ST_ConformanceClassUnset, ST_ConformanceClassStrict or ST_ConformanceClassTransitional.
func ( _agfe Document ) SetConformance ( conformanceAttr _de . ST_ConformanceClass ) { _agfe . _dbc . ConformanceAttr = conformanceAttr ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetNumberingDefinitionByID sets the numbering definition ID directly, which must
// match an ID defined in numbering.xml
func ( _bbggb Paragraph ) SetNumberingDefinitionByID ( abstractNumberID int64 ) { _bbggb . ensurePPr ( ) ; if _bbggb . _gbaee . PPr . NumPr == nil { _bbggb . _gbaee . PPr . NumPr = _gdb . NewCT_NumPr ( ) ; } ; _bcca := _gdb . NewCT_DecimalNumber ( ) ; _bcca . ValAttr = int64 ( abstractNumberID ) ;
_bbggb . _gbaee . PPr . NumPr . NumId = _bcca ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// SetLineSpacing sets the spacing between lines in a paragraph.
func ( _gbaf Paragraph ) SetLineSpacing ( d _dg . Distance , rule _gdb . ST_LineSpacingRule ) { _gbaf . ensurePPr ( ) ; if _gbaf . _gbaee . PPr . Spacing == nil { _gbaf . _gbaee . PPr . Spacing = _gdb . NewCT_Spacing ( ) ; } ; _facg := _gbaf . _gbaee . PPr . Spacing ; if rule == _gdb . ST_LineSpacingRuleUnset { _facg . LineRuleAttr = _gdb . ST_LineSpacingRuleUnset ;
_facg . LineAttr = nil ; } else { _facg . LineRuleAttr = rule ; _facg . LineAttr = & _gdb . ST_SignedTwipsMeasure { } ; _facg . LineAttr . Int64 = _f . Int64 ( int64 ( d / _dg . Twips ) ) ; } ; } ;
// AddText adds text to a run.
func ( _dagbc Run ) AddText ( s string ) { _dfcda := _gdb . NewEG_RunInnerContent ( ) ; _dagbc . _feebb . EG_RunInnerContent = append ( _dagbc . _feebb . EG_RunInnerContent , _dfcda ) ; _dfcda . T = _gdb . NewCT_Text ( ) ; if _f . NeedsSpacePreserve ( s ) { _fgeef := "\u0070\u0072\u0065\u0073\u0065\u0072\u0076\u0065" ;
_dfcda . T . SpaceAttr = & _fgeef ; } ; _dfcda . T . Content = s ; } ; func _eeecg ( ) * _eb . OfcLock { _dgfgbd := _eb . NewOfcLock ( ) ; _dgfgbd . ExtAttr = _eb . ST_ExtEdit ; _dgfgbd . TextAttr = _de . ST_TrueFalseTrue ; _dgfgbd . ShapetypeAttr = _de . ST_TrueFalseTrue ; return _dgfgbd ;
2024-07-28 07:48:26 +00:00
} ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _gace TableWidth ) X ( ) * _gdb . CT_TblWidth { return _gace . _fcfca } ; func _ecbd ( _fddg * Document , _ddbg [ ] * _gdb . CT_P , _cefa * TableInfo , _dgbcb * DrawingInfo ) [ ] Node { _fede := [ ] Node { } ; for _ , _eabec := range _ddbg { _fgfg := Paragraph { _fddg , _eabec } ; _cdae := Node { _eabe : _fddg , _dbca : & _fgfg } ;
if _gbgf , _gbgae := _fddg . Styles . SearchStyleById ( _fgfg . Style ( ) ) ; _gbgae { _cdae . Style = _gbgf ; } ; for _ , _cfgf := range _fgfg . Runs ( ) { _cdae . Children = append ( _cdae . Children , Node { _eabe : _fddg , _dbca : _cfgf , AnchoredDrawings : _cfgf . DrawingAnchored ( ) , InlineDrawings : _cfgf . DrawingInline ( ) } ) ;
} ; _fede = append ( _fede , _cdae ) ; } ; return _fede ; } ;
// SetTextWrapTight sets the text wrap to tight with a give wrap type.
func ( _dbe AnchoredDrawing ) SetTextWrapTight ( option * AnchorDrawWrapOptions ) { _dbe . _bc . Choice = & _gdb . WdEG_WrapTypeChoice { } ; _dbe . _bc . Choice . WrapTight = _gdb . NewWdCT_WrapTight ( ) ; _dbe . _bc . Choice . WrapTight . WrapTextAttr = _gdb . WdST_WrapTextBothSides ;
_dca := false ; _dbe . _bc . Choice . WrapTight . WrapPolygon . EditedAttr = & _dca ; if option == nil { option = NewAnchorDrawWrapOptions ( ) ; } ; _dbe . _bc . Choice . WrapTight . WrapPolygon . LineTo = option . GetWrapPathLineTo ( ) ; _dbe . _bc . Choice . WrapTight . WrapPolygon . Start = option . GetWrapPathStart ( ) ;
_dbe . _bc . LayoutInCellAttr = true ; _dbe . _bc . AllowOverlapAttr = true ; } ;
// InsertParagraphBefore adds a new empty paragraph before the relativeTo
// paragraph.
func ( _gdcae * Document ) InsertParagraphBefore ( relativeTo Paragraph ) Paragraph { return _gdcae . insertParagraph ( relativeTo , true ) ; } ;
// SetRight sets the right border to a specified type, color and thickness.
func ( _ecfd ParagraphBorders ) SetRight ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _ecfd . _ecade . Right = _gdb . NewCT_Border ( ) ; _fada ( _ecfd . _ecade . Right , t , c , thickness ) ; } ;
2024-04-03 00:10:23 +07:00
2024-07-28 07:48:26 +00:00
// Validate validates the structure and in cases where it't possible, the ranges
// of elements within a document. A validation error dones't mean that the
// document won't work in MS Word or LibreOffice, but it's worth checking into.
2024-09-16 09:59:58 +00:00
func ( _gecg * Document ) Validate ( ) error { if _gecg == nil || _gecg . _dbc == nil { return _cb . 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 _ , _cfa := range [ ] func ( ) error { _gecg . validateTableCells , _gecg . validateBookmarks } { if _gdgc := _cfa ( ) ; _gdgc != nil { return _gdgc ; } ; } ; if _bbed := _gecg . _dbc . Validate ( ) ; _bbed != nil { return _bbed ; } ; return nil ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// CellProperties returns the cell properties.
func ( _cecbd TableConditionalFormatting ) CellProperties ( ) CellProperties { if _cecbd . _bfcgg . TcPr == nil { _cecbd . _bfcgg . TcPr = _gdb . NewCT_TcPr ( ) ; } ; return CellProperties { _cecbd . _bfcgg . TcPr } ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// GetWrapPathLineTo return wrapPath lineTo value.
func ( _gca AnchorDrawWrapOptions ) GetWrapPathLineTo ( ) [ ] * _dcb . CT_Point2D { return _gca . _cde } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// // SetBeforeLineSpacing sets spacing above paragraph in line units.
func ( _fdgb Paragraph ) SetBeforeLineSpacing ( d _dg . Distance ) { _fdgb . ensurePPr ( ) ; if _fdgb . _gbaee . PPr . Spacing == nil { _fdgb . _gbaee . PPr . Spacing = _gdb . NewCT_Spacing ( ) ; } ; _afbf := _fdgb . _gbaee . PPr . Spacing ; _afbf . BeforeLinesAttr = _f . Int64 ( int64 ( d / _dg . Twips ) ) ;
} ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetEndIndent controls the end indentation.
func ( _fefgc ParagraphProperties ) SetEndIndent ( m _dg . Distance ) { if _fefgc . _egbf . Ind == nil { _fefgc . _egbf . Ind = _gdb . NewCT_Ind ( ) ; } ; if m == _dg . Zero { _fefgc . _egbf . Ind . EndAttr = nil ; } else { _fefgc . _egbf . Ind . EndAttr = & _gdb . ST_SignedTwipsMeasure { } ;
_fefgc . _egbf . Ind . EndAttr . Int64 = _f . Int64 ( int64 ( m / _dg . Twips ) ) ; } ; } ;
// AddDropdownList adds dropdown list form field to the paragraph and returns it.
func ( _efgg Paragraph ) AddDropdownList ( name string ) FormField { _febgd := _efgg . addFldCharsForField ( name , "\u0046\u004f\u0052M\u0044\u0052\u004f\u0050\u0044\u004f\u0057\u004e" ) ; _febgd . _eebdg . DdList = _gdb . NewCT_FFDDList ( ) ; return _febgd ; } ; func ( _cabg Paragraph ) addEndBookmark ( _cgaef int64 ) * _gdb . CT_MarkupRange { _gcbde := _gdb . NewEG_PContent ( ) ;
_cabg . _gbaee . EG_PContent = append ( _cabg . _gbaee . EG_PContent , _gcbde ) ; _cdfcg := _gdb . NewEG_ContentRunContent ( ) ; _dcgd := _gdb . NewEG_RunLevelElts ( ) ; _dcgeb := _gdb . NewEG_RangeMarkupElements ( ) ; _dega := _gdb . NewCT_MarkupRange ( ) ; _dega . IdAttr = _cgaef ;
_dcgeb . BookmarkEnd = _dega ; _gcbde . EG_ContentRunContent = append ( _gcbde . EG_ContentRunContent , _cdfcg ) ; _cdfcg . EG_RunLevelElts = append ( _cdfcg . EG_RunLevelElts , _dcgd ) ; _dcgd . EG_RangeMarkupElements = append ( _dcgd . EG_RangeMarkupElements , _dcgeb ) ; return _dega ;
2024-07-28 07:48:26 +00:00
} ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// SetStrict is a shortcut for document.SetConformance,
// as one of these values from github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes:
// ST_ConformanceClassUnset, ST_ConformanceClassStrict or ST_ConformanceClassTransitional.
func ( _cagf Document ) SetStrict ( strict bool ) { if strict { _cagf . _dbc . ConformanceAttr = _de . ST_ConformanceClassStrict ; } else { _cagf . _dbc . ConformanceAttr = _de . ST_ConformanceClassTransitional ; } ; } ; func ( _daba * Document ) insertNumberingFromStyleProperties ( _ecag Numbering , _fgffg ParagraphStyleProperties ) { _egab := _fgffg . NumId ( ) ;
_cbbd := int64 ( - 1 ) ; if _egab > - 1 { for _ , _ddaf := range _ecag . _cgbg . Num { if _ddaf . NumIdAttr == _egab { if _ddaf . AbstractNumId != nil { _cbbd = _ddaf . AbstractNumId . ValAttr ; _fdcde := false ; for _ , _cbdg := range _daba . Numbering . _cgbg . Num { if _cbdg . NumIdAttr == _egab { _fdcde = true ;
break ; } ; } ; if ! _fdcde { _daba . Numbering . _cgbg . Num = append ( _daba . Numbering . _cgbg . Num , _ddaf ) ; } ; break ; } ; } ; } ; for _ , _gcdd := range _ecag . _cgbg . AbstractNum { if _gcdd . AbstractNumIdAttr == _cbbd { _eedee := false ; for _ , _bced := range _daba . Numbering . _cgbg . AbstractNum { if _bced . AbstractNumIdAttr == _cbbd { _eedee = true ;
break ; } ; } ; if ! _eedee { _daba . Numbering . _cgbg . AbstractNum = append ( _daba . Numbering . _cgbg . AbstractNum , _gcdd ) ; } ; break ; } ; } ; } ; } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// SetFollowImageShape sets wrapPath to follow image shape,
// if nil return wrapPath that follow image size.
func ( _cg AnchorDrawWrapOptions ) SetFollowImageShape ( val bool ) { _cg . _baea = val ; if ! val { _cbgb , _agc := _gdbd ( ) ; _cg . _ace = _cbgb ; _cg . _cde = _agc ; } ; } ; func ( _dadb * Document ) getWatermarkHeaderInnerContentPictures ( ) [ ] * _gdb . CT_Picture { var _abeb [ ] * _gdb . CT_Picture ;
for _ , _cbda := range _dadb . Headers ( ) { for _ , _ebgb := range _cbda . X ( ) . EG_ContentBlockContent { for _ , _cfaf := range _ebgb . P { for _ , _cffg := range _cfaf . EG_PContent { for _ , _deeb := range _cffg . EG_ContentRunContent { if _deeb . R == nil { continue ; } ; for _ , _bdaaf := range _deeb . R . EG_RunInnerContent { if _bdaaf . Pict == nil { continue ;
} ; _dgaa := false ; for _ , _bgdf := range _bdaaf . Pict . Any { _fgeb , _ccgd := _bgdf . ( * _f . XSDAny ) ; if _ccgd && _fgeb . XMLName . Local == "\u0073\u0068\u0061p\u0065" { _dgaa = true ; } ; } ; if _dgaa { _abeb = append ( _abeb , _bdaaf . Pict ) ; } ; } ; } ; } ; } ; } ; } ; return _abeb ; } ; func _beggg ( _agceaf * _gdb . CT_Border , _eefeg _gdb . ST_Border , _fbbaf _gbc . Color , _ddgge _dg . Distance ) { _agceaf . ValAttr = _eefeg ;
_agceaf . ColorAttr = & _gdb . ST_HexColor { } ; if _fbbaf . IsAuto ( ) { _agceaf . ColorAttr . ST_HexColorAuto = _gdb . ST_HexColorAutoAuto ; } else { _agceaf . ColorAttr . ST_HexColorRGB = _fbbaf . AsRGBString ( ) ; } ; if _ddgge != _dg . Zero { _agceaf . SzAttr = _f . Uint64 ( uint64 ( _ddgge / _dg . Point * 8 ) ) ;
} ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// WatermarkText is watermark text within the document.
type WatermarkText struct { _aabdf * _gdb . CT_Picture ; _aegbc * _gg . TextpathStyle ; _ddcag * _eb . Shape ; _bgfg * _eb . Shapetype ; } ;
2021-08-23 20:44:48 +00:00
2024-09-16 09:59:58 +00:00
// SetHangingIndent controls the hanging indent of the paragraph.
func ( _gaed ParagraphStyleProperties ) SetHangingIndent ( m _dg . Distance ) { if _gaed . _cdeed . Ind == nil { _gaed . _cdeed . Ind = _gdb . NewCT_Ind ( ) ; } ; if m == _dg . Zero { _gaed . _cdeed . Ind . HangingAttr = nil ; } else { _gaed . _cdeed . Ind . HangingAttr = & _de . ST_TwipsMeasure { } ;
_gaed . _cdeed . Ind . HangingAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( m / _dg . Twips ) ) ; } ; } ;
2021-08-23 20:44:48 +00:00
2024-09-16 09:59:58 +00:00
// GetStyleByID returns Style by it's IdAttr.
func ( _gbg * Document ) GetStyleByID ( id string ) Style { for _ , _egfg := range _gbg . Styles . _cadcge . Style { if _egfg . StyleIdAttr != nil && * _egfg . StyleIdAttr == id { return Style { _egfg } ; } ; } ; return Style { } ; } ;
// Color controls the run or styles color.
type Color struct { _ffe * _gdb . CT_Color } ; func ( _afcgd Paragraph ) addSeparateFldChar ( ) * _gdb . CT_FldChar { _gdcgd := _afcgd . addFldChar ( ) ; _gdcgd . FldCharTypeAttr = _gdb . ST_FldCharTypeSeparate ; return _gdcgd ; } ;
// AddTextInput adds text input form field to the paragraph and returns it.
func ( _eaedd Paragraph ) AddTextInput ( name string ) FormField { _fdfg := _eaedd . addFldCharsForField ( name , "\u0046\u004f\u0052\u004d\u0054\u0045\u0058\u0054" ) ; _fdfg . _eebdg . TextInput = _gdb . NewCT_FFTextInput ( ) ; return _fdfg ; } ;
// Paragraphs returns the paragraphs defined in a footnote.
func ( _gbbgg Footnote ) Paragraphs ( ) [ ] Paragraph { _ebde := [ ] Paragraph { } ; for _ , _edgf := range _gbbgg . content ( ) { for _ , _ecae := range _edgf . P { _ebde = append ( _ebde , Paragraph { _gbbgg . _cfee , _ecae } ) ; } ; } ; return _ebde ; } ;
// SetTextStyleBold set text style of watermark to bold.
func ( _caded * WatermarkText ) SetTextStyleBold ( value bool ) { if _caded . _ddcag != nil { _gcfa := _caded . GetStyle ( ) ; _gcfa . SetBold ( value ) ; _caded . SetStyle ( _gcfa ) ; } ; } ; func _bgab ( _cdcg [ ] * _gdb . CT_P , _ffdg * TableInfo , _fdafa * DrawingInfo ) [ ] TextItem { _agef := [ ] TextItem { } ;
for _ , _aeac := range _cdcg { _agef = append ( _agef , _dedc ( _aeac , nil , _ffdg , _fdafa , _aeac . EG_PContent ) ... ) ; } ; return _agef ; } ;
// SetRightPct sets the cell right margin
func ( _fabb CellMargins ) SetRightPct ( pct float64 ) { _fabb . _cf . Right = _gdb . NewCT_TblWidth ( ) ; _cca ( _fabb . _cf . Right , pct ) ; } ;
// RemoveRun removes a child run from a paragraph.
func ( _eaag Paragraph ) RemoveRun ( r Run ) { for _ , _cdga := range _eaag . _gbaee . EG_PContent { for _agad , _gdff := range _cdga . EG_ContentRunContent { if _gdff . R == r . _feebb { copy ( _cdga . EG_ContentRunContent [ _agad : ] , _cdga . EG_ContentRunContent [ _agad + 1 : ] ) ;
_cdga . EG_ContentRunContent = _cdga . EG_ContentRunContent [ 0 : len ( _cdga . EG_ContentRunContent ) - 1 ] ; } ; if _gdff . Sdt != nil && _gdff . Sdt . SdtContent != nil { for _gafba , _ggdd := range _gdff . Sdt . SdtContent . EG_ContentRunContent { if _ggdd . R == r . _feebb { copy ( _gdff . Sdt . SdtContent . EG_ContentRunContent [ _gafba : ] , _gdff . Sdt . SdtContent . EG_ContentRunContent [ _gafba + 1 : ] ) ;
_gdff . Sdt . SdtContent . EG_ContentRunContent = _gdff . Sdt . SdtContent . EG_ContentRunContent [ 0 : len ( _gdff . Sdt . SdtContent . EG_ContentRunContent ) - 1 ] ; } ; } ; } ; } ; } ; } ;
// TOCOptions specify options for table of contents customization.
type TOCOptions struct {
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
//UseHyperlinks makes the table of contents entries hyperlinks.
UseHyperlinks bool ;
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
//OmitPageNumbers allows omitting page numbers from the table of contents.
OmitPageNumbers bool ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
//HeadingLevel uses paragraphs formatted with all of the specified range of built-in heading styles.
//"3-3" is to show only third heading level, for instance.
HeadingLevel string ; } ; func ( _acaac * WatermarkText ) getShape ( ) * _f . XSDAny { return _acaac . getInnerElement ( "\u0073\u0068\u0061p\u0065" ) ; } ; func ( _fdad * Document ) syncFootnoteSettings ( ) { _dcfb := [ ] int64 { } ; _dbbf := _fdad . Footnotes ( ) ; for _ , _afed := range _dbbf { if _afed . X ( ) . TypeAttr != _gdb . ST_FtnEdnUnset && _afed . X ( ) . TypeAttr != _gdb . ST_FtnEdnNormal { _dcfb = append ( _dcfb , _afed . X ( ) . IdAttr ) ;
} ; } ; _ecea := _fdad . Settings . X ( ) . CT_Settings . FootnotePr ; if _ecea == nil { _ecea = _gdb . NewCT_FtnDocProps ( ) ; } ; if len ( _dcfb ) == 0 { _ecea . Footnote = nil ; return ; } ; _ecea . Footnote = [ ] * _gdb . CT_FtnEdnSepRef { } ; for _ , _bgd := range _dcfb { _cec := _gdb . NewCT_FtnEdnSepRef ( ) ;
_cec . IdAttr = _bgd ; _ecea . Footnote = append ( _ecea . Footnote , _cec ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// NewWatermarkPicture generates new WatermarkPicture.
func NewWatermarkPicture ( ) WatermarkPicture { _bgde := _eb . NewShapetype ( ) ; _cafe := _eb . NewEG_ShapeElements ( ) ; _cafe . Formulas = _gcfddg ( ) ; _cafe . Path = _fbcb ( ) ; _cafe . Lock = _gbfg ( ) ; _bgde . EG_ShapeElements = [ ] * _eb . EG_ShapeElements { _cafe } ; var ( _facb = "\u005f\u0078\u0030\u0030\u0030\u0030\u005f\u0074\u0037\u0035" ;
_afaga = "2\u0031\u0036\u0030\u0030\u002c\u0032\u0031\u0036\u0030\u0030" ; _cbaca = float32 ( 75.0 ) ; _gcfg = "\u006d\u0040\u0034\u00405l\u0040\u0034\u0040\u0031\u0031\u0040\u0039\u0040\u0031\u0031\u0040\u0039\u0040\u0035x\u0065" ; ) ; _bgde . IdAttr = & _facb ; _bgde . CoordsizeAttr = & _afaga ;
_bgde . SptAttr = & _cbaca ; _bgde . PreferrelativeAttr = _de . ST_TrueFalseTrue ; _bgde . PathAttr = & _gcfg ; _bgde . FilledAttr = _de . ST_TrueFalseFalse ; _bgde . StrokedAttr = _de . ST_TrueFalseFalse ; _eaeeb := _eb . NewShape ( ) ; _cfbb := _eb . NewEG_ShapeElements ( ) ; _cfbb . Imagedata = _gfgbc ( ) ;
_eaeeb . EG_ShapeElements = [ ] * _eb . EG_ShapeElements { _cfbb } ; var ( _cccgg = "\u0057\u006f\u0072\u0064\u0050\u0069\u0063\u0074\u0075\u0072e\u0057\u0061\u0074\u0065\u0072\u006d\u0061r\u006b\u0031\u0036\u0033\u0032\u0033\u0031\u0036\u0035\u0039\u0035" ; _fdff = "\u005f\u0078\u00300\u0030\u0030\u005f\u0073\u0032\u0030\u0035\u0031" ;
_bfga = "#\u005f\u0078\u0030\u0030\u0030\u0030\u005f\u0074\u0037\u0035" ; _dbegd = "" ; _ebffbg = "\u0070os\u0069t\u0069o\u006e\u003a\u0061\u0062\u0073\u006fl\u0075\u0074\u0065\u003bm\u0061\u0072\u0067\u0069\u006e\u002d\u006c\u0065\u0066\u0074\u003a\u0030\u003bma\u0072\u0067\u0069\u006e\u002d\u0074\u006f\u0070\u003a\u0030\u003b\u0077\u0069\u0064\u0074\u0068\u003a\u0030\u0070\u0074;\u0068e\u0069\u0067\u0068\u0074\u003a\u0030\u0070\u0074\u003b\u007a\u002d\u0069\u006ed\u0065\u0078:\u002d\u0032\u00351\u0036\u0035\u0038\u0032\u0034\u0030\u003b\u006d\u0073o-\u0070\u006f\u0073i\u0074\u0069\u006f\u006e-\u0068\u006f\u0072\u0069\u007a\u006fn\u0074\u0061l\u003a\u0063\u0065\u006e\u0074\u0065\u0072\u003bm\u0073\u006f\u002d\u0070\u006f\u0073\u0069\u0074\u0069\u006f\u006e\u002d\u0068\u006f\u0072\u0069\u007a\u006f\u006e\u0074\u0061\u006c\u002drela\u0074\u0069\u0076\u0065\u003a\u006d\u0061\u0072\u0067\u0069\u006e\u003b\u006d\u0073\u006f\u002d\u0070\u006f\u0073\u0069\u0074\u0069\u006f\u006e\u002d\u0076\u0065\u0072t\u0069c\u0061l\u003a\u0063\u0065\u006e\u0074\u0065\u0072\u003b\u006d\u0073\u006f\u002d\u0070\u006f\u0073\u0069\u0074\u0069\u006f\u006e-\u0076\u0065r\u0074\u0069c\u0061l\u002d\u0072\u0065\u006c\u0061\u0074i\u0076\u0065\u003a\u006d\u0061\u0072\u0067\u0069\u006e" ;
) ; _eaeeb . IdAttr = & _cccgg ; _eaeeb . SpidAttr = & _fdff ; _eaeeb . TypeAttr = & _bfga ; _eaeeb . AltAttr = & _dbegd ; _eaeeb . StyleAttr = & _ebffbg ; _eaeeb . AllowincellAttr = _de . ST_TrueFalseFalse ; _afba := _gdb . NewCT_Picture ( ) ; _afba . Any = [ ] _f . Any { _bgde , _eaeeb } ;
return WatermarkPicture { _gfaa : _afba , _adabf : _eaeeb , _fcdb : _bgde } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Section return paragraph properties section value.
func ( _dfebb ParagraphProperties ) Section ( ) ( Section , bool ) { if _dfebb . _egbf . SectPr != nil { return Section { _dfebb . _gddf , _dfebb . _egbf . SectPr } , true ; } ; return Section { } , false ; } ; func _gegf ( _cffb * _dcb . CT_Blip , _daff map [ string ] string ) { if _cffb . EmbedAttr != nil { if _efed , _cdeg := _daff [ * _cffb . EmbedAttr ] ;
_cdeg { * _cffb . EmbedAttr = _efed ; } ; } ; } ;
2024-02-17 03:37:07 +00:00
2024-09-16 09:59:58 +00:00
// FindNodeByStyleName return slice of node base on style name.
func ( _bcga * Nodes ) FindNodeByStyleName ( styleName string ) [ ] Node { _ceefa := [ ] Node { } ; for _ , _gdgdc := range _bcga . _gegee { switch _dfefe := _gdgdc . _dbca . ( type ) { case * Paragraph : if _dfefe != nil { if _badb , _ggfg := _gdgdc . _eabe . Styles . SearchStyleByName ( styleName ) ;
_ggfg { _gfea := _dfefe . Style ( ) ; if _gfea == _badb . StyleID ( ) { _ceefa = append ( _ceefa , _gdgdc ) ; } ; } ; } ; case * Table : if _dfefe != nil { if _faaaa , _gffa := _gdgdc . _eabe . Styles . SearchStyleByName ( styleName ) ; _gffa { _fedfe := _dfefe . Style ( ) ; if _fedfe == _faaaa . StyleID ( ) { _ceefa = append ( _ceefa , _gdgdc ) ;
} ; } ; } ; } ; _dbda := Nodes { _gegee : _gdgdc . Children } ; _ceefa = append ( _ceefa , _dbda . FindNodeByStyleName ( styleName ) ... ) ; } ; return _ceefa ; } ;
2021-08-23 20:44:48 +00:00
2024-09-16 09:59:58 +00:00
// SetAlignment controls the paragraph alignment
func ( _gbebd ParagraphProperties ) SetAlignment ( align _gdb . ST_Jc ) { if align == _gdb . ST_JcUnset { _gbebd . _egbf . Jc = nil ; } else { _gbebd . _egbf . Jc = _gdb . NewCT_Jc ( ) ; _gbebd . _egbf . Jc . ValAttr = align ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// AddPageBreak adds a page break to a run.
func ( _agfgfa Run ) AddPageBreak ( ) { _fabed := _agfgfa . newIC ( ) ; _fabed . Br = _gdb . NewCT_Br ( ) ; _fabed . Br . TypeAttr = _gdb . ST_BrTypePage ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// InsertRunBefore inserts a run in the paragraph before the relative run.
func ( _dedab Paragraph ) InsertRunBefore ( relativeTo Run ) Run { return _dedab . insertRun ( relativeTo , true ) ; } ; func _cefe ( _dbegb * _gdb . CT_OnOff ) bool { return _dbegb != nil } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// GetEffect returns the effect of the run.
func ( _cdgdc RunProperties ) GetEffect ( ) _gdb . ST_TextEffect { if _cdgdc . _bace . Effect == nil { return _gdb . ST_TextEffectUnset ; } ; return _cdgdc . _bace . Effect . ValAttr ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// CharacterSpacingMeasure returns paragraph characters spacing with its measure which can be mm, cm, in, pt, pc or pi.
func ( _ggga ParagraphProperties ) CharacterSpacingMeasure ( ) string { if _bdde := _ggga . _egbf . RPr . Spacing ; _bdde != nil { _cege := _bdde . ValAttr ; if _cege . ST_UniversalMeasure != nil { return * _cege . ST_UniversalMeasure ; } ; } ; return "" ; } ;
2022-02-05 13:05:36 +00:00
2024-09-16 09:59:58 +00:00
// Imprint returns true if run imprint is on.
func ( _cgda RunProperties ) Imprint ( ) bool { return _cefe ( _cgda . _bace . Imprint ) } ;
2021-09-22 16:41:01 +00:00
2024-09-16 09:59:58 +00:00
// Paragraphs returns the paragraphs defined in an endnote.
func ( _ecedg Endnote ) Paragraphs ( ) [ ] Paragraph { _ebffb := [ ] Paragraph { } ; for _ , _ecbb := range _ecedg . content ( ) { for _ , _fgee := range _ecbb . P { _ebffb = append ( _ebffb , Paragraph { _ecedg . _bdgb , _fgee } ) ; } ; } ; return _ebffb ; } ;
2021-09-22 16:41:01 +00:00
2024-09-16 09:59:58 +00:00
// FindNodeByText return node based on matched text and return a slice of node.
func ( _gcbb * Nodes ) FindNodeByText ( text string ) [ ] Node { _deab := [ ] Node { } ; for _ , _ebea := range _gcbb . _gegee { if _ab . TrimSpace ( _ebea . Text ( ) ) == text { _deab = append ( _deab , _ebea ) ; } ; _begg := Nodes { _gegee : _ebea . Children } ; _deab = append ( _deab , _begg . FindNodeByText ( text ) ... ) ;
} ; return _deab ; } ;
2021-09-22 16:41:01 +00:00
2024-09-16 09:59:58 +00:00
// Tables returns the tables defined in the document.
func ( _fce * Document ) Tables ( ) [ ] Table { _bgbe := [ ] Table { } ; if _fce . _dbc . Body == nil { return nil ; } ; for _ , _dda := range _fce . _dbc . Body . EG_BlockLevelElts { for _ , _eca := range _dda . EG_ContentBlockContent { for _ , _aadg := range _fce . tables ( _eca ) { _bgbe = append ( _bgbe , _aadg ) ;
} ; } ; } ; return _bgbe ; } ;
2020-12-17 22:07:08 +00:00
2024-07-28 07:48:26 +00:00
// X returns the inner wrapped XML type.
2024-09-16 09:59:58 +00:00
func ( _bfce Table ) X ( ) * _gdb . CT_Tbl { return _bfce . _afabf } ;
2023-07-04 11:04:03 +00:00
2024-09-16 09:59:58 +00:00
// SetHeight allows controlling the height of a row within a table.
func ( _fddda RowProperties ) SetHeight ( ht _dg . Distance , rule _gdb . ST_HeightRule ) { if rule == _gdb . ST_HeightRuleUnset { _fddda . _aggd . TrHeight = nil ; } else { _ceddba := _gdb . NewCT_Height ( ) ; _ceddba . HRuleAttr = rule ; _ceddba . ValAttr = & _de . ST_TwipsMeasure { } ;
_ceddba . ValAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( ht / _dg . Twips ) ) ; _fddda . _aggd . TrHeight = [ ] * _gdb . CT_Height { _ceddba } ; } ; } ;
2020-12-17 22:07:08 +00:00
2024-09-16 09:59:58 +00:00
// Shadow returns true if run shadow is on.
func ( _ggdfb RunProperties ) Shadow ( ) bool { return _cefe ( _ggdfb . _bace . Shadow ) } ; func ( _ddcaf Paragraph ) addStartBookmark ( _eaab int64 , _cbbda string ) * _gdb . CT_Bookmark { _addfb := _gdb . NewEG_PContent ( ) ; _ddcaf . _gbaee . EG_PContent = append ( _ddcaf . _gbaee . EG_PContent , _addfb ) ;
_cdegc := _gdb . NewEG_ContentRunContent ( ) ; _fdgd := _gdb . NewEG_RunLevelElts ( ) ; _ccbbb := _gdb . NewEG_RangeMarkupElements ( ) ; _fbaa := _gdb . NewCT_Bookmark ( ) ; _fbaa . NameAttr = _cbbda ; _fbaa . IdAttr = _eaab ; _ccbbb . BookmarkStart = _fbaa ; _addfb . EG_ContentRunContent = append ( _addfb . EG_ContentRunContent , _cdegc ) ;
_cdegc . EG_RunLevelElts = append ( _cdegc . EG_RunLevelElts , _fdgd ) ; _fdgd . EG_RangeMarkupElements = append ( _fdgd . EG_RangeMarkupElements , _ccbbb ) ; return _fbaa ; } ;
2023-12-28 15:53:06 +00:00
2024-09-16 09:59:58 +00:00
// NumId return numbering numId that being use by style properties.
func ( _baaf ParagraphStyleProperties ) NumId ( ) int64 { if _baaf . _cdeed . NumPr != nil { if _baaf . _cdeed . NumPr . NumId != nil { return _baaf . _cdeed . NumPr . NumId . ValAttr ; } ; } ; return - 1 ; } ;
2020-12-17 22:07:08 +00:00
2024-09-16 09:59:58 +00:00
// Fonts allows manipulating a style or run's fonts.
type Fonts struct { _cfeaa * _gdb . CT_Fonts } ;
2020-12-17 22:07:08 +00:00
2024-09-16 09:59:58 +00:00
// Styles is the document wide styles contained in styles.xml.
type Styles struct { _cadcge * _gdb . Styles } ;
2020-12-17 22:07:08 +00:00
2024-09-16 09:59:58 +00:00
// SetSize sets the size of the displayed image on the page.
func ( _gcga InlineDrawing ) SetSize ( w , h _dg . Distance ) { _gcga . _eeed . Extent . CxAttr = int64 ( float64 ( w * _dg . Pixel72 ) / _dg . EMU ) ; _gcga . _eeed . Extent . CyAttr = int64 ( float64 ( h * _dg . Pixel72 ) / _dg . EMU ) ; } ;
2022-12-06 11:56:49 +00:00
2024-09-16 09:59:58 +00:00
// SetShapeStyle sets style to the element v:shape in watermark.
func ( _dbed * WatermarkPicture ) SetShapeStyle ( shapeStyle _gg . ShapeStyle ) { if _dbed . _adabf != nil { _beacc := shapeStyle . String ( ) ; _dbed . _adabf . StyleAttr = & _beacc ; } ; } ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// SetSmallCaps sets the run to small caps.
func ( _cbcbb RunProperties ) SetSmallCaps ( b bool ) { if ! b { _cbcbb . _bace . SmallCaps = nil ; } else { _cbcbb . _bace . SmallCaps = _gdb . NewCT_OnOff ( ) ; } ; } ;
2022-12-06 11:56:49 +00:00
2024-09-16 09:59:58 +00:00
// SetCellSpacing sets the cell spacing within a table.
func ( _fagea TableProperties ) SetCellSpacing ( m _dg . Distance ) { _fagea . _affd . TblCellSpacing = _gdb . NewCT_TblWidth ( ) ; _fagea . _affd . TblCellSpacing . TypeAttr = _gdb . ST_TblWidthDxa ; _fagea . _affd . TblCellSpacing . WAttr = & _gdb . ST_MeasurementOrPercent { } ;
_fagea . _affd . TblCellSpacing . WAttr . ST_DecimalNumberOrPercent = & _gdb . ST_DecimalNumberOrPercent { } ; _fagea . _affd . TblCellSpacing . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _f . Int64 ( int64 ( m / _dg . Dxa ) ) ; } ;
2022-06-27 19:44:23 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _dacad RunProperties ) X ( ) * _gdb . CT_RPr { return _dacad . _bace } ;
2022-06-27 19:44:23 +00:00
2024-09-16 09:59:58 +00:00
// SetBeforeSpacing sets spacing above paragraph.
func ( _dagc Paragraph ) SetBeforeSpacing ( d _dg . Distance ) { _dagc . ensurePPr ( ) ; if _dagc . _gbaee . PPr . Spacing == nil { _dagc . _gbaee . PPr . Spacing = _gdb . NewCT_Spacing ( ) ; } ; _ggcce := _dagc . _gbaee . PPr . Spacing ; _ggcce . BeforeAttr = & _de . ST_TwipsMeasure { } ;
_ggcce . BeforeAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( d / _dg . Twips ) ) ; } ;
2020-12-17 22:07:08 +00:00
2024-09-16 09:59:58 +00:00
// read reads a document from an io.Reader.
func Read ( r _g . ReaderAt , size int64 ) ( * Document , error ) { return _geff ( r , size , "" ) } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped type
func ( _bfc CellBorders ) X ( ) * _gdb . CT_TcBorders { return _bfc . _ebf } ; func ( _fgdd * Document ) syncEndnoteSettings ( ) { _cebc := [ ] int64 { } ; _bacb := _fgdd . Endnotes ( ) ; for _ , _fad := range _bacb { if _fad . X ( ) . TypeAttr != _gdb . ST_FtnEdnUnset && _fad . X ( ) . TypeAttr != _gdb . ST_FtnEdnNormal { _cebc = append ( _cebc , _fad . X ( ) . IdAttr ) ;
} ; } ; _gec := _fgdd . Settings . X ( ) . CT_Settings . EndnotePr ; if _gec == nil { _gec = _gdb . NewCT_EdnDocProps ( ) ; } ; if len ( _cebc ) == 0 { _gec . Endnote = nil ; return ; } ; _gec . Endnote = [ ] * _gdb . CT_FtnEdnSepRef { } ; for _ , _afgc := range _cebc { _ede := _gdb . NewCT_FtnEdnSepRef ( ) ;
_ede . IdAttr = _afgc ; _gec . Endnote = append ( _gec . Endnote , _ede ) ; } ; } ; func ( _bdbcg * WatermarkPicture ) findNode ( _ecead * _f . XSDAny , _gebfb string ) * _f . XSDAny { for _ , _bgfb := range _ecead . Nodes { if _bgfb . XMLName . Local == _gebfb { return _bgfb ; } ; } ; return nil ;
} ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SaveToFile writes the document out to a file.
func ( _bbceg * Document ) SaveToFile ( path string ) error { _gdca , _cbde := _ag . Create ( path ) ; if _cbde != nil { return _cbde ; } ; defer _gdca . Close ( ) ; return _bbceg . Save ( _gdca ) ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetWidth sets the cell width to a specified width.
func ( _efd CellProperties ) SetWidth ( d _dg . Distance ) { _efd . _debd . TcW = _gdb . NewCT_TblWidth ( ) ; _efd . _debd . TcW . TypeAttr = _gdb . ST_TblWidthDxa ; _efd . _debd . TcW . WAttr = & _gdb . ST_MeasurementOrPercent { } ; _efd . _debd . TcW . WAttr . ST_DecimalNumberOrPercent = & _gdb . ST_DecimalNumberOrPercent { } ;
_efd . _debd . TcW . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _f . Int64 ( int64 ( d / _dg . Twips ) ) ; } ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// AddParagraph adds a paragraph to the endnote.
func ( _cdacd Endnote ) AddParagraph ( ) Paragraph { _dfcbc := _gdb . NewEG_ContentBlockContent ( ) ; _edfd := len ( _cdacd . _baab . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent ) ; _cdacd . _baab . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent = append ( _cdacd . _baab . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent , _dfcbc ) ;
_cbdfa := _gdb . NewCT_P ( ) ; var _abdfg * _gdb . CT_String ; if _edfd != 0 { _acaca := len ( _cdacd . _baab . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent [ _edfd - 1 ] . P ) ; _abdfg = _cdacd . _baab . EG_BlockLevelElts [ 0 ] . EG_ContentBlockContent [ _edfd - 1 ] . P [ _acaca - 1 ] . PPr . PStyle ;
} else { _abdfg = _gdb . NewCT_String ( ) ; _abdfg . ValAttr = "\u0045n\u0064\u006e\u006f\u0074\u0065" ; } ; _dfcbc . P = append ( _dfcbc . P , _cbdfa ) ; _bbef := Paragraph { _cdacd . _bdgb , _cbdfa } ; _bbef . _gbaee . PPr = _gdb . NewCT_PPr ( ) ; _bbef . _gbaee . PPr . PStyle = _abdfg ;
_bbef . _gbaee . PPr . RPr = _gdb . NewCT_ParaRPr ( ) ; return _bbef ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Tables returns the tables defined in the header.
func ( _ffbg Header ) Tables ( ) [ ] Table { _ggadd := [ ] Table { } ; if _ffbg . _eeee == nil { return nil ; } ; for _ , _abea := range _ffbg . _eeee . EG_ContentBlockContent { for _ , _bdeb := range _ffbg . _ddgg . tables ( _abea ) { _ggadd = append ( _ggadd , _bdeb ) ; } ; } ; return _ggadd ;
} ;
2020-08-23 14:15:53 +00:00
2024-07-28 07:48:26 +00:00
// X returns the inner wrapped XML type.
2024-09-16 09:59:58 +00:00
func ( _fef CellProperties ) X ( ) * _gdb . CT_TcPr { return _fef . _debd } ;
2023-08-06 17:57:53 +00:00
2024-09-16 09:59:58 +00:00
// IsItalic returns true if the run has been set to italics.
func ( _gabae RunProperties ) IsItalic ( ) bool { return _gabae . ItalicValue ( ) == OnOffValueOn } ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// SetAlignment set alignment of paragraph.
func ( _fgddb Paragraph ) SetAlignment ( alignment _gdb . ST_Jc ) { _fgddb . ensurePPr ( ) ; if _fgddb . _gbaee . PPr . Jc == nil { _fgddb . _gbaee . PPr . Jc = _gdb . NewCT_Jc ( ) ; } ; _fgddb . _gbaee . PPr . Jc . ValAttr = alignment ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// ClearContent clears any content in the run (text, tabs, breaks, etc.)
func ( _cdcfd Run ) ClearContent ( ) { _cdcfd . _feebb . EG_RunInnerContent = nil } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Endnote is an individual endnote reference within the document.
type Endnote struct { _bdgb * Document ; _baab * _gdb . CT_FtnEdn ; } ;
2017-08-28 20:56:18 -05:00
2024-09-16 09:59:58 +00:00
// SetEmboss sets the run to embossed text.
func ( _cgba RunProperties ) SetEmboss ( b bool ) { if ! b { _cgba . _bace . Emboss = nil ; } else { _cgba . _bace . Emboss = _gdb . NewCT_OnOff ( ) ; } ; } ;
2022-01-15 21:17:38 +00:00
2024-09-16 09:59:58 +00:00
// Name returns the name of the bookmark whcih is the document unique ID that
// identifies the bookmark.
func ( _eaba Bookmark ) Name ( ) string { return _eaba . _ad . NameAttr } ;
2020-03-13 09:53:51 +00:00
2024-09-16 09:59:58 +00:00
// AddWatermarkPicture adds new watermark picture to document.
func ( _eeag * Document ) AddWatermarkPicture ( imageRef _cc . ImageRef ) WatermarkPicture { var _dbeg [ ] Header ; if _daag , _gfdf := _eeag . BodySection ( ) . GetHeader ( _gdb . ST_HdrFtrDefault ) ; _gfdf { _dbeg = append ( _dbeg , _daag ) ; } ; if _gaae , _faed := _eeag . BodySection ( ) . GetHeader ( _gdb . ST_HdrFtrEven ) ;
_faed { _dbeg = append ( _dbeg , _gaae ) ; } ; if _egb , _bcge := _eeag . BodySection ( ) . GetHeader ( _gdb . ST_HdrFtrFirst ) ; _bcge { _dbeg = append ( _dbeg , _egb ) ; } ; if len ( _dbeg ) < 1 { _dff := _eeag . AddHeader ( ) ; _eeag . BodySection ( ) . SetHeader ( _dff , _gdb . ST_HdrFtrDefault ) ;
_dbeg = append ( _dbeg , _dff ) ; } ; var _fgf error ; _ceec := NewWatermarkPicture ( ) ; for _ , _abed := range _dbeg { imageRef , _fgf = _abed . AddImageRef ( imageRef ) ; if _fgf != nil { return WatermarkPicture { } ; } ; _dbce := _abed . Paragraphs ( ) ; if len ( _dbce ) < 1 { _eecf := _abed . AddParagraph ( ) ;
_eecf . AddRun ( ) . AddText ( "" ) ; } ; for _ , _aagg := range _abed . X ( ) . EG_ContentBlockContent { for _ , _faae := range _aagg . P { for _ , _fbbg := range _faae . EG_PContent { for _ , _ffg := range _fbbg . EG_ContentRunContent { if _ffg . R == nil { continue ; } ; for _ , _bdee := range _ffg . R . EG_RunInnerContent { _bdee . Pict = _ceec . _gfaa ;
break ; } ; } ; } ; } ; } ; } ; _ceec . SetPicture ( imageRef ) ; return _ceec ; } ;
2020-03-13 09:53:51 +00:00
2024-09-16 09:59:58 +00:00
// DoubleStrike returns true if paragraph is double striked.
func ( _bcad ParagraphProperties ) DoubleStrike ( ) bool { return _cefe ( _bcad . _egbf . RPr . Dstrike ) } ;
2020-03-13 09:53:51 +00:00
2024-09-16 09:59:58 +00:00
// EastAsiaFont returns the name of paragraph font family for East Asia.
func ( _cbga ParagraphProperties ) EastAsiaFont ( ) string { if _eebca := _cbga . _egbf . RPr . RFonts ; _eebca != nil { if _eebca . EastAsiaAttr != nil { return * _eebca . EastAsiaAttr ; } ; } ; return "" ; } ;
2023-07-04 11:04:03 +00:00
2024-09-16 09:59:58 +00:00
// SetTextWrapThrough sets the text wrap to through with a give wrap type.
func ( _ea AnchoredDrawing ) SetTextWrapThrough ( option * AnchorDrawWrapOptions ) { _ea . _bc . Choice = & _gdb . WdEG_WrapTypeChoice { } ; _ea . _bc . Choice . WrapThrough = _gdb . NewWdCT_WrapThrough ( ) ; _ea . _bc . Choice . WrapThrough . WrapTextAttr = _gdb . WdST_WrapTextBothSides ;
_aec := false ; _ea . _bc . Choice . WrapThrough . WrapPolygon . EditedAttr = & _aec ; if option == nil { option = NewAnchorDrawWrapOptions ( ) ; } ; _ea . _bc . Choice . WrapThrough . WrapPolygon . Start = option . GetWrapPathStart ( ) ; _ea . _bc . Choice . WrapThrough . WrapPolygon . LineTo = option . GetWrapPathLineTo ( ) ;
_ea . _bc . LayoutInCellAttr = true ; _ea . _bc . AllowOverlapAttr = true ; } ;
2023-07-04 11:04:03 +00:00
2024-09-16 09:59:58 +00:00
// SetSize sets size attribute for a FormFieldTypeCheckBox in pt.
func ( _gbaag FormField ) SetSize ( size uint64 ) { size *= 2 ; if _gbaag . _eebdg . CheckBox != nil { _gbaag . _eebdg . CheckBox . Choice = _gdb . NewCT_FFCheckBoxChoice ( ) ; _gbaag . _eebdg . CheckBox . Choice . Size = _gdb . NewCT_HpsMeasure ( ) ; _gbaag . _eebdg . CheckBox . Choice . Size . ValAttr = _gdb . ST_HpsMeasure { ST_UnsignedDecimalNumber : & size } ;
} ; } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// SetSize sets the size of the displayed image on the page.
func ( _dgg AnchoredDrawing ) SetSize ( w , h _dg . Distance ) { _dgg . _bc . Extent . CxAttr = int64 ( float64 ( w * _dg . Pixel72 ) / _dg . EMU ) ; _dgg . _bc . Extent . CyAttr = int64 ( float64 ( h * _dg . Pixel72 ) / _dg . EMU ) ; } ;
2020-03-13 09:53:51 +00:00
2024-09-16 09:59:58 +00:00
// Cells returns the cells defined in the table.
func ( _eacfe Row ) Cells ( ) [ ] Cell { _agefb := [ ] Cell { } ; for _ , _bacdg := range _eacfe . _begf . EG_ContentCellContent { for _ , _bcada := range _bacdg . Tc { _agefb = append ( _agefb , Cell { _eacfe . _cebfg , _bcada } ) ; } ; if _bacdg . Sdt != nil && _bacdg . Sdt . SdtContent != nil { for _ , _dgbd := range _bacdg . Sdt . SdtContent . Tc { _agefb = append ( _agefb , Cell { _eacfe . _cebfg , _dgbd } ) ;
} ; } ; } ; return _agefb ; } ;
2021-08-23 20:44:48 +00:00
2024-09-16 09:59:58 +00:00
// Paragraphs returns all of the paragraphs in the document body including tables.
func ( _ddd * Document ) Paragraphs ( ) [ ] Paragraph { _cbfb := [ ] Paragraph { } ; if _ddd . _dbc . Body == nil { return nil ; } ; for _ , _bbdc := range _ddd . _dbc . Body . EG_BlockLevelElts { for _ , _cbe := range _bbdc . EG_ContentBlockContent { for _ , _ceea := range _cbe . P { _cbfb = append ( _cbfb , Paragraph { _ddd , _ceea } ) ;
} ; } ; } ; for _ , _cbca := range _ddd . Tables ( ) { for _ , _cdac := range _cbca . Rows ( ) { for _ , _beb := range _cdac . Cells ( ) { _cbfb = append ( _cbfb , _beb . Paragraphs ( ) ... ) ; } ; } ; } ; return _cbfb ; } ;
2017-08-28 20:56:18 -05:00
2024-09-16 09:59:58 +00:00
// Rows returns the rows defined in the table.
func ( _bbeg Table ) Rows ( ) [ ] Row { _cgfab := [ ] Row { } ; for _ , _aeabb := range _bbeg . _afabf . EG_ContentRowContent { for _ , _dddfe := range _aeabb . Tr { _cgfab = append ( _cgfab , Row { _bbeg . _feaf , _dddfe } ) ; } ; if _aeabb . Sdt != nil && _aeabb . Sdt . SdtContent != nil { for _ , _dcadcb := range _aeabb . Sdt . SdtContent . Tr { _cgfab = append ( _cgfab , Row { _bbeg . _feaf , _dcadcb } ) ;
} ; } ; } ; return _cgfab ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetName sets the name of the image, visible in the properties of the image
// within Word.
func ( _dcd AnchoredDrawing ) SetName ( name string ) { _dcd . _bc . DocPr . NameAttr = name ; for _ , _ge := range _dcd . _bc . Graphic . GraphicData . Any { if _agg , _db := _ge . ( * _ef . Pic ) ; _db { _agg . NvPicPr . CNvPr . DescrAttr = _f . String ( name ) ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// GetWrapPathStart return wrapPath start value.
func ( _bag AnchorDrawWrapOptions ) GetWrapPathStart ( ) * _dcb . CT_Point2D { return _bag . _ace } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetWrapPathLineTo sets wrapPath lineTo value.
func ( _eab AnchorDrawWrapOptions ) SetWrapPathLineTo ( coordinates [ ] * _dcb . CT_Point2D ) { _eab . _cde = coordinates ; } ;
2020-08-23 14:15:53 +00:00
2024-07-28 07:48:26 +00:00
// Font returns the name of paragraph font family.
2024-09-16 09:59:58 +00:00
func ( _afcga ParagraphProperties ) Font ( ) string { if _ggbee := _afcga . _egbf . RPr . RFonts ; _ggbee != nil { if _ggbee . AsciiAttr != nil { return * _ggbee . AsciiAttr ; } else if _ggbee . HAnsiAttr != nil { return * _ggbee . HAnsiAttr ; } else if _ggbee . CsAttr != nil { return * _ggbee . CsAttr ;
2024-07-28 07:48:26 +00:00
} ; } ; return "" ; } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// AddTable adds a new table to the document body.
func ( _gga * Document ) AddTable ( ) Table { _acdd := _gdb . NewEG_BlockLevelElts ( ) ; _gga . _dbc . Body . EG_BlockLevelElts = append ( _gga . _dbc . Body . EG_BlockLevelElts , _acdd ) ; _dbfa := _gdb . NewEG_ContentBlockContent ( ) ; _acdd . EG_ContentBlockContent = append ( _acdd . EG_ContentBlockContent , _dbfa ) ;
_caf := _gdb . NewCT_Tbl ( ) ; _dbfa . Tbl = append ( _dbfa . Tbl , _caf ) ; return Table { _gga , _caf } ; } ; func ( _cdba * Document ) appendTable ( _faf * Paragraph , _egd Table , _afc bool ) Table { _gdbe := _cdba . _dbc . Body ; _bcdf := _gdb . NewEG_BlockLevelElts ( ) ; _cdba . _dbc . Body . EG_BlockLevelElts = append ( _cdba . _dbc . Body . EG_BlockLevelElts , _bcdf ) ;
_bee := _gdb . NewEG_ContentBlockContent ( ) ; _bcdf . EG_ContentBlockContent = append ( _bcdf . EG_ContentBlockContent , _bee ) ; if _faf != nil { _caca := _faf . X ( ) ; for _dagf , _bddf := range _gdbe . EG_BlockLevelElts { for _ , _fga := range _bddf . EG_ContentBlockContent { for _cgf , _abbc := range _bee . P { if _abbc == _caca { _abdg := _egd . X ( ) ;
_ecd := _gdb . NewEG_BlockLevelElts ( ) ; _ffaa := _gdb . NewEG_ContentBlockContent ( ) ; _ecd . EG_ContentBlockContent = append ( _ecd . EG_ContentBlockContent , _ffaa ) ; _ffaa . Tbl = append ( _ffaa . Tbl , _abdg ) ; _gdbe . EG_BlockLevelElts = append ( _gdbe . EG_BlockLevelElts , nil ) ;
if _afc { copy ( _gdbe . EG_BlockLevelElts [ _dagf + 1 : ] , _gdbe . EG_BlockLevelElts [ _dagf : ] ) ; _gdbe . EG_BlockLevelElts [ _dagf ] = _ecd ; if _cgf != 0 { _caeb := _gdb . NewEG_BlockLevelElts ( ) ; _gffc := _gdb . NewEG_ContentBlockContent ( ) ; _caeb . EG_ContentBlockContent = append ( _caeb . EG_ContentBlockContent , _gffc ) ;
_gffc . P = _fga . P [ : _cgf ] ; _gdbe . EG_BlockLevelElts = append ( _gdbe . EG_BlockLevelElts , nil ) ; copy ( _gdbe . EG_BlockLevelElts [ _dagf + 1 : ] , _gdbe . EG_BlockLevelElts [ _dagf : ] ) ; _gdbe . EG_BlockLevelElts [ _dagf ] = _caeb ; } ; _fga . P = _fga . P [ _cgf : ] ; } else { copy ( _gdbe . EG_BlockLevelElts [ _dagf + 2 : ] , _gdbe . EG_BlockLevelElts [ _dagf + 1 : ] ) ;
_gdbe . EG_BlockLevelElts [ _dagf + 1 ] = _ecd ; if _cgf != len ( _fga . P ) - 1 { _ffeg := _gdb . NewEG_BlockLevelElts ( ) ; _bda := _gdb . NewEG_ContentBlockContent ( ) ; _ffeg . EG_ContentBlockContent = append ( _ffeg . EG_ContentBlockContent , _bda ) ; _bda . P = _fga . P [ _cgf + 1 : ] ;
_gdbe . EG_BlockLevelElts = append ( _gdbe . EG_BlockLevelElts , nil ) ; copy ( _gdbe . EG_BlockLevelElts [ _dagf + 3 : ] , _gdbe . EG_BlockLevelElts [ _dagf + 2 : ] ) ; _gdbe . EG_BlockLevelElts [ _dagf + 2 ] = _ffeg ; } ; _fga . P = _fga . P [ : _cgf + 1 ] ; } ; break ; } ; } ; for _ , _edcb := range _fga . Tbl { _ecfb := _fda ( _edcb , _caca , _afc ) ;
if _ecfb != nil { break ; } ; } ; } ; } ; } else { _bee . Tbl = append ( _bee . Tbl , _egd . X ( ) ) ; } ; return Table { _cdba , _egd . X ( ) } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetColor sets the text color.
func ( _afceee RunProperties ) SetColor ( c _gbc . Color ) { _afceee . _bace . Color = _gdb . NewCT_Color ( ) ; _afceee . _bace . Color . ValAttr . ST_HexColorRGB = c . AsRGBString ( ) ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Tables returns the tables defined in the footer.
func ( _gfec Footer ) Tables ( ) [ ] Table { _bgfa := [ ] Table { } ; if _gfec . _dbdg == nil { return nil ; } ; for _ , _gcce := range _gfec . _dbdg . EG_ContentBlockContent { for _ , _fdbeb := range _gfec . _dgbc . tables ( _gcce ) { _bgfa = append ( _bgfa , _fdbeb ) ; } ; } ; return _bgfa ;
} ; func ( _daa * Document ) removeEndnote ( _aecg int64 ) { _dgge := _daa . _gde ; var _feeg int ; for _cgd , _bedg := range _dgge . CT_Endnotes . Endnote { if _bedg . IdAttr == _aecg { _feeg = _cgd ; break ; } ; } ; _dgge . CT_Endnotes . Endnote [ _feeg ] = nil ; _dgge . CT_Endnotes . Endnote [ _feeg ] = _dgge . CT_Endnotes . Endnote [ len ( _dgge . CT_Endnotes . Endnote ) - 1 ] ;
_dgge . CT_Endnotes . Endnote = _dgge . CT_Endnotes . Endnote [ : len ( _dgge . CT_Endnotes . Endnote ) - 1 ] ; _daa . reorderEndnote ( ) ; _daa . syncEndnoteSettings ( ) ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Append appends a document d0 to a document d1. All settings, headers and footers remain the same as in the document d0 if they exist there, otherwise they are taken from the d1.
func ( _dgaf * Document ) Append ( d1orig * Document ) error { _aefdf , _adcf := d1orig . Copy ( ) ; if _adcf != nil { return _adcf ; } ; _dgaf . DocBase = _dgaf . DocBase . Append ( _aefdf . DocBase ) ; if _aefdf . _dbc . ConformanceAttr != _de . ST_ConformanceClassStrict { _dgaf . _dbc . ConformanceAttr = _aefdf . _dbc . ConformanceAttr ;
} ; _aeef := _dgaf . _aed . X ( ) . Relationship ; _bddde := _aefdf . _aed . X ( ) . Relationship ; _gefb := _aefdf . _dbc . Body ; _ecbg := map [ string ] string { } ; _bgdb := map [ int64 ] int64 { } ; _cage := map [ int64 ] int64 { } ; for _ , _gbfa := range _bddde { _dbdd := true ; _dedf := _gbfa . IdAttr ;
_gafeb := _gbfa . TargetAttr ; _fbgd := _gbfa . TypeAttr ; _feada := _fbgd == _f . ImageType ; _bbg := _fbgd == _f . HyperLinkType ; var _efc string ; for _ , _defgf := range _aeef { if _defgf . TypeAttr == _fbgd && _defgf . TargetAttr == _gafeb { _dbdd = false ; _efc = _defgf . IdAttr ;
break ; } ; } ; if _feada { _ddcb := "\u0077\u006f\u0072d\u002f" + _gafeb ; for _ , _agbbc := range _aefdf . DocBase . Images { if _agbbc . Target ( ) == _ddcb { _fdbdd , _fegd := _cc . ImageFromStorage ( _agbbc . Path ( ) ) ; if _fegd != nil { return _fegd ; } ; _dfeb , _fegd := _dgaf . AddImage ( _fdbdd ) ;
if _fegd != nil { return _fegd ; } ; _efc = _dfeb . RelID ( ) ; break ; } ; } ; } else if _dbdd { if _bbg { _cfd := _dgaf . _aed . AddHyperlink ( _gafeb ) ; _efc = _cc . Relationship ( _cfd ) . ID ( ) ; } else { _ffgd := _dgaf . _aed . AddRelationship ( _gafeb , _fbgd ) ; _efc = _ffgd . X ( ) . IdAttr ;
} ; } ; if _dedf != _efc { _ecbg [ _dedf ] = _efc ; } ; } ; if _gefb . SectPr != nil { for _ , _afae := range _gefb . SectPr . EG_HdrFtrReferences { if _afae . HeaderReference != nil { if _fgce , _ffbc := _ecbg [ _afae . HeaderReference . IdAttr ] ; _ffbc { _afae . HeaderReference . IdAttr = _fgce ;
_dgaf . _fgd = append ( _dgaf . _fgd , _cc . NewRelationships ( ) ) ; } ; } else if _afae . FooterReference != nil { if _bfee , _cdfeg := _ecbg [ _afae . FooterReference . IdAttr ] ; _cdfeg { _afae . FooterReference . IdAttr = _bfee ; _dgaf . _gaf = append ( _dgaf . _gaf , _cc . NewRelationships ( ) ) ;
} ; } ; } ; } ; _bacfe , _ggda := _dgaf . _gde , _aefdf . _gde ; if _bacfe != nil { if _ggda != nil { if _bacfe . Endnote != nil { if _ggda . Endnote != nil { _fbcd := int64 ( len ( _bacfe . Endnote ) + 1 ) ; for _ , _egca := range _ggda . Endnote { _fbdd := _egca . IdAttr ; if _fbdd > 0 { _egca . IdAttr = _fbcd ;
_bacfe . Endnote = append ( _bacfe . Endnote , _egca ) ; _cage [ _fbdd ] = _fbcd ; _fbcd ++ ; } ; } ; } ; } else { _bacfe . Endnote = _ggda . Endnote ; } ; } ; } else if _ggda != nil { _bacfe = _ggda ; } ; _dgaf . _gde = _bacfe ; _dbabb , _cbfg := _dgaf . _bgg , _aefdf . _bgg ; if _dbabb != nil { if _cbfg != nil { if _dbabb . Footnote != nil { if _cbfg . Footnote != nil { _dfdc := int64 ( len ( _dbabb . Footnote ) + 1 ) ;
for _ , _ggdf := range _cbfg . Footnote { _aegcc := _ggdf . IdAttr ; if _aegcc > 0 { _ggdf . IdAttr = _dfdc ; _dbabb . Footnote = append ( _dbabb . Footnote , _ggdf ) ; _bgdb [ _aegcc ] = _dfdc ; _dfdc ++ ; } ; } ; } ; } else { _dbabb . Footnote = _cbfg . Footnote ; } ; } ; } else if _cbfg != nil { _dbabb = _cbfg ;
} ; _dgaf . _bgg = _dbabb ; for _ , _acbe := range _gefb . EG_BlockLevelElts { for _ , _bdbcb := range _acbe . EG_ContentBlockContent { for _ , _dbac := range _bdbcb . P { _dage ( _dbac , _ecbg ) ; _adcd ( _dbac , _ecbg ) ; _dbfc ( _dbac , _bgdb , _cage ) ; } ; for _ , _gggf := range _bdbcb . Tbl { _gffbe ( _gggf , _ecbg ) ;
_aafb ( _gggf , _ecbg ) ; _cecf ( _gggf , _bgdb , _cage ) ; } ; } ; } ; _dgaf . _dbc . Body . EG_BlockLevelElts = append ( _dgaf . _dbc . Body . EG_BlockLevelElts , _aefdf . _dbc . Body . EG_BlockLevelElts ... ) ; if _dgaf . _dbc . Body . SectPr == nil { _dgaf . _dbc . Body . SectPr = _aefdf . _dbc . Body . SectPr ;
} else { var _gbfd , _bccg bool ; for _ , _dedfa := range _dgaf . _dbc . Body . SectPr . EG_HdrFtrReferences { if _dedfa . HeaderReference != nil { _gbfd = true ; } else if _dedfa . FooterReference != nil { _bccg = true ; } ; } ; if ! _gbfd { for _ , _fcea := range _aefdf . _dbc . Body . SectPr . EG_HdrFtrReferences { if _fcea . HeaderReference != nil { _dgaf . _dbc . Body . SectPr . EG_HdrFtrReferences = append ( _dgaf . _dbc . Body . SectPr . EG_HdrFtrReferences , _fcea ) ;
break ; } ; } ; } ; if ! _bccg { for _ , _aagd := range _aefdf . _dbc . Body . SectPr . EG_HdrFtrReferences { if _aagd . FooterReference != nil { _dgaf . _dbc . Body . SectPr . EG_HdrFtrReferences = append ( _dgaf . _dbc . Body . SectPr . EG_HdrFtrReferences , _aagd ) ; break ; } ; } ; } ;
if _dgaf . _dbc . Body . SectPr . Cols == nil && _aefdf . _dbc . Body . SectPr . Cols != nil { _dgaf . _dbc . Body . SectPr . Cols = _aefdf . _dbc . Body . SectPr . Cols ; } ; } ; _caa := _dgaf . Numbering . _cgbg ; _ccab := _aefdf . Numbering . _cgbg ; if _caa == nil && _ccab != nil { _caa = _ccab ;
} ; _dgaf . Numbering . _cgbg = _caa ; if _dgaf . Styles . _cadcge == nil && _aefdf . Styles . _cadcge != nil { _dgaf . Styles . _cadcge = _aefdf . Styles . _cadcge ; } ; _dgaf . _aaf = append ( _dgaf . _aaf , _aefdf . _aaf ... ) ; _dgaf . _acf = append ( _dgaf . _acf , _aefdf . _acf ... ) ;
if len ( _dgaf . _agfcg ) == 0 { _dgaf . _agfcg = _aefdf . _agfcg ; } ; if len ( _dgaf . _dea ) == 0 { _dgaf . _dea = _aefdf . _dea ; } ; _aeddd := _dgaf . _abbb ; _cccf := _aefdf . _abbb ; if _aeddd != nil { if _cccf != nil { if _aeddd . Divs != nil { if _cccf . Divs != nil { _aeddd . Divs . Div = append ( _aeddd . Divs . Div , _cccf . Divs . Div ... ) ;
} ; } else { _aeddd . Divs = _cccf . Divs ; } ; } ; _aeddd . Frameset = nil ; } else if _cccf != nil { _aeddd = _cccf ; _aeddd . Frameset = nil ; } ; _dgaf . _abbb = _aeddd ; _cggc := _dgaf . _cdee ; _eede := _aefdf . _cdee ; if _cggc != nil { if _eede != nil { if _cggc . Font != nil { if _eede . Font != nil { for _ , _efge := range _eede . Font { _ebae := true ;
for _ , _afce := range _cggc . Font { if _afce . NameAttr == _efge . NameAttr { _ebae = false ; break ; } ; } ; if _ebae { _cggc . Font = append ( _cggc . Font , _efge ) ; } ; } ; } ; } else { _cggc . Font = _eede . Font ; } ; } ; } else if _eede != nil { _cggc = _eede ; } ; _dgaf . _cdee = _cggc ; return nil ;
} ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// StructuredDocumentTags returns the structured document tags in the document
// which are commonly used in document templates.
func ( _aeae * Document ) StructuredDocumentTags ( ) [ ] StructuredDocumentTag { _fbfg := [ ] StructuredDocumentTag { } ; for _ , _gega := range _aeae . _dbc . Body . EG_BlockLevelElts { for _ , _defgc := range _gega . EG_ContentBlockContent { if _defgc . Sdt != nil { _fbfg = append ( _fbfg , StructuredDocumentTag { _aeae , _defgc . Sdt } ) ;
} ; } ; } ; return _fbfg ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Numbering return numbering that being use by paragraph.
func ( _fddd Paragraph ) Numbering ( ) Numbering { _fddd . ensurePPr ( ) ; _acfd := NewNumbering ( ) ; if _fddd . _gbaee . PPr . NumPr != nil { _bcefg := int64 ( - 1 ) ; _dfcdb := int64 ( - 1 ) ; if _fddd . _gbaee . PPr . NumPr . NumId != nil { _bcefg = _fddd . _gbaee . PPr . NumPr . NumId . ValAttr ;
} ; for _ , _eegdd := range _fddd . _fdec . Numbering . _cgbg . Num { if _bcefg < 0 { break ; } ; if _eegdd . NumIdAttr == _bcefg { if _eegdd . AbstractNumId != nil { _dfcdb = _eegdd . AbstractNumId . ValAttr ; _acfd . _cgbg . Num = append ( _acfd . _cgbg . Num , _eegdd ) ; break ; } ; } ;
} ; for _ , _dgdag := range _fddd . _fdec . Numbering . _cgbg . AbstractNum { if _dfcdb < 0 { break ; } ; if _dgdag . AbstractNumIdAttr == _dfcdb { _acfd . _cgbg . AbstractNum = append ( _acfd . _cgbg . AbstractNum , _dgdag ) ; break ; } ; } ; } ; return _acfd ; } ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// BoldValue returns the precise nature of the bold setting (unset, off or on).
func ( _fgcgd RunProperties ) BoldValue ( ) OnOffValue { return _egbb ( _fgcgd . _bace . B ) } ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// Name returns the name of the style if set.
func ( _eeafa Style ) Name ( ) string { if _eeafa . _gfdb . Name == nil { return "" ; } ; return _eeafa . _gfdb . Name . ValAttr ; } ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// SetAll sets all of the borders to a given value.
func ( _faged TableBorders ) SetAll ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _faged . SetBottom ( t , c , thickness ) ; _faged . SetLeft ( t , c , thickness ) ; _faged . SetRight ( t , c , thickness ) ; _faged . SetTop ( t , c , thickness ) ; _faged . SetInsideHorizontal ( t , c , thickness ) ;
_faged . SetInsideVertical ( t , c , thickness ) ; } ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// EastAsiaFont returns the name of run font family for East Asia.
func ( _dddcc RunProperties ) EastAsiaFont ( ) string { if _aged := _dddcc . _bace . RFonts ; _aged != nil { if _aged . EastAsiaAttr != nil { return * _aged . EastAsiaAttr ; } ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetStart sets the cell start margin
func ( _dd CellMargins ) SetStart ( d _dg . Distance ) { _dd . _cf . Start = _gdb . NewCT_TblWidth ( ) ; _dgf ( _dd . _cf . Start , d ) ; } ; func _ecff ( _edcbe string ) mergeFieldInfo { _gbaad := [ ] string { } ; _aeefg := _fc . Buffer { } ; _fffgdf := - 1 ; for _gbab , _bedb := range _edcbe { switch _bedb { case ' ' : if _aeefg . Len ( ) != 0 { _gbaad = append ( _gbaad , _aeefg . String ( ) ) ;
} ; _aeefg . Reset ( ) ; case '"' : if _fffgdf != - 1 { _gbaad = append ( _gbaad , _edcbe [ _fffgdf + 1 : _gbab ] ) ; _fffgdf = - 1 ; } else { _fffgdf = _gbab ; } ; default : _aeefg . WriteRune ( _bedb ) ; } ; } ; if _aeefg . Len ( ) != 0 { _gbaad = append ( _gbaad , _aeefg . String ( ) ) ; } ; _caed := mergeFieldInfo { } ;
for _bbgd := 0 ; _bbgd < len ( _gbaad ) - 1 ; _bbgd ++ { _eabc := _gbaad [ _bbgd ] ; switch _eabc { case "\u004d\u0045\u0052\u0047\u0045\u0046\u0049\u0045\u004c\u0044" : _caed . _ecgf = _gbaad [ _bbgd + 1 ] ; _bbgd ++ ; case "\u005c\u0066" : _caed . _fdccb = _gbaad [ _bbgd + 1 ] ; _bbgd ++ ;
case "\u005c\u0062" : _caed . _bccgb = _gbaad [ _bbgd + 1 ] ; _bbgd ++ ; case "\u005c\u002a" : switch _gbaad [ _bbgd + 1 ] { case "\u0055\u0070\u0070e\u0072" : _caed . _ddbad = true ; case "\u004c\u006f\u0077e\u0072" : _caed . _feddcc = true ; case "\u0043\u0061\u0070\u0073" : _caed . _fddca = true ;
case "\u0046\u0069\u0072\u0073\u0074\u0043\u0061\u0070" : _caed . _bfde = true ; } ; _bbgd ++ ; } ; } ; return _caed ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// AddEndnoteReference adds a footnote reference to a run.
func ( _aeefc Run ) AddEndnoteReference ( ) { _fcef := _aeefc . newIC ( ) ; _fcef . EndnoteRef = & _gdb . CT_Empty { } } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wml.CT_TblBorders
func ( _faeab TableBorders ) X ( ) * _gdb . CT_TblBorders { return _faeab . _gfgae } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _dace Fonts ) X ( ) * _gdb . CT_Fonts { return _dace . _cfeaa } ;
// Text returns text from the document as one string separated with line breaks.
func ( _cdbe * DocText ) Text ( ) string { _fbgca := _fc . NewBuffer ( [ ] byte { } ) ; for _ , _eefag := range _cdbe . Items { if _eefag . Text != "" { _fbgca . WriteString ( _eefag . Text ) ; _fbgca . WriteString ( "\u000a" ) ; } ; } ; return _fbgca . String ( ) ; } ;
// DrawingInfo is used for keep information about a drawing wrapping a textbox where the text is located.
type DrawingInfo struct { Drawing * _gdb . CT_Drawing ; Width int64 ; Height int64 ; } ; var _febg = false ; func ( _ecbbe * WatermarkText ) getShapeType ( ) * _f . XSDAny { return _ecbbe . getInnerElement ( "\u0073h\u0061\u0070\u0065\u0074\u0079\u0070e" ) ; } ;
// SetStyle sets the font size.
func ( _adbdg RunProperties ) SetStyle ( style string ) { if style == "" { _adbdg . _bace . RStyle = nil ; } else { _adbdg . _bace . RStyle = _gdb . NewCT_String ( ) ; _adbdg . _bace . RStyle . ValAttr = style ; } ; } ;
// SetLeftIndent controls left indent of paragraph.
func ( _acafa Paragraph ) SetLeftIndent ( m _dg . Distance ) { _acafa . ensurePPr ( ) ; _cdfcac := _acafa . _gbaee . PPr ; if _cdfcac . Ind == nil { _cdfcac . Ind = _gdb . NewCT_Ind ( ) ; } ; if m == _dg . Zero { _cdfcac . Ind . LeftAttr = nil ; } else { _cdfcac . Ind . LeftAttr = & _gdb . ST_SignedTwipsMeasure { } ;
_cdfcac . Ind . LeftAttr . Int64 = _f . Int64 ( int64 ( m / _dg . Twips ) ) ; } ; } ; func ( _acgd * Document ) addEndnoteSeparator ( ) { _acead := _gdb . NewCT_FtnEdn ( ) ; _acead . IdAttr = - 1 ; _acead . TypeAttr = _gdb . ST_FtnEdnSeparator ; _afcg := Footnote { _acgd , _acead } ; _afcg . X ( ) . EG_BlockLevelElts = [ ] * _gdb . EG_BlockLevelElts { _gdb . NewEG_BlockLevelElts ( ) } ;
_beec := _afcg . AddParagraph ( ) ; _beec . X ( ) . PPr = nil ; _egda := _beec . AddRun ( ) ; _ddfa := _egda . newIC ( ) ; _ddfa . Separator = _gdb . NewCT_Empty ( ) ; _acgd . _gde . CT_Endnotes . Endnote = append ( _acgd . _gde . CT_Endnotes . Endnote , _acead ) ; _acead = _gdb . NewCT_FtnEdn ( ) ;
_acead . IdAttr = 0 ; _acead . TypeAttr = _gdb . ST_FtnEdnContinuationSeparator ; _afcg = Footnote { _acgd , _acead } ; _afcg . X ( ) . EG_BlockLevelElts = [ ] * _gdb . EG_BlockLevelElts { _gdb . NewEG_BlockLevelElts ( ) } ; _beec = _afcg . AddParagraph ( ) ; _beec . X ( ) . PPr = nil ; _egda = _beec . AddRun ( ) ;
_ddfa = _egda . newIC ( ) ; _ddfa . ContinuationSeparator = _gdb . NewCT_Empty ( ) ; _acgd . _gde . CT_Endnotes . Endnote = append ( _acgd . _gde . CT_Endnotes . Endnote , _acead ) ; } ; func _cca ( _bcc * _gdb . CT_TblWidth , _dag float64 ) { _bcc . TypeAttr = _gdb . ST_TblWidthPct ;
_bcc . WAttr = & _gdb . ST_MeasurementOrPercent { } ; _bcc . WAttr . ST_DecimalNumberOrPercent = & _gdb . ST_DecimalNumberOrPercent { } ; _bcc . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _f . Int64 ( int64 ( _dag * 50 ) ) ; } ;
// FindNodeByText return node based on matched text and return a slice of node.
func ( _efba * Nodes ) FindNodeByRegexp ( r * _d . Regexp ) [ ] Node { _agfb := [ ] Node { } ; for _ , _egcf := range _efba . _gegee { if r . MatchString ( _egcf . Text ( ) ) { _agfb = append ( _agfb , _egcf ) ; } ; _dfaf := Nodes { _gegee : _egcf . Children } ; _agfb = append ( _agfb , _dfaf . FindNodeByRegexp ( r ) ... ) ;
} ; return _agfb ; } ;
2020-12-17 22:07:08 +00:00
2024-07-28 07:48:26 +00:00
// InitializeDefault constructs the default styles.
2024-09-16 09:59:58 +00:00
func ( _begag Styles ) InitializeDefault ( ) { _begag . initializeDocDefaults ( ) ; _begag . initializeStyleDefaults ( ) ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// SetAllowOverlapAttr sets the allowOverlap attribute of anchor.
func ( _dfe AnchoredDrawing ) SetAllowOverlapAttr ( val bool ) { _dfe . _bc . AllowOverlapAttr = val } ;
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
// SetXOffset sets the X offset for an image relative to the origin.
func ( _faa AnchoredDrawing ) SetXOffset ( x _dg . Distance ) { _faa . _bc . PositionH . Choice = & _gdb . WdCT_PosHChoice { } ; _faa . _bc . PositionH . Choice . PosOffset = _f . Int32 ( int32 ( x / _dg . EMU ) ) ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// MergeFields returns the list of all mail merge fields found in the document.
func ( _afcdg Document ) MergeFields ( ) [ ] string { _egabf := map [ string ] struct { } { } ; for _ , _dbgfb := range _afcdg . mergeFields ( ) { _egabf [ _dbgfb . _ecgf ] = struct { } { } ; } ; _gcda := [ ] string { } ; for _aaaff := range _egabf { _gcda = append ( _gcda , _aaaff ) ; } ; return _gcda ;
} ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetInsideHorizontal sets the interior horizontal borders to a specified type, color and thickness.
func ( _dbd CellBorders ) SetInsideHorizontal ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _dbd . _ebf . InsideH = _gdb . NewCT_Border ( ) ; _beggg ( _dbd . _ebf . InsideH , t , c , thickness ) ; } ; func _aafb ( _eacge * _gdb . CT_Tbl , _cfea map [ string ] string ) { for _ , _aefe := range _eacge . EG_ContentRowContent { for _ , _geac := range _aefe . Tr { for _ , _bgdbb := range _geac . EG_ContentCellContent { for _ , _fcff := range _bgdbb . Tc { for _ , _gedc := range _fcff . EG_BlockLevelElts { for _ , _eegb := range _gedc . EG_ContentBlockContent { for _ , _efef := range _eegb . P { _adcd ( _efef , _cfea ) ;
} ; for _ , _bacd := range _eegb . Tbl { _aafb ( _bacd , _cfea ) ; } ; } ; } ; } ; } ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetTableIndent sets the Table Indent from the Leading Margin
func ( _cagcd TableStyleProperties ) SetTableIndent ( ind _dg . Distance ) { _cagcd . _addgf . TblInd = _gdb . NewCT_TblWidth ( ) ; _cagcd . _addgf . TblInd . TypeAttr = _gdb . ST_TblWidthDxa ; _cagcd . _addgf . TblInd . WAttr = & _gdb . ST_MeasurementOrPercent { } ; _cagcd . _addgf . TblInd . WAttr . ST_DecimalNumberOrPercent = & _gdb . ST_DecimalNumberOrPercent { } ;
_cagcd . _addgf . TblInd . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _f . Int64 ( int64 ( ind / _dg . Dxa ) ) ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Restart restarts the numbering
func ( _ccgf * Numbering ) Restart ( nd * NumberingDefinition ) { _fbge := nd . _gged . Lvl ; _babdf := _ccgf . AddDefinition ( ) ; nd . _gged = _babdf . _gged ; nd . _gged . Lvl = _fbge ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetHorizontalBanding controls the conditional formatting for horizontal banding.
func ( _gfaf TableLook ) SetHorizontalBanding ( on bool ) { if ! on { _gfaf . _cdag . NoHBandAttr = & _de . ST_OnOff { } ; _gfaf . _cdag . NoHBandAttr . ST_OnOff1 = _de . ST_OnOff1On ; } else { _gfaf . _cdag . NoHBandAttr = & _de . ST_OnOff { } ; _gfaf . _cdag . NoHBandAttr . ST_OnOff1 = _de . ST_OnOff1Off ;
} ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Styles returns all styles.
func ( _bcea Styles ) Styles ( ) [ ] Style { _afbec := [ ] Style { } ; for _ , _ebce := range _bcea . _cadcge . Style { _afbec = append ( _afbec , Style { _ebce } ) ; } ; return _afbec ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetCellSpacingAuto sets the cell spacing within a table to automatic.
func ( _dggag TableProperties ) SetCellSpacingAuto ( ) { _dggag . _affd . TblCellSpacing = _gdb . NewCT_TblWidth ( ) ; _dggag . _affd . TblCellSpacing . TypeAttr = _gdb . ST_TblWidthAuto ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetHeadingLevel sets a heading level and style based on the level to a
// paragraph. The default styles for a new unioffice document support headings
// from level 1 to 8.
func ( _geaf ParagraphProperties ) SetHeadingLevel ( idx int ) { _geaf . SetStyle ( _gb . Sprintf ( "\u0048e\u0061\u0064\u0069\u006e\u0067\u0025d" , idx ) ) ; if _geaf . _egbf . NumPr == nil { _geaf . _egbf . NumPr = _gdb . NewCT_NumPr ( ) ; } ; _geaf . _egbf . NumPr . Ilvl = _gdb . NewCT_DecimalNumber ( ) ;
_geaf . _egbf . NumPr . Ilvl . ValAttr = int64 ( idx ) ; } ; func _egbb ( _gaef * _gdb . CT_OnOff ) OnOffValue { if _gaef == nil { return OnOffValueUnset ; } ; if _gaef . ValAttr != nil && _gaef . ValAttr . Bool != nil && * _gaef . ValAttr . Bool == false { return OnOffValueOff ; } ; return OnOffValueOn ;
} ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetKeepOnOnePage controls if all lines in a paragraph are kept on the same
// page.
func ( _aagc ParagraphProperties ) SetKeepOnOnePage ( b bool ) { if ! b { _aagc . _egbf . KeepLines = nil ; } else { _aagc . _egbf . KeepLines = _gdb . NewCT_OnOff ( ) ; } ; } ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// ComplexSizeValue returns the value of paragraph font size for complex fonts in points.
func ( _aaabf ParagraphProperties ) ComplexSizeValue ( ) float64 { if _bffb := _aaabf . _egbf . RPr . SzCs ; _bffb != nil { _effdb := _bffb . ValAttr ; if _effdb . ST_UnsignedDecimalNumber != nil { return float64 ( * _effdb . ST_UnsignedDecimalNumber ) / 2 ; } ; } ; return 0.0 ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// NewSettings constructs a new empty Settings
func NewSettings ( ) Settings { _fdece := _gdb . NewSettings ( ) ; _fdece . Compat = _gdb . NewCT_Compat ( ) ; _bcdfe := _gdb . NewCT_CompatSetting ( ) ; _bcdfe . NameAttr = _f . String ( "\u0063\u006f\u006d\u0070\u0061\u0074\u0069\u0062\u0069\u006c\u0069\u0074y\u004d\u006f\u0064\u0065" ) ;
_bcdfe . UriAttr = _f . 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" ) ; _bcdfe . ValAttr = _f . String ( "\u0031\u0035" ) ;
_fdece . Compat . CompatSetting = append ( _fdece . Compat . CompatSetting , _bcdfe ) ; return Settings { _fdece } ; } ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// TableLook is the conditional formatting associated with a table style that
// has been assigned to a table.
type TableLook struct { _cdag * _gdb . CT_TblLook } ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// AddParagraph adds a new paragraph to the document body.
func ( _gded * Document ) AddParagraph ( ) Paragraph { _aedd := _gdb . NewEG_BlockLevelElts ( ) ; _gded . _dbc . Body . EG_BlockLevelElts = append ( _gded . _dbc . Body . EG_BlockLevelElts , _aedd ) ; _gbba := _gdb . NewEG_ContentBlockContent ( ) ; _aedd . EG_ContentBlockContent = append ( _aedd . EG_ContentBlockContent , _gbba ) ;
_cfb := _gdb . NewCT_P ( ) ; _gbba . P = append ( _gbba . P , _cfb ) ; return Paragraph { _gded , _cfb } ; } ;
// ExtractFromFooter returns text from the document footer as an array of TextItems.
func ExtractFromFooter ( footer * _gdb . Ftr ) [ ] TextItem { return _ddcc ( footer . EG_ContentBlockContent , nil ) } ;
// Bold returns true if paragraph font is bold.
func ( _acfdf ParagraphProperties ) Bold ( ) bool { _dafgg := _acfdf . _egbf . RPr ; return _cefe ( _dafgg . B ) || _cefe ( _dafgg . BCs ) ; } ; func _gcfddg ( ) * _eb . Formulas { _agbec := _eb . NewFormulas ( ) ; _agbec . F = [ ] * _eb . CT_F { _gg . CreateFormula ( "\u0069\u0066 \u006c\u0069\u006e\u0065\u0044\u0072\u0061\u0077\u006e\u0020\u0070\u0069\u0078\u0065\u006c\u004c\u0069\u006e\u0065\u0057\u0069\u0064th\u0020\u0030" ) , _gg . CreateFormula ( "\u0073\u0075\u006d\u0020\u0040\u0030\u0020\u0031\u0020\u0030" ) , _gg . CreateFormula ( "\u0073\u0075\u006d\u0020\u0030\u0020\u0030\u0020\u0040\u0031" ) , _gg . CreateFormula ( "p\u0072\u006f\u0064\u0020\u0040\u0032\u0020\u0031\u0020\u0032" ) , _gg . CreateFormula ( "\u0070r\u006f\u0064\u0020\u0040\u0033\u0020\u0032\u0031\u0036\u0030\u0030 \u0070\u0069\u0078\u0065\u006c\u0057\u0069\u0064\u0074\u0068" ) , _gg . CreateFormula ( "\u0070r\u006f\u0064\u0020\u00403\u0020\u0032\u0031\u0036\u00300\u0020p\u0069x\u0065\u006c\u0048\u0065\u0069\u0067\u0068t" ) , _gg . CreateFormula ( "\u0073\u0075\u006d\u0020\u0040\u0030\u0020\u0030\u0020\u0031" ) , _gg . CreateFormula ( "p\u0072\u006f\u0064\u0020\u0040\u0036\u0020\u0031\u0020\u0032" ) , _gg . CreateFormula ( "\u0070r\u006f\u0064\u0020\u0040\u0037\u0020\u0032\u0031\u0036\u0030\u0030 \u0070\u0069\u0078\u0065\u006c\u0057\u0069\u0064\u0074\u0068" ) , _gg . CreateFormula ( "\u0073\u0075\u006d\u0020\u0040\u0038\u0020\u0032\u00316\u0030\u0030\u0020\u0030" ) , _gg . CreateFormula ( "\u0070r\u006f\u0064\u0020\u00407\u0020\u0032\u0031\u0036\u00300\u0020p\u0069x\u0065\u006c\u0048\u0065\u0069\u0067\u0068t" ) , _gg . CreateFormula ( "\u0073u\u006d \u0040\u0031\u0030\u0020\u0032\u0031\u0036\u0030\u0030\u0020\u0030" ) } ;
return _agbec ; } ;
// FindNodeByCondition return node based on condition function,
// if wholeElements is true, its will extract childs as next node elements.
func ( _ddddc * Nodes ) FindNodeByCondition ( f func ( _fgffgc * Node ) bool , wholeElements bool ) [ ] Node { _gfddf := [ ] Node { } ; for _ , _cged := range _ddddc . _gegee { if f ( & _cged ) { _gfddf = append ( _gfddf , _cged ) ; } ; if wholeElements { _agda := Nodes { _gegee : _cged . Children } ;
_gfddf = append ( _gfddf , _agda . FindNodeByCondition ( f , wholeElements ) ... ) ; } ; } ; return _gfddf ; } ;
// GetImage returns the ImageRef associated with an AnchoredDrawing.
func ( _deb AnchoredDrawing ) GetImage ( ) ( _cc . ImageRef , bool ) { _dee := _deb . _bc . Graphic . GraphicData . Any ; if len ( _dee ) > 0 { _gc , _ga := _dee [ 0 ] . ( * _ef . Pic ) ; if _ga { if _gc . BlipFill != nil && _gc . BlipFill . Blip != nil && _gc . BlipFill . Blip . EmbedAttr != nil { return _deb . _aa . GetImageByRelID ( * _gc . BlipFill . Blip . EmbedAttr ) ;
} ; } ; } ; return _cc . ImageRef { } , false ; } ; type mergeFieldInfo struct { _ecgf string ; _fdccb string ; _bccgb string ; _ddbad bool ; _feddcc bool ; _bfde bool ; _fddca bool ; _fdag Paragraph ; _bgdg , _bfbf , _ffda int ; _ceae * _gdb . EG_PContent ; _deafg bool ; } ;
2024-05-08 13:54:39 +00:00
2024-07-28 07:48:26 +00:00
// X returns the inner wrapped XML type.
2024-09-16 09:59:58 +00:00
func ( _aggg TableProperties ) X ( ) * _gdb . CT_TblPr { return _aggg . _affd } ; func ( _ggae * Document ) appendParagraph ( _ged * Paragraph , _gfca Paragraph , _gdfc bool ) Paragraph { _fdbeg := _gdb . NewEG_BlockLevelElts ( ) ; _ggae . _dbc . Body . EG_BlockLevelElts = append ( _ggae . _dbc . Body . EG_BlockLevelElts , _fdbeg ) ;
_bdc := _gdb . NewEG_ContentBlockContent ( ) ; _fdbeg . EG_ContentBlockContent = append ( _fdbeg . EG_ContentBlockContent , _bdc ) ; if _ged != nil { _dcbc := _ged . X ( ) ; for _ , _fgaf := range _ggae . _dbc . Body . EG_BlockLevelElts { for _ , _gege := range _fgaf . EG_ContentBlockContent { for _dcdf , _fgcg := range _gege . P { if _fgcg == _dcbc { _bef := _gfca . X ( ) ;
_gege . P = append ( _gege . P , nil ) ; if _gdfc { copy ( _gege . P [ _dcdf + 1 : ] , _gege . P [ _dcdf : ] ) ; _gege . P [ _dcdf ] = _bef ; } else { copy ( _gege . P [ _dcdf + 2 : ] , _gege . P [ _dcdf + 1 : ] ) ; _gege . P [ _dcdf + 1 ] = _bef ; } ; break ; } ; } ; for _ , _eeaa := range _gege . Tbl { for _ , _gee := range _eeaa . EG_ContentRowContent { for _ , _eaa := range _gee . Tr { for _ , _cacab := range _eaa . EG_ContentCellContent { for _ , _ega := range _cacab . Tc { for _ , _eeae := range _ega . EG_BlockLevelElts { for _ , _efa := range _eeae . EG_ContentBlockContent { for _gfdd , _agbb := range _efa . P { if _agbb == _dcbc { _geae := _gfca . X ( ) ;
_efa . P = append ( _efa . P , nil ) ; if _gdfc { copy ( _efa . P [ _gfdd + 1 : ] , _efa . P [ _gfdd : ] ) ; _efa . P [ _gfdd ] = _geae ; } else { copy ( _efa . P [ _gfdd + 2 : ] , _efa . P [ _gfdd + 1 : ] ) ; _efa . P [ _gfdd + 1 ] = _geae ; } ; break ; } ; } ; } ; } ; } ; } ; } ; } ; } ; if _gege . Sdt != nil && _gege . Sdt . SdtContent != nil && _gege . Sdt . SdtContent . P != nil { for _cdf , _abaf := range _gege . Sdt . SdtContent . P { if _abaf == _dcbc { _aade := _gfca . X ( ) ;
_gege . Sdt . SdtContent . P = append ( _gege . Sdt . SdtContent . P , nil ) ; if _gdfc { copy ( _gege . Sdt . SdtContent . P [ _cdf + 1 : ] , _gege . Sdt . SdtContent . P [ _cdf : ] ) ; _gege . Sdt . SdtContent . P [ _cdf ] = _aade ; } else { copy ( _gege . Sdt . SdtContent . P [ _cdf + 2 : ] , _gege . Sdt . SdtContent . P [ _cdf + 1 : ] ) ;
_gege . Sdt . SdtContent . P [ _cdf + 1 ] = _aade ; } ; break ; } ; } ; } ; } ; } ; } else { _bdc . P = append ( _bdc . P , _gfca . X ( ) ) ; } ; _fee := _gfca . Properties ( ) ; if _beba , _cba := _fee . Section ( ) ; _cba { var ( _gfac map [ string ] string ; _gcaf map [ string ] string ; ) ; _ecg := _beba . X ( ) . EG_HdrFtrReferences ;
for _ , _dgce := range _ecg { if _dgce . HeaderReference != nil { _gfac = map [ string ] string { _dgce . HeaderReference . IdAttr : _beba . _aaaeb . _aed . GetTargetByRelId ( _dgce . HeaderReference . IdAttr ) } ; } ; if _dgce . FooterReference != nil { _gcaf = map [ string ] string { _dgce . FooterReference . IdAttr : _beba . _aaaeb . _aed . GetTargetByRelId ( _dgce . FooterReference . IdAttr ) } ;
} ; } ; var _dcf map [ int ] _cc . ImageRef ; for _ , _eace := range _beba . _aaaeb . Headers ( ) { for _adff , _dcbf := range _gfac { _acef := _gb . Sprintf ( "\u0068\u0065\u0061d\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c" , ( _eace . Index ( ) + 1 ) ) ; if _acef == _dcbf { _aga := _gb . Sprintf ( "\u0068\u0065\u0061d\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c" , _eace . Index ( ) ) ;
_ggae . _agfcg = append ( _ggae . _agfcg , _eace . X ( ) ) ; _efae := _ggae . _aed . AddRelationship ( _aga , _f . HeaderType ) ; _efae . SetID ( _adff ) ; _ggae . ContentTypes . AddOverride ( "\u002f\u0077\u006f\u0072\u0064\u002f" + _aga , "\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" ) ;
_ggae . _fgd = append ( _ggae . _fgd , _cc . NewRelationships ( ) ) ; _ccaa := _eace . Paragraphs ( ) ; for _ , _gefe := range _ccaa { for _ , _egg := range _gefe . Runs ( ) { _ggb := _egg . DrawingAnchored ( ) ; for _ , _bdb := range _ggb { if _gfg , _ccaaa := _bdb . GetImage ( ) ; _ccaaa { _dcf = map [ int ] _cc . ImageRef { _eace . Index ( ) : _gfg } ;
} ; } ; _fafa := _egg . DrawingInline ( ) ; for _ , _dgda := range _fafa { if _fac , _fgac := _dgda . GetImage ( ) ; _fgac { _dcf = map [ int ] _cc . ImageRef { _eace . Index ( ) : _fac } ; } ; } ; } ; } ; } ; } ; } ; for _gac , _beg := range _dcf { for _ , _ebef := range _ggae . Headers ( ) { if ( _ebef . Index ( ) + 1 ) == _gac { _gcb , _gcef := _cc . ImageFromFile ( _beg . Path ( ) ) ;
if _gcef != nil { _fe . Log . Debug ( "\u0075\u006e\u0061\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0063r\u0065\u0061\u0074\u0065\u0020\u0069\u006d\u0061\u0067\u0065:\u0020\u0025\u0073" , _gcef ) ; } ; if _ , _gcef = _ebef . AddImage ( _gcb ) ; _gcef != nil { _fe . Log . Debug ( "u\u006e\u0061\u0062\u006c\u0065\u0020t\u006f\u0020\u0061\u0064\u0064\u0020i\u006d\u0061\u0067\u0065\u0020\u0074\u006f \u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u003a\u0020%\u0073" , _gcef ) ;
} ; } ; for _ , _fea := range _ebef . Paragraphs ( ) { if _dfac , _ggba := _beba . _aaaeb . Styles . SearchStyleById ( _fea . Style ( ) ) ; _ggba { if _ , _cbb := _ggae . Styles . SearchStyleById ( _fea . Style ( ) ) ; ! _cbb { _ggae . Styles . InsertStyle ( _dfac ) ; } ; } ; } ; } ; } ; var _cedf map [ int ] _cc . ImageRef ;
for _ , _faab := range _beba . _aaaeb . Footers ( ) { for _edbc , _aded := range _gcaf { _acea := _gb . Sprintf ( "\u0066\u006f\u006ft\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c" , ( _faab . Index ( ) + 1 ) ) ; if _acea == _aded { _fcba := _gb . Sprintf ( "\u0066\u006f\u006ft\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c" , _faab . Index ( ) ) ;
_ggae . _dea = append ( _ggae . _dea , _faab . X ( ) ) ; _fead := _ggae . _aed . AddRelationship ( _fcba , _f . FooterType ) ; _fead . SetID ( _edbc ) ; _ggae . ContentTypes . AddOverride ( "\u002f\u0077\u006f\u0072\u0064\u002f" + _fcba , "\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" ) ;
_ggae . _gaf = append ( _ggae . _gaf , _cc . NewRelationships ( ) ) ; _edgef := _faab . Paragraphs ( ) ; for _ , _befa := range _edgef { for _ , _bff := range _befa . Runs ( ) { _dcde := _bff . DrawingAnchored ( ) ; for _ , _agaf := range _dcde { if _badd , _gbe := _agaf . GetImage ( ) ; _gbe { _cedf = map [ int ] _cc . ImageRef { _faab . Index ( ) : _badd } ;
} ; } ; _aefd := _bff . DrawingInline ( ) ; for _ , _cag := range _aefd { if _gfdc , _cbgbg := _cag . GetImage ( ) ; _cbgbg { _cedf = map [ int ] _cc . ImageRef { _faab . Index ( ) : _gfdc } ; } ; } ; } ; } ; } ; } ; } ; for _dde , _bfac := range _cedf { for _ , _cagc := range _ggae . Footers ( ) { if ( _cagc . Index ( ) + 1 ) == _dde { _efab , _efb := _cc . ImageFromFile ( _bfac . Path ( ) ) ;
if _efb != nil { _fe . Log . Debug ( "\u0075\u006e\u0061\u0062\u006c\u0065\u0020\u0074\u006f\u0020\u0063r\u0065\u0061\u0074\u0065\u0020\u0069\u006d\u0061\u0067\u0065:\u0020\u0025\u0073" , _efb ) ; } ; if _ , _efb = _cagc . AddImage ( _efab ) ; _efb != nil { _fe . Log . Debug ( "u\u006e\u0061\u0062\u006c\u0065\u0020t\u006f\u0020\u0061\u0064\u0064\u0020i\u006d\u0061\u0067\u0065\u0020\u0074\u006f \u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u003a\u0020%\u0073" , _efb ) ;
} ; } ; for _ , _aeb := range _cagc . Paragraphs ( ) { if _fedf , _eacc := _beba . _aaaeb . Styles . SearchStyleById ( _aeb . Style ( ) ) ; _eacc { if _ , _gfddg := _ggae . Styles . SearchStyleById ( _aeb . Style ( ) ) ; ! _gfddg { _ggae . Styles . InsertStyle ( _fedf ) ; } ; } ; } ; } ; } ; } ; _bgcd := _gfca . Numbering ( ) ;
_ggae . Numbering . _cgbg . AbstractNum = append ( _ggae . Numbering . _cgbg . AbstractNum , _bgcd . _cgbg . AbstractNum ... ) ; _ggae . Numbering . _cgbg . Num = append ( _ggae . Numbering . _cgbg . Num , _bgcd . _cgbg . Num ... ) ; return Paragraph { _ggae , _gfca . X ( ) } ; } ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// SetWidthPercent sets the table to a width percentage.
func ( _ebgc TableProperties ) SetWidthPercent ( pct float64 ) { _ebgc . _affd . TblW = _gdb . NewCT_TblWidth ( ) ; _ebgc . _affd . TblW . TypeAttr = _gdb . ST_TblWidthPct ; _ebgc . _affd . TblW . WAttr = & _gdb . ST_MeasurementOrPercent { } ; _ebgc . _affd . TblW . WAttr . ST_DecimalNumberOrPercent = & _gdb . ST_DecimalNumberOrPercent { } ;
_ebgc . _affd . TblW . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _f . Int64 ( int64 ( pct * 50 ) ) ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// GetKerning returns the kerning (character spacing) of a run
func ( _eebgd RunProperties ) GetKerning ( ) _dg . Distance { if _eebgd . _bace . Kern != nil { return _dg . Distance ( float64 ( * _eebgd . _bace . Kern . ValAttr . ST_UnsignedDecimalNumber ) * _dg . HalfPoint ) ; } ; return 0 ; } ;
2022-04-09 14:27:46 +00:00
2024-09-16 09:59:58 +00:00
// SetUISortOrder controls the order the style is displayed in the UI.
func ( _fbfc Style ) SetUISortOrder ( order int ) { _fbfc . _gfdb . UiPriority = _gdb . NewCT_DecimalNumber ( ) ; _fbfc . _gfdb . UiPriority . ValAttr = int64 ( order ) ; } ;
2024-07-28 07:48:26 +00:00
2024-09-16 09:59:58 +00:00
// StructuredDocumentTag are a tagged bit of content in a document.
type StructuredDocumentTag struct { _bfbfa * Document ; _fabc * _gdb . CT_SdtBlock ; } ;
2022-04-09 14:27:46 +00:00
2024-09-16 09:59:58 +00:00
// BodySection returns the default body section used for all preceding
// paragraphs until the previous Section. If there is no previous sections, the
// body section applies to the entire document.
func ( _fff * Document ) BodySection ( ) Section { if _fff . _dbc . Body . SectPr == nil { _fff . _dbc . Body . SectPr = _gdb . NewCT_SectPr ( ) ; } ; return Section { _fff , _fff . _dbc . Body . SectPr } ; } ; func _gdbd ( ) ( * _dcb . CT_Point2D , [ ] * _dcb . CT_Point2D ) { var ( _ebb int64 = 0 ;
_bbf int64 = 21600 ; ) ; _ee := _dcb . ST_Coordinate { ST_CoordinateUnqualified : & _ebb , ST_UniversalMeasure : nil } ; _aac := _dcb . ST_Coordinate { ST_CoordinateUnqualified : & _bbf , ST_UniversalMeasure : nil } ; _fb := _dcb . NewCT_Point2D ( ) ; _fb . XAttr = _ee ; _fb . YAttr = _ee ;
_cdd := [ ] * _dcb . CT_Point2D { & _dcb . CT_Point2D { XAttr : _ee , YAttr : _aac } , & _dcb . CT_Point2D { XAttr : _aac , YAttr : _aac } , & _dcb . CT_Point2D { XAttr : _aac , YAttr : _ee } , _fb } ; return _fb , _cdd ; } ;
2022-04-09 14:27:46 +00:00
2024-09-16 09:59:58 +00:00
// Properties returns the paragraph properties.
func ( _gdcbe Paragraph ) Properties ( ) ParagraphProperties { _gdcbe . ensurePPr ( ) ; return ParagraphProperties { _gdcbe . _fdec , _gdcbe . _gbaee . PPr } ; } ;
2024-07-28 07:48:26 +00:00
2024-09-16 09:59:58 +00:00
// SetLastRow controls the conditional formatting for the last row in a table.
// This is called the 'Total' row within Word.
func ( _bgdccg TableLook ) SetLastRow ( on bool ) { if ! on { _bgdccg . _cdag . LastRowAttr = & _de . ST_OnOff { } ; _bgdccg . _cdag . LastRowAttr . ST_OnOff1 = _de . ST_OnOff1Off ; } else { _bgdccg . _cdag . LastRowAttr = & _de . ST_OnOff { } ; _bgdccg . _cdag . LastRowAttr . ST_OnOff1 = _de . ST_OnOff1On ;
} ; } ;
2024-07-28 07:48:26 +00:00
2024-09-16 09:59:58 +00:00
// TableLook returns the table look, or conditional formatting applied to a table style.
func ( _bbcee TableProperties ) TableLook ( ) TableLook { if _bbcee . _affd . TblLook == nil { _bbcee . _affd . TblLook = _gdb . NewCT_TblLook ( ) ; } ; return TableLook { _bbcee . _affd . TblLook } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Bookmark is a bookmarked location within a document that can be referenced
// with a hyperlink.
type Bookmark struct { _ad * _gdb . CT_Bookmark } ; func _ddcc ( _adga [ ] * _gdb . EG_ContentBlockContent , _cbbg * TableInfo ) [ ] TextItem { _feda := [ ] TextItem { } ; for _ , _edcba := range _adga { if _gedcb := _edcba . Sdt ; _gedcb != nil { if _dgfb := _gedcb . SdtContent ; _dgfb != nil { _feda = append ( _feda , _bgab ( _dgfb . P , _cbbg , nil ) ... ) ;
} ; } ; _feda = append ( _feda , _bgab ( _edcba . P , _cbbg , nil ) ... ) ; for _ , _eddc := range _edcba . Tbl { for _efgee , _gaaec := range _eddc . EG_ContentRowContent { for _ , _bgac := range _gaaec . Tr { for _ecde , _bbfdg := range _bgac . EG_ContentCellContent { for _ , _bebf := range _bbfdg . Tc { _beecc := & TableInfo { Table : _eddc , Row : _bgac , Cell : _bebf , RowIndex : _efgee , ColIndex : _ecde } ;
for _ , _adaf := range _bebf . EG_BlockLevelElts { _feda = append ( _feda , _ddcc ( _adaf . EG_ContentBlockContent , _beecc ) ... ) ; } ; } ; } ; } ; } ; } ; } ; return _feda ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// AddWatermarkText adds new watermark text to the document.
func ( _bfbb * Document ) AddWatermarkText ( text string ) WatermarkText { var _efeg [ ] Header ; if _cbfa , _aebd := _bfbb . BodySection ( ) . GetHeader ( _gdb . ST_HdrFtrDefault ) ; _aebd { _efeg = append ( _efeg , _cbfa ) ; } ; if _deg , _cfab := _bfbb . BodySection ( ) . GetHeader ( _gdb . ST_HdrFtrEven ) ;
_cfab { _efeg = append ( _efeg , _deg ) ; } ; if _bdfb , _cbac := _bfbb . BodySection ( ) . GetHeader ( _gdb . ST_HdrFtrFirst ) ; _cbac { _efeg = append ( _efeg , _bdfb ) ; } ; if len ( _efeg ) < 1 { _dbbe := _bfbb . AddHeader ( ) ; _bfbb . BodySection ( ) . SetHeader ( _dbbe , _gdb . ST_HdrFtrDefault ) ;
_efeg = append ( _efeg , _dbbe ) ; } ; _eacg := NewWatermarkText ( ) ; for _ , _abdga := range _efeg { _cgege := _abdga . Paragraphs ( ) ; if len ( _cgege ) < 1 { _bgcec := _abdga . AddParagraph ( ) ; _bgcec . AddRun ( ) . AddText ( "" ) ; } ; for _ , _baad := range _abdga . X ( ) . EG_ContentBlockContent { for _ , _addd := range _baad . P { for _ , _ead := range _addd . EG_PContent { for _ , _acac := range _ead . EG_ContentRunContent { if _acac . R == nil { continue ;
} ; for _ , _fecg := range _acac . R . EG_RunInnerContent { _fecg . Pict = _eacg . _aabdf ; break ; } ; } ; } ; } ; } ; } ; _eacg . SetText ( text ) ; return _eacg ; } ; func ( _agdgc * WatermarkPicture ) getShapeImagedata ( ) * _f . XSDAny { return _agdgc . getInnerElement ( "\u0069m\u0061\u0067\u0065\u0064\u0061\u0074a" ) ;
} ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SizeValue returns the value of paragraph font size in points.
func ( _cageg ParagraphProperties ) SizeValue ( ) float64 { if _bfeeb := _cageg . _egbf . RPr . Sz ; _bfeeb != nil { _dged := _bfeeb . ValAttr ; if _dged . ST_UnsignedDecimalNumber != nil { return float64 ( * _dged . ST_UnsignedDecimalNumber ) / 2 ; } ; } ; return 0.0 ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetPossibleValues sets possible values for a FormFieldTypeDropDown.
func ( _ggad FormField ) SetPossibleValues ( values [ ] string ) { if _ggad . _eebdg . DdList != nil { for _ , _aacd := range values { _feaa := _gdb . NewCT_String ( ) ; _feaa . ValAttr = _aacd ; _ggad . _eebdg . DdList . ListEntry = append ( _ggad . _eebdg . DdList . ListEntry , _feaa ) ;
} ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetCharacterSpacing sets the run's Character Spacing Adjustment.
func ( _egfd RunProperties ) SetCharacterSpacing ( size _dg . Distance ) { _egfd . _bace . Spacing = _gdb . NewCT_SignedTwipsMeasure ( ) ; _egfd . _bace . Spacing . ValAttr . Int64 = _f . Int64 ( int64 ( size / _dg . Twips ) ) ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetSize sets the font size for a run.
func ( _abdac RunProperties ) SetSize ( size _dg . Distance ) { _abdac . _bace . Sz = _gdb . NewCT_HpsMeasure ( ) ; _abdac . _bace . Sz . ValAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( size / _dg . HalfPoint ) ) ; _abdac . _bace . SzCs = _gdb . NewCT_HpsMeasure ( ) ; _abdac . _bace . SzCs . ValAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( size / _dg . HalfPoint ) ) ;
} ;
2023-03-01 18:42:44 +00:00
2024-09-16 09:59:58 +00:00
// Definitions returns the defined numbering definitions.
func ( _gfab Numbering ) Definitions ( ) [ ] NumberingDefinition { _gdbdg := [ ] NumberingDefinition { } ; if _gfab . _cgbg != nil { for _ , _gfgg := range _gfab . _cgbg . AbstractNum { _gdbdg = append ( _gdbdg , NumberingDefinition { _gfgg } ) ; } ; } ; return _gdbdg ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// HasFootnotes returns a bool based on the presence or abscence of footnotes within
// the document.
func ( _abee * Document ) HasFootnotes ( ) bool { return _abee . _bgg != nil } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// AddBookmark adds a bookmark to a document that can then be used from a hyperlink. Name is a document
// unique name that identifies the bookmark so it can be referenced from hyperlinks.
func ( _cbaf Paragraph ) AddBookmark ( name string ) Bookmark { _aacdd := _gdb . NewEG_PContent ( ) ; _fcedg := _gdb . NewEG_ContentRunContent ( ) ; _aacdd . EG_ContentRunContent = append ( _aacdd . EG_ContentRunContent , _fcedg ) ; _bgfc := _gdb . NewEG_RunLevelElts ( ) ; _fcedg . EG_RunLevelElts = append ( _fcedg . EG_RunLevelElts , _bgfc ) ;
_eaaeg := _gdb . NewEG_RangeMarkupElements ( ) ; _beaag := _gdb . NewCT_Bookmark ( ) ; _eaaeg . BookmarkStart = _beaag ; _bgfc . EG_RangeMarkupElements = append ( _bgfc . EG_RangeMarkupElements , _eaaeg ) ; _eaaeg = _gdb . NewEG_RangeMarkupElements ( ) ; _eaaeg . BookmarkEnd = _gdb . NewCT_MarkupRange ( ) ;
_bgfc . EG_RangeMarkupElements = append ( _bgfc . EG_RangeMarkupElements , _eaaeg ) ; _cbaf . _gbaee . EG_PContent = append ( _cbaf . _gbaee . EG_PContent , _aacdd ) ; _egcb := Bookmark { _beaag } ; _egcb . SetName ( name ) ; return _egcb ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wml.CT_PBdr
func ( _ggeee ParagraphBorders ) X ( ) * _gdb . CT_PBdr { return _ggeee . _ecade } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _dddca Paragraph ) X ( ) * _gdb . CT_P { return _dddca . _gbaee } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// SetStyle sets the style of a paragraph and is identical to setting it on the
// paragraph's Properties()
func ( _afcae Paragraph ) SetStyle ( s string ) { _afcae . ensurePPr ( ) ; if s == "" { _afcae . _gbaee . PPr . PStyle = nil ; } else { _afcae . _gbaee . PPr . PStyle = _gdb . NewCT_String ( ) ; _afcae . _gbaee . PPr . PStyle . ValAttr = s ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// GetStyle returns string style of the text in watermark and format it to TextpathStyle.
func ( _fefa * WatermarkText ) GetStyle ( ) _gg . TextpathStyle { _eade := _fefa . getShape ( ) ; if _fefa . _ddcag != nil { _afdb := _fefa . _ddcag . EG_ShapeElements ; if len ( _afdb ) > 0 && _afdb [ 0 ] . Textpath != nil { return _gg . NewTextpathStyle ( * _afdb [ 0 ] . Textpath . StyleAttr ) ;
} ; } else { _abef := _fefa . findNode ( _eade , "\u0074\u0065\u0078\u0074\u0070\u0061\u0074\u0068" ) ; for _ , _ddbaf := range _abef . Attrs { if _ddbaf . Name . Local == "\u0073\u0074\u0079l\u0065" { return _gg . NewTextpathStyle ( _ddbaf . Value ) ; } ; } ; } ; return _gg . NewTextpathStyle ( "" ) ;
} ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _eac Bookmark ) X ( ) * _gdb . CT_Bookmark { return _eac . _ad } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetPageBreakBefore controls if there is a page break before this paragraph.
func ( _fgaff ParagraphProperties ) SetPageBreakBefore ( b bool ) { if ! b { _fgaff . _egbf . PageBreakBefore = nil ; } else { _fgaff . _egbf . PageBreakBefore = _gdb . NewCT_OnOff ( ) ; } ; } ;
2023-12-28 15:53:06 +00:00
2024-09-16 09:59:58 +00:00
// SizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.
func ( _dcef RunProperties ) SizeMeasure ( ) string { if _dedd := _dcef . _bace . Sz ; _dedd != nil { _babc := _dedd . ValAttr ; if _babc . ST_PositiveUniversalMeasure != nil { return * _babc . ST_PositiveUniversalMeasure ; } ; } ; return "" ; } ; func _fada ( _agefa * _gdb . CT_Border , _dgcdd _gdb . ST_Border , _dabc _gbc . Color , _dgde _dg . Distance ) { _agefa . ValAttr = _dgcdd ;
_agefa . ColorAttr = & _gdb . ST_HexColor { } ; if _dabc . IsAuto ( ) { _agefa . ColorAttr . ST_HexColorAuto = _gdb . ST_HexColorAutoAuto ; } else { _agefa . ColorAttr . ST_HexColorRGB = _dabc . AsRGBString ( ) ; } ; if _dgde != _dg . Zero { _agefa . SzAttr = _f . Uint64 ( uint64 ( _dgde / _dg . Point * 8 ) ) ;
} ; } ;
2022-06-27 19:44:23 +00:00
2024-09-16 09:59:58 +00:00
// AddTabStop adds a tab stop to the paragraph. It controls the position of text when using Run.AddTab()
func ( _cbec ParagraphProperties ) AddTabStop ( position _dg . Distance , justificaton _gdb . ST_TabJc , leader _gdb . ST_TabTlc ) { if _cbec . _egbf . Tabs == nil { _cbec . _egbf . Tabs = _gdb . NewCT_Tabs ( ) ; } ; _gffbed := _gdb . NewCT_TabStop ( ) ; _gffbed . LeaderAttr = leader ;
_gffbed . ValAttr = justificaton ; _gffbed . PosAttr . Int64 = _f . Int64 ( int64 ( position / _dg . Twips ) ) ; _cbec . _egbf . Tabs . Tab = append ( _cbec . _egbf . Tabs . Tab , _gffbed ) ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// NewWatermarkText generates a new WatermarkText.
func NewWatermarkText ( ) WatermarkText { _acba := _eb . NewShapetype ( ) ; _efdda := _eb . NewEG_ShapeElements ( ) ; _efdda . Formulas = _acdca ( ) ; _efdda . Path = _acadg ( ) ; _efdda . Textpath = _fegg ( ) ; _efdda . Handles = _ddcdc ( ) ; _efdda . Lock = _eeecg ( ) ; _acba . EG_ShapeElements = [ ] * _eb . EG_ShapeElements { _efdda } ;
var ( _cgdc = "_\u0078\u0030\u0030\u0030\u0030\u005f\u0074\u0031\u0033\u0036" ; _cccfb = "2\u0031\u0036\u0030\u0030\u002c\u0032\u0031\u0036\u0030\u0030" ; _aaegf = float32 ( 136.0 ) ; _fafcb = "\u0031\u0030\u00380\u0030" ; _gcdgd = "m\u0040\u0037\u002c\u006c\u0040\u0038,\u006d\u0040\u0035\u002c\u0032\u0031\u0036\u0030\u0030l\u0040\u0036\u002c2\u00316\u0030\u0030\u0065" ;
) ; _acba . IdAttr = & _cgdc ; _acba . CoordsizeAttr = & _cccfb ; _acba . SptAttr = & _aaegf ; _acba . AdjAttr = & _fafcb ; _acba . PathAttr = & _gcdgd ; _dbega := _eb . NewShape ( ) ; _bgaa := _eb . NewEG_ShapeElements ( ) ; _bgaa . Textpath = _edfbb ( ) ; _dbega . EG_ShapeElements = [ ] * _eb . EG_ShapeElements { _bgaa } ;
var ( _gccdg = "\u0050\u006f\u0077\u0065\u0072\u0050l\u0075\u0073\u0057\u0061\u0074\u0065\u0072\u004d\u0061\u0072\u006b\u004f\u0062j\u0065\u0063\u0074\u0031\u0033\u0036\u00380\u0030\u0038\u0038\u0036" ; _ceaeff = "\u005f\u0078\u00300\u0030\u0030\u005f\u0073\u0032\u0030\u0035\u0031" ;
_efdc = "\u0023\u005f\u00780\u0030\u0030\u0030\u005f\u0074\u0031\u0033\u0036" ; _cccfd = "" ; _decf = "\u0070\u006f\u0073\u0069\u0074\u0069\u006f\u006e\u003a\u0061\u0062\u0073\u006f\u006c\u0075\u0074\u0065\u003b\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u006c\u0065f\u0074:\u0030\u003b\u006d\u0061\u0072\u0067\u0069\u006e\u002d\u0074o\u0070\u003a\u0030\u003b\u0077\u0069\u0064\u0074\u0068\u003a\u0034\u0036\u0038\u0070\u0074;\u0068\u0065\u0069\u0067\u0068\u0074\u003a\u0032\u0033\u0034\u0070\u0074\u003b\u007a\u002d\u0069\u006ede\u0078\u003a\u002d\u0032\u0035\u0031\u0036\u0035\u0031\u0030\u0037\u0032\u003b\u006d\u0073\u006f\u002d\u0077\u0072\u0061\u0070\u002d\u0065\u0064\u0069\u0074\u0065\u0064\u003a\u0066\u003b\u006d\u0073\u006f\u002d\u0077\u0069\u0064\u0074\u0068\u002d\u0070\u0065\u0072\u0063\u0065\u006e\u0074\u003a\u0030\u003b\u006d\u0073\u006f\u002d\u0068\u0065\u0069\u0067h\u0074-p\u0065\u0072\u0063\u0065\u006et\u003a\u0030\u003b\u006d\u0073\u006f\u002d\u0070\u006f\u0073\u0069\u0074\u0069\u006f\u006e\u002d\u0068\u006f\u0072\u0069\u007a\u006fn\u0074\u0061\u006c\u003a\u0063\u0065\u006e\u0074\u0065\u0072\u003b\u006d\u0073\u006f\u002d\u0070o\u0073\u0069\u0074\u0069\u006f\u006e\u002d\u0068\u006f\u0072\u0069\u007a\u006f\u006e\u0074\u0061\u006c\u002d\u0072\u0065l\u0061\u0074\u0069\u0076\u0065:\u006d\u0061\u0072\u0067\u0069n\u003b\u006d\u0073o\u002d\u0070\u006f\u0073\u0069\u0074\u0069o\u006e-\u0076\u0065\u0072\u0074\u0069\u0063\u0061\u006c\u003a\u0063\u0065\u006e\u0074\u0065\u0072\u003b\u006d\u0073\u006f\u002d\u0070\u006f\u0073\u0069\u0074\u0069\u006f\u006e\u002d\u0076\u0065r\u0074\u0069\u0063\u0061\u006c\u002d\u0072e\u006c\u0061\u0074i\u0076\u0065\u003a\u006d\u0061\u0072\u0067\u0069\u006e\u003b\u006d\u0073\u006f\u002d\u0077\u0069\u0064\u0074\u0068\u002d\u0070\u0065\u0072\u0063e\u006e\u0074\u003a\u0030\u003b\u006d\u0073\u006f\u002dh\u0065\u0069\u0067\u0068t\u002dp\u0065\u0072\u0063\u0065\u006et\u003a0" ;
_bgaba = "\u0073\u0069\u006c\u0076\u0065\u0072" ; ) ; _dbega . IdAttr = & _gccdg ; _dbega . SpidAttr = & _ceaeff ; _dbega . TypeAttr = & _efdc ; _dbega . AltAttr = & _cccfd ; _dbega . StyleAttr = & _decf ; _dbega . AllowincellAttr = _de . ST_TrueFalseFalse ; _dbega . FillcolorAttr = & _bgaba ;
_dbega . StrokedAttr = _de . ST_TrueFalseFalse ; _defa := _gdb . NewCT_Picture ( ) ; _defa . Any = [ ] _f . Any { _acba , _dbega } ; return WatermarkText { _aabdf : _defa , _ddcag : _dbega , _bgfg : _acba } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetShading controls the cell shading.
func ( _ebba CellProperties ) SetShading ( shd _gdb . ST_Shd , foreground , fill _gbc . Color ) { if shd == _gdb . ST_ShdUnset { _ebba . _debd . Shd = nil ; } else { _ebba . _debd . Shd = _gdb . NewCT_Shd ( ) ; _ebba . _debd . Shd . ValAttr = shd ; _ebba . _debd . Shd . ColorAttr = & _gdb . ST_HexColor { } ;
if foreground . IsAuto ( ) { _ebba . _debd . Shd . ColorAttr . ST_HexColorAuto = _gdb . ST_HexColorAutoAuto ; } else { _ebba . _debd . Shd . ColorAttr . ST_HexColorRGB = foreground . AsRGBString ( ) ; } ; _ebba . _debd . Shd . FillAttr = & _gdb . ST_HexColor { } ; if fill . IsAuto ( ) { _ebba . _debd . Shd . FillAttr . ST_HexColorAuto = _gdb . ST_HexColorAutoAuto ;
} else { _ebba . _debd . Shd . FillAttr . ST_HexColorRGB = fill . AsRGBString ( ) ; } ; } ; } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// SetEastAsiaTheme sets the font East Asia Theme.
func ( _efad Fonts ) SetEastAsiaTheme ( t _gdb . ST_Theme ) { _efad . _cfeaa . EastAsiaThemeAttr = t } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// SetHANSITheme sets the font H ANSI Theme.
func ( _eedb Fonts ) SetHANSITheme ( t _gdb . ST_Theme ) { _eedb . _cfeaa . HAnsiThemeAttr = t } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Type returns the type of the style.
func ( _aebf Style ) Type ( ) _gdb . ST_StyleType { return _aebf . _gfdb . TypeAttr } ; const ( OnOffValueUnset OnOffValue = iota ; OnOffValueOff ; OnOffValueOn ; ) ; func _dbfc ( _fffgd * _gdb . CT_P , _ffcd , _egaa map [ int64 ] int64 ) { for _ , _cdfb := range _fffgd . EG_PContent { for _ , _cfaa := range _cdfb . EG_ContentRunContent { if _cfaa . R != nil { for _ , _gbad := range _cfaa . R . EG_RunInnerContent { _gffb := _gbad . EndnoteReference ;
if _gffb != nil && _gffb . IdAttr > 0 { if _aacc , _gcea := _egaa [ _gffb . IdAttr ] ; _gcea { _gffb . IdAttr = _aacc ; } ; } ; _gegae := _gbad . FootnoteReference ; if _gegae != nil && _gegae . IdAttr > 0 { if _cbcg , _ccge := _ffcd [ _gegae . IdAttr ] ; _ccge { _gegae . IdAttr = _cbcg ;
} ; } ; } ; } ; } ; } ; } ; func ( _cae * Document ) save ( _fcb _g . Writer , _fdd string ) error { const _bfb = "\u0064o\u0063u\u006d\u0065\u006e\u0074\u003a\u0064\u002e\u0053\u0061\u0076\u0065" ; if _cdde := _cae . _dbc . Validate ( ) ; _cdde != nil { _fe . Log . Warning ( "\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" , _cdde ) ;
} ; _gad := _f . DocTypeDocument ; if ! _fd . GetLicenseKey ( ) . IsLicensed ( ) && ! _febg { _gb . 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" ) ;
_gb . 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 _cb . 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" ) ; } ; _acaf := "\u0075n\u006b\u006e\u006f\u0077\u006e" ; if _cfg , _eebd := _fcb . ( * _ag . File ) ;
_eebd { _acaf = _cfg . Name ( ) ; } ; if len ( _cae . _edg ) == 0 { if len ( _fdd ) > 0 { _cae . _edg = _fdd ; } else { _cac , _aba := _fd . GenRefId ( "\u0064\u0077" ) ; if _aba != nil { _fe . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _aba ) ; return _aba ; } ; _cae . _edg = _cac ;
} ; } ; if _bfca := _fd . Track ( _cae . _edg , _bfb , _acaf ) ; _bfca != nil { _fe . Log . Error ( "\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v" , _bfca ) ; return _bfca ; } ; _dcdgf := _fa . NewWriter ( _fcb ) ; defer _dcdgf . Close ( ) ; if _gcfd := _gd . MarshalXML ( _dcdgf , _f . BaseRelsFilename , _cae . Rels . X ( ) ) ;
_gcfd != nil { return _gcfd ; } ; if _cdg := _gd . MarshalXMLByType ( _dcdgf , _gad , _f . ExtendedPropertiesType , _cae . AppProperties . X ( ) ) ; _cdg != nil { return _cdg ; } ; if _eda := _gd . MarshalXMLByType ( _dcdgf , _gad , _f . CorePropertiesType , _cae . CoreProperties . X ( ) ) ;
_eda != nil { return _eda ; } ; if _cae . CustomProperties . X ( ) != nil { if _dcdb := _gd . MarshalXMLByType ( _dcdgf , _gad , _f . CustomPropertiesType , _cae . CustomProperties . X ( ) ) ; _dcdb != nil { return _dcdb ; } ; } ; if _cae . Thumbnail != nil { _fdbe , _cdaa := _dcdgf . Create ( "\u0064\u006f\u0063Pr\u006f\u0070\u0073\u002f\u0074\u0068\u0075\u006d\u0062\u006e\u0061\u0069\u006c\u002e\u006a\u0070\u0065\u0067" ) ;
if _cdaa != nil { return _cdaa ; } ; if _dagb := _e . Encode ( _fdbe , _cae . Thumbnail , nil ) ; _dagb != nil { return _dagb ; } ; } ; if _gge := _gd . MarshalXMLByType ( _dcdgf , _gad , _f . SettingsType , _cae . Settings . X ( ) ) ; _gge != nil { return _gge ; } ; _fefg := _f . AbsoluteFilename ( _gad , _f . OfficeDocumentType , 0 ) ;
if _aaae := _gd . MarshalXML ( _dcdgf , _fefg , _cae . _dbc ) ; _aaae != nil { return _aaae ; } ; if _afe := _gd . MarshalXML ( _dcdgf , _gd . RelationsPathFor ( _fefg ) , _cae . _aed . X ( ) ) ; _afe != nil { return _afe ; } ; if _cae . Numbering . X ( ) != nil { if _adb := _gd . MarshalXMLByType ( _dcdgf , _gad , _f . NumberingType , _cae . Numbering . X ( ) ) ;
_adb != nil { return _adb ; } ; } ; if _fcbf := _gd . MarshalXMLByType ( _dcdgf , _gad , _f . StylesType , _cae . Styles . X ( ) ) ; _fcbf != nil { return _fcbf ; } ; if _cae . _abbb != nil { if _afg := _gd . MarshalXMLByType ( _dcdgf , _gad , _f . WebSettingsType , _cae . _abbb ) ; _afg != nil { return _afg ;
} ; } ; if _cae . _cdee != nil { if _fdeg := _gd . MarshalXMLByType ( _dcdgf , _gad , _f . FontTableType , _cae . _cdee ) ; _fdeg != nil { return _fdeg ; } ; } ; if _cae . _gde != nil { if _aaff := _gd . MarshalXMLByType ( _dcdgf , _gad , _f . EndNotesType , _cae . _gde ) ; _aaff != nil { return _aaff ;
} ; } ; if _cae . _bgg != nil { if _def := _gd . MarshalXMLByType ( _dcdgf , _gad , _f . FootNotesType , _cae . _bgg ) ; _def != nil { return _def ; } ; } ; for _fdc , _ddg := range _cae . _aaf { if _be := _gd . MarshalXMLByTypeIndex ( _dcdgf , _gad , _f . ThemeType , _fdc + 1 , _ddg ) ; _be != nil { return _be ;
} ; } ; for _gcg , _ebbb := range _cae . _acf { _defg , _debe := _ebbb . ExportToByteArray ( ) ; if _debe != nil { return _debe ; } ; _aacf := "\u0077\u006f\u0072d\u002f" + _ebbb . TargetAttr [ : len ( _ebbb . TargetAttr ) - 4 ] + "\u002e\u0062\u0069\u006e" ; if _eba := _gd . AddFileFromBytes ( _dcdgf , _aacf , _defg ) ;
_eba != nil { return _eba ; } ; if _cdaac := _gd . MarshalXMLByTypeIndex ( _dcdgf , _gad , _f . ControlType , _gcg + 1 , _ebbb . Ocx ) ; _cdaac != nil { return _cdaac ; } ; } ; for _abc , _eaca := range _cae . _agfcg { _cbff := _f . AbsoluteFilename ( _gad , _f . HeaderType , _abc + 1 ) ; if _gfae := _gd . MarshalXML ( _dcdgf , _cbff , _eaca ) ;
_gfae != nil { return _gfae ; } ; if ! _cae . _fgd [ _abc ] . IsEmpty ( ) { _gd . MarshalXML ( _dcdgf , _gd . RelationsPathFor ( _cbff ) , _cae . _fgd [ _abc ] . X ( ) ) ; } ; } ; for _adf , _fbb := range _cae . _dea { _dfg := _f . AbsoluteFilename ( _gad , _f . FooterType , _adf + 1 ) ; if _ffa := _gd . MarshalXMLByTypeIndex ( _dcdgf , _gad , _f . FooterType , _adf + 1 , _fbb ) ;
_ffa != nil { return _ffa ; } ; if ! _cae . _gaf [ _adf ] . IsEmpty ( ) { _gd . MarshalXML ( _dcdgf , _gd . RelationsPathFor ( _dfg ) , _cae . _gaf [ _adf ] . X ( ) ) ; } ; } ; for _deec , _abbd := range _cae . Images { if _adc := _cc . AddImageToZip ( _dcdgf , _abbd , _deec + 1 , _f . DocTypeDocument ) ;
_adc != nil { return _adc ; } ; } ; for _bac , _edb := range _cae . _deae { _ced := _f . AbsoluteFilename ( _gad , _f . ChartType , _bac + 1 ) ; _gd . MarshalXML ( _dcdgf , _ced , _edb . _ffd ) ; } ; if _gda := _gd . MarshalXML ( _dcdgf , _f . ContentTypesFilename , _cae . ContentTypes . X ( ) ) ;
_gda != nil { return _gda ; } ; if _afa := _cae . WriteExtraFiles ( _dcdgf ) ; _afa != nil { return _afa ; } ; return _dcdgf . Close ( ) ; } ;
2022-02-25 19:20:45 +00:00
2024-09-16 09:59:58 +00:00
// SetUnderline controls underline for a run style.
func ( _addffc RunProperties ) SetUnderline ( style _gdb . ST_Underline , c _gbc . Color ) { if style == _gdb . ST_UnderlineUnset { _addffc . _bace . U = nil ; } else { _addffc . _bace . U = _gdb . NewCT_Underline ( ) ; _addffc . _bace . U . ColorAttr = & _gdb . ST_HexColor { } ; _addffc . _bace . U . ColorAttr . ST_HexColorRGB = c . AsRGBString ( ) ;
_addffc . _bace . U . ValAttr = style ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Borders allows controlling individual cell borders.
func ( _ege CellProperties ) Borders ( ) CellBorders { if _ege . _debd . TcBorders == nil { _ege . _debd . TcBorders = _gdb . NewCT_TcBorders ( ) ; } ; return CellBorders { _ege . _debd . TcBorders } ; } ;
2017-08-28 20:56:18 -05:00
2024-09-16 09:59:58 +00:00
// SetAll sets all of the borders to a given value.
func ( _aaaf CellBorders ) SetAll ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _aaaf . SetBottom ( t , c , thickness ) ; _aaaf . SetLeft ( t , c , thickness ) ; _aaaf . SetRight ( t , c , thickness ) ; _aaaf . SetTop ( t , c , thickness ) ; _aaaf . SetInsideHorizontal ( t , c , thickness ) ;
_aaaf . SetInsideVertical ( t , c , thickness ) ; } ;
2017-08-30 16:49:57 -05:00
2024-09-16 09:59:58 +00:00
// SetCSTheme sets the font complex script theme.
func ( _faea Fonts ) SetCSTheme ( t _gdb . ST_Theme ) { _faea . _cfeaa . CsthemeAttr = t } ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// SetRightIndent controls right indent of paragraph.
func ( _feadaf Paragraph ) SetRightIndent ( m _dg . Distance ) { _feadaf . ensurePPr ( ) ; _cgeb := _feadaf . _gbaee . PPr ; if _cgeb . Ind == nil { _cgeb . Ind = _gdb . NewCT_Ind ( ) ; } ; if m == _dg . Zero { _cgeb . Ind . RightAttr = nil ; } else { _cgeb . Ind . RightAttr = & _gdb . ST_SignedTwipsMeasure { } ;
_cgeb . Ind . RightAttr . Int64 = _f . Int64 ( int64 ( m / _dg . Twips ) ) ; } ; } ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// SetColumnBandSize sets the number of Columns in the column band
func ( _eaafc TableStyleProperties ) SetColumnBandSize ( cols int64 ) { _eaafc . _addgf . TblStyleColBandSize = _gdb . NewCT_DecimalNumber ( ) ; _eaafc . _addgf . TblStyleColBandSize . ValAttr = cols ; } ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// AddHyperLink adds a new hyperlink to a parapgraph.
func ( _bfgc Paragraph ) AddHyperLink ( ) HyperLink { _dadbbc := _gdb . NewEG_PContent ( ) ; _bfgc . _gbaee . EG_PContent = append ( _bfgc . _gbaee . EG_PContent , _dadbbc ) ; _dadbbc . Hyperlink = _gdb . NewCT_Hyperlink ( ) ; return HyperLink { _bfgc . _fdec , _dadbbc . Hyperlink } ;
} ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// AddImage adds an image to the document package, returning a reference that
// can be used to add the image to a run and place it in the document contents.
func ( _fdfa Footer ) AddImage ( i _cc . Image ) ( _cc . ImageRef , error ) { var _abfd _cc . Relationships ; for _eceaa , _gcgg := range _fdfa . _dgbc . _dea { if _gcgg == _fdfa . _dbdg { _abfd = _fdfa . _dgbc . _gaf [ _eceaa ] ; } ; } ; _eeea := _cc . MakeImageRef ( i , & _fdfa . _dgbc . DocBase , _abfd ) ;
if i . Data == nil && i . Path == "" { return _eeea , _cb . 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 _eeea , _cb . 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 _eeea , _cb . 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" ) ; } ; _fdfa . _dgbc . Images = append ( _fdfa . _dgbc . Images , _eeea ) ;
_afbde := _gb . Sprintf ( "\u006d\u0065d\u0069\u0061\u002fi\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073" , len ( _fdfa . _dgbc . Images ) , i . Format ) ; _ddea := _abfd . AddRelationship ( _afbde , _f . ImageType ) ; _eeea . SetRelID ( _ddea . X ( ) . IdAttr ) ; return _eeea , nil ;
} ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// SetFirstLineIndent controls the first line indent of the paragraph.
func ( _ggfe ParagraphStyleProperties ) SetFirstLineIndent ( m _dg . Distance ) { if _ggfe . _cdeed . Ind == nil { _ggfe . _cdeed . Ind = _gdb . NewCT_Ind ( ) ; } ; if m == _dg . Zero { _ggfe . _cdeed . Ind . FirstLineAttr = nil ; } else { _ggfe . _cdeed . Ind . FirstLineAttr = & _de . ST_TwipsMeasure { } ;
_ggfe . _cdeed . Ind . FirstLineAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( m / _dg . Twips ) ) ; } ; } ;
2024-05-08 13:54:39 +00:00
2024-09-16 09:59:58 +00:00
// CharacterSpacingMeasure returns paragraph characters spacing with its measure which can be mm, cm, in, pt, pc or pi.
func ( _agcg RunProperties ) CharacterSpacingMeasure ( ) string { if _ededc := _agcg . _bace . Spacing ; _ededc != nil { _cgee := _ededc . ValAttr ; if _cgee . ST_UniversalMeasure != nil { return * _cgee . ST_UniversalMeasure ; } ; } ; return "" ; } ;
2017-08-28 20:56:18 -05:00
2024-09-16 09:59:58 +00:00
// SetHeader sets a section header.
func ( _cbbe Section ) SetHeader ( h Header , t _gdb . ST_HdrFtr ) { _bgcfa := _gdb . NewEG_HdrFtrReferences ( ) ; _cbbe . _bcgc . EG_HdrFtrReferences = append ( _cbbe . _bcgc . EG_HdrFtrReferences , _bgcfa ) ; _bgcfa . HeaderReference = _gdb . NewCT_HdrFtrRef ( ) ; _bgcfa . HeaderReference . TypeAttr = t ;
_eaabd := _cbbe . _aaaeb . _aed . FindRIDForN ( h . Index ( ) , _f . HeaderType ) ; if _eaabd == "" { _fe . Log . Debug ( "\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" ) ;
} ; _bgcfa . HeaderReference . IdAttr = _eaabd ; } ;
2022-09-02 11:46:53 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _ffbb Endnote ) X ( ) * _gdb . CT_FtnEdn { return _ffbb . _baab } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetLineSpacing controls the line spacing of the paragraph.
func ( _cfadg ParagraphStyleProperties ) SetLineSpacing ( m _dg . Distance , rule _gdb . ST_LineSpacingRule ) { if _cfadg . _cdeed . Spacing == nil { _cfadg . _cdeed . Spacing = _gdb . NewCT_Spacing ( ) ; } ; if rule == _gdb . ST_LineSpacingRuleUnset { _cfadg . _cdeed . Spacing . LineRuleAttr = _gdb . ST_LineSpacingRuleUnset ;
_cfadg . _cdeed . Spacing . LineAttr = nil ; } else { _cfadg . _cdeed . Spacing . LineRuleAttr = rule ; _cfadg . _cdeed . Spacing . LineAttr = & _gdb . ST_SignedTwipsMeasure { } ; _cfadg . _cdeed . Spacing . LineAttr . Int64 = _f . Int64 ( int64 ( m / _dg . Twips ) ) ; } ; } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// Document is a text document that can be written out in the OOXML .docx
// format. It can be opened from a file on disk and modified, or created from
// scratch.
type Document struct { _cc . DocBase ; _dbc * _gdb . Document ; Settings Settings ; Numbering Numbering ; Styles Styles ; _agfcg [ ] * _gdb . Hdr ; _fgd [ ] _cc . Relationships ; _dea [ ] * _gdb . Ftr ; _gaf [ ] _cc . Relationships ; _aed _cc . Relationships ; _aaf [ ] * _dcb . Theme ;
_abbb * _gdb . WebSettings ; _cdee * _gdb . Fonts ; _gef _cc . Relationships ; _gde * _gdb . Endnotes ; _bgg * _gdb . Footnotes ; _acf [ ] * _ac . Control ; _deae [ ] * chart ; _edg string ; } ; func ( _fbfge * Document ) putNode ( _afeg , _bcdb Node , _gbag bool ) bool { _fbfge . insertImageFromNode ( _bcdb ) ;
_fbfge . insertStyleFromNode ( _bcdb ) ; switch _cabbe := _bcdb . _dbca . ( type ) { case * Paragraph : if _beac , _dgbb := _afeg . X ( ) . ( * Paragraph ) ; _dgbb { _fbfge . appendParagraph ( _beac , * _cabbe , _gbag ) ; return true ; } else { for _ , _deaa := range _afeg . Children { if _cadcb := _fbfge . putNode ( _deaa , _bcdb , _gbag ) ;
_cadcb { break ; } ; } ; } ; case * Table : if _gbeb , _egage := _afeg . X ( ) . ( * Paragraph ) ; _egage { _dbef := _fbfge . appendTable ( _gbeb , * _cabbe , _gbag ) ; _dbef . _afabf = _cabbe . _afabf ; return true ; } else { for _ , _cbcf := range _afeg . Children { if _geadc := _fbfge . putNode ( _cbcf , _bcdb , _gbag ) ;
_geadc { break ; } ; } ; } ; } ; return false ; } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// SetTextWrapInFrontOfText sets the text wrap to in front of text.
func ( _af AnchoredDrawing ) SetTextWrapInFrontOfText ( ) { _af . _bc . Choice = & _gdb . WdEG_WrapTypeChoice { } ; _af . _bc . Choice . WrapNone = _gdb . NewWdCT_WrapNone ( ) ; _af . _bc . BehindDocAttr = false ; _af . _bc . LayoutInCellAttr = true ; _af . _bc . AllowOverlapAttr = true ;
2024-07-28 07:48:26 +00:00
} ;
2020-10-12 13:59:12 +00:00
2024-09-16 09:59:58 +00:00
// Index returns the index of the header within the document. This is used to
// form its zip packaged filename as well as to match it with its relationship
// ID.
func ( _dfedb Header ) Index ( ) int { for _fagde , _dbbea := range _dfedb . _ddgg . _agfcg { if _dbbea == _dfedb . _eeee { return _fagde ; } ; } ; return - 1 ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _eddcd ParagraphStyleProperties ) X ( ) * _gdb . CT_PPrGeneral { return _eddcd . _cdeed } ;
2020-11-09 01:00:18 +00:00
2024-09-16 09:59:58 +00:00
// SetImprint sets the run to imprinted text.
func ( _fgdfg RunProperties ) SetImprint ( b bool ) { if ! b { _fgdfg . _bace . Imprint = nil ; } else { _fgdfg . _bace . Imprint = _gdb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// HasEndnotes returns a bool based on the presence or abscence of endnotes within
// the document.
func ( _ecad * Document ) HasEndnotes ( ) bool { return _ecad . _gde != nil } ; func ( _abbe Paragraph ) addFldChar ( ) * _gdb . CT_FldChar { _fagg := _abbe . AddRun ( ) ; _ecbec := _fagg . X ( ) ; _ggbaf := _gdb . NewEG_RunInnerContent ( ) ; _fedac := _gdb . NewCT_FldChar ( ) ; _ggbaf . FldChar = _fedac ;
_ecbec . EG_RunInnerContent = append ( _ecbec . EG_RunInnerContent , _ggbaf ) ; return _fedac ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Levels returns all of the numbering levels defined in the definition.
func ( _gfbg NumberingDefinition ) Levels ( ) [ ] NumberingLevel { _gbedg := [ ] NumberingLevel { } ; for _ , _gebf := range _gfbg . _gged . Lvl { _gbedg = append ( _gbedg , NumberingLevel { _gebf } ) ; } ; return _gbedg ; } ;
2024-07-28 07:48:26 +00:00
2024-09-16 09:59:58 +00:00
// Properties returns the numbering level paragraph properties.
func ( _cfgba NumberingLevel ) Properties ( ) ParagraphStyleProperties { if _cfgba . _ggagc . PPr == nil { _cfgba . _ggagc . PPr = _gdb . NewCT_PPrGeneral ( ) ; } ; return ParagraphStyleProperties { _cfgba . _ggagc . PPr } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetFirstLineIndent controls the indentation of the first line in a paragraph.
func ( _ggdeg ParagraphProperties ) SetFirstLineIndent ( m _dg . Distance ) { if _ggdeg . _egbf . Ind == nil { _ggdeg . _egbf . Ind = _gdb . NewCT_Ind ( ) ; } ; if m == _dg . Zero { _ggdeg . _egbf . Ind . FirstLineAttr = nil ; } else { _ggdeg . _egbf . Ind . FirstLineAttr = & _de . ST_TwipsMeasure { } ;
_ggdeg . _egbf . Ind . FirstLineAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( m / _dg . Twips ) ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SearchStylesById returns style by its id.
func ( _ebded Styles ) SearchStyleById ( id string ) ( Style , bool ) { for _ , _gaaa := range _ebded . _cadcge . Style { if _gaaa . StyleIdAttr != nil { if * _gaaa . StyleIdAttr == id { return Style { _gaaa } , true ; } ; } ; } ; return Style { } , false ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetSpacing sets the spacing that comes before and after the paragraph.
func ( _cfdc ParagraphStyleProperties ) SetSpacing ( before , after _dg . Distance ) { if _cfdc . _cdeed . Spacing == nil { _cfdc . _cdeed . Spacing = _gdb . NewCT_Spacing ( ) ; } ; if before == _dg . Zero { _cfdc . _cdeed . Spacing . BeforeAttr = nil ; } else { _cfdc . _cdeed . Spacing . BeforeAttr = & _de . ST_TwipsMeasure { } ;
_cfdc . _cdeed . Spacing . BeforeAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( before / _dg . Twips ) ) ; } ; if after == _dg . Zero { _cfdc . _cdeed . Spacing . AfterAttr = nil ; } else { _cfdc . _cdeed . Spacing . AfterAttr = & _de . ST_TwipsMeasure { } ; _cfdc . _cdeed . Spacing . AfterAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( after / _dg . Twips ) ) ;
} ; } ;
2021-04-23 20:00:00 +00:00
2024-09-16 09:59:58 +00:00
// SetTblHeader set row properties for repeat table row on every new page value.
func ( _cfcd RowProperties ) SetTblHeader ( val bool ) { if ! val { _cfcd . _aggd . TblHeader = nil ; } else { _dccbg := _gdb . NewCT_OnOff ( ) ; _cfcd . _aggd . TblHeader = [ ] * _gdb . CT_OnOff { _dccbg } ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetStartPct sets the cell start margin
func ( _aae CellMargins ) SetStartPct ( pct float64 ) { _aae . _cf . Start = _gdb . NewCT_TblWidth ( ) ; _cca ( _aae . _cf . Start , pct ) ; } ;
2021-11-10 11:45:21 +00:00
2024-09-16 09:59:58 +00:00
// IgnoreSpaceBetweenParagraphOfSameStyle sets contextual spacing.
func ( _cggbf Paragraph ) IgnoreSpaceBetweenParagraphOfSameStyle ( ) { _cggbf . ensurePPr ( ) ; if _cggbf . _gbaee . PPr . ContextualSpacing == nil { _cggbf . _gbaee . PPr . ContextualSpacing = _gdb . NewCT_OnOff ( ) ; } ; _cggbf . _gbaee . PPr . ContextualSpacing . ValAttr = & _de . ST_OnOff { ST_OnOff1 : _de . ST_OnOff1On } ;
} ; func _adcd ( _bccd * _gdb . CT_P , _ccbb map [ string ] string ) { for _ , _cefb := range _bccd . EG_PContent { if _cefb . Hyperlink != nil && _cefb . Hyperlink . IdAttr != nil { if _addg , _bafb := _ccbb [ * _cefb . Hyperlink . IdAttr ] ; _bafb { * _cefb . Hyperlink . IdAttr = _addg ;
} ; } ; } ; } ;
2023-12-28 15:53:06 +00:00
2024-09-16 09:59:58 +00:00
// Section is the beginning of a new section.
type Section struct { _aaaeb * Document ; _bcgc * _gdb . CT_SectPr ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// PutNodeBefore put node to position before relativeTo.
func ( _fdaca * Document ) PutNodeBefore ( relativeTo , node Node ) { _fdaca . putNode ( relativeTo , node , true ) } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Style is a style within the styles.xml file.
type Style struct { _gfdb * _gdb . CT_Style } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Font returns the name of run font family.
func ( _fdee RunProperties ) Font ( ) string { if _ebcg := _fdee . _bace . RFonts ; _ebcg != nil { if _ebcg . AsciiAttr != nil { return * _ebcg . AsciiAttr ; } else if _ebcg . HAnsiAttr != nil { return * _ebcg . HAnsiAttr ; } else if _ebcg . CsAttr != nil { return * _ebcg . CsAttr ;
} ; } ; return "" ; } ;
2024-02-17 03:37:07 +00:00
2024-09-16 09:59:58 +00:00
// ParagraphProperties returns the paragraph style properties.
func ( _dccg Style ) ParagraphProperties ( ) ParagraphStyleProperties { if _dccg . _gfdb . PPr == nil { _dccg . _gfdb . PPr = _gdb . NewCT_PPrGeneral ( ) ; } ; return ParagraphStyleProperties { _dccg . _gfdb . PPr } ; } ;
2020-10-12 13:59:12 +00:00
2024-09-16 09:59:58 +00:00
// IsEndnote returns a bool based on whether the run has a
// footnote or not. Returns both a bool as to whether it has
// a footnote as well as the ID of the footnote.
func ( _ecffe Run ) IsEndnote ( ) ( bool , int64 ) { if _ecffe . _feebb . EG_RunInnerContent != nil { if _ecffe . _feebb . EG_RunInnerContent [ 0 ] . EndnoteReference != nil { return true , _ecffe . _feebb . EG_RunInnerContent [ 0 ] . EndnoteReference . IdAttr ; } ; } ; return false , 0 ;
} ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// AddDefinition adds a new numbering definition.
func ( _fbec Numbering ) AddDefinition ( ) NumberingDefinition { _cdgf := _gdb . NewCT_Num ( ) ; _eeeag := int64 ( 1 ) ; for _ , _cegb := range _fbec . Definitions ( ) { if _cegb . AbstractNumberID ( ) >= _eeeag { _eeeag = _cegb . AbstractNumberID ( ) + 1 ; } ; } ; _cafa := int64 ( 1 ) ; for _ , _deeda := range _fbec . X ( ) . Num { if _deeda . NumIdAttr >= _cafa { _cafa = _deeda . NumIdAttr + 1 ;
} ; } ; _cdgf . NumIdAttr = _cafa ; _cdgf . AbstractNumId = _gdb . NewCT_DecimalNumber ( ) ; _cdgf . AbstractNumId . ValAttr = _eeeag ; _beggd := _gdb . NewCT_AbstractNum ( ) ; _beggd . AbstractNumIdAttr = _eeeag ; _fbec . _cgbg . AbstractNum = append ( _fbec . _cgbg . AbstractNum , _beggd ) ;
_fbec . _cgbg . Num = append ( _fbec . _cgbg . Num , _cdgf ) ; return NumberingDefinition { _beggd } ; } ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// Footers returns the footers defined in the document.
func ( _debb * Document ) Footers ( ) [ ] Footer { _aceb := [ ] Footer { } ; for _ , _gaeg := range _debb . _dea { _aceb = append ( _aceb , Footer { _debb , _gaeg } ) ; } ; return _aceb ; } ; func ( _fcc * Document ) validateBookmarks ( ) error { _agbd := make ( map [ string ] struct { } ) ; for _ , _eacf := range _fcc . Bookmarks ( ) { if _ , _acgc := _agbd [ _eacf . Name ( ) ] ;
_acgc { return _gb . Errorf ( "d\u0075\u0070\u006c\u0069\u0063\u0061t\u0065\u0020\u0062\u006f\u006f\u006b\u006d\u0061\u0072k\u0020\u0025\u0073 \u0066o\u0075\u006e\u0064" , _eacf . Name ( ) ) ; } ; _agbd [ _eacf . Name ( ) ] = struct { } { } ; } ; return nil ; } ;
2020-10-12 13:59:12 +00:00
2024-09-16 09:59:58 +00:00
// AddParagraph adds a paragraph to the footer.
func ( _gafa Footer ) AddParagraph ( ) Paragraph { _cbdd := _gdb . NewEG_ContentBlockContent ( ) ; _gafa . _dbdg . EG_ContentBlockContent = append ( _gafa . _dbdg . EG_ContentBlockContent , _cbdd ) ; _fcad := _gdb . NewCT_P ( ) ; _cbdd . P = append ( _cbdd . P , _fcad ) ; return Paragraph { _gafa . _dgbc , _fcad } ;
} ; func ( _eeeaa Paragraph ) addBeginFldChar ( _ebee string ) * _gdb . CT_FFData { _dfbd := _eeeaa . addFldChar ( ) ; _dfbd . FldCharTypeAttr = _gdb . ST_FldCharTypeBegin ; _dfbd . FfData = _gdb . NewCT_FFData ( ) ; _eadd := _gdb . NewCT_FFName ( ) ; _eadd . ValAttr = & _ebee ; _dfbd . FfData . Name = [ ] * _gdb . CT_FFName { _eadd } ;
return _dfbd . FfData ; } ; func _fgaa ( _aegc * _gdb . EG_ContentBlockContent ) [ ] Bookmark { _afff := [ ] Bookmark { } ; for _ , _eagc := range _aegc . P { for _ , _cfc := range _eagc . EG_PContent { for _ , _dcdfa := range _cfc . EG_ContentRunContent { for _ , _dcfd := range _dcdfa . EG_RunLevelElts { for _ , _aab := range _dcfd . EG_RangeMarkupElements { if _aab . BookmarkStart != nil { _afff = append ( _afff , Bookmark { _aab . BookmarkStart } ) ;
} ; } ; } ; } ; } ; } ; for _ , _bacc := range _aegc . EG_RunLevelElts { for _ , _dbeba := range _bacc . EG_RangeMarkupElements { if _dbeba . BookmarkStart != nil { _afff = append ( _afff , Bookmark { _dbeba . BookmarkStart } ) ; } ; } ; } ; for _ , _fdbf := range _aegc . Tbl { for _ , _aedf := range _fdbf . EG_ContentRowContent { for _ , _bdcg := range _aedf . Tr { for _ , _gggb := range _bdcg . EG_ContentCellContent { for _ , _dgb := range _gggb . Tc { for _ , _ffegc := range _dgb . EG_BlockLevelElts { for _ , _fdac := range _ffegc . EG_ContentBlockContent { for _ , _eced := range _fgaa ( _fdac ) { _afff = append ( _afff , _eced ) ;
} ; } ; } ; } ; } ; } ; } ; } ; return _afff ; } ;
2024-07-28 07:48:26 +00:00
2024-09-16 09:59:58 +00:00
// DrawingAnchored returns a slice of AnchoredDrawings.
func ( _gegcc Run ) DrawingAnchored ( ) [ ] AnchoredDrawing { _eebg := [ ] AnchoredDrawing { } ; for _ , _bbdbg := range _gegcc . _feebb . EG_RunInnerContent { if _bbdbg . Drawing == nil { continue ; } ; for _ , _fbcc := range _bbdbg . Drawing . Anchor { _eebg = append ( _eebg , AnchoredDrawing { _gegcc . _ecda , _fbcc } ) ;
} ; } ; return _eebg ; } ;
2024-07-28 07:48:26 +00:00
2024-09-16 09:59:58 +00:00
// ComplexSizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.
func ( _dbcfg RunProperties ) ComplexSizeMeasure ( ) string { if _bdafb := _dbcfg . _bace . SzCs ; _bdafb != nil { _cdgaf := _bdafb . ValAttr ; if _cdgaf . ST_PositiveUniversalMeasure != nil { return * _cdgaf . ST_PositiveUniversalMeasure ; } ; } ; return "" ; } ;
2022-09-02 11:46:53 +00:00
2024-09-16 09:59:58 +00:00
// Name returns the name of the field.
func ( _cced FormField ) Name ( ) string { return * _cced . _eebdg . Name [ 0 ] . ValAttr } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// FormField is a form within a document. It references the document, so changes
// to the form field wil be reflected in the document if it is saved.
type FormField struct { _eebdg * _gdb . CT_FFData ; _eaggc * _gdb . EG_RunInnerContent ; } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// InsertParagraphAfter adds a new empty paragraph after the relativeTo
// paragraph.
func ( _agcc * Document ) InsertParagraphAfter ( relativeTo Paragraph ) Paragraph { return _agcc . insertParagraph ( relativeTo , false ) ; } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// RightToLeft returns true if paragraph text goes from right to left.
func ( _cbgd ParagraphProperties ) RightToLeft ( ) bool { return _cefe ( _cbgd . _egbf . RPr . Rtl ) } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// VerticalAlign returns the value of run vertical align.
func ( _dbefa RunProperties ) VerticalAlignment ( ) _de . ST_VerticalAlignRun { if _cbef := _dbefa . _bace . VertAlign ; _cbef != nil { return _cbef . ValAttr ; } ; return 0 ; } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// RunProperties returns the RunProperties controlling numbering level font, etc.
func ( _ddeaf NumberingLevel ) RunProperties ( ) RunProperties { if _ddeaf . _ggagc . RPr == nil { _ddeaf . _ggagc . RPr = _gdb . NewCT_RPr ( ) ; } ; return RunProperties { _ddeaf . _ggagc . RPr } ; } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// AddParagraph adds a paragraph to the table cell.
func ( _da Cell ) AddParagraph ( ) Paragraph { _eg := _gdb . NewEG_BlockLevelElts ( ) ; _da . _dbf . EG_BlockLevelElts = append ( _da . _dbf . EG_BlockLevelElts , _eg ) ; _dfa := _gdb . NewEG_ContentBlockContent ( ) ; _eg . EG_ContentBlockContent = append ( _eg . EG_ContentBlockContent , _dfa ) ;
_bdgg := _gdb . NewCT_P ( ) ; _dfa . P = append ( _dfa . P , _bdgg ) ; return Paragraph { _da . _age , _bdgg } ; } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// CellProperties are a table cells properties within a document.
type CellProperties struct { _debd * _gdb . CT_TcPr } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// RemoveParagraph removes a paragraph from the footnote.
func ( _gcfdd Footnote ) RemoveParagraph ( p Paragraph ) { for _ , _fbef := range _gcfdd . content ( ) { for _ffff , _adddb := range _fbef . P { if _adddb == p . _gbaee { copy ( _fbef . P [ _ffff : ] , _fbef . P [ _ffff + 1 : ] ) ; _fbef . P = _fbef . P [ 0 : len ( _fbef . P ) - 1 ] ; return ; } ; } ;
} ; } ;
2022-09-02 11:46:53 +00:00
2024-09-16 09:59:58 +00:00
// SetPrimaryStyle marks the style as a primary style.
func ( _baeb Style ) SetPrimaryStyle ( b bool ) { if b { _baeb . _gfdb . QFormat = _gdb . NewCT_OnOff ( ) ; } else { _baeb . _gfdb . QFormat = nil ; } ; } ;
2022-09-02 11:46:53 +00:00
2024-09-16 09:59:58 +00:00
// SetTop sets the top border to a specified type, color and thickness.
func ( _gcggd TableBorders ) SetTop ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _gcggd . _gfgae . Top = _gdb . NewCT_Border ( ) ; _beggg ( _gcggd . _gfgae . Top , t , c , thickness ) ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// NewAnchorDrawWrapOptions return anchor drawing options property.
func NewAnchorDrawWrapOptions ( ) * AnchorDrawWrapOptions { _fae := & AnchorDrawWrapOptions { } ; if ! _fae . _baea { _aaa , _cab := _gdbd ( ) ; _fae . _ace = _aaa ; _fae . _cde = _cab ; } ; return _fae ; } ;
2020-11-09 01:00:18 +00:00
2024-09-16 09:59:58 +00:00
// SetProperties sets the `RunProperties` to the `Run` element
func ( _bfgg Run ) SetProperties ( rp RunProperties ) { if rp . _bace == nil { _bfgg . _feebb . RPr = _gdb . NewCT_RPr ( ) ; } else { _gebc := & _gdb . CT_RPr { } ; if rp . _bace . RStyle != nil { _gebc . RStyle = & _gdb . CT_String { ValAttr : rp . _bace . RStyle . ValAttr } ; } ; if rp . _bace . RFonts != nil { _gebc . RFonts = & _gdb . CT_Fonts { HintAttr : rp . _bace . RFonts . HintAttr , AsciiAttr : rp . _bace . RFonts . AsciiAttr , HAnsiAttr : rp . _bace . RFonts . HAnsiAttr , EastAsiaAttr : rp . _bace . RFonts . EastAsiaAttr , CsAttr : rp . _bace . RFonts . CsAttr , AsciiThemeAttr : rp . _bace . RFonts . AsciiThemeAttr , HAnsiThemeAttr : rp . _bace . RFonts . HAnsiThemeAttr , EastAsiaThemeAttr : rp . _bace . RFonts . EastAsiaThemeAttr , CsthemeAttr : rp . _bace . RFonts . CsthemeAttr } ;
} ; if rp . _bace . B != nil { _gebc . B = & _gdb . CT_OnOff { } ; if rp . _bace . B . ValAttr != nil { _eabfa := * rp . _bace . B . ValAttr ; _gebc . B . ValAttr = & _eabfa ; } ; } ; if rp . _bace . BCs != nil { _gebc . BCs = & _gdb . CT_OnOff { } ; if rp . _bace . BCs . ValAttr != nil { _dbfe := * rp . _bace . BCs . ValAttr ;
_gebc . BCs . ValAttr = & _dbfe ; } ; } ; if rp . _bace . I != nil { _gebc . I = & _gdb . CT_OnOff { } ; if rp . _bace . I . ValAttr != nil { _eacbe := * rp . _bace . I . ValAttr ; _gebc . I . ValAttr = & _eacbe ; } ; } ; if rp . _bace . ICs != nil { _gebc . ICs = & _gdb . CT_OnOff { } ; if rp . _bace . ICs . ValAttr != nil { _bcbd := * rp . _bace . ICs . ValAttr ;
_gebc . ICs . ValAttr = & _bcbd ; } ; } ; if rp . _bace . Caps != nil { _gebc . Caps = & _gdb . CT_OnOff { } ; if rp . _bace . Caps . ValAttr != nil { _fdbg := * rp . _bace . Caps . ValAttr ; _gebc . Caps . ValAttr = & _fdbg ; } ; } ; if rp . _bace . SmallCaps != nil { _gebc . SmallCaps = & _gdb . CT_OnOff { } ;
if rp . _bace . SmallCaps . ValAttr != nil { _bbcgc := * rp . _bace . SmallCaps . ValAttr ; _gebc . SmallCaps . ValAttr = & _bbcgc ; } ; } ; if rp . _bace . Strike != nil { _gebc . Strike = & _gdb . CT_OnOff { } ; if rp . _bace . Strike . ValAttr != nil { _ccgdc := * rp . _bace . Strike . ValAttr ;
_gebc . Strike . ValAttr = & _ccgdc ; } ; } ; if rp . _bace . Dstrike != nil { _gebc . Dstrike = & _gdb . CT_OnOff { } ; if rp . _bace . Dstrike . ValAttr != nil { _fabac := * rp . _bace . Dstrike . ValAttr ; _gebc . Dstrike . ValAttr = & _fabac ; } ; } ; if rp . _bace . Outline != nil { _gebc . Outline = & _gdb . CT_OnOff { } ;
if rp . _bace . Outline . ValAttr != nil { _bgff := * rp . _bace . Outline . ValAttr ; _gebc . Outline . ValAttr = & _bgff ; } ; } ; if rp . _bace . Shadow != nil { _gebc . Shadow = & _gdb . CT_OnOff { } ; if rp . _bace . Shadow . ValAttr != nil { _ddgad := * rp . _bace . Shadow . ValAttr ; _gebc . Shadow . ValAttr = & _ddgad ;
} ; } ; if rp . _bace . Emboss != nil { _gebc . Emboss = & _gdb . CT_OnOff { } ; if rp . _bace . Emboss . ValAttr != nil { _cgaa := * rp . _bace . Emboss . ValAttr ; _gebc . Emboss . ValAttr = & _cgaa ; } ; } ; if rp . _bace . Imprint != nil { _gebc . Imprint = & _gdb . CT_OnOff { } ; if rp . _bace . Imprint . ValAttr != nil { _daef := * rp . _bace . Imprint . ValAttr ;
_gebc . Imprint . ValAttr = & _daef ; } ; } ; if rp . _bace . NoProof != nil { _gebc . NoProof = & _gdb . CT_OnOff { } ; if rp . _bace . NoProof . ValAttr != nil { _ccfg := * rp . _bace . NoProof . ValAttr ; _gebc . NoProof . ValAttr = & _ccfg ; } ; } ; if rp . _bace . SnapToGrid != nil { _gebc . SnapToGrid = & _gdb . CT_OnOff { } ;
if rp . _bace . SnapToGrid . ValAttr != nil { _gcbe := * rp . _bace . SnapToGrid . ValAttr ; _gebc . SnapToGrid . ValAttr = & _gcbe ; } ; } ; if rp . _bace . Vanish != nil { _gebc . Vanish = & _gdb . CT_OnOff { } ; if rp . _bace . Vanish . ValAttr != nil { _fadde := * rp . _bace . Vanish . ValAttr ;
_gebc . Vanish . ValAttr = & _fadde ; } ; } ; if rp . _bace . WebHidden != nil { _gebc . WebHidden = & _gdb . CT_OnOff { } ; if rp . _bace . WebHidden . ValAttr != nil { _gdcc := * rp . _bace . WebHidden . ValAttr ; _gebc . WebHidden . ValAttr = & _gdcc ; } ; } ; if rp . _bace . Color != nil { _gebc . Color = & _gdb . CT_Color { ValAttr : rp . _bace . Color . ValAttr , ThemeColorAttr : rp . _bace . Color . ThemeColorAttr , ThemeTintAttr : rp . _bace . Color . ThemeTintAttr , ThemeShadeAttr : rp . _bace . Color . ThemeShadeAttr } ;
} ; if rp . _bace . Spacing != nil { _gebc . Spacing = & _gdb . CT_SignedTwipsMeasure { ValAttr : rp . _bace . Spacing . ValAttr } ; } ; if rp . _bace . W != nil { _gebc . W = & _gdb . CT_TextScale { ValAttr : rp . _bace . W . ValAttr } ; } ; if rp . _bace . Kern != nil { _gebc . Kern = & _gdb . CT_HpsMeasure { ValAttr : rp . _bace . Kern . ValAttr } ;
} ; if rp . _bace . Position != nil { _gebc . Position = & _gdb . CT_SignedHpsMeasure { ValAttr : rp . _bace . Position . ValAttr } ; } ; if rp . _bace . Sz != nil { _gebc . Sz = & _gdb . CT_HpsMeasure { ValAttr : rp . _bace . Sz . ValAttr } ; } ; if rp . _bace . SzCs != nil { _gebc . SzCs = & _gdb . CT_HpsMeasure { ValAttr : rp . _bace . SzCs . ValAttr } ;
} ; if rp . _bace . Highlight != nil { _gebc . Highlight = & _gdb . CT_Highlight { ValAttr : rp . _bace . Highlight . ValAttr } ; } ; if rp . _bace . U != nil { _gebc . U = & _gdb . CT_Underline { ValAttr : rp . _bace . U . ValAttr , ColorAttr : rp . _bace . U . ColorAttr , ThemeColorAttr : rp . _bace . U . ThemeColorAttr , ThemeTintAttr : rp . _bace . U . ThemeTintAttr , ThemeShadeAttr : rp . _bace . U . ThemeShadeAttr } ;
} ; if rp . _bace . Effect != nil { _gebc . Effect = & _gdb . CT_TextEffect { ValAttr : rp . _bace . Effect . ValAttr } ; } ; if rp . _bace . Bdr != nil { _gebc . Bdr = & _gdb . CT_Border { ValAttr : rp . _bace . Bdr . ValAttr , ColorAttr : rp . _bace . Bdr . ColorAttr , ThemeColorAttr : rp . _bace . Bdr . ThemeColorAttr , ThemeTintAttr : rp . _bace . Bdr . ThemeTintAttr , ThemeShadeAttr : rp . _bace . Bdr . ThemeShadeAttr , SzAttr : rp . _bace . Bdr . SzAttr , SpaceAttr : rp . _bace . Bdr . SpaceAttr , ShadowAttr : rp . _bace . Bdr . ShadowAttr , FrameAttr : rp . _bace . Bdr . FrameAttr } ;
} ; if rp . _bace . Shd != nil { _gebc . Shd = & _gdb . CT_Shd { ValAttr : rp . _bace . Shd . ValAttr , ColorAttr : rp . _bace . Shd . ColorAttr , ThemeColorAttr : rp . _bace . Shd . ThemeColorAttr , ThemeTintAttr : rp . _bace . Shd . ThemeTintAttr , ThemeShadeAttr : rp . _bace . Shd . ThemeShadeAttr , FillAttr : rp . _bace . Shd . FillAttr , ThemeFillAttr : rp . _bace . Shd . ThemeFillAttr , ThemeFillTintAttr : rp . _bace . Shd . ThemeFillTintAttr , ThemeFillShadeAttr : rp . _bace . Shd . ThemeFillShadeAttr } ;
} ; if rp . _bace . FitText != nil { _gebc . FitText = & _gdb . CT_FitText { ValAttr : rp . _bace . FitText . ValAttr , IdAttr : rp . _bace . FitText . IdAttr } ; } ; if rp . _bace . VertAlign != nil { _gebc . VertAlign = & _gdb . CT_VerticalAlignRun { ValAttr : rp . _bace . VertAlign . ValAttr } ;
} ; if rp . _bace . Rtl != nil { _gebc . Rtl = & _gdb . CT_OnOff { ValAttr : rp . _bace . Rtl . ValAttr } ; } ; if rp . _bace . Cs != nil { _gebc . Cs = & _gdb . CT_OnOff { ValAttr : rp . _bace . Cs . ValAttr } ; } ; if rp . _bace . Em != nil { _gebc . Em = & _gdb . CT_Em { ValAttr : rp . _bace . Em . ValAttr } ;
} ; if rp . _bace . Lang != nil { _gebc . Lang = & _gdb . CT_Language { ValAttr : rp . _bace . Lang . ValAttr , EastAsiaAttr : rp . _bace . Lang . EastAsiaAttr , BidiAttr : rp . _bace . Lang . BidiAttr } ; } ; if rp . _bace . EastAsianLayout != nil { _gebc . EastAsianLayout = & _gdb . CT_EastAsianLayout { IdAttr : rp . _bace . EastAsianLayout . IdAttr , CombineAttr : rp . _bace . EastAsianLayout . CombineAttr , CombineBracketsAttr : rp . _bace . EastAsianLayout . CombineBracketsAttr , VertAttr : rp . _bace . EastAsianLayout . VertAttr , VertCompressAttr : rp . _bace . EastAsianLayout . VertCompressAttr } ;
} ; if rp . _bace . SpecVanish != nil { _gebc . SpecVanish = & _gdb . CT_OnOff { ValAttr : rp . _bace . SpecVanish . ValAttr } ; } ; if rp . _bace . OMath != nil { _gebc . OMath = & _gdb . CT_OnOff { ValAttr : rp . _bace . OMath . ValAttr } ; } ; _bfgg . _feebb . RPr = _gebc ; } ; } ; func ( _ggag * Document ) validateTableCells ( ) error { for _ , _gdbda := range _ggag . _dbc . Body . EG_BlockLevelElts { for _ , _cfeg := range _gdbda . EG_ContentBlockContent { for _ , _aee := range _cfeg . Tbl { for _ , _bbcg := range _aee . EG_ContentRowContent { for _ , _aefb := range _bbcg . Tr { _gfga := false ;
for _ , _caga := range _aefb . EG_ContentCellContent { _gcdc := false ; for _ , _gaa := range _caga . Tc { _gfga = true ; for _ , _babd := range _gaa . EG_BlockLevelElts { for _ , _daea := range _babd . EG_ContentBlockContent { if len ( _daea . P ) > 0 { _gcdc = true ; break ; } ;
} ; } ; } ; if ! _gcdc { return _cb . 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 ! _gfga { return _cb . New ( "\u0074\u0061b\u006c\u0065\u0020\u0072\u006f\u0077\u0020\u006d\u0075\u0073\u0074\u0020\u0063\u006f\u006e\u0074\u0061\u0069\u006e\u0020\u0061\u0020ce\u006c\u006c" ) ;
} ; } ; } ; } ; } ; } ; return nil ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetPictureSize set watermark picture size with given width and height.
func ( _gefea * WatermarkPicture ) SetPictureSize ( width , height int64 ) { if _gefea . _adabf != nil { _bfeab := _gefea . GetShapeStyle ( ) ; _bfeab . SetWidth ( float64 ( width ) * _dg . Point ) ; _bfeab . SetHeight ( float64 ( height ) * _dg . Point ) ; _gefea . SetShapeStyle ( _bfeab ) ;
} ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Run is a run of text within a paragraph that shares the same formatting.
type Run struct { _ecda * Document ; _feebb * _gdb . CT_R ; } ;
2023-06-10 07:12:37 +00:00
2024-09-16 09:59:58 +00:00
// Row is a row within a table within a document.
type Row struct { _cebfg * Document ; _begf * _gdb . CT_Row ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SizeValue returns the value of run font size in points.
func ( _dgee RunProperties ) SizeValue ( ) float64 { if _ggge := _dgee . _bace . Sz ; _ggge != nil { _edfde := _ggge . ValAttr ; if _edfde . ST_UnsignedDecimalNumber != nil { return float64 ( * _edfde . ST_UnsignedDecimalNumber ) / 2 ; } ; } ; return 0.0 ; } ; func ( _bbbe * Document ) InsertTableBefore ( relativeTo Paragraph ) Table { return _bbbe . insertTable ( relativeTo , true ) ;
} ;
2023-07-04 11:04:03 +00:00
2024-09-16 09:59:58 +00:00
// PutNodeAfter put node to position after relativeTo.
func ( _cfec * Document ) PutNodeAfter ( relativeTo , node Node ) { _cfec . putNode ( relativeTo , node , false ) } ; func _ggcd ( _efbaf * Document , _aefba [ ] * _gdb . EG_ContentBlockContent , _dgbbd * TableInfo ) [ ] Node { _bebfa := [ ] Node { } ; for _ , _ffeda := range _aefba { if _ccbd := _ffeda . Sdt ;
_ccbd != nil { if _befd := _ccbd . SdtContent ; _befd != nil { _bebfa = append ( _bebfa , _ecbd ( _efbaf , _befd . P , _dgbbd , nil ) ... ) ; } ; } ; _bebfa = append ( _bebfa , _ecbd ( _efbaf , _ffeda . P , _dgbbd , nil ) ... ) ; for _ , _aedgb := range _ffeda . Tbl { _ceaef := Table { _efbaf , _aedgb } ;
_effef , _ := _efbaf . Styles . SearchStyleById ( _ceaef . Style ( ) ) ; _addff := [ ] Node { } ; for _cgff , _fafc := range _aedgb . EG_ContentRowContent { for _ , _fbcg := range _fafc . Tr { for _dgfgb , _ceab := range _fbcg . EG_ContentCellContent { for _ , _fgeg := range _ceab . Tc { _bfbg := & TableInfo { Table : _aedgb , Row : _fbcg , Cell : _fgeg , RowIndex : _cgff , ColIndex : _dgfgb } ;
for _ , _ffdgc := range _fgeg . EG_BlockLevelElts { _addff = append ( _addff , _ggcd ( _efbaf , _ffdgc . EG_ContentBlockContent , _bfbg ) ... ) ; } ; } ; } ; } ; } ; _bebfa = append ( _bebfa , Node { _eabe : _efbaf , _dbca : & _ceaef , Style : _effef , Children : _addff } ) ; } ; } ; return _bebfa ;
} ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetOutline sets the run to outlined text.
func ( _afdg RunProperties ) SetOutline ( b bool ) { if ! b { _afdg . _bace . Outline = nil ; } else { _afdg . _bace . Outline = _gdb . NewCT_OnOff ( ) ; } ; } ;
2023-04-15 17:27:31 +00:00
2024-09-16 09:59:58 +00:00
// Strike returns true if run is striked.
func ( _dface RunProperties ) Strike ( ) bool { return _cefe ( _dface . _bace . Strike ) } ;
2023-09-16 17:56:36 +00:00
2024-09-16 09:59:58 +00:00
// RightToLeft returns true if run text goes from right to left.
func ( _bbea RunProperties ) RightToLeft ( ) bool { return _cefe ( _bbea . _bace . Rtl ) } ; func _adaba ( _gfcg Paragraph ) * _gdb . CT_NumPr { _gfcg . ensurePPr ( ) ; if _gfcg . _gbaee . PPr . NumPr == nil { return nil ; } ; return _gfcg . _gbaee . PPr . NumPr ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Outline returns true if run outline is on.
func ( _bfcf RunProperties ) Outline ( ) bool { return _cefe ( _bfcf . _bace . Outline ) } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Header is a header for a document section.
type Header struct { _ddgg * Document ; _eeee * _gdb . Hdr ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// AddEndnote will create a new endnote and attach it to the Paragraph in the
// location at the end of the previous run (endnotes create their own run within
// the paragraph. The text given to the function is simply a convenience helper,
// paragraphs and runs can always be added to the text of the endnote later.
func ( _bbae Paragraph ) AddEndnote ( text string ) Endnote { var _faabe int64 ; if _bbae . _fdec . HasEndnotes ( ) { for _ , _gcde := range _bbae . _fdec . Endnotes ( ) { if _gcde . id ( ) > _faabe { _faabe = _gcde . id ( ) ; } ; } ; _faabe ++ ; } else { _bbae . _fdec . addEndnotes ( ) ; _faabe = 1 ;
} ; _gfgce := _gdb . NewCT_FtnEdn ( ) ; _fggg := _gdb . NewCT_FtnEdnRef ( ) ; _fggg . IdAttr = _faabe ; _bbae . _fdec . _gde . CT_Endnotes . Endnote = append ( _bbae . _fdec . _gde . CT_Endnotes . Endnote , _gfgce ) ; _fcgg := _bbae . AddRun ( ) ; _bbbc := _fcgg . Properties ( ) ; _bbbc . SetStyle ( _acd ) ;
_fcgg . _feebb . EG_RunInnerContent = [ ] * _gdb . EG_RunInnerContent { _gdb . NewEG_RunInnerContent ( ) } ; _fcgg . _feebb . EG_RunInnerContent [ 0 ] . EndnoteReference = _fggg ; _dedfb := Endnote { _bbae . _fdec , _gfgce } ; _dedfb . _baab . IdAttr = _faabe ; _dedfb . _baab . EG_BlockLevelElts = [ ] * _gdb . EG_BlockLevelElts { _gdb . NewEG_BlockLevelElts ( ) } ;
_fbfdc := _dedfb . AddParagraph ( ) ; _fbfdc . Properties ( ) . SetStyle ( EndnoteTextStyleId ) ; _fbfdc . _gbaee . PPr . RPr = _gdb . NewCT_ParaRPr ( ) ; _ffec := _fbfdc . AddRun ( ) ; _cdead := _ffec . Properties ( ) ; _cdead . SetStyle ( _acd ) ; _ffec . AddEndnoteReference ( ) ; _bcbe := _fbfdc . AddRun ( ) ;
_bcbe . AddText ( "\u0020" ) ; _bcbe = _fbfdc . AddRun ( ) ; _bcbe . AddText ( text ) ; return _dedfb ; } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// Open opens and reads a document from a file (.docx).
func Open ( filename string ) ( * Document , error ) { _ccac , _gdgf := _ag . Open ( filename ) ; if _gdgf != nil { return nil , _gb . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _gdgf ) ; } ; defer _ccac . Close ( ) ;
_bgdc , _gdgf := _ag . Stat ( filename ) ; if _gdgf != nil { return nil , _gb . Errorf ( "e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073" , filename , _gdgf ) ; } ; _ = _bgdc ; return Read ( _ccac , _bgdc . Size ( ) ) ; } ;
2024-07-28 07:48:26 +00:00
2024-09-16 09:59:58 +00:00
// RemoveEndnote removes a endnote from both the paragraph and the document
// the requested endnote must be anchored on the paragraph being referenced.
//
// After each removal, the rest of the endnote ids would be reordered.
func ( _ecbe Paragraph ) RemoveEndnote ( id int64 ) { for _ , _cdfegb := range _ecbe . Runs ( ) { if _fbeg , _caba := _cdfegb . IsEndnote ( ) ; _fbeg { if _caba == id { _ecbe . RemoveRun ( _cdfegb ) ; break ; } ; } ; } ; _ecbe . _fdec . removeEndnote ( id ) ; } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// SetLeft sets the left border to a specified type, color and thickness.
func ( _eebcf TableBorders ) SetLeft ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _eebcf . _gfgae . Left = _gdb . NewCT_Border ( ) ; _beggg ( _eebcf . _gfgae . Left , t , c , thickness ) ; } ; const ( FormFieldTypeUnknown FormFieldType = iota ; FormFieldTypeText ;
FormFieldTypeCheckBox ; FormFieldTypeDropDown ; ) ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// ReplaceTextByRegexp replace text inside node using regexp.
func ( _ddga * Nodes ) ReplaceTextByRegexp ( expr * _d . Regexp , newText string ) { for _ , _cceeb := range _ddga . _gegee { _cceeb . ReplaceTextByRegexp ( expr , newText ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetOffset sets the offset of the image relative to the origin, which by
// default this is the top-left corner of the page. Offset is incompatible with
// SetAlignment, whichever is called last is applied.
func ( _ba AnchoredDrawing ) SetOffset ( x , y _dg . Distance ) { _ba . SetXOffset ( x ) ; _ba . SetYOffset ( y ) } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _bcbb Footnote ) X ( ) * _gdb . CT_FtnEdn { return _bcbb . _eacb } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetVerticalAlignment sets the vertical alignment of content within a table cell.
func ( _bdd CellProperties ) SetVerticalAlignment ( align _gdb . ST_VerticalJc ) { if align == _gdb . ST_VerticalJcUnset { _bdd . _debd . VAlign = nil ; } else { _bdd . _debd . VAlign = _gdb . NewCT_VerticalJc ( ) ; _bdd . _debd . VAlign . ValAttr = align ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// RunProperties returns the run style properties.
func ( _dafe Style ) RunProperties ( ) RunProperties { if _dafe . _gfdb . RPr == nil { _dafe . _gfdb . RPr = _gdb . NewCT_RPr ( ) ; } ; return RunProperties { _dafe . _gfdb . RPr } ; } ;
2024-05-04 18:48:06 +00:00
2024-09-16 09:59:58 +00:00
// RowProperties are the properties for a row within a table
type RowProperties struct { _aggd * _gdb . CT_TrPr } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// AddImage adds an image to the document package, returning a reference that
// can be used to add the image to a run and place it in the document contents.
func ( _gfdfb Header ) AddImage ( i _cc . Image ) ( _cc . ImageRef , error ) { var _aedg _cc . Relationships ; for _feed , _egbc := range _gfdfb . _ddgg . _agfcg { if _egbc == _gfdfb . _eeee { _aedg = _gfdfb . _ddgg . _fgd [ _feed ] ; } ; } ; _afbcb := _cc . MakeImageRef ( i , & _gfdfb . _ddgg . DocBase , _aedg ) ;
if i . Data == nil && i . Path == "" { return _afbcb , _cb . 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 _afbcb , _cb . 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 _afbcb , _cb . 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" ) ; } ; _gfdfb . _ddgg . Images = append ( _gfdfb . _ddgg . Images , _afbcb ) ;
_ddda := _gb . Sprintf ( "\u006d\u0065d\u0069\u0061\u002fi\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073" , len ( _gfdfb . _ddgg . Images ) , i . Format ) ; _gcbd := _aedg . AddRelationship ( _ddda , _f . ImageType ) ; _afbcb . SetRelID ( _gcbd . X ( ) . IdAttr ) ; return _afbcb , nil ;
} ; func _gfgbc ( ) * _eb . Imagedata { _bfbe := _eb . NewImagedata ( ) ; _affa := "\u0072\u0049\u0064\u0031" ; _cade := "\u0057A\u0054\u0045\u0052\u004d\u0041\u0052K" ; _bfbe . IdAttr = & _affa ; _bfbe . TitleAttr = & _cade ; return _bfbe ; } ;
2024-02-17 03:37:07 +00:00
2024-09-16 09:59:58 +00:00
// SetWidthPercent sets the cell to a width percentage.
func ( _agfc CellProperties ) SetWidthPercent ( pct float64 ) { _agfc . _debd . TcW = _gdb . NewCT_TblWidth ( ) ; _agfc . _debd . TcW . TypeAttr = _gdb . ST_TblWidthPct ; _agfc . _debd . TcW . WAttr = & _gdb . ST_MeasurementOrPercent { } ; _agfc . _debd . TcW . WAttr . ST_DecimalNumberOrPercent = & _gdb . ST_DecimalNumberOrPercent { } ;
_agfc . _debd . TcW . WAttr . ST_DecimalNumberOrPercent . ST_UnqualifiedPercentage = _f . Int64 ( int64 ( pct * 50 ) ) ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// RemoveParagraph removes a paragraph from a footer.
func ( _aaabb Header ) RemoveParagraph ( p Paragraph ) { for _ , _fdfd := range _aaabb . _eeee . EG_ContentBlockContent { for _cdgd , _gdcg := range _fdfd . P { if _gdcg == p . _gbaee { copy ( _fdfd . P [ _cdgd : ] , _fdfd . P [ _cdgd + 1 : ] ) ; _fdfd . P = _fdfd . P [ 0 : len ( _fdfd . P ) - 1 ] ;
return ; } ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// TableInfo is used for keep information about a table, a row and a cell where the text is located.
type TableInfo struct { Table * _gdb . CT_Tbl ; Row * _gdb . CT_Row ; Cell * _gdb . CT_Tc ; RowIndex int ; ColIndex int ; } ;
2024-02-17 03:37:07 +00:00
2024-09-16 09:59:58 +00:00
// Caps returns true if paragraph font is capitalized.
func ( _eeedc ParagraphProperties ) Caps ( ) bool { return _cefe ( _eeedc . _egbf . RPr . Caps ) } ;
2024-02-17 03:37:07 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _afec HyperLink ) X ( ) * _gdb . CT_Hyperlink { return _afec . _ffed } ;
2021-01-04 16:11:39 +00:00
2024-09-16 09:59:58 +00:00
// ReplaceText replace the text inside node.
func ( _cafg * Node ) ReplaceText ( oldText , newText string ) { switch _ebaeg := _cafg . X ( ) . ( type ) { case * Paragraph : for _ , _fadg := range _ebaeg . Runs ( ) { for _ , _bfdf := range _fadg . _feebb . EG_RunInnerContent { if _bfdf . T != nil { _cccfc := _bfdf . T . Content ; _cccfc = _ab . ReplaceAll ( _cccfc , oldText , newText ) ;
_bfdf . T . Content = _cccfc ; } ; } ; } ; } ; for _ , _deadg := range _cafg . Children { _deadg . ReplaceText ( oldText , newText ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _dfdbc Style ) X ( ) * _gdb . CT_Style { return _dfdbc . _gfdb } ;
2021-01-04 16:11:39 +00:00
2024-09-16 09:59:58 +00:00
// AddRun adds a run of text to a hyperlink. This is the text that will be linked.
func ( _gfba HyperLink ) AddRun ( ) Run { _bceda := _gdb . NewEG_ContentRunContent ( ) ; _gfba . _ffed . EG_ContentRunContent = append ( _gfba . _ffed . EG_ContentRunContent , _bceda ) ; _becb := _gdb . NewCT_R ( ) ; _bceda . R = _becb ; return Run { _gfba . _cggbd , _becb } ; } ;
// Properties returns the table properties.
func ( _eaddc Table ) Properties ( ) TableProperties { if _eaddc . _afabf . TblPr == nil { _eaddc . _afabf . TblPr = _gdb . NewCT_TblPr ( ) ; } ; return TableProperties { _eaddc . _afabf . TblPr } ; } ;
2020-08-23 14:15:53 +00:00
2024-07-28 07:48:26 +00:00
// X returns the inner wrapped XML type.
2024-09-16 09:59:58 +00:00
func ( _cdcd TableConditionalFormatting ) X ( ) * _gdb . CT_TblStylePr { return _cdcd . _bfcgg } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// FormFields extracts all of the fields from a document. They can then be
// manipulated via the methods on the field and the document saved.
func ( _eeac * Document ) FormFields ( ) [ ] FormField { _ddgd := [ ] FormField { } ; for _ , _cadc := range _eeac . Paragraphs ( ) { _eaeb := _cadc . Runs ( ) ; for _acb , _dfce := range _eaeb { for _ , _bfab := range _dfce . _feebb . EG_RunInnerContent { if _bfab . FldChar == nil || _bfab . FldChar . FfData == nil { continue ;
} ; if _bfab . FldChar . FldCharTypeAttr == _gdb . ST_FldCharTypeBegin { if len ( _bfab . FldChar . FfData . Name ) == 0 || _bfab . FldChar . FfData . Name [ 0 ] . ValAttr == nil { continue ; } ; _eef := FormField { _eebdg : _bfab . FldChar . FfData } ; if _bfab . FldChar . FfData . TextInput != nil { for _geea := _acb + 1 ;
_geea < len ( _eaeb ) - 1 ; _geea ++ { if len ( _eaeb [ _geea ] . _feebb . EG_RunInnerContent ) == 0 { continue ; } ; _faba := _eaeb [ _geea ] . _feebb . EG_RunInnerContent [ 0 ] ; if _faba . FldChar != nil && _faba . FldChar . FldCharTypeAttr == _gdb . ST_FldCharTypeSeparate { if len ( _eaeb [ _geea + 1 ] . _feebb . EG_RunInnerContent ) == 0 { continue ;
} ; if _eaeb [ _geea + 1 ] . _feebb . EG_RunInnerContent [ 0 ] . FldChar == nil { _eef . _eaggc = _eaeb [ _geea + 1 ] . _feebb . EG_RunInnerContent [ 0 ] ; break ; } ; } ; } ; } ; _ddgd = append ( _ddgd , _eef ) ; } ; } ; } ; } ; for _ , _agce := range _eeac . Headers ( ) { for _ , _ecee := range _agce . Paragraphs ( ) { _agcea := _ecee . Runs ( ) ;
for _defga , _fdg := range _agcea { for _ , _gcafb := range _fdg . _feebb . EG_RunInnerContent { if _gcafb . FldChar == nil || _gcafb . FldChar . FfData == nil { continue ; } ; if _gcafb . FldChar . FldCharTypeAttr == _gdb . ST_FldCharTypeBegin { if len ( _gcafb . FldChar . FfData . Name ) == 0 || _gcafb . FldChar . FfData . Name [ 0 ] . ValAttr == nil { continue ;
} ; _beag := FormField { _eebdg : _gcafb . FldChar . FfData } ; if _gcafb . FldChar . FfData . TextInput != nil { for _eaae := _defga + 1 ; _eaae < len ( _agcea ) - 1 ; _eaae ++ { if len ( _agcea [ _eaae ] . _feebb . EG_RunInnerContent ) == 0 { continue ; } ; _cagae := _agcea [ _eaae ] . _feebb . EG_RunInnerContent [ 0 ] ;
if _cagae . FldChar != nil && _cagae . FldChar . FldCharTypeAttr == _gdb . ST_FldCharTypeSeparate { if len ( _agcea [ _eaae + 1 ] . _feebb . EG_RunInnerContent ) == 0 { continue ; } ; if _agcea [ _eaae + 1 ] . _feebb . EG_RunInnerContent [ 0 ] . FldChar == nil { _beag . _eaggc = _agcea [ _eaae + 1 ] . _feebb . EG_RunInnerContent [ 0 ] ;
break ; } ; } ; } ; } ; _ddgd = append ( _ddgd , _beag ) ; } ; } ; } ; } ; } ; for _ , _ffea := range _eeac . Footers ( ) { for _ , _bdbc := range _ffea . Paragraphs ( ) { _gccb := _bdbc . Runs ( ) ; for _abede , _ceef := range _gccb { for _ , _aafa := range _ceef . _feebb . EG_RunInnerContent { if _aafa . FldChar == nil || _aafa . FldChar . FfData == nil { continue ;
} ; if _aafa . FldChar . FldCharTypeAttr == _gdb . ST_FldCharTypeBegin { if len ( _aafa . FldChar . FfData . Name ) == 0 || _aafa . FldChar . FfData . Name [ 0 ] . ValAttr == nil { continue ; } ; _abda := FormField { _eebdg : _aafa . FldChar . FfData } ; if _aafa . FldChar . FfData . TextInput != nil { for _ebfd := _abede + 1 ;
_ebfd < len ( _gccb ) - 1 ; _ebfd ++ { if len ( _gccb [ _ebfd ] . _feebb . EG_RunInnerContent ) == 0 { continue ; } ; _eddb := _gccb [ _ebfd ] . _feebb . EG_RunInnerContent [ 0 ] ; if _eddb . FldChar != nil && _eddb . FldChar . FldCharTypeAttr == _gdb . ST_FldCharTypeSeparate { if len ( _gccb [ _ebfd + 1 ] . _feebb . EG_RunInnerContent ) == 0 { continue ;
} ; if _gccb [ _ebfd + 1 ] . _feebb . EG_RunInnerContent [ 0 ] . FldChar == nil { _abda . _eaggc = _gccb [ _ebfd + 1 ] . _feebb . EG_RunInnerContent [ 0 ] ; break ; } ; } ; } ; } ; _ddgd = append ( _ddgd , _abda ) ; } ; } ; } ; } ; } ; return _ddgd ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetPicture sets the watermark picture.
func ( _cabgc * WatermarkPicture ) SetPicture ( imageRef _cc . ImageRef ) { _abdef := imageRef . RelID ( ) ; _eebb := _cabgc . getShape ( ) ; if _cabgc . _adabf != nil { _ffeag := _cabgc . _adabf . EG_ShapeElements ; if len ( _ffeag ) > 0 && _ffeag [ 0 ] . Imagedata != nil { _ffeag [ 0 ] . Imagedata . IdAttr = & _abdef ;
} ; } else { _aabb := _cabgc . findNode ( _eebb , "\u0069m\u0061\u0067\u0065\u0064\u0061\u0074a" ) ; for _efbfd , _ffgc := range _aabb . Attrs { if _ffgc . Name . Local == "\u0069\u0064" { _aabb . Attrs [ _efbfd ] . Value = _abdef ; } ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// CharacterSpacingValue returns the value of run's characters spacing in twips (1/20 of point).
func ( _dacc RunProperties ) CharacterSpacingValue ( ) int64 { if _dbcf := _dacc . _bace . Spacing ; _dbcf != nil { _aeaeb := _dbcf . ValAttr ; if _aeaeb . Int64 != nil { return * _aeaeb . Int64 ; } ; } ; return int64 ( 0 ) ; } ; func ( _ceb * Document ) reorderFootnote ( ) { _aceg := int64 ( 1 ) ;
_gbf := map [ int64 ] int64 { } ; for _ , _aaab := range _ceb . _bgg . Footnote { switch _aaab . TypeAttr { case _gdb . ST_FtnEdnSeparator : _aaab . IdAttr = - 1 ; break ; case _gdb . ST_FtnEdnContinuationSeparator : _aaab . IdAttr = 0 ; break ; default : _gbf [ _aaab . IdAttr ] = _aceg ;
_aaab . IdAttr = _aceg ; _aceg ++ ; } ; } ; for _ , _fdbc := range _ceb . Paragraphs ( ) { for _ , _bbce := range _fdbc . Runs ( ) { if _dbabf , _debc := _bbce . IsFootnote ( ) ; _dbabf { _bbce . X ( ) . EG_RunInnerContent [ 0 ] . FootnoteReference . IdAttr = _gbf [ _debc ] ; } ; } ; } ; } ; func ( _baf * Document ) InsertTableAfter ( relativeTo Paragraph ) Table { return _baf . insertTable ( relativeTo , false ) ;
} ;
// SetStartIndent controls the start indentation.
func ( _beece ParagraphProperties ) SetStartIndent ( m _dg . Distance ) { if _beece . _egbf . Ind == nil { _beece . _egbf . Ind = _gdb . NewCT_Ind ( ) ; } ; if m == _dg . Zero { _beece . _egbf . Ind . StartAttr = nil ; } else { _beece . _egbf . Ind . StartAttr = & _gdb . ST_SignedTwipsMeasure { } ;
_beece . _egbf . Ind . StartAttr . Int64 = _f . Int64 ( int64 ( m / _dg . Twips ) ) ; } ; } ;
// SetFirstLineIndent controls the indentation of the first line in a paragraph.
func ( _cdaaf Paragraph ) SetFirstLineIndent ( m _dg . Distance ) { _cdaaf . ensurePPr ( ) ; _agcdg := _cdaaf . _gbaee . PPr ; if _agcdg . Ind == nil { _agcdg . Ind = _gdb . NewCT_Ind ( ) ; } ; if m == _dg . Zero { _agcdg . Ind . FirstLineAttr = nil ; } else { _agcdg . Ind . FirstLineAttr = & _de . ST_TwipsMeasure { } ;
_agcdg . Ind . FirstLineAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( m / _dg . Twips ) ) ; } ; } ; func ( _bbgf FormFieldType ) String ( ) string { if _bbgf >= FormFieldType ( len ( _gaaf ) - 1 ) { return _gb . Sprintf ( "\u0046\u006f\u0072\u006d\u0046\u0069\u0065\u006c\u0064\u0054\u0079\u0070e\u0028\u0025\u0064\u0029" , _bbgf ) ;
} ; return _deef [ _gaaf [ _bbgf ] : _gaaf [ _bbgf + 1 ] ] ; } ;
2017-10-03 08:03:24 -05:00
2024-09-16 09:59:58 +00:00
// AddDrawingAnchored adds an anchored (floating) drawing from an ImageRef.
func ( _dcfda Run ) AddDrawingAnchored ( img _cc . ImageRef ) ( AnchoredDrawing , error ) { _fbbc := _dcfda . newIC ( ) ; _fbbc . Drawing = _gdb . NewCT_Drawing ( ) ; _ffecd := _gdb . NewWdAnchor ( ) ; _eafb := AnchoredDrawing { _dcfda . _ecda , _ffecd } ; _ffecd . SimplePosAttr = _f . Bool ( false ) ;
_ffecd . AllowOverlapAttr = true ; _ffecd . CNvGraphicFramePr = _dcb . NewCT_NonVisualGraphicFrameProperties ( ) ; _fbbc . Drawing . Anchor = append ( _fbbc . Drawing . Anchor , _ffecd ) ; _ffecd . Graphic = _dcb . NewGraphic ( ) ; _ffecd . Graphic . GraphicData = _dcb . NewCT_GraphicalObjectData ( ) ;
_ffecd . 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" ;
_ffecd . SimplePos . XAttr . ST_CoordinateUnqualified = _f . Int64 ( 0 ) ; _ffecd . SimplePos . YAttr . ST_CoordinateUnqualified = _f . Int64 ( 0 ) ; _ffecd . PositionH . RelativeFromAttr = _gdb . WdST_RelFromHPage ; _ffecd . PositionH . Choice = & _gdb . WdCT_PosHChoice { } ; _ffecd . PositionH . Choice . PosOffset = _f . Int32 ( 0 ) ;
_ffecd . PositionV . RelativeFromAttr = _gdb . WdST_RelFromVPage ; _ffecd . PositionV . Choice = & _gdb . WdCT_PosVChoice { } ; _ffecd . PositionV . Choice . PosOffset = _f . Int32 ( 0 ) ; _ffecd . Extent . CxAttr = int64 ( float64 ( img . Size ( ) . X * _dg . Pixel72 ) / _dg . EMU ) ; _ffecd . Extent . CyAttr = int64 ( float64 ( img . Size ( ) . Y * _dg . Pixel72 ) / _dg . EMU ) ;
_ffecd . Choice = & _gdb . WdEG_WrapTypeChoice { } ; _ffecd . Choice . WrapSquare = _gdb . NewWdCT_WrapSquare ( ) ; _ffecd . Choice . WrapSquare . WrapTextAttr = _gdb . WdST_WrapTextBothSides ; _bade := 0x7FFFFFFF & _b . Uint32 ( ) ; _ffecd . DocPr . IdAttr = _bade ; _cdecc := _ef . NewPic ( ) ;
_cdecc . NvPicPr . CNvPr . IdAttr = _bade ; _geffc := img . RelID ( ) ; if _geffc == "" { return _eafb , _cb . 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" ) ;
} ; _ffecd . Graphic . GraphicData . Any = append ( _ffecd . Graphic . GraphicData . Any , _cdecc ) ; _cdecc . BlipFill = _dcb . NewCT_BlipFillProperties ( ) ; _cdecc . BlipFill . Blip = _dcb . NewCT_Blip ( ) ; _cdecc . BlipFill . Blip . EmbedAttr = & _geffc ; _cdecc . BlipFill . Stretch = _dcb . NewCT_StretchInfoProperties ( ) ;
_cdecc . BlipFill . Stretch . FillRect = _dcb . NewCT_RelativeRect ( ) ; _cdecc . SpPr = _dcb . NewCT_ShapeProperties ( ) ; _cdecc . SpPr . Xfrm = _dcb . NewCT_Transform2D ( ) ; _cdecc . SpPr . Xfrm . Off = _dcb . NewCT_Point2D ( ) ; _cdecc . SpPr . Xfrm . Off . XAttr . ST_CoordinateUnqualified = _f . Int64 ( 0 ) ;
_cdecc . SpPr . Xfrm . Off . YAttr . ST_CoordinateUnqualified = _f . Int64 ( 0 ) ; _cdecc . SpPr . Xfrm . Ext = _dcb . NewCT_PositiveSize2D ( ) ; _cdecc . SpPr . Xfrm . Ext . CxAttr = int64 ( img . Size ( ) . X * _dg . Point ) ; _cdecc . SpPr . Xfrm . Ext . CyAttr = int64 ( img . Size ( ) . Y * _dg . Point ) ;
_cdecc . SpPr . PrstGeom = _dcb . NewCT_PresetGeometry2D ( ) ; _cdecc . SpPr . PrstGeom . PrstAttr = _dcb . ST_ShapeTypeRect ; return _eafb , nil ; } ;
2017-08-30 21:00:24 -05:00
2024-09-16 09:59:58 +00:00
// AddHeader creates a header associated with the document, but doesn't add it
// to the document for display.
func ( _bcd * Document ) AddHeader ( ) Header { _gdc := _gdb . NewHdr ( ) ; _bcd . _agfcg = append ( _bcd . _agfcg , _gdc ) ; _fec := _gb . Sprintf ( "\u0068\u0065\u0061d\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c" , len ( _bcd . _agfcg ) ) ; _bcd . _aed . AddRelationship ( _fec , _f . HeaderType ) ;
_bcd . ContentTypes . AddOverride ( "\u002f\u0077\u006f\u0072\u0064\u002f" + _fec , "\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" ) ;
_bcd . _fgd = append ( _bcd . _fgd , _cc . NewRelationships ( ) ) ; return Header { _bcd , _gdc } ; } ;
2022-06-27 19:44:23 +00:00
2024-09-16 09:59:58 +00:00
// AddCheckBox adds checkbox form field to the paragraph and returns it.
func ( _ggbg Paragraph ) AddCheckBox ( name string ) FormField { _faec := _ggbg . addFldCharsForField ( name , "\u0046\u004f\u0052M\u0043\u0048\u0045\u0043\u004b\u0042\u004f\u0058" ) ; _faec . _eebdg . CheckBox = _gdb . NewCT_FFCheckBox ( ) ; return _faec ; } ; func ( _becg * WatermarkPicture ) getInnerElement ( _acgdf string ) * _f . XSDAny { for _ , _dbbg := range _becg . _gfaa . Any { _dfeaa , _bagae := _dbbg . ( * _f . XSDAny ) ;
if _bagae && ( _dfeaa . XMLName . Local == _acgdf || _dfeaa . XMLName . Local == "\u0076\u003a" + _acgdf ) { return _dfeaa ; } ; } ; return nil ; } ;
2017-09-01 18:42:02 -05:00
2024-09-16 09:59:58 +00:00
// SetName marks sets a name attribute for a FormField.
func ( _cgegc FormField ) SetName ( name string ) { _acfc := _gdb . NewCT_FFName ( ) ; _acfc . ValAttr = & name ; _cgegc . _eebdg . Name = [ ] * _gdb . CT_FFName { _acfc } ; } ; func ( _fdaf * Document ) reorderEndnote ( ) { _cgg := int64 ( 1 ) ; _gfddc := map [ int64 ] int64 { } ; for _ , _bddd := range _fdaf . _gde . Endnote { switch _bddd . TypeAttr { case _gdb . ST_FtnEdnSeparator : _bddd . IdAttr = - 1 ;
break ; case _gdb . ST_FtnEdnContinuationSeparator : _bddd . IdAttr = 0 ; break ; default : _gfddc [ _bddd . IdAttr ] = _cgg ; _bddd . IdAttr = _cgg ; _cgg ++ ; } ; } ; for _ , _dceg := range _fdaf . Paragraphs ( ) { for _ , _ecga := range _dceg . Runs ( ) { if _dbeea , _dggcg := _ecga . IsEndnote ( ) ;
_dbeea { _ecga . X ( ) . EG_RunInnerContent [ 0 ] . EndnoteReference . IdAttr = _gfddc [ _dggcg ] ; } ; } ; } ; } ;
2020-08-31 22:58:25 +00:00
2024-09-16 09:59:58 +00:00
// Clear clears the styes.
func ( _gdccc Styles ) Clear ( ) { _gdccc . _cadcge . DocDefaults = nil ; _gdccc . _cadcge . LatentStyles = nil ; _gdccc . _cadcge . Style = nil ; } ;
2017-10-10 12:40:02 -05:00
2024-09-16 09:59:58 +00:00
// SetEffect sets a text effect on the run.
func ( _aafda RunProperties ) SetEffect ( e _gdb . ST_TextEffect ) { if e == _gdb . ST_TextEffectUnset { _aafda . _bace . Effect = nil ; } else { _aafda . _bace . Effect = _gdb . NewCT_TextEffect ( ) ; _aafda . _bace . Effect . ValAttr = e ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetPageMargins sets the page margins for a section
func ( _abga Section ) SetPageMargins ( top , right , bottom , left , header , footer , gutter _dg . Distance ) { _deedc := _gdb . NewCT_PageMar ( ) ; _deedc . TopAttr . Int64 = _f . Int64 ( int64 ( top / _dg . Twips ) ) ; _deedc . BottomAttr . Int64 = _f . Int64 ( int64 ( bottom / _dg . Twips ) ) ;
_deedc . RightAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( right / _dg . Twips ) ) ; _deedc . LeftAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( left / _dg . Twips ) ) ; _deedc . HeaderAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( header / _dg . Twips ) ) ;
_deedc . FooterAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( footer / _dg . Twips ) ) ; _deedc . GutterAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( gutter / _dg . Twips ) ) ; _abga . _bcgc . PgMar = _deedc ; } ;
2020-08-23 14:15:53 +00:00
2024-07-28 07:48:26 +00:00
// X returns the inner wrapped XML type.
2024-09-16 09:59:58 +00:00
func ( _feffg NumberingDefinition ) X ( ) * _gdb . CT_AbstractNum { return _feffg . _gged } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// ReplaceText replace text inside node.
func ( _aebc * Nodes ) ReplaceText ( oldText , newText string ) { for _ , _addde := range _aebc . _gegee { _addde . ReplaceText ( oldText , newText ) ; } ; } ; func _dage ( _cagfb * _gdb . CT_P , _ddb map [ string ] string ) { for _ , _ffdd := range _cagfb . EG_PContent { for _ , _aacb := range _ffdd . EG_ContentRunContent { if _aacb . R != nil { for _ , _edfc := range _aacb . R . EG_RunInnerContent { _bgga := _edfc . Drawing ;
if _bgga != nil { for _ , _gfgb := range _bgga . Anchor { for _ , _cdcf := range _gfgb . Graphic . GraphicData . Any { switch _dacg := _cdcf . ( type ) { case * _ef . Pic : if _dacg . BlipFill != nil && _dacg . BlipFill . Blip != nil { _gegf ( _dacg . BlipFill . Blip , _ddb ) ; } ; default : } ;
} ; } ; for _ , _agdd := range _bgga . Inline { for _ , _gabaf := range _agdd . Graphic . GraphicData . Any { switch _gagb := _gabaf . ( type ) { case * _ef . Pic : if _gagb . BlipFill != nil && _gagb . BlipFill . Blip != nil { _gegf ( _gagb . BlipFill . Blip , _ddb ) ; } ; default : } ; } ; } ;
} ; } ; } ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// MultiLevelType returns the multilevel type, or ST_MultiLevelTypeUnset if not set.
func ( _cefd NumberingDefinition ) MultiLevelType ( ) _gdb . ST_MultiLevelType { if _cefd . _gged . MultiLevelType != nil { return _cefd . _gged . MultiLevelType . ValAttr ; } else { return _gdb . ST_MultiLevelTypeUnset ; } ; } ; func _fbcb ( ) * _eb . Path { _geed := _eb . NewPath ( ) ;
_geed . ExtrusionokAttr = _de . ST_TrueFalseTrue ; _geed . GradientshapeokAttr = _de . ST_TrueFalseTrue ; _geed . ConnecttypeAttr = _eb . OfcST_ConnectTypeRect ; return _geed ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetBefore sets the spacing that comes before the paragraph.
func ( _ddbf ParagraphSpacing ) SetBefore ( before _dg . Distance ) { _ddbf . _fggcd . BeforeAttr = & _de . ST_TwipsMeasure { } ; _ddbf . _fggcd . BeforeAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( before / _dg . Twips ) ) ; } ;
2021-05-31 16:22:30 +00:00
2024-09-16 09:59:58 +00:00
// DocText is an array of extracted text items which has some methods for representing extracted text.
type DocText struct { Items [ ] TextItem ; _cdbd [ ] listItemInfo ; _eddbf map [ int64 ] map [ int64 ] int64 ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Borders returns the ParagraphBorders for setting-up border on paragraph.
func ( _dbgb Paragraph ) Borders ( ) ParagraphBorders { _dbgb . ensurePPr ( ) ; if _dbgb . _gbaee . PPr . PBdr == nil { _dbgb . _gbaee . PPr . PBdr = _gdb . NewCT_PBdr ( ) ; } ; return ParagraphBorders { _dbgb . _fdec , _dbgb . _gbaee . PPr . PBdr } ; } ;
2019-04-03 03:02:32 -07:00
2024-09-16 09:59:58 +00:00
// SetLeftIndent controls the left indent of the paragraph.
func ( _cbacd ParagraphStyleProperties ) SetLeftIndent ( m _dg . Distance ) { if _cbacd . _cdeed . Ind == nil { _cbacd . _cdeed . Ind = _gdb . NewCT_Ind ( ) ; } ; if m == _dg . Zero { _cbacd . _cdeed . Ind . LeftAttr = nil ; } else { _cbacd . _cdeed . Ind . LeftAttr = & _gdb . ST_SignedTwipsMeasure { } ;
_cbacd . _cdeed . Ind . LeftAttr . Int64 = _f . Int64 ( int64 ( m / _dg . Twips ) ) ; } ; } ;
2020-05-12 19:07:52 +03:00
2024-09-16 09:59:58 +00:00
// DoubleStrike returns true if run is double striked.
func ( _cfbda RunProperties ) DoubleStrike ( ) bool { return _cefe ( _cfbda . _bace . Dstrike ) } ;
2020-06-05 23:38:29 +07:00
2024-09-16 09:59:58 +00:00
// VerticalAlign returns the value of paragraph vertical align.
func ( _aeed ParagraphProperties ) VerticalAlignment ( ) _de . ST_VerticalAlignRun { if _acgg := _aeed . _egbf . RPr . VertAlign ; _acgg != nil { return _acgg . ValAttr ; } ; return 0 ; } ;
2023-09-16 17:56:36 +00:00
2024-09-16 09:59:58 +00:00
// GetImageByRelID returns an ImageRef with the associated relation ID in the
// document.
func ( _ecb * Document ) GetImageByRelID ( relID string ) ( _cc . ImageRef , bool ) { _gbcg := _ecb . _aed . GetTargetByRelId ( relID ) ; _bdaa := "" ; for _ , _egfb := range _ecb . _fgd { if _bdaa != "" { break ; } ; _bdaa = _egfb . GetTargetByRelId ( relID ) ; } ; for _ , _bbfd := range _ecb . Images { if _bbfd . RelID ( ) == relID { return _bbfd , true ;
} ; if _gbcg != "" { _dad := _ab . Replace ( _bbfd . Target ( ) , "\u0077\u006f\u0072d\u002f" , "" , 1 ) ; if _dad == _gbcg { if _bbfd . RelID ( ) == "" { _bbfd . SetRelID ( relID ) ; } ; return _bbfd , true ; } ; } ; if _bdaa != "" { _fbe := _ab . Replace ( _bbfd . Target ( ) , "\u0077\u006f\u0072d\u002f" , "" , 1 ) ;
if _fbe == _bdaa { if _bbfd . RelID ( ) == "" { _bbfd . SetRelID ( relID ) ; } ; return _bbfd , true ; } ; } ; } ; return _cc . ImageRef { } , false ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// AnchorDrawWrapOptions is options to set
// wrapPolygon for wrap text through and tight.
type AnchorDrawWrapOptions struct { _baea bool ; _ace * _dcb . CT_Point2D ; _cde [ ] * _dcb . CT_Point2D ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// Endnote returns the endnote based on the ID; this can be used nicely with
// the run.IsEndnote() functionality.
func ( _bdbe * Document ) Endnote ( id int64 ) Endnote { for _ , _abbcd := range _bdbe . Endnotes ( ) { if _abbcd . id ( ) == id { return _abbcd ; } ; } ; return Endnote { } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// GetDocRelTargetByID returns TargetAttr of document relationship given its IdAttr.
func ( _fdf * Document ) GetDocRelTargetByID ( idAttr string ) string { for _ , _cggf := range _fdf . _aed . X ( ) . Relationship { if _cggf . IdAttr == idAttr { return _cggf . TargetAttr ; } ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetBottom sets the bottom border to a specified type, color and thickness.
func ( _gefd TableBorders ) SetBottom ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _gefd . _gfgae . Bottom = _gdb . NewCT_Border ( ) ; _beggg ( _gefd . _gfgae . Bottom , t , c , thickness ) ; } ;
2020-08-31 22:58:25 +00:00
2024-09-16 09:59:58 +00:00
// SetNextStyle sets the style that the next paragraph will use.
func ( _cgfa Style ) SetNextStyle ( name string ) { if name == "" { _cgfa . _gfdb . Next = nil ; } else { _cgfa . _gfdb . Next = _gdb . NewCT_String ( ) ; _cgfa . _gfdb . Next . ValAttr = name ; } ; } ;
2020-08-31 22:58:25 +00:00
2024-09-16 09:59:58 +00:00
// SetBasedOn sets the style that this style is based on.
func ( _bedfa Style ) SetBasedOn ( name string ) { if name == "" { _bedfa . _gfdb . BasedOn = nil ; } else { _bedfa . _gfdb . BasedOn = _gdb . NewCT_String ( ) ; _bedfa . _gfdb . BasedOn . ValAttr = name ; } ; } ;
2020-08-31 22:58:25 +00:00
2024-09-16 09:59:58 +00:00
// SetSemiHidden controls if the style is hidden in the UI.
func ( _gbgac Style ) SetSemiHidden ( b bool ) { if b { _gbgac . _gfdb . SemiHidden = _gdb . NewCT_OnOff ( ) ; } else { _gbgac . _gfdb . SemiHidden = nil ; } ; } ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// GetTargetByRelId returns a target path with the associated relation ID in the
// document.
func ( _edbf * Document ) GetTargetByRelId ( idAttr string ) string { return _edbf . _aed . GetTargetByRelId ( idAttr ) ; } ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// GetShapeStyle returns string style of the shape in watermark and format it to ShapeStyle.
func ( _gcgf * WatermarkPicture ) GetShapeStyle ( ) _gg . ShapeStyle { if _gcgf . _adabf != nil && _gcgf . _adabf . StyleAttr != nil { return _gg . NewShapeStyle ( * _gcgf . _adabf . StyleAttr ) ; } ; return _gg . NewShapeStyle ( "" ) ; } ;
2021-08-23 20:44:48 +00:00
2024-09-16 09:59:58 +00:00
// SetNumberingDefinition sets the numbering definition ID via a NumberingDefinition
// defined in numbering.xml
func ( _gggbc Paragraph ) SetNumberingDefinition ( nd NumberingDefinition ) { _gggbc . ensurePPr ( ) ; if _gggbc . _gbaee . PPr . NumPr == nil { _gggbc . _gbaee . PPr . NumPr = _gdb . NewCT_NumPr ( ) ; } ; _fddee := _gdb . NewCT_DecimalNumber ( ) ; _cbgfd := int64 ( - 1 ) ; for _ , _ddfbf := range _gggbc . _fdec . Numbering . _cgbg . Num { if _ddfbf . AbstractNumId != nil && _ddfbf . AbstractNumId . ValAttr == nd . AbstractNumberID ( ) { _cbgfd = _ddfbf . NumIdAttr ;
} ; } ; if _cbgfd == - 1 { _fgca := _gdb . NewCT_Num ( ) ; _gggbc . _fdec . Numbering . _cgbg . Num = append ( _gggbc . _fdec . Numbering . _cgbg . Num , _fgca ) ; _fgca . NumIdAttr = int64 ( len ( _gggbc . _fdec . Numbering . _cgbg . Num ) ) ; _fgca . AbstractNumId = _gdb . NewCT_DecimalNumber ( ) ;
_fgca . AbstractNumId . ValAttr = nd . AbstractNumberID ( ) ; _cbgfd = _fgca . NumIdAttr ; } ; _fddee . ValAttr = _cbgfd ; _gggbc . _gbaee . PPr . NumPr . NumId = _fddee ; } ;
2023-12-12 23:20:29 +00:00
2024-09-16 09:59:58 +00:00
// ParagraphProperties are the properties for a paragraph.
type ParagraphProperties struct { _gddf * Document ; _egbf * _gdb . CT_PPr ; } ;
2023-12-12 23:20:29 +00:00
2024-09-16 09:59:58 +00:00
// SetTargetBookmark sets the bookmark target of the hyperlink.
func ( _afbg HyperLink ) SetTargetBookmark ( bm Bookmark ) { _afbg . _ffed . AnchorAttr = _f . String ( bm . Name ( ) ) ; _afbg . _ffed . IdAttr = nil ; } ;
2023-12-12 23:20:29 +00:00
2024-09-16 09:59:58 +00:00
// InitializeDefault constructs a default numbering.
func ( _ceag Numbering ) InitializeDefault ( ) { _afcee := _gdb . NewCT_AbstractNum ( ) ; _afcee . MultiLevelType = _gdb . NewCT_MultiLevelType ( ) ; _afcee . MultiLevelType . ValAttr = _gdb . ST_MultiLevelTypeHybridMultilevel ; _ceag . _cgbg . AbstractNum = append ( _ceag . _cgbg . AbstractNum , _afcee ) ;
_afcee . AbstractNumIdAttr = 1 ; const _cgcd = 720 ; const _gabcg = 720 ; const _aadf = 360 ; for _cfad := 0 ; _cfad < 9 ; _cfad ++ { _efaec := _gdb . NewCT_Lvl ( ) ; _efaec . IlvlAttr = int64 ( _cfad ) ; _efaec . Start = _gdb . NewCT_DecimalNumber ( ) ; _efaec . Start . ValAttr = 1 ; _efaec . NumFmt = _gdb . NewCT_NumFmt ( ) ;
_efaec . NumFmt . ValAttr = _gdb . ST_NumberFormatBullet ; _efaec . Suff = _gdb . NewCT_LevelSuffix ( ) ; _efaec . Suff . ValAttr = _gdb . ST_LevelSuffixNothing ; _efaec . LvlText = _gdb . NewCT_LevelText ( ) ; _efaec . LvlText . ValAttr = _f . String ( "\uf0b7" ) ; _efaec . LvlJc = _gdb . NewCT_Jc ( ) ;
_efaec . LvlJc . ValAttr = _gdb . ST_JcLeft ; _efaec . RPr = _gdb . NewCT_RPr ( ) ; _efaec . RPr . RFonts = _gdb . NewCT_Fonts ( ) ; _efaec . RPr . RFonts . AsciiAttr = _f . String ( "\u0053\u0079\u006d\u0062\u006f\u006c" ) ; _efaec . RPr . RFonts . HAnsiAttr = _f . String ( "\u0053\u0079\u006d\u0062\u006f\u006c" ) ;
_efaec . RPr . RFonts . HintAttr = _gdb . ST_HintDefault ; _efaec . PPr = _gdb . NewCT_PPrGeneral ( ) ; _ecbcg := int64 ( _cfad * _gabcg + _cgcd ) ; _efaec . PPr . Ind = _gdb . NewCT_Ind ( ) ; _efaec . PPr . Ind . LeftAttr = & _gdb . ST_SignedTwipsMeasure { } ; _efaec . PPr . Ind . LeftAttr . Int64 = _f . Int64 ( _ecbcg ) ;
_efaec . PPr . Ind . HangingAttr = & _de . ST_TwipsMeasure { } ; _efaec . PPr . Ind . HangingAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( _aadf ) ) ; _afcee . Lvl = append ( _afcee . Lvl , _efaec ) ; } ; _fafaf := _gdb . NewCT_Num ( ) ; _fafaf . NumIdAttr = 1 ; _fafaf . AbstractNumId = _gdb . NewCT_DecimalNumber ( ) ;
_fafaf . AbstractNumId . ValAttr = 1 ; _ceag . _cgbg . Num = append ( _ceag . _cgbg . Num , _fafaf ) ; } ;
2023-12-12 23:20:29 +00:00
2024-09-16 09:59:58 +00:00
// Bold returns true if run font is bold.
func ( _agbda RunProperties ) Bold ( ) bool { _cgcb := _agbda . _bace ; return _cefe ( _cgcb . B ) || _cefe ( _cgcb . BCs ) ; } ;
// Paragraphs returns the paragraphs defined in the cell.
func ( _fab Cell ) Paragraphs ( ) [ ] Paragraph { _gf := [ ] Paragraph { } ; for _ , _gag := range _fab . _dbf . EG_BlockLevelElts { for _ , _cad := range _gag . EG_ContentBlockContent { for _ , _fdb := range _cad . P { _gf = append ( _gf , Paragraph { _fab . _age , _fdb } ) ; } ; } ; } ; return _gf ;
2024-07-28 07:48:26 +00:00
} ;
2023-12-12 23:20:29 +00:00
2024-09-16 09:59:58 +00:00
// Properties returns the row properties.
func ( _edgc Row ) Properties ( ) RowProperties { if _edgc . _begf . TrPr == nil { _edgc . _begf . TrPr = _gdb . NewCT_TrPr ( ) ; } ; return RowProperties { _edgc . _begf . TrPr } ; } ;
2023-12-12 23:20:29 +00:00
2024-09-16 09:59:58 +00:00
// SetColumnSpan sets the number of Grid Columns Spanned by the Cell. This is used
// to give the appearance of merged cells.
func ( _ff CellProperties ) SetColumnSpan ( cols int ) { if cols == 0 { _ff . _debd . GridSpan = nil ; } else { _ff . _debd . GridSpan = _gdb . NewCT_DecimalNumber ( ) ; _ff . _debd . GridSpan . ValAttr = int64 ( cols ) ; } ; } ;
2023-12-12 23:20:29 +00:00
2024-09-16 09:59:58 +00:00
// TableConditionalFormatting controls the conditional formatting within a table
// style.
type TableConditionalFormatting struct { _bfcgg * _gdb . CT_TblStylePr } ;
2023-12-12 23:20:29 +00:00
2024-09-16 09:59:58 +00:00
// SetBottom sets the bottom border to a specified type, color and thickness.
func ( _adba ParagraphBorders ) SetBottom ( t _gdb . ST_Border , c _gbc . Color , thickness _dg . Distance ) { _adba . _ecade . Bottom = _gdb . NewCT_Border ( ) ; _fada ( _adba . _ecade . Bottom , t , c , thickness ) ; } ;
2021-07-30 17:03:26 +00:00
2024-09-16 09:59:58 +00:00
// AddTab adds tab to a run and can be used with the the Paragraph's tab stops.
func ( _bfgb Run ) AddTab ( ) { _cfece := _bfgb . newIC ( ) ; _cfece . Tab = _gdb . NewCT_Empty ( ) } ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// SetPictureWashout set washout to watermark picture.
func ( _dgggf * WatermarkPicture ) SetPictureWashout ( isWashout bool ) { if _dgggf . _adabf != nil { _dedda := _dgggf . _adabf . EG_ShapeElements ; if len ( _dedda ) > 0 && _dedda [ 0 ] . Imagedata != nil { if isWashout { _ccfdf := "\u0031\u0039\u0036\u0036\u0031\u0066" ; _adad := "\u0032\u0032\u0039\u0033\u0038\u0066" ;
_dedda [ 0 ] . Imagedata . GainAttr = & _ccfdf ; _dedda [ 0 ] . Imagedata . BlacklevelAttr = & _adad ; } ; } ; } ; } ;
2023-04-15 17:27:31 +00:00
2024-09-16 09:59:58 +00:00
// SetASCIITheme sets the font ASCII Theme.
func ( _egeb Fonts ) SetASCIITheme ( t _gdb . ST_Theme ) { _egeb . _cfeaa . AsciiThemeAttr = t } ;
2023-04-15 17:27:31 +00:00
2024-09-16 09:59:58 +00:00
// Color returns the style's Color.
func ( _aagf RunProperties ) Color ( ) Color { if _aagf . _bace . Color == nil { _aagf . _bace . Color = _gdb . NewCT_Color ( ) ; } ; return Color { _aagf . _bace . Color } ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// IsBold returns true if the run has been set to bold.
func ( _ggbac RunProperties ) IsBold ( ) bool { return _ggbac . BoldValue ( ) == OnOffValueOn } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// RemoveParagraph removes a paragraph from a footer.
func ( _ddcbf Footer ) RemoveParagraph ( p Paragraph ) { for _ , _gbdba := range _ddcbf . _dbdg . EG_ContentBlockContent { for _cceb , _bcfe := range _gbdba . P { if _bcfe == p . _gbaee { copy ( _gbdba . P [ _cceb : ] , _gbdba . P [ _cceb + 1 : ] ) ; _gbdba . P = _gbdba . P [ 0 : len ( _gbdba . P ) - 1 ] ;
return ; } ; } ; } ; } ; func ( _egbd * WatermarkText ) getInnerElement ( _dafd string ) * _f . XSDAny { for _ , _gbeea := range _egbd . _aabdf . Any { _bfbgb , _acge := _gbeea . ( * _f . XSDAny ) ; if _acge && ( _bfbgb . XMLName . Local == _dafd || _bfbgb . XMLName . Local == "\u0076\u003a" + _dafd ) { return _bfbgb ;
} ; } ; return nil ; } ; func ( _aeecf Run ) newIC ( ) * _gdb . EG_RunInnerContent { _bfbc := _gdb . NewEG_RunInnerContent ( ) ; _aeecf . _feebb . EG_RunInnerContent = append ( _aeecf . _feebb . EG_RunInnerContent , _bfbc ) ; return _bfbc ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// Borders allows manipulation of the table borders.
func ( _dcdc TableProperties ) Borders ( ) TableBorders { if _dcdc . _affd . TblBorders == nil { _dcdc . _affd . TblBorders = _gdb . NewCT_TblBorders ( ) ; } ; return TableBorders { _dcdc . _affd . TblBorders } ; } ;
2023-04-15 17:27:31 +00:00
2024-09-16 09:59:58 +00:00
// Footnote returns the footnote based on the ID; this can be used nicely with
// the run.IsFootnote() functionality.
func ( _dae * Document ) Footnote ( id int64 ) Footnote { for _ , _daga := range _dae . Footnotes ( ) { if _daga . id ( ) == id { return _daga ; } ; } ; return Footnote { } ; } ;
2023-04-15 17:27:31 +00:00
2024-09-16 09:59:58 +00:00
// SetKeepOnOnePage controls if all lines in a paragraph are kept on the same
// page.
func ( _eaaec ParagraphStyleProperties ) SetKeepOnOnePage ( b bool ) { if ! b { _eaaec . _cdeed . KeepLines = nil ; } else { _eaaec . _cdeed . KeepLines = _gdb . NewCT_OnOff ( ) ; } ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// SetAfterSpacing sets spacing below paragraph.
func ( _fafba Paragraph ) SetAfterSpacing ( d _dg . Distance ) { _fafba . ensurePPr ( ) ; if _fafba . _gbaee . PPr . Spacing == nil { _fafba . _gbaee . PPr . Spacing = _gdb . NewCT_Spacing ( ) ; } ; _ecbca := _fafba . _gbaee . PPr . Spacing ; _ecbca . AfterAttr = & _de . ST_TwipsMeasure { } ;
_ecbca . AfterAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( d / _dg . Twips ) ) ; } ;
2020-08-23 14:15:53 +00:00
2024-09-16 09:59:58 +00:00
// ItalicValue returns the precise nature of the italic setting (unset, off or on).
func ( _afda RunProperties ) ItalicValue ( ) OnOffValue { return _egbb ( _afda . _bace . I ) } ;
2023-05-26 09:49:04 +00:00
2024-09-16 09:59:58 +00:00
// Italic returns true if run font is italic.
func ( _ecagc RunProperties ) Italic ( ) bool { _ggec := _ecagc . _bace ; return _cefe ( _ggec . I ) || _cefe ( _ggec . ICs ) ; } ;
2020-08-31 22:58:25 +00:00
2024-09-16 09:59:58 +00:00
// CellMargins are the margins for an individual cell.
type CellMargins struct { _cf * _gdb . CT_TcMar } ;
2021-03-16 20:51:18 +00:00
2024-09-16 09:59:58 +00:00
// Cell is a table cell within a document (not a spreadsheet)
type Cell struct { _age * Document ; _dbf * _gdb . CT_Tc ; } ; func ( _aege Paragraph ) addEndFldChar ( ) * _gdb . CT_FldChar { _aeec := _aege . addFldChar ( ) ; _aeec . FldCharTypeAttr = _gdb . ST_FldCharTypeEnd ; return _aeec ; } ;
2021-03-16 20:51:18 +00:00
2024-09-16 09:59:58 +00:00
// AnchoredDrawing is an absolutely positioned image within a document page.
type AnchoredDrawing struct { _aa * Document ; _bc * _gdb . WdAnchor ; } ;
2021-06-16 07:10:52 +00:00
2024-09-16 09:59:58 +00:00
// SetRowBandSize sets the number of Rows in the row band
func ( _agage TableStyleProperties ) SetRowBandSize ( rows int64 ) { _agage . _addgf . TblStyleRowBandSize = _gdb . NewCT_DecimalNumber ( ) ; _agage . _addgf . TblStyleRowBandSize . ValAttr = rows ; } ;
2021-07-30 17:03:26 +00:00
2024-09-16 09:59:58 +00:00
// Clear content of node element.
func ( _ceadd * Node ) Clear ( ) { _ceadd . _dbca = nil } ;
2021-07-30 17:03:26 +00:00
2024-09-16 09:59:58 +00:00
// FindNodeByStyleId return slice of node base on style id.
func ( _ccfd * Nodes ) FindNodeByStyleId ( styleId string ) [ ] Node { _dfde := [ ] Node { } ; for _ , _decbe := range _ccfd . _gegee { switch _fdfdf := _decbe . _dbca . ( type ) { case * Paragraph : if _fdfdf != nil && _fdfdf . Style ( ) == styleId { _dfde = append ( _dfde , _decbe ) ; } ;
case * Table : if _fdfdf != nil && _fdfdf . Style ( ) == styleId { _dfde = append ( _dfde , _decbe ) ; } ; } ; _eafae := Nodes { _gegee : _decbe . Children } ; _dfde = append ( _dfde , _eafae . FindNodeByStyleId ( styleId ) ... ) ; } ; return _dfde ; } ; func ( _edad * WatermarkText ) findNode ( _beaae * _f . XSDAny , _dbceb string ) * _f . XSDAny { for _ , _efaa := range _beaae . Nodes { if _efaa . XMLName . Local == _dbceb { return _efaa ;
} ; } ; return nil ; } ; func _edfbb ( ) * _eb . Textpath { _afbad := _eb . NewTextpath ( ) ; _fdbde := "\u0066\u006f\u006e\u0074\u002d\u0066\u0061\u006d\u0069l\u0079\u003a\u0022\u0043\u0061\u006c\u0069\u0062\u0072\u0069\u0022\u003b\u0066\u006f\u006e\u0074\u002d\u0073\u0069\u007a\u0065\u003a\u00366\u0070\u0074;\u0066\u006fn\u0074\u002d\u0077\u0065\u0069\u0067\u0068\u0074\u003a\u0062\u006f\u006c\u0064;f\u006f\u006e\u0074\u002d\u0073\u0074\u0079\u006c\u0065:\u0069\u0074\u0061\u006c\u0069\u0063" ;
_afbad . StyleAttr = & _fdbde ; _bbded := "\u0041\u0053\u0041\u0050" ; _afbad . StringAttr = & _bbded ; return _afbad ; } ;
2021-07-30 17:03:26 +00:00
2024-09-16 09:59:58 +00:00
// SetBottomPct sets the cell bottom margin
func ( _gab CellMargins ) SetBottomPct ( pct float64 ) { _gab . _cf . Bottom = _gdb . NewCT_TblWidth ( ) ; _cca ( _gab . _cf . Bottom , pct ) ; } ; func ( _bde * chart ) X ( ) * _gbd . ChartSpace { return _bde . _ffd } ;
2021-08-23 20:44:48 +00:00
2024-09-16 09:59:58 +00:00
// Clear removes all of the content from within a run.
func ( _cbddd Run ) Clear ( ) { _cbddd . _feebb . EG_RunInnerContent = nil } ;
2021-08-23 20:44:48 +00:00
2024-09-16 09:59:58 +00:00
// SetYOffset sets the Y offset for an image relative to the origin.
func ( _gdg AnchoredDrawing ) SetYOffset ( y _dg . Distance ) { _gdg . _bc . PositionV . Choice = & _gdb . WdCT_PosVChoice { } ; _gdg . _bc . PositionV . Choice . PosOffset = _f . Int32 ( int32 ( y / _dg . EMU ) ) ; } ; func _acdca ( ) * _eb . Formulas { _ffega := _eb . NewFormulas ( ) ; _ffega . F = [ ] * _eb . CT_F { _gg . CreateFormula ( "\u0073\u0075\u006d\u0020\u0023\u0030\u0020\u0030\u00201\u0030\u0038\u0030\u0030" ) , _gg . CreateFormula ( "p\u0072\u006f\u0064\u0020\u0023\u0030\u0020\u0032\u0020\u0031" ) , _gg . CreateFormula ( "\u0073\u0075\u006d\u0020\u0032\u0031\u0036\u0030\u0030 \u0030\u0020\u0040\u0031" ) , _gg . CreateFormula ( "\u0073\u0075\u006d\u0020\u0030\u0020\u0030\u0020\u0040\u0032" ) , _gg . CreateFormula ( "\u0073\u0075\u006d\u0020\u0032\u0031\u0036\u0030\u0030 \u0030\u0020\u0040\u0033" ) , _gg . CreateFormula ( "\u0069\u0066\u0020\u0040\u0030\u0020\u0040\u0033\u0020\u0030" ) , _gg . CreateFormula ( "\u0069\u0066\u0020\u0040\u0030\u0020\u0032\u0031\u00360\u0030\u0020\u0040\u0031" ) , _gg . CreateFormula ( "\u0069\u0066\u0020\u0040\u0030\u0020\u0030\u0020\u0040\u0032" ) , _gg . CreateFormula ( "\u0069\u0066\u0020\u0040\u0030\u0020\u0040\u0034\u00202\u0031\u0036\u0030\u0030" ) , _gg . CreateFormula ( "\u006di\u0064\u0020\u0040\u0035\u0020\u00406" ) , _gg . CreateFormula ( "\u006di\u0064\u0020\u0040\u0038\u0020\u00405" ) , _gg . CreateFormula ( "\u006di\u0064\u0020\u0040\u0037\u0020\u00408" ) , _gg . CreateFormula ( "\u006di\u0064\u0020\u0040\u0036\u0020\u00407" ) , _gg . CreateFormula ( "s\u0075\u006d\u0020\u0040\u0036\u0020\u0030\u0020\u0040\u0035" ) } ;
return _ffega ; } ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// StyleID returns the style ID.
func ( _caec Style ) StyleID ( ) string { if _caec . _gfdb . StyleIdAttr == nil { return "" ; } ; return * _caec . _gfdb . StyleIdAttr ; } ;
2024-05-04 18:48:06 +00:00
2024-09-16 09:59:58 +00:00
// GetImageObjByRelId returns a common.Image with the associated relation ID in the
// document.
func ( _dcee * Document ) GetImageObjByRelId ( relId string ) ( _cc . Image , error ) { _ebbe := _dcee . _aed . GetTargetByRelIdAndType ( relId , _f . ImageType ) ; if _ebbe == "" { for _ , _ddfb := range _dcee . _fgd { if _ebbe != "" { break ; } ; _ebbe = _ddfb . GetTargetByRelIdAndType ( relId , _f . ImageType ) ;
} ; } ; if _ebbe == "" { for _ , _dcfe := range _dcee . _gaf { if _ebbe != "" { break ; } ; _ebbe = _dcfe . GetTargetByRelIdAndType ( relId , _f . ImageType ) ; } ; } ; return _dcee . DocBase . GetImageBytesByTarget ( _ebbe ) ; } ;
2024-05-04 18:48:06 +00:00
2024-09-16 09:59:58 +00:00
// InlineDrawing is an inlined image within a run.
type InlineDrawing struct { _ddba * Document ; _eeed * _gdb . WdInline ; } ;
2023-12-12 23:20:29 +00:00
2024-09-16 09:59:58 +00:00
// Bookmarks returns all of the bookmarks defined in the document.
func ( _afcd Document ) Bookmarks ( ) [ ] Bookmark { if _afcd . _dbc . Body == nil { return nil ; } ; _dbcg := [ ] Bookmark { } ; for _ , _adcg := range _afcd . _dbc . Body . EG_BlockLevelElts { for _ , _cbdf := range _adcg . EG_ContentBlockContent { for _ , _gfda := range _fgaa ( _cbdf ) { _dbcg = append ( _dbcg , _gfda ) ;
} ; } ; } ; return _dbcg ; } ;
2023-12-12 23:20:29 +00:00
2024-09-16 09:59:58 +00:00
// SetFirstColumn controls the conditional formatting for the first column in a table.
func ( _ffdad TableLook ) SetFirstColumn ( on bool ) { if ! on { _ffdad . _cdag . FirstColumnAttr = & _de . ST_OnOff { } ; _ffdad . _cdag . FirstColumnAttr . ST_OnOff1 = _de . ST_OnOff1Off ; } else { _ffdad . _cdag . FirstColumnAttr = & _de . ST_OnOff { } ; _ffdad . _cdag . FirstColumnAttr . ST_OnOff1 = _de . ST_OnOff1On ;
} ; } ;
2023-12-12 23:20:29 +00:00
2024-09-16 09:59:58 +00:00
// GetNumberingLevelByIds returns a NumberingLevel by its NumId and LevelId attributes
// or an empty one if not found.
func ( _efeee * Document ) GetNumberingLevelByIds ( numId , levelId int64 ) NumberingLevel { if _efeee . Numbering . _cgbg == nil { return NumberingLevel { } ; } ; for _ , _acad := range _efeee . Numbering . _cgbg . Num { if _acad != nil && _acad . NumIdAttr == numId { _acdcf := _acad . AbstractNumId . ValAttr ;
for _ , _egaae := range _efeee . Numbering . _cgbg . AbstractNum { if _egaae . AbstractNumIdAttr == _acdcf { if _egaae . NumStyleLink != nil && len ( _egaae . Lvl ) == 0 { if _eaaf , _dadf := _efeee . Styles . SearchStyleById ( _egaae . NumStyleLink . ValAttr ) ; _dadf { if _eaaf . ParagraphProperties ( ) . NumId ( ) > - 1 { return _efeee . GetNumberingLevelByIds ( _eaaf . ParagraphProperties ( ) . NumId ( ) , levelId ) ;
} ; } ; } ; for _ , _decb := range _egaae . Lvl { if _decb . IlvlAttr == levelId { return NumberingLevel { _decb } ; } ; } ; } ; } ; } ; } ; return NumberingLevel { } ; } ;
2023-12-12 23:20:29 +00:00
2024-09-16 09:59:58 +00:00
// SetKerning sets the run's font kerning.
func ( _gbbf RunProperties ) SetKerning ( size _dg . Distance ) { _gbbf . _bace . Kern = _gdb . NewCT_HpsMeasure ( ) ; _gbbf . _bace . Kern . ValAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( size / _dg . HalfPoint ) ) ; } ;
2023-12-12 23:20:29 +00:00
2024-09-16 09:59:58 +00:00
// CellBorders are the borders for an individual
type CellBorders struct { _ebf * _gdb . CT_TcBorders } ;
// ParagraphSpacing controls the spacing for a paragraph and its lines.
type ParagraphSpacing struct { _fggcd * _gdb . CT_Spacing } ;
2022-02-05 13:05:36 +00:00
2024-07-28 07:48:26 +00:00
// X returns the inner wrapped XML type.
2024-09-16 09:59:58 +00:00
func ( _cfbfg Styles ) X ( ) * _gdb . Styles { return _cfbfg . _cadcge } ;
2022-04-09 14:27:46 +00:00
2024-09-16 09:59:58 +00:00
// SetLeftPct sets the cell left margin
func ( _gdf CellMargins ) SetLeftPct ( pct float64 ) { _gdf . _cf . Left = _gdb . NewCT_TblWidth ( ) ; _cca ( _gdf . _cf . Left , pct ) ; } ;
2022-04-09 14:27:46 +00:00
2024-09-16 09:59:58 +00:00
// SetStyle sets the table style name.
func ( _fcga TableProperties ) SetStyle ( name string ) { if name == "" { _fcga . _affd . TblStyle = nil ; } else { _fcga . _affd . TblStyle = _gdb . NewCT_String ( ) ; _fcga . _affd . TblStyle . ValAttr = name ; } ; } ; func ( _gead * Document ) onNewRelationship ( _fbgg * _gd . DecodeMap , _adgg , _fffg string , _geeg [ ] * _fa . File , _dbae * _ggd . Relationship , _bcef _gd . Target ) error { _feff := _f . DocTypeDocument ;
switch _fffg { case _f . OfficeDocumentType , _f . OfficeDocumentTypeStrict : _gead . _dbc = _gdb . NewDocument ( ) ; _fbgg . AddTarget ( _adgg , _gead . _dbc , _fffg , 0 ) ; _fbgg . AddTarget ( _gd . RelationsPathFor ( _adgg ) , _gead . _aed . X ( ) , _fffg , 0 ) ; _dbae . TargetAttr = _f . RelativeFilename ( _feff , _bcef . Typ , _fffg , 0 ) ;
case _f . CorePropertiesType : _fbgg . AddTarget ( _adgg , _gead . CoreProperties . X ( ) , _fffg , 0 ) ; _dbae . TargetAttr = _f . RelativeFilename ( _feff , _bcef . Typ , _fffg , 0 ) ; case _f . CorePropertiesAltType : _fbgg . AddTarget ( _adgg , _gead . CoreProperties . X ( ) , _f . CorePropertiesType , 0 ) ;
_dbae . TargetAttr = _f . RelativeFilename ( _feff , _bcef . Typ , _f . CorePropertiesType , 0 ) ; case _f . CustomPropertiesType : _fbgg . AddTarget ( _adgg , _gead . CustomProperties . X ( ) , _fffg , 0 ) ; _dbae . TargetAttr = _f . RelativeFilename ( _feff , _bcef . Typ , _fffg , 0 ) ;
case _f . ExtendedPropertiesType , _f . ExtendedPropertiesTypeStrict : _fbgg . AddTarget ( _adgg , _gead . AppProperties . X ( ) , _fffg , 0 ) ; _dbae . TargetAttr = _f . RelativeFilename ( _feff , _bcef . Typ , _fffg , 0 ) ; case _f . ThumbnailType , _f . ThumbnailTypeStrict : for _bbab , _feg := range _geeg { if _feg == nil { continue ;
} ; if _feg . Name == _adgg { _cdfca , _bgef := _feg . Open ( ) ; if _bgef != nil { return _gb . Errorf ( "e\u0072\u0072\u006f\u0072\u0020\u0072e\u0061\u0064\u0069\u006e\u0067\u0020\u0074\u0068\u0075m\u0062\u006e\u0061i\u006c:\u0020\u0025\u0073" , _bgef ) ; } ; _gead . Thumbnail , _ , _bgef = _bd . Decode ( _cdfca ) ;
_cdfca . Close ( ) ; if _bgef != nil { return _gb . 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" , _bgef ) ; } ; _geeg [ _bbab ] = nil ; } ; } ; case _f . SettingsType , _f . SettingsTypeStrict : _fbgg . AddTarget ( _adgg , _gead . Settings . X ( ) , _fffg , 0 ) ;
_dbae . TargetAttr = _f . RelativeFilename ( _feff , _bcef . Typ , _fffg , 0 ) ; case _f . NumberingType , _f . NumberingTypeStrict : _gead . Numbering = NewNumbering ( ) ; _fbgg . AddTarget ( _adgg , _gead . Numbering . X ( ) , _fffg , 0 ) ; _dbae . TargetAttr = _f . RelativeFilename ( _feff , _bcef . Typ , _fffg , 0 ) ;
case _f . StylesType , _f . StylesTypeStrict : _gead . Styles . Clear ( ) ; _fbgg . AddTarget ( _adgg , _gead . Styles . X ( ) , _fffg , 0 ) ; _dbae . TargetAttr = _f . RelativeFilename ( _feff , _bcef . Typ , _fffg , 0 ) ; case _f . HeaderType , _f . HeaderTypeStrict : _gbbg := _gdb . NewHdr ( ) ;
_fbgg . AddTarget ( _adgg , _gbbg , _fffg , uint32 ( len ( _gead . _agfcg ) ) ) ; _gead . _agfcg = append ( _gead . _agfcg , _gbbg ) ; _dbae . TargetAttr = _f . RelativeFilename ( _feff , _bcef . Typ , _fffg , len ( _gead . _agfcg ) ) ; _fba := _cc . NewRelationships ( ) ; _fbgg . AddTarget ( _gd . RelationsPathFor ( _adgg ) , _fba . X ( ) , _fffg , 0 ) ;
_gead . _fgd = append ( _gead . _fgd , _fba ) ; case _f . FooterType , _f . FooterTypeStrict : _dcc := _gdb . NewFtr ( ) ; _fbgg . AddTarget ( _adgg , _dcc , _fffg , uint32 ( len ( _gead . _dea ) ) ) ; _gead . _dea = append ( _gead . _dea , _dcc ) ; _dbae . TargetAttr = _f . RelativeFilename ( _feff , _bcef . Typ , _fffg , len ( _gead . _dea ) ) ;
_abcc := _cc . NewRelationships ( ) ; _fbgg . AddTarget ( _gd . RelationsPathFor ( _adgg ) , _abcc . X ( ) , _fffg , 0 ) ; _gead . _gaf = append ( _gead . _gaf , _abcc ) ; case _f . ThemeType , _f . ThemeTypeStrict : _fcdf := _dcb . NewTheme ( ) ; _fbgg . AddTarget ( _adgg , _fcdf , _fffg , uint32 ( len ( _gead . _aaf ) ) ) ;
_gead . _aaf = append ( _gead . _aaf , _fcdf ) ; _dbae . TargetAttr = _f . RelativeFilename ( _feff , _bcef . Typ , _fffg , len ( _gead . _aaf ) ) ; case _f . WebSettingsType , _f . WebSettingsTypeStrict : _gead . _abbb = _gdb . NewWebSettings ( ) ; _fbgg . AddTarget ( _adgg , _gead . _abbb , _fffg , 0 ) ;
_dbae . TargetAttr = _f . RelativeFilename ( _feff , _bcef . Typ , _fffg , 0 ) ; case _f . FontTableType , _f . FontTableTypeStrict : _gead . _cdee = _gdb . NewFonts ( ) ; _fbgg . AddTarget ( _adgg , _gead . _cdee , _fffg , 0 ) ; _dbae . TargetAttr = _f . RelativeFilename ( _feff , _bcef . Typ , _fffg , 0 ) ;
case _f . FontEmbeddingType : _gcdg := _cc . NewRelationships ( ) ; _fbgg . AddTarget ( _gd . RelationsPathFor ( _adgg ) , _gcdg . X ( ) , _fffg , 0 ) ; _gead . _gef = _gcdg ; case _f . EndNotesType , _f . EndNotesTypeStrict : _gead . _gde = _gdb . NewEndnotes ( ) ; _fbgg . AddTarget ( _adgg , _gead . _gde , _fffg , 0 ) ;
_dbae . TargetAttr = _f . RelativeFilename ( _feff , _bcef . Typ , _fffg , 0 ) ; case _f . FootNotesType , _f . FootNotesTypeStrict : _gead . _bgg = _gdb . NewFootnotes ( ) ; _fbgg . AddTarget ( _adgg , _gead . _bgg , _fffg , 0 ) ; _dbae . TargetAttr = _f . RelativeFilename ( _feff , _bcef . Typ , _fffg , 0 ) ;
case _f . ImageType , _f . ImageTypeStrict : var _ded _cc . ImageRef ; for _afb , _dfadf := range _geeg { if _dfadf == nil { continue ; } ; _cbfe := _ab . TrimPrefix ( _dfadf . Name , "\u0077\u006f\u0072d\u002f" ) ; if _aafc := _ab . TrimPrefix ( _adgg , "\u0077\u006f\u0072d\u002f" ) ;
_cbfe == _aafc { _fgfd , _fedd := _gd . ExtractToDiskTmp ( _dfadf , _gead . TmpPath ) ; if _fedd != nil { return _fedd ; } ; _aega := _ae . Ext ( _dfadf . Name ) ; _ffbe := _cc . Image { } ; if _aega [ 1 : ] != "\u0065\u006d\u0066" { _cdeee , _aedb := _cc . ImageFromStorage ( _fgfd ) ; if _aedb != nil { return _aedb ;
} ; _ffbe = _cdeee ; } else { _ffbe . Path = _fgfd ; } ; _ffbe . Format = _aega [ 1 : ] ; _ded = _cc . MakeImageRef ( _ffbe , & _gead . DocBase , _gead . _aed ) ; _geeg [ _afb ] = nil ; } ; } ; if _ded . Format ( ) != "" { _faef := "\u002e" + _ab . ToLower ( _ded . Format ( ) ) ; _dbae . TargetAttr = _f . RelativeFilename ( _feff , _bcef . Typ , _fffg , len ( _gead . Images ) + 1 ) ;
if _bca := _ae . Ext ( _dbae . TargetAttr ) ; _bca != _faef { _dbae . TargetAttr = _dbae . TargetAttr [ 0 : len ( _dbae . TargetAttr ) - len ( _bca ) ] + _faef ; } ; _ded . SetTarget ( "\u0077\u006f\u0072d\u002f" + _dbae . TargetAttr ) ; _gead . Images = append ( _gead . Images , _ded ) ; } ;
case _f . ControlType , _f . ControlTypeStrict : _bgbeg := _dc . NewOcx ( ) ; _ggeb := _f . RelativeFilename ( _feff , _bcef . Typ , _fffg , len ( _gead . _acf ) + 1 ) ; _cadg := "\u0077\u006f\u0072d\u002f" + _ggeb [ : len ( _ggeb ) - 4 ] + "\u002e\u0062\u0069\u006e" ; for _abdb , _bgbg := range _geeg { if _bgbg == nil { continue ;
} ; if _bgbg . Name == _cadg { _aagga , _dccd := _gd . ExtractToDiskTmp ( _bgbg , _gead . TmpPath ) ; if _dccd != nil { return _dccd ; } ; _bbff , _dccd := _ac . ImportFromFile ( _aagga ) ; if _dccd == nil { _bbff . TargetAttr = _ggeb ; _bbff . Ocx = _bgbeg ; _gead . _acf = append ( _gead . _acf , _bbff ) ;
_fbgg . AddTarget ( _adgg , _bgbeg , _fffg , uint32 ( len ( _gead . _acf ) ) ) ; _dbae . TargetAttr = _ggeb ; _geeg [ _abdb ] = nil ; } else { _fe . Log . Debug ( "c\u0061\u006e\u006e\u006f\u0074\u0020r\u0065\u0061\u0064\u0020\u0062\u0069\u006e\u0020\u0066i\u006c\u0065\u003a \u0025s\u0020\u0025\u0073" , _cadg , _dccd . Error ( ) ) ;
} ; break ; } ; } ; case _f . ChartType : _ebad := chart { _ffd : _gbd . NewChartSpace ( ) } ; _bdfd := uint32 ( len ( _gead . _deae ) ) ; _fbgg . AddTarget ( _adgg , _ebad . _ffd , _fffg , _bdfd ) ; _gead . _deae = append ( _gead . _deae , & _ebad ) ; _dbae . TargetAttr = _f . RelativeFilename ( _feff , _bcef . Typ , _fffg , len ( _gead . _deae ) ) ;
_ebad . _eec = _dbae . TargetAttr ; default : _fe . Log . Debug ( "\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" , _fffg , _adgg ) ;
} ; return nil ; } ;
2022-06-27 19:44:23 +00:00
2024-09-16 09:59:58 +00:00
// Settings controls the document settings.
type Settings struct { _bggce * _gdb . Settings } ;
2022-06-27 19:44:23 +00:00
2024-09-16 09:59:58 +00:00
// ExtractText returns text from the document as a DocText object.
func ( _gecf * Document ) ExtractText ( ) * DocText { _dfcd := [ ] TextItem { } ; for _ , _bcba := range _gecf . _dbc . Body . EG_BlockLevelElts { _dfcd = append ( _dfcd , _ddcc ( _bcba . EG_ContentBlockContent , nil ) ... ) ; } ; var _afca [ ] listItemInfo ; _gdae := _gecf . Paragraphs ( ) ;
for _ , _bcf := range _gdae { _afcde := _gbfb ( _gecf , _bcf ) ; _afca = append ( _afca , _afcde ) ; } ; _feef := _gbde ( _gecf ) ; return & DocText { Items : _dfcd , _cdbd : _afca , _eddbf : _feef } ; } ;
2022-06-27 19:44:23 +00:00
2024-09-16 09:59:58 +00:00
// Text returns the underlying text in the run.
func ( _aaafa Run ) Text ( ) string { if len ( _aaafa . _feebb . EG_RunInnerContent ) == 0 { return "" ; } ; _fgda := _fc . Buffer { } ; for _ , _efdg := range _aaafa . _feebb . EG_RunInnerContent { if _efdg . T != nil { _fgda . WriteString ( _efdg . T . Content ) ; } ; if _efdg . Tab != nil { _fgda . WriteByte ( '\t' ) ;
} ; } ; return _fgda . String ( ) ; } ;
2022-12-06 11:56:49 +00:00
2024-09-16 09:59:58 +00:00
// Paragraph is a paragraph within a document.
type Paragraph struct { _fdec * Document ; _gbaee * _gdb . CT_P ; } ;
2022-12-06 11:56:49 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _edbab TableStyleProperties ) X ( ) * _gdb . CT_TblPrBase { return _edbab . _addgf } ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// SetHangingIndent controls special indent of paragraph.
func ( _daafb Paragraph ) SetHangingIndent ( m _dg . Distance ) { _daafb . ensurePPr ( ) ; _cgega := _daafb . _gbaee . PPr ; if _cgega . Ind == nil { _cgega . Ind = _gdb . NewCT_Ind ( ) ; } ; if m == _dg . Zero { _cgega . Ind . HangingAttr = nil ; } else { _cgega . Ind . HangingAttr = & _de . ST_TwipsMeasure { } ;
_cgega . Ind . HangingAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( m / _dg . Twips ) ) ; } ; } ;
2023-04-15 17:27:31 +00:00
2024-09-16 09:59:58 +00:00
// SetAfterAuto controls if spacing after a paragraph is automatically determined.
func ( _abfa ParagraphSpacing ) SetAfterAuto ( b bool ) { if b { _abfa . _fggcd . AfterAutospacingAttr = & _de . ST_OnOff { } ; _abfa . _fggcd . AfterAutospacingAttr . Bool = _f . Bool ( true ) ; } else { _abfa . _fggcd . AfterAutospacingAttr = nil ; } ; } ;
2023-04-15 17:27:31 +00:00
2024-09-16 09:59:58 +00:00
// GetRightToLeft returns true if the run text is displayed from right to left.
func ( _ffgeb RunProperties ) GetRightToLeft ( ) bool { return _cefe ( _ffgeb . _bace . Rtl ) } ;
2023-04-15 17:27:31 +00:00
2024-09-16 09:59:58 +00:00
// AddLevel adds a new numbering level to a NumberingDefinition.
func ( _agbe NumberingDefinition ) AddLevel ( ) NumberingLevel { _defc := _gdb . NewCT_Lvl ( ) ; _defc . Start = & _gdb . CT_DecimalNumber { ValAttr : 1 } ; _defc . IlvlAttr = int64 ( len ( _agbe . _gged . Lvl ) ) ; _agbe . _gged . Lvl = append ( _agbe . _gged . Lvl , _defc ) ; return NumberingLevel { _defc } ;
} ;
2023-06-10 07:12:37 +00:00
2024-09-16 09:59:58 +00:00
// GetSize return the size of anchor on the page.
func ( _bg AnchoredDrawing ) GetSize ( ) ( _bae , _fg int64 ) { return _bg . _bc . Extent . CxAttr , _bg . _bc . Extent . CyAttr ; } ;
2023-06-10 07:12:37 +00:00
2024-09-16 09:59:58 +00:00
// InsertStyle insert style to styles.
func ( _dcbbc Styles ) InsertStyle ( ss Style ) { _dcbbc . _cadcge . Style = append ( _dcbbc . _cadcge . Style , ss . X ( ) ) ; } ;
2023-08-06 17:57:53 +00:00
2024-09-16 09:59:58 +00:00
// SetTextWrapBehindText sets the text wrap to behind text.
func ( _gea AnchoredDrawing ) SetTextWrapBehindText ( ) { _gea . _bc . Choice = & _gdb . WdEG_WrapTypeChoice { } ; _gea . _bc . Choice . WrapNone = _gdb . NewWdCT_WrapNone ( ) ; _gea . _bc . BehindDocAttr = true ; _gea . _bc . LayoutInCellAttr = true ; _gea . _bc . AllowOverlapAttr = true ;
} ;
2023-08-06 17:57:53 +00:00
2024-09-16 09:59:58 +00:00
// SetName sets the name of the style.
func ( _ccfda Style ) SetName ( name string ) { _ccfda . _gfdb . Name = _gdb . NewCT_String ( ) ; _ccfda . _gfdb . Name . ValAttr = name ; } ;
2023-08-06 17:57:53 +00:00
2024-09-16 09:59:58 +00:00
// GetChartSpaceByRelId returns a *crt.ChartSpace with the associated relation ID in the
// document.
func ( _afab * Document ) GetChartSpaceByRelId ( relId string ) * _gbd . ChartSpace { _edaa := _afab . _aed . GetTargetByRelId ( relId ) ; for _ , _decg := range _afab . _deae { if _edaa == _decg . Target ( ) { return _decg . _ffd ; } ; } ; return nil ; } ;
2023-09-16 17:56:36 +00:00
2024-09-16 09:59:58 +00:00
// SetTextWrapTopAndBottom sets the text wrap to top and bottom.
func ( _cbd AnchoredDrawing ) SetTextWrapTopAndBottom ( ) { _cbd . _bc . Choice = & _gdb . WdEG_WrapTypeChoice { } ; _cbd . _bc . Choice . WrapTopAndBottom = _gdb . NewWdCT_WrapTopBottom ( ) ; _cbd . _bc . LayoutInCellAttr = true ; _cbd . _bc . AllowOverlapAttr = true ; } ;
2023-12-12 23:20:29 +00:00
2024-09-16 09:59:58 +00:00
// Index returns the index of the footer within the document. This is used to
// form its zip packaged filename as well as to match it with its relationship
// ID.
func ( _gddd Footer ) Index ( ) int { for _cgaf , _ceaa := range _gddd . _dgbc . _dea { if _ceaa == _gddd . _dbdg { return _cgaf ; } ; } ; return - 1 ; } ;
2024-02-17 03:37:07 +00:00
2024-09-16 09:59:58 +00:00
// SetItalic sets the run to italic.
func ( _dfae RunProperties ) SetItalic ( b bool ) { if ! b { _dfae . _bace . I = nil ; _dfae . _bace . ICs = nil ; } else { _dfae . _bace . I = _gdb . NewCT_OnOff ( ) ; _dfae . _bace . ICs = _gdb . NewCT_OnOff ( ) ; } ; } ;
2023-12-12 23:20:29 +00:00
2024-09-16 09:59:58 +00:00
// SetCalcOnExit marks if a FormField should be CalcOnExit or not.
func ( _eaggf FormField ) SetCalcOnExit ( calcOnExit bool ) { _dgfca := _gdb . NewCT_OnOff ( ) ; _dgfca . ValAttr = & _de . ST_OnOff { Bool : & calcOnExit } ; _eaggf . _eebdg . CalcOnExit = [ ] * _gdb . CT_OnOff { _dgfca } ; } ;
2023-12-12 23:20:29 +00:00
2024-09-16 09:59:58 +00:00
// Outline returns true if paragraph outline is on.
func ( _dddcb ParagraphProperties ) Outline ( ) bool { return _cefe ( _dddcb . _egbf . RPr . Outline ) } ;
2023-12-28 15:53:06 +00:00
2024-09-16 09:59:58 +00:00
// AddDrawingInline adds an inline drawing from an ImageRef.
func ( _fgdb Run ) AddDrawingInline ( img _cc . ImageRef ) ( InlineDrawing , error ) { _ecdag := _fgdb . newIC ( ) ; _ecdag . Drawing = _gdb . NewCT_Drawing ( ) ; _ddeb := _gdb . NewWdInline ( ) ; _eaaab := InlineDrawing { _fgdb . _ecda , _ddeb } ; _ddeb . CNvGraphicFramePr = _dcb . NewCT_NonVisualGraphicFrameProperties ( ) ;
_ecdag . Drawing . Inline = append ( _ecdag . Drawing . Inline , _ddeb ) ; _ddeb . Graphic = _dcb . NewGraphic ( ) ; _ddeb . Graphic . GraphicData = _dcb . NewCT_GraphicalObjectData ( ) ; _ddeb . 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" ;
_ddeb . DistTAttr = _f . Uint32 ( 0 ) ; _ddeb . DistLAttr = _f . Uint32 ( 0 ) ; _ddeb . DistBAttr = _f . Uint32 ( 0 ) ; _ddeb . DistRAttr = _f . Uint32 ( 0 ) ; _ddeb . Extent . CxAttr = int64 ( float64 ( img . Size ( ) . X * _dg . Pixel72 ) / _dg . EMU ) ; _ddeb . Extent . CyAttr = int64 ( float64 ( img . Size ( ) . Y * _dg . Pixel72 ) / _dg . EMU ) ;
_cccad := 0x7FFFFFFF & _b . Uint32 ( ) ; _ddeb . DocPr . IdAttr = _cccad ; _cecbb := _ef . NewPic ( ) ; _cecbb . NvPicPr . CNvPr . IdAttr = _cccad ; _ggdeb := img . RelID ( ) ; if _ggdeb == "" { return _eaaab , _cb . 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" ) ;
} ; _ddeb . Graphic . GraphicData . Any = append ( _ddeb . Graphic . GraphicData . Any , _cecbb ) ; _cecbb . BlipFill = _dcb . NewCT_BlipFillProperties ( ) ; _cecbb . BlipFill . Blip = _dcb . NewCT_Blip ( ) ; _cecbb . BlipFill . Blip . EmbedAttr = & _ggdeb ; _cecbb . BlipFill . Stretch = _dcb . NewCT_StretchInfoProperties ( ) ;
_cecbb . BlipFill . Stretch . FillRect = _dcb . NewCT_RelativeRect ( ) ; _cecbb . SpPr = _dcb . NewCT_ShapeProperties ( ) ; _cecbb . SpPr . Xfrm = _dcb . NewCT_Transform2D ( ) ; _cecbb . SpPr . Xfrm . Off = _dcb . NewCT_Point2D ( ) ; _cecbb . SpPr . Xfrm . Off . XAttr . ST_CoordinateUnqualified = _f . Int64 ( 0 ) ;
_cecbb . SpPr . Xfrm . Off . YAttr . ST_CoordinateUnqualified = _f . Int64 ( 0 ) ; _cecbb . SpPr . Xfrm . Ext = _dcb . NewCT_PositiveSize2D ( ) ; _cecbb . SpPr . Xfrm . Ext . CxAttr = int64 ( img . Size ( ) . X * _dg . Point ) ; _cecbb . SpPr . Xfrm . Ext . CyAttr = int64 ( img . Size ( ) . Y * _dg . Point ) ;
_cecbb . SpPr . PrstGeom = _dcb . NewCT_PresetGeometry2D ( ) ; _cecbb . SpPr . PrstGeom . PrstAttr = _dcb . ST_ShapeTypeRect ; return _eaaab , nil ; } ;
2023-12-28 15:53:06 +00:00
2024-09-16 09:59:58 +00:00
// SetWrapPathStart sets wrapPath start value.
func ( _bdg AnchorDrawWrapOptions ) SetWrapPathStart ( coordinate * _dcb . CT_Point2D ) { _bdg . _ace = coordinate ; } ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// SetAllCaps sets the run to all caps.
func ( _egfa RunProperties ) SetAllCaps ( b bool ) { if ! b { _egfa . _bace . Caps = nil ; } else { _egfa . _bace . Caps = _gdb . NewCT_OnOff ( ) ; } ; } ;
2024-05-04 18:48:06 +00:00
2024-09-16 09:59:58 +00:00
// FontTable returns document fontTable element.
func ( _caeg * Document ) FontTable ( ) * _gdb . Fonts { return _caeg . _cdee } ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _gfcf InlineDrawing ) X ( ) * _gdb . WdInline { return _gfcf . _eeed } ; func _gbde ( _dbded * Document ) map [ int64 ] map [ int64 ] int64 { _gdgfa := _dbded . Paragraphs ( ) ; _bafa := make ( map [ int64 ] map [ int64 ] int64 , 0 ) ; for _ , _cead := range _gdgfa { _fddc := _gbfb ( _dbded , _cead ) ;
if _fddc . NumberingLevel != nil && _fddc . AbstractNumId != nil { _gfbd := * _fddc . AbstractNumId ; if _ , _agdb := _bafa [ _gfbd ] ; _agdb { if _ebada := _fddc . NumberingLevel . X ( ) ; _ebada != nil { if _ , _deed := _bafa [ _gfbd ] [ _ebada . IlvlAttr ] ; _deed { _bafa [ _gfbd ] [ _ebada . IlvlAttr ] ++ ;
} else { _bafa [ _gfbd ] [ _ebada . IlvlAttr ] = 1 ; } ; } ; } else { if _fgde := _fddc . NumberingLevel . X ( ) ; _fgde != nil { _bafa [ _gfbd ] = map [ int64 ] int64 { _fgde . IlvlAttr : 1 } ; } ; } ; } ; } ; return _bafa ; } ;
2023-12-28 15:53:06 +00:00
2024-09-16 09:59:58 +00:00
// GetFooter gets a section Footer for given type
func ( _gbgc Section ) GetFooter ( t _gdb . ST_HdrFtr ) ( Footer , bool ) { for _ , _aace := range _gbgc . _bcgc . EG_HdrFtrReferences { if _aace . FooterReference . TypeAttr == t { for _ , _abbbf := range _gbgc . _aaaeb . Footers ( ) { _aeee := _gbgc . _aaaeb . _aed . FindRIDForN ( _abbbf . Index ( ) , _f . FooterType ) ;
if _aeee == _aace . FooterReference . IdAttr { return _abbbf , true ; } ; } ; } ; } ; return Footer { } , false ; } ;
2024-07-28 07:48:26 +00:00
2024-09-16 09:59:58 +00:00
// TableConditionalFormatting returns a conditional formatting object of a given
// type. Calling this method repeatedly will return the same object.
func ( _ebbad Style ) TableConditionalFormatting ( typ _gdb . ST_TblStyleOverrideType ) TableConditionalFormatting { for _ , _fbdc := range _ebbad . _gfdb . TblStylePr { if _fbdc . TypeAttr == typ { return TableConditionalFormatting { _fbdc } ; } ; } ; _cabbf := _gdb . NewCT_TblStylePr ( ) ;
_cabbf . TypeAttr = typ ; _ebbad . _gfdb . TblStylePr = append ( _ebbad . _gfdb . TblStylePr , _cabbf ) ; return TableConditionalFormatting { _cabbf } ; } ; func ( _ddf * chart ) Target ( ) string { return _ddf . _eec } ;
2024-07-28 07:48:26 +00:00
2024-09-16 09:59:58 +00:00
// SetCellSpacingAuto sets the cell spacing within a table to automatic.
func ( _gbfac TableStyleProperties ) SetCellSpacingAuto ( ) { _gbfac . _addgf . TblCellSpacing = _gdb . NewCT_TblWidth ( ) ; _gbfac . _addgf . TblCellSpacing . TypeAttr = _gdb . ST_TblWidthAuto ; } ;
2024-02-17 03:37:07 +00:00
2024-09-16 09:59:58 +00:00
// Paragraphs returns the paragraphs defined in a header.
func ( _fabaf Header ) Paragraphs ( ) [ ] Paragraph { _dffb := [ ] Paragraph { } ; for _ , _acbg := range _fabaf . _eeee . EG_ContentBlockContent { for _ , _cbaec := range _acbg . P { _dffb = append ( _dffb , Paragraph { _fabaf . _ddgg , _cbaec } ) ; } ; } ; for _ , _gdgd := range _fabaf . Tables ( ) { for _ , _cfef := range _gdgd . Rows ( ) { for _ , _cdegf := range _cfef . Cells ( ) { _dffb = append ( _dffb , _cdegf . Paragraphs ( ) ... ) ;
} ; } ; } ; return _dffb ; } ;
2024-02-17 03:37:07 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _gegc Run ) X ( ) * _gdb . CT_R { return _gegc . _feebb } ;
2024-04-03 00:10:23 +07:00
2024-09-16 09:59:58 +00:00
// Borders allows manipulation of the table borders.
func ( _bafae TableStyleProperties ) Borders ( ) TableBorders { if _bafae . _addgf . TblBorders == nil { _bafae . _addgf . TblBorders = _gdb . NewCT_TblBorders ( ) ; } ; return TableBorders { _bafae . _addgf . TblBorders } ; } ;
2024-05-04 18:48:06 +00:00
2024-09-16 09:59:58 +00:00
// X returns the inner wrapped XML type.
func ( _cd AnchoredDrawing ) X ( ) * _gdb . WdAnchor { return _cd . _bc } ;
2024-05-22 00:21:11 +00:00
2024-09-16 09:59:58 +00:00
// SetSpacing sets the spacing that comes before and after the paragraph.
// Deprecated: See Spacing() instead which allows finer control.
func ( _aceea ParagraphProperties ) SetSpacing ( before , after _dg . Distance ) { if _aceea . _egbf . Spacing == nil { _aceea . _egbf . Spacing = _gdb . NewCT_Spacing ( ) ; } ; _aceea . _egbf . Spacing . BeforeAttr = & _de . ST_TwipsMeasure { } ; _aceea . _egbf . Spacing . BeforeAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( before / _dg . Twips ) ) ;
_aceea . _egbf . Spacing . AfterAttr = & _de . ST_TwipsMeasure { } ; _aceea . _egbf . Spacing . AfterAttr . ST_UnsignedDecimalNumber = _f . Uint64 ( uint64 ( after / _dg . Twips ) ) ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// NewTableWidth returns a newly intialized TableWidth
func NewTableWidth ( ) TableWidth { return TableWidth { _gdb . NewCT_TblWidth ( ) } } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// Control returns an *axcontrol.Control object contained in the run or the nil value in case of no controls.
func ( _fgfb Run ) Control ( ) * _ac . Control { if _adfe := _fgfb . _feebb . EG_RunInnerContent ; _adfe != nil { if _abebb := _adfe [ 0 ] . Object ; _abebb != nil { if _cadb := _abebb . Choice ; _cadb != nil { if _ggagg := _cadb . Control ; _ggagg != nil { if _ggagg . IdAttr != nil { _gfbe := _fgfb . _ecda . GetDocRelTargetByID ( * _ggagg . IdAttr ) ;
for _ , _bedf := range _fgfb . _ecda . _acf { if _gfbe == _bedf . TargetAttr { return _bedf ; } ; } ; } ; } ; } ; } ; } ; return nil ; } ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// Paragraphs returns the paragraphs within a structured document tag.
func ( _efdb StructuredDocumentTag ) Paragraphs ( ) [ ] Paragraph { if _efdb . _fabc . SdtContent == nil { return nil ; } ; _eaeddd := [ ] Paragraph { } ; for _ , _aagbg := range _efdb . _fabc . SdtContent . P { _eaeddd = append ( _eaeddd , Paragraph { _efdb . _bfbfa , _aagbg } ) ; } ; return _eaeddd ;
} ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// AddCell adds a cell to a row and returns it
func ( _eaedg Row ) AddCell ( ) Cell { _bcbg := _gdb . NewEG_ContentCellContent ( ) ; _eaedg . _begf . EG_ContentCellContent = append ( _eaedg . _begf . EG_ContentCellContent , _bcbg ) ; _acaa := _gdb . NewCT_Tc ( ) ; _bcbg . Tc = append ( _bcbg . Tc , _acaa ) ; return Cell { _eaedg . _cebfg , _acaa } ;
} ;
2024-06-20 13:33:45 +00:00
2024-09-16 09:59:58 +00:00
// TableStyleProperties are table properties as defined in a style.
type TableStyleProperties struct { _addgf * _gdb . CT_TblPrBase } ;
// AddStyle adds a new empty style, if styleID is already exists, it will return the style.
func ( _fcdce Styles ) AddStyle ( styleID string , t _gdb . ST_StyleType , isDefault bool ) Style { if _gcgcd , _ffdgb := _fcdce . SearchStyleById ( styleID ) ; _ffdgb { return _gcgcd ; } ; _cggg := _gdb . NewCT_Style ( ) ; _cggg . TypeAttr = t ; if isDefault { _cggg . DefaultAttr = & _de . ST_OnOff { } ;
_cggg . DefaultAttr . Bool = _f . Bool ( isDefault ) ; } ; _cggg . StyleIdAttr = _f . String ( styleID ) ; _fcdce . _cadcge . Style = append ( _fcdce . _cadcge . Style , _cggg ) ; return Style { _cggg } ; } ;