mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-27 13:48:54 +08:00
1755 lines
263 KiB
Go
1755 lines
263 KiB
Go
//
|
|
// Copyright 2020 FoxyUtils ehf. All rights reserved.
|
|
//
|
|
// This is a commercial product and requires a license to operate.
|
|
// A trial license can be obtained at https://unidoc.io
|
|
//
|
|
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
|
|
//
|
|
// Use of this source code is governed by the UniDoc End User License Agreement
|
|
// terms that can be accessed at https://unidoc.io/eula/
|
|
|
|
/*
|
|
|
|
Package document provides creation, reading, and writing of ECMA 376 Open
|
|
Office XML documents.
|
|
|
|
Example:
|
|
|
|
doc := document.New()
|
|
para := doc.AddParagraph()
|
|
run := para.AddRun()
|
|
run.SetText("foo")
|
|
doc.SaveToFile("foo.docx")
|
|
*/
|
|
package document ;import (_g "archive/zip";_de "bytes";_ea "errors";_gb "fmt";_e "github.com/unidoc/unioffice";_aeg "github.com/unidoc/unioffice/color";_acb "github.com/unidoc/unioffice/common";_cb "github.com/unidoc/unioffice/common/axcontrol";_bg "github.com/unidoc/unioffice/common/logger";_deb "github.com/unidoc/unioffice/common/tempstorage";_eb "github.com/unidoc/unioffice/internal/formatutils";_gc "github.com/unidoc/unioffice/internal/license";_bd "github.com/unidoc/unioffice/measurement";_bf "github.com/unidoc/unioffice/schema/schemas.microsoft.com/office/activeX";_cg "github.com/unidoc/unioffice/schema/soo/dml";_cd "github.com/unidoc/unioffice/schema/soo/dml/chart";_fd "github.com/unidoc/unioffice/schema/soo/dml/picture";_ebd "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes";_bgb "github.com/unidoc/unioffice/schema/soo/pkg/relationships";_cc "github.com/unidoc/unioffice/schema/soo/wml";_af "github.com/unidoc/unioffice/schema/urn/schemas_microsoft_com/vml";_ad "github.com/unidoc/unioffice/vmldrawing";_gbf "github.com/unidoc/unioffice/zippkg";_ac "image";_b "image/jpeg";_c "io";_eg "math/rand";_fa "os";_ec "path/filepath";_f "regexp";_d "strings";_ae "unicode";);
|
|
|
|
// SetTargetBookmark sets the bookmark target of the hyperlink.
|
|
func (_bdae HyperLink )SetTargetBookmark (bm Bookmark ){_bdae ._bfde .AnchorAttr =_e .String (bm .Name ());_bdae ._bfde .IdAttr =nil ;};
|
|
|
|
// Numbering return numbering that being use by paragraph.
|
|
func (_adaa Paragraph )Numbering ()Numbering {_adaa .ensurePPr ();_abffa :=NewNumbering ();if _adaa ._dadg .PPr .NumPr !=nil {_cfge :=int64 (-1);_beeef :=int64 (-1);if _adaa ._dadg .PPr .NumPr .NumId !=nil {_cfge =_adaa ._dadg .PPr .NumPr .NumId .ValAttr ;};for _ ,_bgdag :=range _adaa ._gefc .Numbering ._bedb .Num {if _cfge < 0{break ;};if _bgdag .NumIdAttr ==_cfge {if _bgdag .AbstractNumId !=nil {_beeef =_bgdag .AbstractNumId .ValAttr ;_abffa ._bedb .Num =append (_abffa ._bedb .Num ,_bgdag );break ;};};};for _ ,_cgdd :=range _adaa ._gefc .Numbering ._bedb .AbstractNum {if _beeef < 0{break ;};if _cgdd .AbstractNumIdAttr ==_beeef {_abffa ._bedb .AbstractNum =append (_abffa ._bedb .AbstractNum ,_cgdd );break ;};};};return _abffa ;};
|
|
|
|
// Type returns the type of the style.
|
|
func (_acdgd Style )Type ()_cc .ST_StyleType {return _acdgd ._bafd .TypeAttr };func (_ecb *chart )Target ()string {return _ecb ._ada };
|
|
|
|
// AddParagraph adds a paragraph to the footer.
|
|
func (_gdeg Footer )AddParagraph ()Paragraph {_afa :=_cc .NewEG_ContentBlockContent ();_gdeg ._gceg .EG_ContentBlockContent =append (_gdeg ._gceg .EG_ContentBlockContent ,_afa );_beef :=_cc .NewCT_P ();_afa .P =append (_afa .P ,_beef );return Paragraph {_gdeg ._acab ,_beef };};
|
|
|
|
// SetStrikeThrough sets the run to strike-through.
|
|
func (_ecfad RunProperties )SetStrikeThrough (b bool ){if !b {_ecfad ._acgcd .Strike =nil ;}else {_ecfad ._acgcd .Strike =_cc .NewCT_OnOff ();};};
|
|
|
|
// SetWidth sets the table with to a specified width.
|
|
func (_eadeff TableProperties )SetWidth (d _bd .Distance ){_eadeff ._bebbgd .TblW =_cc .NewCT_TblWidth ();_eadeff ._bebbgd .TblW .TypeAttr =_cc .ST_TblWidthDxa ;_eadeff ._bebbgd .TblW .WAttr =&_cc .ST_MeasurementOrPercent {};_eadeff ._bebbgd .TblW .WAttr .ST_DecimalNumberOrPercent =&_cc .ST_DecimalNumberOrPercent {};_eadeff ._bebbgd .TblW .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_e .Int64 (int64 (d /_bd .Twips ));};
|
|
|
|
// CharacterSpacingMeasure returns paragraph characters spacing with its measure which can be mm, cm, in, pt, pc or pi.
|
|
func (_abgg RunProperties )CharacterSpacingMeasure ()string {if _bfedg :=_abgg ._acgcd .Spacing ;_bfedg !=nil {_fcfed :=_bfedg .ValAttr ;if _fcfed .ST_UniversalMeasure !=nil {return *_fcfed .ST_UniversalMeasure ;};};return "";};
|
|
|
|
// SetAfterLineSpacing sets spacing below paragraph in line units.
|
|
func (_abce Paragraph )SetAfterLineSpacing (d _bd .Distance ){_abce .ensurePPr ();if _abce ._dadg .PPr .Spacing ==nil {_abce ._dadg .PPr .Spacing =_cc .NewCT_Spacing ();};_efba :=_abce ._dadg .PPr .Spacing ;_efba .AfterLinesAttr =_e .Int64 (int64 (d /_bd .Twips ));};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_deag NumberingLevel )X ()*_cc .CT_Lvl {return _deag ._befe };
|
|
|
|
// SetWidth sets the cell width to a specified width.
|
|
func (_cee CellProperties )SetWidth (d _bd .Distance ){_cee ._cbfg .TcW =_cc .NewCT_TblWidth ();_cee ._cbfg .TcW .TypeAttr =_cc .ST_TblWidthDxa ;_cee ._cbfg .TcW .WAttr =&_cc .ST_MeasurementOrPercent {};_cee ._cbfg .TcW .WAttr .ST_DecimalNumberOrPercent =&_cc .ST_DecimalNumberOrPercent {};_cee ._cbfg .TcW .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_e .Int64 (int64 (d /_bd .Twips ));};func _gfada (_ebba *Document ,_gece []*_cc .CT_P ,_cgfc *TableInfo ,_bdee *DrawingInfo )[]Node {_bfbfb :=[]Node {};for _ ,_dggb :=range _gece {_caddc :=Paragraph {_ebba ,_dggb };_eea :=Node {_egfb :_ebba ,_bgba :&_caddc };if _fcbb ,_abdf :=_ebba .Styles .SearchStyleById (_caddc .Style ());_abdf {_eea .Style =_fcbb ;};for _ ,_dedbb :=range _caddc .Runs (){_eea .Children =append (_eea .Children ,Node {_egfb :_ebba ,_bgba :_dedbb ,AnchoredDrawings :_dedbb .DrawingAnchored (),InlineDrawings :_dedbb .DrawingInline ()});};_bfbfb =append (_bfbfb ,_eea );};return _bfbfb ;};
|
|
|
|
// SetStartIndent controls the start indent of the paragraph.
|
|
func (_cegdc ParagraphStyleProperties )SetStartIndent (m _bd .Distance ){if _cegdc ._feffd .Ind ==nil {_cegdc ._feffd .Ind =_cc .NewCT_Ind ();};if m ==_bd .Zero {_cegdc ._feffd .Ind .StartAttr =nil ;}else {_cegdc ._feffd .Ind .StartAttr =&_cc .ST_SignedTwipsMeasure {};_cegdc ._feffd .Ind .StartAttr .Int64 =_e .Int64 (int64 (m /_bd .Twips ));};};
|
|
|
|
// SetEndIndent controls the end indentation.
|
|
func (_dbge ParagraphProperties )SetEndIndent (m _bd .Distance ){if _dbge ._bfdca .Ind ==nil {_dbge ._bfdca .Ind =_cc .NewCT_Ind ();};if m ==_bd .Zero {_dbge ._bfdca .Ind .EndAttr =nil ;}else {_dbge ._bfdca .Ind .EndAttr =&_cc .ST_SignedTwipsMeasure {};_dbge ._bfdca .Ind .EndAttr .Int64 =_e .Int64 (int64 (m /_bd .Twips ));};};
|
|
|
|
// SetWindowControl controls if the first or last line of the paragraph is
|
|
// allowed to display on a separate page.
|
|
func (_bbbabb ParagraphProperties )SetWindowControl (b bool ){if !b {_bbbabb ._bfdca .WidowControl =nil ;}else {_bbbabb ._bfdca .WidowControl =_cc .NewCT_OnOff ();};};
|
|
|
|
// RightToLeft returns true if paragraph text goes from right to left.
|
|
func (_fcefg ParagraphProperties )RightToLeft ()bool {return _fcaaa (_fcefg ._bfdca .RPr .Rtl )};
|
|
|
|
// SetStartPct sets the cell start margin
|
|
func (_aed CellMargins )SetStartPct (pct float64 ){_aed ._gdc .Start =_cc .NewCT_TblWidth ();_bea (_aed ._gdc .Start ,pct );};
|
|
|
|
// Endnote is an individual endnote reference within the document.
|
|
type Endnote struct{_accf *Document ;_fcgd *_cc .CT_FtnEdn ;};
|
|
|
|
// X returns the internally wrapped *wml.CT_SectPr.
|
|
func (_cagdb Section )X ()*_cc .CT_SectPr {return _cagdb ._cdac };
|
|
|
|
// SetName marks sets a name attribute for a FormField.
|
|
func (_fead FormField )SetName (name string ){_faade :=_cc .NewCT_FFName ();_faade .ValAttr =&name ;_fead ._dbfcc .Name =[]*_cc .CT_FFName {_faade };};
|
|
|
|
// AddParagraph adds a paragraph to the endnote.
|
|
func (_dgbc Endnote )AddParagraph ()Paragraph {_bccg :=_cc .NewEG_ContentBlockContent ();_bdbg :=len (_dgbc ._fcgd .EG_BlockLevelElts [0].EG_ContentBlockContent );_dgbc ._fcgd .EG_BlockLevelElts [0].EG_ContentBlockContent =append (_dgbc ._fcgd .EG_BlockLevelElts [0].EG_ContentBlockContent ,_bccg );_fgdf :=_cc .NewCT_P ();var _affd *_cc .CT_String ;if _bdbg !=0{_bfbb :=len (_dgbc ._fcgd .EG_BlockLevelElts [0].EG_ContentBlockContent [_bdbg -1].P );_affd =_dgbc ._fcgd .EG_BlockLevelElts [0].EG_ContentBlockContent [_bdbg -1].P [_bfbb -1].PPr .PStyle ;}else {_affd =_cc .NewCT_String ();_affd .ValAttr ="\u0045n\u0064\u006e\u006f\u0074\u0065";};_bccg .P =append (_bccg .P ,_fgdf );_cdgg :=Paragraph {_dgbc ._accf ,_fgdf };_cdgg ._dadg .PPr =_cc .NewCT_PPr ();_cdgg ._dadg .PPr .PStyle =_affd ;_cdgg ._dadg .PPr .RPr =_cc .NewCT_ParaRPr ();return _cdgg ;};func _egaa (_egfe []*_cc .CT_P ,_aeaa *TableInfo ,_eaae *DrawingInfo )[]TextItem {_edgfc :=[]TextItem {};for _ ,_dcag :=range _egfe {_edgfc =append (_edgfc ,_bfacg (_dcag ,nil ,_aeaa ,_eaae ,_dcag .EG_PContent )...);};return _edgfc ;};
|
|
|
|
// SetCellSpacingAuto sets the cell spacing within a table to automatic.
|
|
func (_bdfe TableProperties )SetCellSpacingAuto (){_bdfe ._bebbgd .TblCellSpacing =_cc .NewCT_TblWidth ();_bdfe ._bebbgd .TblCellSpacing .TypeAttr =_cc .ST_TblWidthAuto ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_ecegc NumberingDefinition )X ()*_cc .CT_AbstractNum {return _ecegc ._fabc };
|
|
|
|
// Text returns the underlying text in the run.
|
|
func (_fdead Run )Text ()string {if len (_fdead ._abeed .EG_RunInnerContent )==0{return "";};_fdfg :=_de .Buffer {};for _ ,_dcdc :=range _fdead ._abeed .EG_RunInnerContent {if _dcdc .T !=nil {_fdfg .WriteString (_dcdc .T .Content );};if _dcdc .Tab !=nil {_fdfg .WriteByte ('\t');};};return _fdfg .String ();};
|
|
|
|
// SetFormat sets the numbering format.
|
|
func (_dbfa NumberingLevel )SetFormat (f _cc .ST_NumberFormat ){if _dbfa ._befe .NumFmt ==nil {_dbfa ._befe .NumFmt =_cc .NewCT_NumFmt ();};_dbfa ._befe .NumFmt .ValAttr =f ;};func (_fadb *Document )save (_fbbf _c .Writer ,_feg string )error {const _daf ="\u0064o\u0063u\u006d\u0065\u006e\u0074\u003a\u0064\u002e\u0053\u0061\u0076\u0065";if _fgd :=_fadb ._aeb .Validate ();_fgd !=nil {_bg .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",_fgd );};_eag :=_e .DocTypeDocument ;if !_gc .GetLicenseKey ().IsLicensed ()&&!_ecag {_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 _ea .New ("\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065\u0020\u006ci\u0063\u0065\u006e\u0073\u0065\u0020\u0072\u0065\u0071\u0075i\u0072\u0065\u0064");};if len (_fadb ._dedb )==0{if len (_feg )> 0{_fadb ._dedb =_feg ;}else {_edcd ,_ccad :=_gc .GenRefId ("\u0064\u0077");if _ccad !=nil {_bg .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_ccad );return _ccad ;};_fadb ._dedb =_edcd ;};};if _dga :=_gc .Track (_fadb ._dedb ,_daf );_dga !=nil {_bg .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_dga );return _dga ;};_bbba :=_g .NewWriter (_fbbf );defer _bbba .Close ();if _ccb :=_gbf .MarshalXML (_bbba ,_e .BaseRelsFilename ,_fadb .Rels .X ());_ccb !=nil {return _ccb ;};if _dff :=_gbf .MarshalXMLByType (_bbba ,_eag ,_e .ExtendedPropertiesType ,_fadb .AppProperties .X ());_dff !=nil {return _dff ;};if _aaf :=_gbf .MarshalXMLByType (_bbba ,_eag ,_e .CorePropertiesType ,_fadb .CoreProperties .X ());_aaf !=nil {return _aaf ;};if _fadb .CustomProperties .X ()!=nil {if _cea :=_gbf .MarshalXMLByType (_bbba ,_eag ,_e .CustomPropertiesType ,_fadb .CustomProperties .X ());_cea !=nil {return _cea ;};};if _fadb .Thumbnail !=nil {_agf ,_fda :=_bbba .Create ("\u0064\u006f\u0063Pr\u006f\u0070\u0073\u002f\u0074\u0068\u0075\u006d\u0062\u006e\u0061\u0069\u006c\u002e\u006a\u0070\u0065\u0067");if _fda !=nil {return _fda ;};if _gff :=_b .Encode (_agf ,_fadb .Thumbnail ,nil );_gff !=nil {return _gff ;};};if _acga :=_gbf .MarshalXMLByType (_bbba ,_eag ,_e .SettingsType ,_fadb .Settings .X ());_acga !=nil {return _acga ;};_aac :=_e .AbsoluteFilename (_eag ,_e .OfficeDocumentType ,0);if _ecae :=_gbf .MarshalXML (_bbba ,_aac ,_fadb ._aeb );_ecae !=nil {return _ecae ;};if _fcd :=_gbf .MarshalXML (_bbba ,_gbf .RelationsPathFor (_aac ),_fadb ._ebfd .X ());_fcd !=nil {return _fcd ;};if _fadb .Numbering .X ()!=nil {if _cgf :=_gbf .MarshalXMLByType (_bbba ,_eag ,_e .NumberingType ,_fadb .Numbering .X ());_cgf !=nil {return _cgf ;};};if _bgbe :=_gbf .MarshalXMLByType (_bbba ,_eag ,_e .StylesType ,_fadb .Styles .X ());_bgbe !=nil {return _bgbe ;};if _fadb ._bfg !=nil {if _bccc :=_gbf .MarshalXMLByType (_bbba ,_eag ,_e .WebSettingsType ,_fadb ._bfg );_bccc !=nil {return _bccc ;};};if _fadb ._ebg !=nil {if _cga :=_gbf .MarshalXMLByType (_bbba ,_eag ,_e .FontTableType ,_fadb ._ebg );_cga !=nil {return _cga ;};};if _fadb ._cde !=nil {if _fadd :=_gbf .MarshalXMLByType (_bbba ,_eag ,_e .EndNotesType ,_fadb ._cde );_fadd !=nil {return _fadd ;};};if _fadb ._cdg !=nil {if _egeb :=_gbf .MarshalXMLByType (_bbba ,_eag ,_e .FootNotesType ,_fadb ._cdg );_egeb !=nil {return _egeb ;};};for _fac ,_ggb :=range _fadb ._agc {if _gddb :=_gbf .MarshalXMLByTypeIndex (_bbba ,_eag ,_e .ThemeType ,_fac +1,_ggb );_gddb !=nil {return _gddb ;};};for _afga ,_dgg :=range _fadb ._efd {_cfb ,_bdd :=_dgg .ExportToByteArray ();if _bdd !=nil {return _bdd ;};_gfba :="\u0077\u006f\u0072d\u002f"+_dgg .TargetAttr [:len (_dgg .TargetAttr )-4]+"\u002e\u0062\u0069\u006e";if _dacf :=_gbf .AddFileFromBytes (_bbba ,_gfba ,_cfb );_dacf !=nil {return _dacf ;};if _cdcf :=_gbf .MarshalXMLByTypeIndex (_bbba ,_eag ,_e .ControlType ,_afga +1,_dgg .Ocx );_cdcf !=nil {return _cdcf ;};};for _aedg ,_geb :=range _fadb ._dgbf {_aab :=_e .AbsoluteFilename (_eag ,_e .HeaderType ,_aedg +1);if _bff :=_gbf .MarshalXML (_bbba ,_aab ,_geb );_bff !=nil {return _bff ;};if !_fadb ._edc [_aedg ].IsEmpty (){_gbf .MarshalXML (_bbba ,_gbf .RelationsPathFor (_aab ),_fadb ._edc [_aedg ].X ());};};for _dgf ,_acaa :=range _fadb ._ebda {_dffb :=_e .AbsoluteFilename (_eag ,_e .FooterType ,_dgf +1);if _abge :=_gbf .MarshalXMLByTypeIndex (_bbba ,_eag ,_e .FooterType ,_dgf +1,_acaa );_abge !=nil {return _abge ;};if !_fadb ._dfa [_dgf ].IsEmpty (){_gbf .MarshalXML (_bbba ,_gbf .RelationsPathFor (_dffb ),_fadb ._dfa [_dgf ].X ());};};for _aafg ,_fegc :=range _fadb .Images {if _adbc :=_acb .AddImageToZip (_bbba ,_fegc ,_aafg +1,_e .DocTypeDocument );_adbc !=nil {return _adbc ;};};for _dggg ,_ccag :=range _fadb ._afgd {_agd :=_e .AbsoluteFilename (_eag ,_e .ChartType ,_dggg +1);_gbf .MarshalXML (_bbba ,_agd ,_ccag ._gbbda );};if _fgdb :=_gbf .MarshalXML (_bbba ,_e .ContentTypesFilename ,_fadb .ContentTypes .X ());_fgdb !=nil {return _fgdb ;};if _ecdg :=_fadb .WriteExtraFiles (_bbba );_ecdg !=nil {return _ecdg ;};return _bbba .Close ();};
|
|
|
|
// 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 (_gggg Document )AddHyperlink (url string )_acb .Hyperlink {return _gggg ._ebfd .AddHyperlink (url )};
|
|
|
|
// Value returns the tring value of a FormFieldTypeText or FormFieldTypeDropDown.
|
|
func (_ace FormField )Value ()string {if _ace ._dbfcc .TextInput !=nil &&_ace ._eagcf .T !=nil {return _ace ._eagcf .T .Content ;}else if _ace ._dbfcc .DdList !=nil &&_ace ._dbfcc .DdList .Result !=nil {_abda :=_ace .PossibleValues ();_acfb :=int (_ace ._dbfcc .DdList .Result .ValAttr );if _acfb < len (_abda ){return _abda [_acfb ];};}else if _ace ._dbfcc .CheckBox !=nil {if _ace .IsChecked (){return "\u0074\u0072\u0075\u0065";};return "\u0066\u0061\u006cs\u0065";};return "";};
|
|
|
|
// Footnote is an individual footnote reference within the document.
|
|
type Footnote struct{_eeec *Document ;_effcg *_cc .CT_FtnEdn ;};
|
|
|
|
// GetStyleByID returns Style by it's IdAttr.
|
|
func (_gagb *Document )GetStyleByID (id string )Style {for _ ,_dgfc :=range _gagb .Styles ._ecgbf .Style {if _dgfc .StyleIdAttr !=nil &&*_dgfc .StyleIdAttr ==id {return Style {_dgfc };};};return Style {};};
|
|
|
|
// TableConditionalFormatting returns a conditional formatting object of a given
|
|
// type. Calling this method repeatedly will return the same object.
|
|
func (_ecef Style )TableConditionalFormatting (typ _cc .ST_TblStyleOverrideType )TableConditionalFormatting {for _ ,_fafc :=range _ecef ._bafd .TblStylePr {if _fafc .TypeAttr ==typ {return TableConditionalFormatting {_fafc };};};_fcdd :=_cc .NewCT_TblStylePr ();_fcdd .TypeAttr =typ ;_ecef ._bafd .TblStylePr =append (_ecef ._bafd .TblStylePr ,_fcdd );return TableConditionalFormatting {_fcdd };};func _abbaa (_fdgbg *_cc .CT_P ,_adbbf map[string ]string ){for _ ,_cecb :=range _fdgbg .EG_PContent {for _ ,_fdgc :=range _cecb .EG_ContentRunContent {if _fdgc .R !=nil {for _ ,_gffe :=range _fdgc .R .EG_RunInnerContent {_ggdg :=_gffe .Drawing ;if _ggdg !=nil {for _ ,_facca :=range _ggdg .Anchor {for _ ,_ged :=range _facca .Graphic .GraphicData .Any {switch _fbaf :=_ged .(type ){case *_fd .Pic :if _fbaf .BlipFill !=nil &&_fbaf .BlipFill .Blip !=nil {_acfdc (_fbaf .BlipFill .Blip ,_adbbf );};default:};};};for _ ,_adcb :=range _ggdg .Inline {for _ ,_dbea :=range _adcb .Graphic .GraphicData .Any {switch _baaff :=_dbea .(type ){case *_fd .Pic :if _baaff .BlipFill !=nil &&_baaff .BlipFill .Blip !=nil {_acfdc (_baaff .BlipFill .Blip ,_adbbf );};default:};};};};};};};};};
|
|
|
|
// ExtractFromFooter returns text from the document footer as an array of TextItems.
|
|
func ExtractFromFooter (footer *_cc .Ftr )[]TextItem {return _bgeec (footer .EG_ContentBlockContent ,nil )};
|
|
|
|
// HyperLink is a link within a document.
|
|
type HyperLink struct{_fdaa *Document ;_bfde *_cc .CT_Hyperlink ;};
|
|
|
|
// SetInsideVertical sets the interior vertical borders to a specified type, color and thickness.
|
|
func (_gbbd CellBorders )SetInsideVertical (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_gbbd ._cabe .InsideV =_cc .NewCT_Border ();_bfccc (_gbbd ._cabe .InsideV ,t ,c ,thickness );};
|
|
|
|
// SetStart sets the cell start margin
|
|
func (_eca CellMargins )SetStart (d _bd .Distance ){_eca ._gdc .Start =_cc .NewCT_TblWidth ();_bfc (_eca ._gdc .Start ,d );};
|
|
|
|
// Numbering is the document wide numbering styles contained in numbering.xml.
|
|
type Numbering struct{_bedb *_cc .Numbering };
|
|
|
|
// 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 (_dabfb Document )SetConformance (conformanceAttr _ebd .ST_ConformanceClass ){_dabfb ._aeb .ConformanceAttr =conformanceAttr ;};
|
|
|
|
// SetYOffset sets the Y offset for an image relative to the origin.
|
|
func (_ed AnchoredDrawing )SetYOffset (y _bd .Distance ){_ed ._gg .PositionV .Choice =&_cc .WdCT_PosVChoice {};_ed ._gg .PositionV .Choice .PosOffset =_e .Int32 (int32 (y /_bd .EMU ));};
|
|
|
|
// SetSize sets the size of the displayed image on the page.
|
|
func (_gef AnchoredDrawing )SetSize (w ,h _bd .Distance ){_gef ._gg .Extent .CxAttr =int64 (float64 (w *_bd .Pixel72 )/_bd .EMU );_gef ._gg .Extent .CyAttr =int64 (float64 (h *_bd .Pixel72 )/_bd .EMU );};
|
|
|
|
// ParagraphProperties returns the paragraph properties controlling text formatting within the table.
|
|
func (_gebdc TableConditionalFormatting )ParagraphProperties ()ParagraphStyleProperties {if _gebdc ._fgcg .PPr ==nil {_gebdc ._fgcg .PPr =_cc .NewCT_PPrGeneral ();};return ParagraphStyleProperties {_gebdc ._fgcg .PPr };};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_fbc CellProperties )X ()*_cc .CT_TcPr {return _fbc ._cbfg };
|
|
|
|
// SetBetween sets the between border to a specified type, color and thickness between paragraph.
|
|
func (_abbgf ParagraphBorders )SetBetween (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_abbgf ._fgda .Between =_cc .NewCT_Border ();_aeggb (_abbgf ._fgda .Between ,t ,c ,thickness );};func _bfdad (_aeeb *Document ,_dfdcg []*_cc .EG_ContentBlockContent ,_ggef *TableInfo )[]Node {_gedg :=[]Node {};for _ ,_acdg :=range _dfdcg {if _bffdd :=_acdg .Sdt ;_bffdd !=nil {if _debff :=_bffdd .SdtContent ;_debff !=nil {_gedg =append (_gedg ,_gfada (_aeeb ,_debff .P ,_ggef ,nil )...);};};_gedg =append (_gedg ,_gfada (_aeeb ,_acdg .P ,_ggef ,nil )...);for _ ,_aefd :=range _acdg .Tbl {_decgc :=Table {_aeeb ,_aefd };_eefca ,_ :=_aeeb .Styles .SearchStyleById (_decgc .Style ());_deecg :=[]Node {};for _gab ,_bgg :=range _aefd .EG_ContentRowContent {for _ ,_faca :=range _bgg .Tr {for _gfcef ,_ddeg :=range _faca .EG_ContentCellContent {for _ ,_gffa :=range _ddeg .Tc {_bbbe :=&TableInfo {Table :_aefd ,Row :_faca ,Cell :_gffa ,RowIndex :_gab ,ColIndex :_gfcef };for _ ,_effd :=range _gffa .EG_BlockLevelElts {_deecg =append (_deecg ,_bfdad (_aeeb ,_effd .EG_ContentBlockContent ,_bbbe )...);};};};};};_gedg =append (_gedg ,Node {_egfb :_aeeb ,_bgba :&_decgc ,Style :_eefca ,Children :_deecg });};};return _gedg ;};
|
|
|
|
// 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{_acb .DocBase ;_aeb *_cc .Document ;Settings Settings ;Numbering Numbering ;Styles Styles ;_dgbf []*_cc .Hdr ;_edc []_acb .Relationships ;_ebda []*_cc .Ftr ;_dfa []_acb .Relationships ;_ebfd _acb .Relationships ;_agc []*_cg .Theme ;_bfg *_cc .WebSettings ;_ebg *_cc .Fonts ;_cde *_cc .Endnotes ;_cdg *_cc .Footnotes ;_efd []*_cb .Control ;_afgd []*chart ;_dedb string ;};func (_eda *Document )validateBookmarks ()error {_befg :=make (map[string ]struct{});for _ ,_cgg :=range _eda .Bookmarks (){if _ ,_bfec :=_befg [_cgg .Name ()];_bfec {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",_cgg .Name ());};_befg [_cgg .Name ()]=struct{}{};};return nil ;};
|
|
|
|
// CellMargins are the margins for an individual cell.
|
|
type CellMargins struct{_gdc *_cc .CT_TcMar };
|
|
|
|
// 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 (_ecdf *Document )AddImage (i _acb .Image )(_acb .ImageRef ,error ){_eadfa :=_acb .MakeImageRef (i ,&_ecdf .DocBase ,_ecdf ._ebfd );if i .Data ==nil &&i .Path ==""{return _eadfa ,_ea .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 _eadfa ,_ea .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 _eadfa ,_ea .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 !=""{_edca :=_deb .Add (i .Path );if _edca !=nil {return _eadfa ,_edca ;};};_ecdf .Images =append (_ecdf .Images ,_eadfa );_badg :=_gb .Sprintf ("\u006d\u0065d\u0069\u0061\u002fi\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073",len (_ecdf .Images ),i .Format );_gfge :=_ecdf ._ebfd .AddRelationship (_badg ,_e .ImageType );_ecdf .ContentTypes .EnsureDefault ("\u0070\u006e\u0067","\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg");_ecdf .ContentTypes .EnsureDefault ("\u006a\u0070\u0065\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_ecdf .ContentTypes .EnsureDefault ("\u006a\u0070\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_ecdf .ContentTypes .EnsureDefault ("\u0077\u006d\u0066","i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066");_ecdf .ContentTypes .EnsureDefault (i .Format ,"\u0069\u006d\u0061\u0067\u0065\u002f"+i .Format );_eadfa .SetRelID (_gfge .X ().IdAttr );_eadfa .SetTarget (_badg );return _eadfa ,nil ;};
|
|
|
|
// SetBottom sets the cell bottom margin
|
|
func (_bef CellMargins )SetBottom (d _bd .Distance ){_bef ._gdc .Bottom =_cc .NewCT_TblWidth ();_bfc (_bef ._gdc .Bottom ,d );};
|
|
|
|
// SetBeforeAuto controls if spacing before a paragraph is automatically determined.
|
|
func (_efgae ParagraphSpacing )SetBeforeAuto (b bool ){if b {_efgae ._cgaa .BeforeAutospacingAttr =&_ebd .ST_OnOff {};_efgae ._cgaa .BeforeAutospacingAttr .Bool =_e .Bool (true );}else {_efgae ._cgaa .BeforeAutospacingAttr =nil ;};};
|
|
|
|
// SetFirstLineIndent controls the indentation of the first line in a paragraph.
|
|
func (_fdec ParagraphProperties )SetFirstLineIndent (m _bd .Distance ){if _fdec ._bfdca .Ind ==nil {_fdec ._bfdca .Ind =_cc .NewCT_Ind ();};if m ==_bd .Zero {_fdec ._bfdca .Ind .FirstLineAttr =nil ;}else {_fdec ._bfdca .Ind .FirstLineAttr =&_ebd .ST_TwipsMeasure {};_fdec ._bfdca .Ind .FirstLineAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (m /_bd .Twips ));};};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_eab Cell )X ()*_cc .CT_Tc {return _eab ._gbb };
|
|
|
|
// SetEastAsiaTheme sets the font East Asia Theme.
|
|
func (_bbfd Fonts )SetEastAsiaTheme (t _cc .ST_Theme ){_bbfd ._dgef .EastAsiaThemeAttr =t };
|
|
|
|
// Style is a style within the styles.xml file.
|
|
type Style struct{_bafd *_cc .CT_Style };func _bfc (_ede *_cc .CT_TblWidth ,_cbc _bd .Distance ){_ede .TypeAttr =_cc .ST_TblWidthDxa ;_ede .WAttr =&_cc .ST_MeasurementOrPercent {};_ede .WAttr .ST_DecimalNumberOrPercent =&_cc .ST_DecimalNumberOrPercent {};_ede .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_e .Int64 (int64 (_cbc /_bd .Dxa ));};
|
|
|
|
// SizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.
|
|
func (_fgfb RunProperties )SizeMeasure ()string {if _cedag :=_fgfb ._acgcd .Sz ;_cedag !=nil {_adda :=_cedag .ValAttr ;if _adda .ST_PositiveUniversalMeasure !=nil {return *_adda .ST_PositiveUniversalMeasure ;};};return "";};
|
|
|
|
// SetImprint sets the run to imprinted text.
|
|
func (_dgad RunProperties )SetImprint (b bool ){if !b {_dgad ._acgcd .Imprint =nil ;}else {_dgad ._acgcd .Imprint =_cc .NewCT_OnOff ();};};
|
|
|
|
// DoubleStrike returns true if run is double striked.
|
|
func (_efbdf RunProperties )DoubleStrike ()bool {return _fcaaa (_efbdf ._acgcd .Dstrike )};var _ecag =false ;
|
|
|
|
// AddDefinition adds a new numbering definition.
|
|
func (_ggbcf Numbering )AddDefinition ()NumberingDefinition {_deeae :=_cc .NewCT_Num ();_cgab :=int64 (1);for _ ,_caee :=range _ggbcf .Definitions (){if _caee .AbstractNumberID ()>=_cgab {_cgab =_caee .AbstractNumberID ()+1;};};_fbdd :=int64 (1);for _ ,_eeba :=range _ggbcf .X ().Num {if _eeba .NumIdAttr >=_fbdd {_fbdd =_eeba .NumIdAttr +1;};};_deeae .NumIdAttr =_fbdd ;_deeae .AbstractNumId =_cc .NewCT_DecimalNumber ();_deeae .AbstractNumId .ValAttr =_cgab ;_cegb :=_cc .NewCT_AbstractNum ();_cegb .AbstractNumIdAttr =_cgab ;_ggbcf ._bedb .AbstractNum =append (_ggbcf ._bedb .AbstractNum ,_cegb );_ggbcf ._bedb .Num =append (_ggbcf ._bedb .Num ,_deeae );return NumberingDefinition {_cegb };};
|
|
|
|
// NewStyles constructs a new empty Styles
|
|
func NewStyles ()Styles {return Styles {_cc .NewStyles ()}};func (_dcc *Document )tables (_fag *_cc .EG_ContentBlockContent )[]Table {_aafb :=[]Table {};for _ ,_caga :=range _fag .Tbl {_aafb =append (_aafb ,Table {_dcc ,_caga });for _ ,_bfa :=range _caga .EG_ContentRowContent {for _ ,_fcb :=range _bfa .Tr {for _ ,_gddbd :=range _fcb .EG_ContentCellContent {for _ ,_bcgd :=range _gddbd .Tc {for _ ,_ceg :=range _bcgd .EG_BlockLevelElts {for _ ,_dfe :=range _ceg .EG_ContentBlockContent {for _ ,_dedbd :=range _dcc .tables (_dfe ){_aafb =append (_aafb ,_dedbd );};};};};};};};};return _aafb ;};
|
|
|
|
// Fonts allows manipulating a style or run's fonts.
|
|
type Fonts struct{_dgef *_cc .CT_Fonts };
|
|
|
|
// Paragraphs returns the paragraphs defined in a header.
|
|
func (_becf Header )Paragraphs ()[]Paragraph {_gafff :=[]Paragraph {};for _ ,_gacf :=range _becf ._abed .EG_ContentBlockContent {for _ ,_aacgc :=range _gacf .P {_gafff =append (_gafff ,Paragraph {_becf ._edgdf ,_aacgc });};};for _ ,_daag :=range _becf .Tables (){for _ ,_aegde :=range _daag .Rows (){for _ ,_cefge :=range _aegde .Cells (){_gafff =append (_gafff ,_cefge .Paragraphs ()...);};};};return _gafff ;};func (_cgb *Document )InsertTableBefore (relativeTo Paragraph )Table {return _cgb .insertTable (relativeTo ,true );};
|
|
|
|
// Save writes the document to an io.Writer in the Zip package format.
|
|
func (_aca *Document )Save (w _c .Writer )error {return _aca .save (w ,_aca ._dedb )};type chart struct{_gbbda *_cd .ChartSpace ;_cag string ;_ada string ;};
|
|
|
|
// SetPageBreakBefore controls if there is a page break before this paragraph.
|
|
func (_edfcd ParagraphProperties )SetPageBreakBefore (b bool ){if !b {_edfcd ._bfdca .PageBreakBefore =nil ;}else {_edfcd ._bfdca .PageBreakBefore =_cc .NewCT_OnOff ();};};
|
|
|
|
// Style returns the style for a paragraph, or an empty string if it is unset.
|
|
func (_bgefg Paragraph )Style ()string {if _bgefg ._dadg .PPr !=nil &&_bgefg ._dadg .PPr .PStyle !=nil {return _bgefg ._dadg .PPr .PStyle .ValAttr ;};return "";};
|
|
|
|
// SetHeight allows controlling the height of a row within a table.
|
|
func (_bfgc RowProperties )SetHeight (ht _bd .Distance ,rule _cc .ST_HeightRule ){if rule ==_cc .ST_HeightRuleUnset {_bfgc ._gddc .TrHeight =nil ;}else {_daabb :=_cc .NewCT_Height ();_daabb .HRuleAttr =rule ;_daabb .ValAttr =&_ebd .ST_TwipsMeasure {};_daabb .ValAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (ht /_bd .Twips ));_bfgc ._gddc .TrHeight =[]*_cc .CT_Height {_daabb };};};func _acfdc (_fgde *_cg .CT_Blip ,_ebbg map[string ]string ){if _fgde .EmbedAttr !=nil {if _bbgg ,_gede :=_ebbg [*_fgde .EmbedAttr ];_gede {*_fgde .EmbedAttr =_bbgg ;};};};
|
|
|
|
// SetText sets the text to be used in bullet mode.
|
|
func (_bfeee NumberingLevel )SetText (t string ){if t ==""{_bfeee ._befe .LvlText =nil ;}else {_bfeee ._befe .LvlText =_cc .NewCT_LevelText ();_bfeee ._befe .LvlText .ValAttr =_e .String (t );};};
|
|
|
|
// AddParagraph adds a paragraph to the header.
|
|
func (_adefe Header )AddParagraph ()Paragraph {_eddca :=_cc .NewEG_ContentBlockContent ();_adefe ._abed .EG_ContentBlockContent =append (_adefe ._abed .EG_ContentBlockContent ,_eddca );_bfcdd :=_cc .NewCT_P ();_eddca .P =append (_eddca .P ,_bfcdd );return Paragraph {_adefe ._edgdf ,_bfcdd };};
|
|
|
|
// SetAll sets all of the borders to a given value.
|
|
func (_deeg TableBorders )SetAll (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_deeg .SetBottom (t ,c ,thickness );_deeg .SetLeft (t ,c ,thickness );_deeg .SetRight (t ,c ,thickness );_deeg .SetTop (t ,c ,thickness );_deeg .SetInsideHorizontal (t ,c ,thickness );_deeg .SetInsideVertical (t ,c ,thickness );};func (_cdebb *WatermarkText )getInnerElement (_eeab string )*_e .XSDAny {for _ ,_bbgbc :=range _cdebb ._adfba .Any {_dbfcd ,_eccef :=_bbgbc .(*_e .XSDAny );if _eccef &&(_dbfcd .XMLName .Local ==_eeab ||_dbfcd .XMLName .Local =="\u0076\u003a"+_eeab ){return _dbfcd ;};};return nil ;};
|
|
|
|
// SetCalcOnExit marks if a FormField should be CalcOnExit or not.
|
|
func (_cecbd FormField )SetCalcOnExit (calcOnExit bool ){_dfedc :=_cc .NewCT_OnOff ();_dfedc .ValAttr =&_ebd .ST_OnOff {Bool :&calcOnExit };_cecbd ._dbfcc .CalcOnExit =[]*_cc .CT_OnOff {_dfedc };};
|
|
|
|
// AddRun adds a run of text to a hyperlink. This is the text that will be linked.
|
|
func (_cdag HyperLink )AddRun ()Run {_ffed :=_cc .NewEG_ContentRunContent ();_cdag ._bfde .EG_ContentRunContent =append (_cdag ._bfde .EG_ContentRunContent ,_ffed );_deafb :=_cc .NewCT_R ();_ffed .R =_deafb ;return Run {_cdag ._fdaa ,_deafb };};
|
|
|
|
// AddField adds a field (automatically computed text) to the document.
|
|
func (_afdb Run )AddField (code string ){_afdb .AddFieldWithFormatting (code ,"",true )};
|
|
|
|
// Underline returns the type of paragraph underline.
|
|
func (_fbaff ParagraphProperties )Underline ()_cc .ST_Underline {if _gdegb :=_fbaff ._bfdca .RPr .U ;_gdegb !=nil {return _gdegb .ValAttr ;};return 0;};
|
|
|
|
// Properties returns the run properties.
|
|
func (_ggbcfa Run )Properties ()RunProperties {if _ggbcfa ._abeed .RPr ==nil {_ggbcfa ._abeed .RPr =_cc .NewCT_RPr ();};return RunProperties {_ggbcfa ._abeed .RPr };};
|
|
|
|
// Borders allows manipulation of the table borders.
|
|
func (_cffbe TableProperties )Borders ()TableBorders {if _cffbe ._bebbgd .TblBorders ==nil {_cffbe ._bebbgd .TblBorders =_cc .NewCT_TblBorders ();};return TableBorders {_cffbe ._bebbgd .TblBorders };};
|
|
|
|
// CharacterSpacingMeasure returns paragraph characters spacing with its measure which can be mm, cm, in, pt, pc or pi.
|
|
func (_ddac ParagraphProperties )CharacterSpacingMeasure ()string {if _faaea :=_ddac ._bfdca .RPr .Spacing ;_faaea !=nil {_abcea :=_faaea .ValAttr ;if _abcea .ST_UniversalMeasure !=nil {return *_abcea .ST_UniversalMeasure ;};};return "";};
|
|
|
|
// SetSpacing sets the spacing that comes before and after the paragraph.
|
|
// Deprecated: See Spacing() instead which allows finer control.
|
|
func (_ageb ParagraphProperties )SetSpacing (before ,after _bd .Distance ){if _ageb ._bfdca .Spacing ==nil {_ageb ._bfdca .Spacing =_cc .NewCT_Spacing ();};_ageb ._bfdca .Spacing .BeforeAttr =&_ebd .ST_TwipsMeasure {};_ageb ._bfdca .Spacing .BeforeAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (before /_bd .Twips ));_ageb ._bfdca .Spacing .AfterAttr =&_ebd .ST_TwipsMeasure {};_ageb ._bfdca .Spacing .AfterAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (after /_bd .Twips ));};
|
|
|
|
// SetBold sets the run to bold.
|
|
func (_gdeec RunProperties )SetBold (b bool ){if !b {_gdeec ._acgcd .B =nil ;_gdeec ._acgcd .BCs =nil ;}else {_gdeec ._acgcd .B =_cc .NewCT_OnOff ();_gdeec ._acgcd .BCs =_cc .NewCT_OnOff ();};};
|
|
|
|
// ReplaceText replace the text inside node.
|
|
func (_fbfba *Node )ReplaceText (oldText ,newText string ){switch _bebda :=_fbfba .X ().(type ){case *Paragraph :for _ ,_adcc :=range _bebda .Runs (){for _ ,_bebbg :=range _adcc ._abeed .EG_RunInnerContent {if _bebbg .T !=nil {_fbegd :=_bebbg .T .Content ;_fbegd =_d .ReplaceAll (_fbegd ,oldText ,newText );_bebbg .T .Content =_fbegd ;};};};};for _ ,_ecce :=range _fbfba .Children {_ecce .ReplaceText (oldText ,newText );};};func (_fadba *WatermarkPicture )getShape ()*_e .XSDAny {return _fadba .getInnerElement ("\u0073\u0068\u0061p\u0065");};
|
|
|
|
// NewWatermarkPicture generates new WatermarkPicture.
|
|
func NewWatermarkPicture ()WatermarkPicture {_cggf :=_af .NewShapetype ();_bdba :=_af .NewEG_ShapeElements ();_bdba .Formulas =_afbf ();_bdba .Path =_gacfc ();_bdba .Lock =_fcdg ();_cggf .EG_ShapeElements =[]*_af .EG_ShapeElements {_bdba };var (_efge ="\u005f\u0078\u0030\u0030\u0030\u0030\u005f\u0074\u0037\u0035";_deggcc ="2\u0031\u0036\u0030\u0030\u002c\u0032\u0031\u0036\u0030\u0030";_fefc =float32 (75.0);_bcbgd ="\u006d\u0040\u0034\u00405l\u0040\u0034\u0040\u0031\u0031\u0040\u0039\u0040\u0031\u0031\u0040\u0039\u0040\u0035x\u0065";);_cggf .IdAttr =&_efge ;_cggf .CoordsizeAttr =&_deggcc ;_cggf .SptAttr =&_fefc ;_cggf .PreferrelativeAttr =_ebd .ST_TrueFalseTrue ;_cggf .PathAttr =&_bcbgd ;_cggf .FilledAttr =_ebd .ST_TrueFalseFalse ;_cggf .StrokedAttr =_ebd .ST_TrueFalseFalse ;_bfae :=_af .NewShape ();_gdgb :=_af .NewEG_ShapeElements ();_gdgb .Imagedata =_deba ();_bfae .EG_ShapeElements =[]*_af .EG_ShapeElements {_gdgb };var (_fgebe ="\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";_cabf ="\u005f\u0078\u00300\u0030\u0030\u005f\u0073\u0032\u0030\u0035\u0031";_cbec ="#\u005f\u0078\u0030\u0030\u0030\u0030\u005f\u0074\u0037\u0035";_cacdd ="";_afbaa ="\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";);_bfae .IdAttr =&_fgebe ;_bfae .SpidAttr =&_cabf ;_bfae .TypeAttr =&_cbec ;_bfae .AltAttr =&_cacdd ;_bfae .StyleAttr =&_afbaa ;_bfae .AllowincellAttr =_ebd .ST_TrueFalseFalse ;_abbfd :=_cc .NewCT_Picture ();_abbfd .Any =[]_e .Any {_cggf ,_bfae };return WatermarkPicture {_egag :_abbfd ,_fcggb :_bfae ,_cbgba :_cggf };};
|
|
|
|
// GetHeader gets a section Header for given type t [ST_HdrFtrDefault, ST_HdrFtrEven, ST_HdrFtrFirst]
|
|
func (_eedf Section )GetHeader (t _cc .ST_HdrFtr )(Header ,bool ){for _ ,_afee :=range _eedf ._cdac .EG_HdrFtrReferences {if _afee .HeaderReference .TypeAttr ==t {for _ ,_dbaea :=range _eedf ._aafce .Headers (){_aggd :=_eedf ._aafce ._ebfd .FindRIDForN (_dbaea .Index (),_e .HeaderType );if _aggd ==_afee .HeaderReference .IdAttr {return _dbaea ,true ;};};};};return Header {},false ;};
|
|
|
|
// X returns the inner wml.CT_PBdr
|
|
func (_gcac ParagraphBorders )X ()*_cc .CT_PBdr {return _gcac ._fgda };
|
|
|
|
// 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 (_bcea Footer )AddImage (i _acb .Image )(_acb .ImageRef ,error ){var _dfabc _acb .Relationships ;for _dgdc ,_aegae :=range _bcea ._acab ._ebda {if _aegae ==_bcea ._gceg {_dfabc =_bcea ._acab ._dfa [_dgdc ];};};_dadeg :=_acb .MakeImageRef (i ,&_bcea ._acab .DocBase ,_dfabc );if i .Data ==nil &&i .Path ==""{return _dadeg ,_ea .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 _dadeg ,_ea .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 _dadeg ,_ea .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");};_bcea ._acab .Images =append (_bcea ._acab .Images ,_dadeg );_cbfgd :=_gb .Sprintf ("\u006d\u0065d\u0069\u0061\u002fi\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073",len (_bcea ._acab .Images ),i .Format );_dggf :=_dfabc .AddRelationship (_cbfgd ,_e .ImageType );_dadeg .SetRelID (_dggf .X ().IdAttr );return _dadeg ,nil ;};
|
|
|
|
// Paragraphs returns the paragraphs defined in a footer.
|
|
func (_fbae Footer )Paragraphs ()[]Paragraph {_acac :=[]Paragraph {};for _ ,_abfad :=range _fbae ._gceg .EG_ContentBlockContent {for _ ,_defda :=range _abfad .P {_acac =append (_acac ,Paragraph {_fbae ._acab ,_defda });};};for _ ,_adabg :=range _fbae .Tables (){for _ ,_abff :=range _adabg .Rows (){for _ ,_afe :=range _abff .Cells (){_acac =append (_acac ,_afe .Paragraphs ()...);};};};return _acac ;};
|
|
|
|
// DocRels returns document relationship.
|
|
func (_ggee *Document )DocRels ()_acb .Relationships {return _ggee ._ebfd };
|
|
|
|
// SetPictureWashout set washout to watermark picture.
|
|
func (_decee *WatermarkPicture )SetPictureWashout (isWashout bool ){if _decee ._fcggb !=nil {_gaca :=_decee ._fcggb .EG_ShapeElements ;if len (_gaca )> 0&&_gaca [0].Imagedata !=nil {if isWashout {_fbfg :="\u0031\u0039\u0036\u0036\u0031\u0066";_bceb :="\u0032\u0032\u0039\u0033\u0038\u0066";_gaca [0].Imagedata .GainAttr =&_fbfg ;_gaca [0].Imagedata .BlacklevelAttr =&_bceb ;};};};};type listItemInfo struct{FromStyle *Style ;FromParagraph *Paragraph ;AbstractNumId *int64 ;NumberingLevel *NumberingLevel ;};func (_daga *Document )insertTable (_gca Paragraph ,_bfb bool )Table {_cagc :=_daga ._aeb .Body ;if _cagc ==nil {return _daga .AddTable ();};_ccg :=_gca .X ();for _agec ,_dffa :=range _cagc .EG_BlockLevelElts {for _ ,_ggbc :=range _dffa .EG_ContentBlockContent {for _aeda ,_caf :=range _ggbc .P {if _caf ==_ccg {_eaf :=_cc .NewCT_Tbl ();_aedc :=_cc .NewEG_BlockLevelElts ();_bae :=_cc .NewEG_ContentBlockContent ();_aedc .EG_ContentBlockContent =append (_aedc .EG_ContentBlockContent ,_bae );_bae .Tbl =append (_bae .Tbl ,_eaf );_cagc .EG_BlockLevelElts =append (_cagc .EG_BlockLevelElts ,nil );if _bfb {copy (_cagc .EG_BlockLevelElts [_agec +1:],_cagc .EG_BlockLevelElts [_agec :]);_cagc .EG_BlockLevelElts [_agec ]=_aedc ;if _aeda !=0{_gcb :=_cc .NewEG_BlockLevelElts ();_ecg :=_cc .NewEG_ContentBlockContent ();_gcb .EG_ContentBlockContent =append (_gcb .EG_ContentBlockContent ,_ecg );_ecg .P =_ggbc .P [:_aeda ];_cagc .EG_BlockLevelElts =append (_cagc .EG_BlockLevelElts ,nil );copy (_cagc .EG_BlockLevelElts [_agec +1:],_cagc .EG_BlockLevelElts [_agec :]);_cagc .EG_BlockLevelElts [_agec ]=_gcb ;};_ggbc .P =_ggbc .P [_aeda :];}else {copy (_cagc .EG_BlockLevelElts [_agec +2:],_cagc .EG_BlockLevelElts [_agec +1:]);_cagc .EG_BlockLevelElts [_agec +1]=_aedc ;if _aeda !=len (_ggbc .P )-1{_bbgb :=_cc .NewEG_BlockLevelElts ();_bcca :=_cc .NewEG_ContentBlockContent ();_bbgb .EG_ContentBlockContent =append (_bbgb .EG_ContentBlockContent ,_bcca );_bcca .P =_ggbc .P [_aeda +1:];_cagc .EG_BlockLevelElts =append (_cagc .EG_BlockLevelElts ,nil );copy (_cagc .EG_BlockLevelElts [_agec +3:],_cagc .EG_BlockLevelElts [_agec +2:]);_cagc .EG_BlockLevelElts [_agec +2]=_bbgb ;};_ggbc .P =_ggbc .P [:_aeda +1];};return Table {_daga ,_eaf };};};for _ ,_acba :=range _ggbc .Tbl {_fbf :=_aff (_acba ,_ccg ,_bfb );if _fbf !=nil {return Table {_daga ,_fbf };};};};};return _daga .AddTable ();};
|
|
|
|
// Shadow returns true if paragraph shadow is on.
|
|
func (_cfbcf ParagraphProperties )Shadow ()bool {return _fcaaa (_cfbcf ._bfdca .RPr .Shadow )};func _bea (_dab *_cc .CT_TblWidth ,_fbb float64 ){_dab .TypeAttr =_cc .ST_TblWidthPct ;_dab .WAttr =&_cc .ST_MeasurementOrPercent {};_dab .WAttr .ST_DecimalNumberOrPercent =&_cc .ST_DecimalNumberOrPercent {};_dab .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_e .Int64 (int64 (_fbb *50));};
|
|
|
|
// 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 (_ebebf TableProperties )SetLayout (l _cc .ST_TblLayoutType ){if l ==_cc .ST_TblLayoutTypeUnset ||l ==_cc .ST_TblLayoutTypeAutofit {_ebebf ._bebbgd .TblLayout =nil ;}else {_ebebf ._bebbgd .TblLayout =_cc .NewCT_TblLayoutType ();_ebebf ._bebbgd .TblLayout .TypeAttr =l ;};};
|
|
|
|
// CellBorders are the borders for an individual
|
|
type CellBorders struct{_cabe *_cc .CT_TcBorders };func (_fdee Endnote )id ()int64 {return _fdee ._fcgd .IdAttr };
|
|
|
|
// NumberingDefinition defines a numbering definition for a list of pragraphs.
|
|
type NumberingDefinition struct{_fabc *_cc .CT_AbstractNum };
|
|
|
|
// NewNumbering constructs a new numbering.
|
|
func NewNumbering ()Numbering {_ecfd :=_cc .NewNumbering ();return Numbering {_ecfd }};
|
|
|
|
// SetTop sets the top border to a specified type, color and thickness.
|
|
func (_bcec ParagraphBorders )SetTop (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_bcec ._fgda .Top =_cc .NewCT_Border ();_aeggb (_bcec ._fgda .Top ,t ,c ,thickness );};
|
|
|
|
// Strike returns true if run is striked.
|
|
func (_dfdf RunProperties )Strike ()bool {return _fcaaa (_dfdf ._acgcd .Strike )};
|
|
|
|
// IsChecked returns true if a FormFieldTypeCheckBox is checked.
|
|
func (_fdbb FormField )IsChecked ()bool {if _fdbb ._dbfcc .CheckBox ==nil {return false ;};if _fdbb ._dbfcc .CheckBox .Checked !=nil {return true ;};return false ;};
|
|
|
|
// SetKeepNext controls if the paragraph is kept with the next paragraph.
|
|
func (_gceed ParagraphStyleProperties )SetKeepNext (b bool ){if !b {_gceed ._feffd .KeepNext =nil ;}else {_gceed ._feffd .KeepNext =_cc .NewCT_OnOff ();};};
|
|
|
|
// Definitions returns the defined numbering definitions.
|
|
func (_gcaba Numbering )Definitions ()[]NumberingDefinition {_eabg :=[]NumberingDefinition {};if _gcaba ._bedb !=nil {for _ ,_bged :=range _gcaba ._bedb .AbstractNum {_eabg =append (_eabg ,NumberingDefinition {_bged });};};return _eabg ;};
|
|
|
|
// RunProperties returns the run properties controlling text formatting within the table.
|
|
func (_fggdd TableConditionalFormatting )RunProperties ()RunProperties {if _fggdd ._fgcg .RPr ==nil {_fggdd ._fgcg .RPr =_cc .NewCT_RPr ();};return RunProperties {_fggdd ._fgcg .RPr };};
|
|
|
|
// SetVerticalMerge controls the vertical merging of cells.
|
|
func (_gcc CellProperties )SetVerticalMerge (mergeVal _cc .ST_Merge ){if mergeVal ==_cc .ST_MergeUnset {_gcc ._cbfg .VMerge =nil ;}else {_gcc ._cbfg .VMerge =_cc .NewCT_VMerge ();_gcc ._cbfg .VMerge .ValAttr =mergeVal ;};};
|
|
|
|
// RemoveParagraph removes a paragraph from the endnote.
|
|
func (_gage Endnote )RemoveParagraph (p Paragraph ){for _ ,_dgdb :=range _gage .content (){for _fdadc ,_adfb :=range _dgdb .P {if _adfb ==p ._dadg {copy (_dgdb .P [_fdadc :],_dgdb .P [_fdadc +1:]);_dgdb .P =_dgdb .P [0:len (_dgdb .P )-1];return ;};};};};
|
|
|
|
// FormFieldType is the type of the form field.
|
|
//go:generate stringer -type=FormFieldType
|
|
type FormFieldType byte ;
|
|
|
|
// Styles returns all styles.
|
|
func (_dbad Styles )Styles ()[]Style {_bfbba :=[]Style {};for _ ,_cegg :=range _dbad ._ecgbf .Style {_bfbba =append (_bfbba ,Style {_cegg });};return _bfbba ;};func (_dafac *Document )insertNumberingFromStyleProperties (_fdfdf Numbering ,_dabfa ParagraphStyleProperties ){_bfdcf :=_dabfa .NumId ();_afdc :=int64 (-1);if _bfdcf > -1{for _ ,_efcgce :=range _fdfdf ._bedb .Num {if _efcgce .NumIdAttr ==_bfdcf {if _efcgce .AbstractNumId !=nil {_afdc =_efcgce .AbstractNumId .ValAttr ;_gccce :=false ;for _ ,_ccbf :=range _dafac .Numbering ._bedb .Num {if _ccbf .NumIdAttr ==_bfdcf {_gccce =true ;break ;};};if !_gccce {_dafac .Numbering ._bedb .Num =append (_dafac .Numbering ._bedb .Num ,_efcgce );};break ;};};};for _ ,_fbca :=range _fdfdf ._bedb .AbstractNum {if _fbca .AbstractNumIdAttr ==_afdc {_bbag :=false ;for _ ,_dge :=range _dafac .Numbering ._bedb .AbstractNum {if _dge .AbstractNumIdAttr ==_afdc {_bbag =true ;break ;};};if !_bbag {_dafac .Numbering ._bedb .AbstractNum =append (_dafac .Numbering ._bedb .AbstractNum ,_fbca );};break ;};};};};
|
|
|
|
// Cell is a table cell within a document (not a spreadsheet)
|
|
type Cell struct{_bcc *Document ;_gbb *_cc .CT_Tc ;};
|
|
|
|
// SetOutlineLvl sets outline level of paragraph.
|
|
func (_bdbfc Paragraph )SetOutlineLvl (lvl int64 ){_bdbfc .ensurePPr ();if _bdbfc ._dadg .PPr .OutlineLvl ==nil {_bdbfc ._dadg .PPr .OutlineLvl =_cc .NewCT_DecimalNumber ();};_dbafc :=lvl -1;_bdbfc ._dadg .PPr .OutlineLvl .ValAttr =_dbafc ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_cfdd Run )X ()*_cc .CT_R {return _cfdd ._abeed };func (_dfd *Document )appendParagraph (_degc *Paragraph ,_abb Paragraph ,_bdaa bool )Paragraph {_dcbb :=_cc .NewEG_BlockLevelElts ();_dfd ._aeb .Body .EG_BlockLevelElts =append (_dfd ._aeb .Body .EG_BlockLevelElts ,_dcbb );_cfe :=_cc .NewEG_ContentBlockContent ();_dcbb .EG_ContentBlockContent =append (_dcbb .EG_ContentBlockContent ,_cfe );if _degc !=nil {_dgbe :=_degc .X ();for _ ,_bec :=range _dfd ._aeb .Body .EG_BlockLevelElts {for _ ,_gcd :=range _bec .EG_ContentBlockContent {for _abd ,_ceef :=range _gcd .P {if _ceef ==_dgbe {_bdda :=_abb .X ();_gcd .P =append (_gcd .P ,nil );if _bdaa {copy (_gcd .P [_abd +1:],_gcd .P [_abd :]);_gcd .P [_abd ]=_bdda ;}else {copy (_gcd .P [_abd +2:],_gcd .P [_abd +1:]);_gcd .P [_abd +1]=_bdda ;};break ;};};for _ ,_gcca :=range _gcd .Tbl {for _ ,_abf :=range _gcca .EG_ContentRowContent {for _ ,_dce :=range _abf .Tr {for _ ,_bge :=range _dce .EG_ContentCellContent {for _ ,_acca :=range _bge .Tc {for _ ,_ggbb :=range _acca .EG_BlockLevelElts {for _ ,_gdee :=range _ggbb .EG_ContentBlockContent {for _dcea ,_ageg :=range _gdee .P {if _ageg ==_dgbe {_dcda :=_abb .X ();_gdee .P =append (_gdee .P ,nil );if _bdaa {copy (_gdee .P [_dcea +1:],_gdee .P [_dcea :]);_gdee .P [_dcea ]=_dcda ;}else {copy (_gdee .P [_dcea +2:],_gdee .P [_dcea +1:]);_gdee .P [_dcea +1]=_dcda ;};break ;};};};};};};};};};if _gcd .Sdt !=nil &&_gcd .Sdt .SdtContent !=nil &&_gcd .Sdt .SdtContent .P !=nil {for _beae ,_daa :=range _gcd .Sdt .SdtContent .P {if _daa ==_dgbe {_gce :=_abb .X ();_gcd .Sdt .SdtContent .P =append (_gcd .Sdt .SdtContent .P ,nil );if _bdaa {copy (_gcd .Sdt .SdtContent .P [_beae +1:],_gcd .Sdt .SdtContent .P [_beae :]);_gcd .Sdt .SdtContent .P [_beae ]=_gce ;}else {copy (_gcd .Sdt .SdtContent .P [_beae +2:],_gcd .Sdt .SdtContent .P [_beae +1:]);_gcd .Sdt .SdtContent .P [_beae +1]=_gce ;};break ;};};};};};}else {_cfe .P =append (_cfe .P ,_abb .X ());};_cefb :=_abb .Properties ();if _eaa ,_dafe :=_cefb .Section ();_dafe {var (_dbagd map[string ]string ;_fafb map[string ]string ;);_cec :=_eaa .X ().EG_HdrFtrReferences ;for _ ,_ddf :=range _cec {if _ddf .HeaderReference !=nil {_dbagd =map[string ]string {_ddf .HeaderReference .IdAttr :_eaa ._aafce ._ebfd .GetTargetByRelId (_ddf .HeaderReference .IdAttr )};};if _ddf .FooterReference !=nil {_fafb =map[string ]string {_ddf .FooterReference .IdAttr :_eaa ._aafce ._ebfd .GetTargetByRelId (_ddf .FooterReference .IdAttr )};};};var _fcea map[int ]_acb .ImageRef ;for _ ,_cfd :=range _eaa ._aafce .Headers (){for _cage ,_fdad :=range _dbagd {_gcea :=_gb .Sprintf ("\u0068\u0065\u0061d\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c",(_cfd .Index ()+1));if _gcea ==_fdad {_egbe :=_gb .Sprintf ("\u0068\u0065\u0061d\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c",_cfd .Index ());_dfd ._dgbf =append (_dfd ._dgbf ,_cfd .X ());_dec :=_dfd ._ebfd .AddRelationship (_egbe ,_e .HeaderType );_dec .SetID (_cage );_dfd .ContentTypes .AddOverride ("\u002f\u0077\u006f\u0072\u0064\u002f"+_egbe ,"\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");_dfd ._edc =append (_dfd ._edc ,_acb .NewRelationships ());_gdg :=_cfd .Paragraphs ();for _ ,_dage :=range _gdg {for _ ,_efb :=range _dage .Runs (){_egf :=_efb .DrawingAnchored ();for _ ,_ffd :=range _egf {if _ecad ,_egg :=_ffd .GetImage ();_egg {_fcea =map[int ]_acb .ImageRef {_cfd .Index ():_ecad };};};_gda :=_efb .DrawingInline ();for _ ,_dcbg :=range _gda {if _bcb ,_gec :=_dcbg .GetImage ();_gec {_fcea =map[int ]_acb .ImageRef {_cfd .Index ():_bcb };};};};};};};};for _ade ,_cff :=range _fcea {for _ ,_dbc :=range _dfd .Headers (){if (_dbc .Index ()+1)==_ade {_cfba ,_eff :=_acb .ImageFromFile (_cff .Path ());if _eff !=nil {_bg .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",_eff );};if _ ,_eff =_dbc .AddImage (_cfba );_eff !=nil {_bg .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",_eff );};};for _ ,_gaf :=range _dbc .Paragraphs (){if _eecg ,_befd :=_eaa ._aafce .Styles .SearchStyleById (_gaf .Style ());_befd {if _ ,_facf :=_dfd .Styles .SearchStyleById (_gaf .Style ());!_facf {_dfd .Styles .InsertStyle (_eecg );};};};};};var _ebbd map[int ]_acb .ImageRef ;for _ ,_bfac :=range _eaa ._aafce .Footers (){for _beff ,_eac :=range _fafb {_acf :=_gb .Sprintf ("\u0066\u006f\u006ft\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c",(_bfac .Index ()+1));if _acf ==_eac {_gfa :=_gb .Sprintf ("\u0066\u006f\u006ft\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c",_bfac .Index ());_dfd ._ebda =append (_dfd ._ebda ,_bfac .X ());_bbaab :=_dfd ._ebfd .AddRelationship (_gfa ,_e .FooterType );_bbaab .SetID (_beff );_dfd .ContentTypes .AddOverride ("\u002f\u0077\u006f\u0072\u0064\u002f"+_gfa ,"\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");_dfd ._dfa =append (_dfd ._dfa ,_acb .NewRelationships ());_cgeb :=_bfac .Paragraphs ();for _ ,_bfff :=range _cgeb {for _ ,_bgab :=range _bfff .Runs (){_ffe :=_bgab .DrawingAnchored ();for _ ,_fba :=range _ffe {if _dafec ,_bdff :=_fba .GetImage ();_bdff {_ebbd =map[int ]_acb .ImageRef {_bfac .Index ():_dafec };};};_ecbf :=_bgab .DrawingInline ();for _ ,_ggba :=range _ecbf {if _ggda ,_degac :=_ggba .GetImage ();_degac {_ebbd =map[int ]_acb .ImageRef {_bfac .Index ():_ggda };};};};};};};};for _cdec ,_bdg :=range _ebbd {for _ ,_fbg :=range _dfd .Footers (){if (_fbg .Index ()+1)==_cdec {_ceb ,_adc :=_acb .ImageFromFile (_bdg .Path ());if _adc !=nil {_bg .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",_adc );};if _ ,_adc =_fbg .AddImage (_ceb );_adc !=nil {_bg .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",_adc );};};for _ ,_gebb :=range _fbg .Paragraphs (){if _addf ,_cbced :=_eaa ._aafce .Styles .SearchStyleById (_gebb .Style ());_cbced {if _ ,_dbfb :=_dfd .Styles .SearchStyleById (_gebb .Style ());!_dbfb {_dfd .Styles .InsertStyle (_addf );};};};};};};_ebfc :=_abb .Numbering ();_dfd .Numbering ._bedb .AbstractNum =append (_dfd .Numbering ._bedb .AbstractNum ,_ebfc ._bedb .AbstractNum ...);_dfd .Numbering ._bedb .Num =append (_dfd .Numbering ._bedb .Num ,_ebfc ._bedb .Num ...);return Paragraph {_dfd ,_abb .X ()};};
|
|
|
|
// DocText is an array of extracted text items which has some methods for representing extracted text.
|
|
type DocText struct{Items []TextItem ;_eddgd []listItemInfo ;_gfae map[int64 ]map[int64 ]int64 ;};
|
|
|
|
// 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 (_efac Run )IsFootnote ()(bool ,int64 ){if _efac ._abeed .EG_RunInnerContent !=nil {if _efac ._abeed .EG_RunInnerContent [0].FootnoteReference !=nil {return true ,_efac ._abeed .EG_RunInnerContent [0].FootnoteReference .IdAttr ;};};return false ,0;};
|
|
|
|
// AddTabStop adds a tab stop to the paragraph. It controls the position of text when using Run.AddTab()
|
|
func (_fbccf ParagraphProperties )AddTabStop (position _bd .Distance ,justificaton _cc .ST_TabJc ,leader _cc .ST_TabTlc ){if _fbccf ._bfdca .Tabs ==nil {_fbccf ._bfdca .Tabs =_cc .NewCT_Tabs ();};_cfbc :=_cc .NewCT_TabStop ();_cfbc .LeaderAttr =leader ;_cfbc .ValAttr =justificaton ;_cfbc .PosAttr .Int64 =_e .Int64 (int64 (position /_bd .Twips ));_fbccf ._bfdca .Tabs .Tab =append (_fbccf ._bfdca .Tabs .Tab ,_cfbc );};func (_ffddc *WatermarkText )findNode (_dgccg *_e .XSDAny ,_bcaa string )*_e .XSDAny {for _ ,_dcaff :=range _dgccg .Nodes {if _dcaff .XMLName .Local ==_bcaa {return _dcaff ;};};return nil ;};
|
|
|
|
// SetRightToLeft sets the run text goes from right to left.
|
|
func (_bbegb RunProperties )SetRightToLeft (b bool ){if !b {_bbegb ._acgcd .Rtl =nil ;}else {_bbegb ._acgcd .Rtl =_cc .NewCT_OnOff ();};};
|
|
|
|
// SetStyle sets the table style name.
|
|
func (_addaf TableProperties )SetStyle (name string ){if name ==""{_addaf ._bebbgd .TblStyle =nil ;}else {_addaf ._bebbgd .TblStyle =_cc .NewCT_String ();_addaf ._bebbgd .TblStyle .ValAttr =name ;};};
|
|
|
|
// CharacterSpacingValue returns the value of run's characters spacing in twips (1/20 of point).
|
|
func (_egcc RunProperties )CharacterSpacingValue ()int64 {if _egecd :=_egcc ._acgcd .Spacing ;_egecd !=nil {_bgdcd :=_egecd .ValAttr ;if _bgdcd .Int64 !=nil {return *_bgdcd .Int64 ;};};return int64 (0);};
|
|
|
|
// Close closes the document, removing any temporary files that might have been
|
|
// created when opening a document.
|
|
func (_cffc *Document )Close ()error {if _cffc .TmpPath !=""{return _deb .RemoveAll (_cffc .TmpPath );};return nil ;};
|
|
|
|
// GetSize return the size of anchor on the page.
|
|
func (_gf AnchoredDrawing )GetSize ()(_ce ,_aa int64 ){return _gf ._gg .Extent .CxAttr ,_gf ._gg .Extent .CyAttr ;};
|
|
|
|
// SetRight sets the right border to a specified type, color and thickness.
|
|
func (_gbfg ParagraphBorders )SetRight (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_gbfg ._fgda .Right =_cc .NewCT_Border ();_aeggb (_gbfg ._fgda .Right ,t ,c ,thickness );};
|
|
|
|
// SetValue sets the value of a FormFieldTypeText or FormFieldTypeDropDown. For
|
|
// FormFieldTypeDropDown, the value must be one of the fields possible values.
|
|
func (_aba FormField )SetValue (v string ){if _aba ._dbfcc .DdList !=nil {for _afbdd ,_cfecf :=range _aba .PossibleValues (){if _cfecf ==v {_aba ._dbfcc .DdList .Result =_cc .NewCT_DecimalNumber ();_aba ._dbfcc .DdList .Result .ValAttr =int64 (_afbdd );break ;};};}else if _aba ._dbfcc .TextInput !=nil {_aba ._eagcf .T =_cc .NewCT_Text ();_aba ._eagcf .T .Content =v ;};};
|
|
|
|
// AddFieldWithFormatting adds a field (automatically computed text) to the
|
|
// document with field specifc formatting.
|
|
func (_cdgeb Run )AddFieldWithFormatting (code string ,fmt string ,isDirty bool ){_abdfb :=_cdgeb .newIC ();_abdfb .FldChar =_cc .NewCT_FldChar ();_abdfb .FldChar .FldCharTypeAttr =_cc .ST_FldCharTypeBegin ;if isDirty {_abdfb .FldChar .DirtyAttr =&_ebd .ST_OnOff {};_abdfb .FldChar .DirtyAttr .Bool =_e .Bool (true );};_abdfb =_cdgeb .newIC ();_abdfb .InstrText =_cc .NewCT_Text ();if fmt !=""{_abdfb .InstrText .Content =code +"\u0020"+fmt ;}else {_abdfb .InstrText .Content =code ;};_abdfb =_cdgeb .newIC ();_abdfb .FldChar =_cc .NewCT_FldChar ();_abdfb .FldChar .FldCharTypeAttr =_cc .ST_FldCharTypeEnd ;};
|
|
|
|
// Paragraphs returns the paragraphs defined in a footnote.
|
|
func (_dfca Footnote )Paragraphs ()[]Paragraph {_dbabc :=[]Paragraph {};for _ ,_dffce :=range _dfca .content (){for _ ,_gbdc :=range _dffce .P {_dbabc =append (_dbabc ,Paragraph {_dfca ._eeec ,_gbdc });};};return _dbabc ;};
|
|
|
|
// SetOrigin sets the origin of the image. It defaults to ST_RelFromHPage and
|
|
// ST_RelFromVPage
|
|
func (_fce AnchoredDrawing )SetOrigin (h _cc .WdST_RelFromH ,v _cc .WdST_RelFromV ){_fce ._gg .PositionH .RelativeFromAttr =h ;_fce ._gg .PositionV .RelativeFromAttr =v ;};
|
|
|
|
// Paragraphs returns all of the paragraphs in the document body including tables.
|
|
func (_dffbc *Document )Paragraphs ()[]Paragraph {_deec :=[]Paragraph {};if _dffbc ._aeb .Body ==nil {return nil ;};for _ ,_efc :=range _dffbc ._aeb .Body .EG_BlockLevelElts {for _ ,_bbe :=range _efc .EG_ContentBlockContent {for _ ,_agb :=range _bbe .P {_deec =append (_deec ,Paragraph {_dffbc ,_agb });};};};for _ ,_bfd :=range _dffbc .Tables (){for _ ,_bbee :=range _bfd .Rows (){for _ ,_gbd :=range _bbee .Cells (){_deec =append (_deec ,_gbd .Paragraphs ()...);};};};return _deec ;};
|
|
|
|
// ComplexSizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.
|
|
func (_ccbeg RunProperties )ComplexSizeMeasure ()string {if _cbbb :=_ccbeg ._acgcd .SzCs ;_cbbb !=nil {_aaeb :=_cbbb .ValAttr ;if _aaeb .ST_PositiveUniversalMeasure !=nil {return *_aaeb .ST_PositiveUniversalMeasure ;};};return "";};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_ebfe Fonts )X ()*_cc .CT_Fonts {return _ebfe ._dgef };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_dfdfb Settings )X ()*_cc .Settings {return _dfdfb ._bbdg };
|
|
|
|
// 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 (_aade *Document )FormFields ()[]FormField {_gbbb :=[]FormField {};for _ ,_bfeeg :=range _aade .Paragraphs (){_decb :=_bfeeg .Runs ();for _aacg ,_fgdd :=range _decb {for _ ,_feb :=range _fgdd ._abeed .EG_RunInnerContent {if _feb .FldChar ==nil ||_feb .FldChar .FfData ==nil {continue ;};if _feb .FldChar .FldCharTypeAttr ==_cc .ST_FldCharTypeBegin {if len (_feb .FldChar .FfData .Name )==0||_feb .FldChar .FfData .Name [0].ValAttr ==nil {continue ;};_ecf :=FormField {_dbfcc :_feb .FldChar .FfData };if _feb .FldChar .FfData .TextInput !=nil {for _fgbc :=_aacg +1;_fgbc < len (_decb )-1;_fgbc ++{if len (_decb [_fgbc ]._abeed .EG_RunInnerContent )==0{continue ;};_bca :=_decb [_fgbc ]._abeed .EG_RunInnerContent [0];if _bca .FldChar !=nil &&_bca .FldChar .FldCharTypeAttr ==_cc .ST_FldCharTypeSeparate {if len (_decb [_fgbc +1]._abeed .EG_RunInnerContent )==0{continue ;};if _decb [_fgbc +1]._abeed .EG_RunInnerContent [0].FldChar ==nil {_ecf ._eagcf =_decb [_fgbc +1]._abeed .EG_RunInnerContent [0];break ;};};};};_gbbb =append (_gbbb ,_ecf );};};};};for _ ,_eafb :=range _aade .Headers (){for _ ,_cgcb :=range _eafb .Paragraphs (){_agee :=_cgcb .Runs ();for _fcge ,_ebfcd :=range _agee {for _ ,_dbced :=range _ebfcd ._abeed .EG_RunInnerContent {if _dbced .FldChar ==nil ||_dbced .FldChar .FfData ==nil {continue ;};if _dbced .FldChar .FldCharTypeAttr ==_cc .ST_FldCharTypeBegin {if len (_dbced .FldChar .FfData .Name )==0||_dbced .FldChar .FfData .Name [0].ValAttr ==nil {continue ;};_cbbe :=FormField {_dbfcc :_dbced .FldChar .FfData };if _dbced .FldChar .FfData .TextInput !=nil {for _cfab :=_fcge +1;_cfab < len (_agee )-1;_cfab ++{if len (_agee [_cfab ]._abeed .EG_RunInnerContent )==0{continue ;};_ecdgb :=_agee [_cfab ]._abeed .EG_RunInnerContent [0];if _ecdgb .FldChar !=nil &&_ecdgb .FldChar .FldCharTypeAttr ==_cc .ST_FldCharTypeSeparate {if len (_agee [_cfab +1]._abeed .EG_RunInnerContent )==0{continue ;};if _agee [_cfab +1]._abeed .EG_RunInnerContent [0].FldChar ==nil {_cbbe ._eagcf =_agee [_cfab +1]._abeed .EG_RunInnerContent [0];break ;};};};};_gbbb =append (_gbbb ,_cbbe );};};};};};for _ ,_gbab :=range _aade .Footers (){for _ ,_fefg :=range _gbab .Paragraphs (){_fdfd :=_fefg .Runs ();for _gdad ,_aaff :=range _fdfd {for _ ,_accba :=range _aaff ._abeed .EG_RunInnerContent {if _accba .FldChar ==nil ||_accba .FldChar .FfData ==nil {continue ;};if _accba .FldChar .FldCharTypeAttr ==_cc .ST_FldCharTypeBegin {if len (_accba .FldChar .FfData .Name )==0||_accba .FldChar .FfData .Name [0].ValAttr ==nil {continue ;};_gddaf :=FormField {_dbfcc :_accba .FldChar .FfData };if _accba .FldChar .FfData .TextInput !=nil {for _dfgg :=_gdad +1;_dfgg < len (_fdfd )-1;_dfgg ++{if len (_fdfd [_dfgg ]._abeed .EG_RunInnerContent )==0{continue ;};_abcd :=_fdfd [_dfgg ]._abeed .EG_RunInnerContent [0];if _abcd .FldChar !=nil &&_abcd .FldChar .FldCharTypeAttr ==_cc .ST_FldCharTypeSeparate {if len (_fdfd [_dfgg +1]._abeed .EG_RunInnerContent )==0{continue ;};if _fdfd [_dfgg +1]._abeed .EG_RunInnerContent [0].FldChar ==nil {_gddaf ._eagcf =_fdfd [_dfgg +1]._abeed .EG_RunInnerContent [0];break ;};};};};_gbbb =append (_gbbb ,_gddaf );};};};};};return _gbbb ;};
|
|
|
|
// SetUnhideWhenUsed controls if a semi hidden style becomes visible when used.
|
|
func (_dbefa Style )SetUnhideWhenUsed (b bool ){if b {_dbefa ._bafd .UnhideWhenUsed =_cc .NewCT_OnOff ();}else {_dbefa ._bafd .UnhideWhenUsed =nil ;};};
|
|
|
|
// ParagraphProperties returns the paragraph style properties.
|
|
func (_cgfd Style )ParagraphProperties ()ParagraphStyleProperties {if _cgfd ._bafd .PPr ==nil {_cgfd ._bafd .PPr =_cc .NewCT_PPrGeneral ();};return ParagraphStyleProperties {_cgfd ._bafd .PPr };};
|
|
|
|
// SetColor sets the text color.
|
|
func (_bffff RunProperties )SetColor (c _aeg .Color ){_bffff ._acgcd .Color =_cc .NewCT_Color ();_bffff ._acgcd .Color .ValAttr .ST_HexColorRGB =c .AsRGBString ();};
|
|
|
|
// SetName sets the name of the bookmark. This is the name that is used to
|
|
// reference the bookmark from hyperlinks.
|
|
func (_abc Bookmark )SetName (name string ){_abc ._cdcg .NameAttr =name };
|
|
|
|
// SetMultiLevelType sets the multilevel type.
|
|
func (_cacgg NumberingDefinition )SetMultiLevelType (t _cc .ST_MultiLevelType ){if t ==_cc .ST_MultiLevelTypeUnset {_cacgg ._fabc .MultiLevelType =nil ;}else {_cacgg ._fabc .MultiLevelType =_cc .NewCT_MultiLevelType ();_cacgg ._fabc .MultiLevelType .ValAttr =t ;};};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_bbdf Endnote )X ()*_cc .CT_FtnEdn {return _bbdf ._fcgd };
|
|
|
|
// DrawingInline return a slice of InlineDrawings.
|
|
func (_ddebg Run )DrawingInline ()[]InlineDrawing {_fdab :=[]InlineDrawing {};for _ ,_bcced :=range _ddebg ._abeed .EG_RunInnerContent {if _bcced .Drawing ==nil {continue ;};for _ ,_gdgd :=range _bcced .Drawing .Inline {_fdab =append (_fdab ,InlineDrawing {_ddebg ._bdaag ,_gdgd });};};return _fdab ;};
|
|
|
|
// GetChartSpaceByRelId returns a *crt.ChartSpace with the associated relation ID in the
|
|
// document.
|
|
func (_aagf *Document )GetChartSpaceByRelId (relId string )*_cd .ChartSpace {_ecfb :=_aagf ._ebfd .GetTargetByRelId (relId );for _ ,_dagf :=range _aagf ._afgd {if _ecfb ==_dagf .Target (){return _dagf ._gbbda ;};};return nil ;};
|
|
|
|
// Control returns an *axcontrol.Control object contained in the run or the nil value in case of no controls.
|
|
func (_bfbe Run )Control ()*_cb .Control {if _deda :=_bfbe ._abeed .EG_RunInnerContent ;_deda !=nil {if _ddbd :=_deda [0].Object ;_ddbd !=nil {if _cfbaa :=_ddbd .Choice ;_cfbaa !=nil {if _bgbba :=_cfbaa .Control ;_bgbba !=nil {if _bgbba .IdAttr !=nil {_febf :=_bfbe ._bdaag .GetDocRelTargetByID (*_bgbba .IdAttr );for _ ,_cebfe :=range _bfbe ._bdaag ._efd {if _febf ==_cebfe .TargetAttr {return _cebfe ;};};};};};};};return nil ;};
|
|
|
|
// RemoveParagraph removes a paragraph from a footer.
|
|
func (_ceefef Header )RemoveParagraph (p Paragraph ){for _ ,_bcfd :=range _ceefef ._abed .EG_ContentBlockContent {for _gbcg ,_acfg :=range _bcfd .P {if _acfg ==p ._dadg {copy (_bcfd .P [_gbcg :],_bcfd .P [_gbcg +1:]);_bcfd .P =_bcfd .P [0:len (_bcfd .P )-1];return ;};};};};
|
|
|
|
// SetStyle sets the style of a paragraph.
|
|
func (_gbfbf ParagraphProperties )SetStyle (s string ){if s ==""{_gbfbf ._bfdca .PStyle =nil ;}else {_gbfbf ._bfdca .PStyle =_cc .NewCT_String ();_gbfbf ._bfdca .PStyle .ValAttr =s ;};};
|
|
|
|
// GetNumberingLevelByIds returns a NumberingLevel by its NumId and LevelId attributes
|
|
// or an empty one if not found.
|
|
func (_ggfg *Document )GetNumberingLevelByIds (numId ,levelId int64 )NumberingLevel {for _ ,_cdad :=range _ggfg .Numbering ._bedb .Num {if _cdad !=nil &&_cdad .NumIdAttr ==numId {_bffg :=_cdad .AbstractNumId .ValAttr ;for _ ,_caeb :=range _ggfg .Numbering ._bedb .AbstractNum {if _caeb .AbstractNumIdAttr ==_bffg {if _caeb .NumStyleLink !=nil &&len (_caeb .Lvl )==0{if _gcfb ,_gbbg :=_ggfg .Styles .SearchStyleById (_caeb .NumStyleLink .ValAttr );_gbbg {if _gcfb .ParagraphProperties ().NumId ()> -1{return _ggfg .GetNumberingLevelByIds (_gcfb .ParagraphProperties ().NumId (),levelId );};};};for _ ,_ggea :=range _caeb .Lvl {if _ggea .IlvlAttr ==levelId {return NumberingLevel {_ggea };};};};};};};return NumberingLevel {};};
|
|
|
|
// Font returns the name of run font family.
|
|
func (_deed RunProperties )Font ()string {if _caggf :=_deed ._acgcd .RFonts ;_caggf !=nil {if _caggf .AsciiAttr !=nil {return *_caggf .AsciiAttr ;}else if _caggf .HAnsiAttr !=nil {return *_caggf .HAnsiAttr ;}else if _caggf .CsAttr !=nil {return *_caggf .CsAttr ;};};return "";};
|
|
|
|
// SetCharacterSpacing sets the run's Character Spacing Adjustment.
|
|
func (_befed RunProperties )SetCharacterSpacing (size _bd .Distance ){_befed ._acgcd .Spacing =_cc .NewCT_SignedTwipsMeasure ();_befed ._acgcd .Spacing .ValAttr .Int64 =_e .Int64 (int64 (size /_bd .Twips ));};
|
|
|
|
// Name returns the name of the bookmark whcih is the document unique ID that
|
|
// identifies the bookmark.
|
|
func (_deg Bookmark )Name ()string {return _deg ._cdcg .NameAttr };
|
|
|
|
// InsertRunBefore inserts a run in the paragraph before the relative run.
|
|
func (_aaagf Paragraph )InsertRunBefore (relativeTo Run )Run {return _aaagf .insertRun (relativeTo ,true );};
|
|
|
|
// Style returns the style for a paragraph, or an empty string if it is unset.
|
|
func (_gfbage ParagraphProperties )Style ()string {if _gfbage ._bfdca .PStyle !=nil {return _gfbage ._bfdca .PStyle .ValAttr ;};return "";};
|
|
|
|
// GetImageObjByRelId returns a common.Image with the associated relation ID in the
|
|
// document.
|
|
func (_baca *Document )GetImageObjByRelId (relId string )(_acb .Image ,error ){_gfdb :=_baca ._ebfd .GetTargetByRelIdAndType (relId ,_e .ImageType );if _gfdb ==""{for _ ,_cfcbc :=range _baca ._edc {_gfdb =_cfcbc .GetTargetByRelIdAndType (relId ,_e .ImageType );};};if _gfdb ==""{for _ ,_bfcd :=range _baca ._dfa {_gfdb =_bfcd .GetTargetByRelIdAndType (relId ,_e .ImageType );};};return _baca .DocBase .GetImageBytesByTarget (_gfdb );};
|
|
|
|
// AddCheckBox adds checkbox form field to the paragraph and returns it.
|
|
func (_gcaf Paragraph )AddCheckBox (name string )FormField {_cbge :=_gcaf .addFldCharsForField (name ,"\u0046\u004f\u0052M\u0043\u0048\u0045\u0043\u004b\u0042\u004f\u0058");_cbge ._dbfcc .CheckBox =_cc .NewCT_FFCheckBox ();return _cbge ;};
|
|
|
|
// SetKeepOnOnePage controls if all lines in a paragraph are kept on the same
|
|
// page.
|
|
func (_cabb ParagraphStyleProperties )SetKeepOnOnePage (b bool ){if !b {_cabb ._feffd .KeepLines =nil ;}else {_cabb ._feffd .KeepLines =_cc .NewCT_OnOff ();};};
|
|
|
|
// SetRight sets the right border to a specified type, color and thickness.
|
|
func (_ggf CellBorders )SetRight (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_ggf ._cabe .Right =_cc .NewCT_Border ();_bfccc (_ggf ._cabe .Right ,t ,c ,thickness );};
|
|
|
|
// RStyle returns the name of character style.
|
|
// It is defined here http://officeopenxml.com/WPstyleCharStyles.php
|
|
func (_bfgcf RunProperties )RStyle ()string {if _bfgcf ._acgcd .RStyle !=nil {return _bfgcf ._acgcd .RStyle .ValAttr ;};return "";};
|
|
|
|
// SetRightIndent controls right indent of paragraph.
|
|
func (_ecfbe Paragraph )SetRightIndent (m _bd .Distance ){_ecfbe .ensurePPr ();_eadaa :=_ecfbe ._dadg .PPr ;if _eadaa .Ind ==nil {_eadaa .Ind =_cc .NewCT_Ind ();};if m ==_bd .Zero {_eadaa .Ind .RightAttr =nil ;}else {_eadaa .Ind .RightAttr =&_cc .ST_SignedTwipsMeasure {};_eadaa .Ind .RightAttr .Int64 =_e .Int64 (int64 (m /_bd .Twips ));};};
|
|
|
|
// SetWidthPercent sets the cell to a width percentage.
|
|
func (_fbcd CellProperties )SetWidthPercent (pct float64 ){_fbcd ._cbfg .TcW =_cc .NewCT_TblWidth ();_fbcd ._cbfg .TcW .TypeAttr =_cc .ST_TblWidthPct ;_fbcd ._cbfg .TcW .WAttr =&_cc .ST_MeasurementOrPercent {};_fbcd ._cbfg .TcW .WAttr .ST_DecimalNumberOrPercent =&_cc .ST_DecimalNumberOrPercent {};_fbcd ._cbfg .TcW .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_e .Int64 (int64 (pct *50));};
|
|
|
|
// InsertRowAfter inserts a row after another row
|
|
func (_cdgbc Table )InsertRowAfter (r Row )Row {for _aeee ,_dgabd :=range _cdgbc ._fagd .EG_ContentRowContent {if len (_dgabd .Tr )> 0&&r .X ()==_dgabd .Tr [0]{_fdfbf :=_cc .NewEG_ContentRowContent ();if len (_cdgbc ._fagd .EG_ContentRowContent )< _aeee +2{return _cdgbc .AddRow ();};_cdgbc ._fagd .EG_ContentRowContent =append (_cdgbc ._fagd .EG_ContentRowContent ,nil );copy (_cdgbc ._fagd .EG_ContentRowContent [_aeee +2:],_cdgbc ._fagd .EG_ContentRowContent [_aeee +1:]);_cdgbc ._fagd .EG_ContentRowContent [_aeee +1]=_fdfbf ;_ecefg :=_cc .NewCT_Row ();_fdfbf .Tr =append (_fdfbf .Tr ,_ecefg );return Row {_cdgbc ._caff ,_ecefg };};};return _cdgbc .AddRow ();};
|
|
|
|
// GetShapeStyle returns string style of the shape in watermark and format it to ShapeStyle.
|
|
func (_eadec *WatermarkPicture )GetShapeStyle ()_ad .ShapeStyle {if _eadec ._fcggb !=nil &&_eadec ._fcggb .StyleAttr !=nil {return _ad .NewShapeStyle (*_eadec ._fcggb .StyleAttr );};return _ad .NewShapeStyle ("");};
|
|
|
|
// UnderlineColor returns the hex color value of paragraph underline.
|
|
func (_fgefc ParagraphProperties )UnderlineColor ()string {if _fdgf :=_fgefc ._bfdca .RPr .U ;_fdgf !=nil {_ddba :=_fdgf .ColorAttr ;if _ddba !=nil &&_ddba .ST_HexColorRGB !=nil {return *_ddba .ST_HexColorRGB ;};};return "";};
|
|
|
|
// Header is a header for a document section.
|
|
type Header struct{_edgdf *Document ;_abed *_cc .Hdr ;};
|
|
|
|
// SetSpacing sets the spacing that comes before and after the paragraph.
|
|
func (_cacbc ParagraphStyleProperties )SetSpacing (before ,after _bd .Distance ){if _cacbc ._feffd .Spacing ==nil {_cacbc ._feffd .Spacing =_cc .NewCT_Spacing ();};if before ==_bd .Zero {_cacbc ._feffd .Spacing .BeforeAttr =nil ;}else {_cacbc ._feffd .Spacing .BeforeAttr =&_ebd .ST_TwipsMeasure {};_cacbc ._feffd .Spacing .BeforeAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (before /_bd .Twips ));};if after ==_bd .Zero {_cacbc ._feffd .Spacing .AfterAttr =nil ;}else {_cacbc ._feffd .Spacing .AfterAttr =&_ebd .ST_TwipsMeasure {};_cacbc ._feffd .Spacing .AfterAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (after /_bd .Twips ));};};const _fccg ="\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";
|
|
|
|
// StructuredDocumentTag are a tagged bit of content in a document.
|
|
type StructuredDocumentTag struct{_eebg *Document ;_cgdef *_cc .CT_SdtBlock ;};
|
|
|
|
// SetDefaultValue sets the default value of a FormFieldTypeDropDown. For
|
|
// FormFieldTypeDropDown, the value must be one of the fields possible values.
|
|
func (_daad FormField )SetDefaultValue (v string ){if _daad ._dbfcc .DdList !=nil {for _bbgga ,_dgaf :=range _daad .PossibleValues (){if _dgaf ==v {_daad ._dbfcc .DdList .Default =_cc .NewCT_DecimalNumber ();_daad ._dbfcc .DdList .Default .ValAttr =int64 (_bbgga );break ;};};};};
|
|
|
|
// SetASCIITheme sets the font ASCII Theme.
|
|
func (_dgdbd Fonts )SetASCIITheme (t _cc .ST_Theme ){_dgdbd ._dgef .AsciiThemeAttr =t };
|
|
|
|
// SetPageMargins sets the page margins for a section
|
|
func (_gcba Section )SetPageMargins (top ,right ,bottom ,left ,header ,footer ,gutter _bd .Distance ){_fbab :=_cc .NewCT_PageMar ();_fbab .TopAttr .Int64 =_e .Int64 (int64 (top /_bd .Twips ));_fbab .BottomAttr .Int64 =_e .Int64 (int64 (bottom /_bd .Twips ));_fbab .RightAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (right /_bd .Twips ));_fbab .LeftAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (left /_bd .Twips ));_fbab .HeaderAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (header /_bd .Twips ));_fbab .FooterAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (footer /_bd .Twips ));_fbab .GutterAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (gutter /_bd .Twips ));_gcba ._cdac .PgMar =_fbab ;};
|
|
|
|
// RemoveParagraph removes a paragraph from a document.
|
|
func (_gba *Document )RemoveParagraph (p Paragraph ){if _gba ._aeb .Body ==nil {return ;};for _ ,_dffbf :=range _gba ._aeb .Body .EG_BlockLevelElts {for _ ,_eafe :=range _dffbf .EG_ContentBlockContent {for _gege ,_bde :=range _eafe .P {if _bde ==p ._dadg {copy (_eafe .P [_gege :],_eafe .P [_gege +1:]);_eafe .P =_eafe .P [0:len (_eafe .P )-1];return ;};};if _eafe .Sdt !=nil &&_eafe .Sdt .SdtContent !=nil &&_eafe .Sdt .SdtContent .P !=nil {for _fef ,_cfa :=range _eafe .Sdt .SdtContent .P {if _cfa ==p ._dadg {copy (_eafe .P [_fef :],_eafe .P [_fef +1:]);_eafe .P =_eafe .P [0:len (_eafe .P )-1];return ;};};};};};for _ ,_efgf :=range _gba .Tables (){for _ ,_cef :=range _efgf .Rows (){for _ ,_bfgf :=range _cef .Cells (){for _ ,_bbaa :=range _bfgf ._gbb .EG_BlockLevelElts {for _ ,_agdc :=range _bbaa .EG_ContentBlockContent {for _eadf ,_fed :=range _agdc .P {if _fed ==p ._dadg {copy (_agdc .P [_eadf :],_agdc .P [_eadf +1:]);_agdc .P =_agdc .P [0:len (_agdc .P )-1];return ;};};};};};};};for _ ,_cdcfd :=range _gba .Headers (){_cdcfd .RemoveParagraph (p );};for _ ,_geff :=range _gba .Footers (){_geff .RemoveParagraph (p );};};func (_feaa Run )newIC ()*_cc .EG_RunInnerContent {_dcagd :=_cc .NewEG_RunInnerContent ();_feaa ._abeed .EG_RunInnerContent =append (_feaa ._abeed .EG_RunInnerContent ,_dcagd );return _dcagd ;};func _bfacg (_dffg *_cc .CT_P ,_bgf *_cc .CT_Hyperlink ,_ebc *TableInfo ,_bacaa *DrawingInfo ,_aga []*_cc .EG_PContent )[]TextItem {if len (_aga )==0{return []TextItem {TextItem {Text :"",DrawingInfo :_bacaa ,Paragraph :_dffg ,Hyperlink :_bgf ,Run :nil ,TableInfo :_ebc }};};_bbaee :=[]TextItem {};for _ ,_bebc :=range _aga {for _ ,_egaf :=range _bebc .FldSimple {if _egaf !=nil {_bbaee =append (_bbaee ,_bfacg (_dffg ,_bgf ,_ebc ,_bacaa ,_egaf .EG_PContent )...);};};if _cdcge :=_bebc .Hyperlink ;_cdcge !=nil {_bbaee =append (_bbaee ,_bege (_dffg ,_cdcge ,_ebc ,_bacaa ,_cdcge .EG_ContentRunContent )...);};_bbaee =append (_bbaee ,_bege (_dffg ,nil ,_ebc ,_bacaa ,_bebc .EG_ContentRunContent )...);};return _bbaee ;};
|
|
|
|
// X returns the inner wrapped type
|
|
func (_cdcc CellBorders )X ()*_cc .CT_TcBorders {return _cdcc ._cabe };
|
|
|
|
// SetBasedOn sets the style that this style is based on.
|
|
func (_cbcea Style )SetBasedOn (name string ){if name ==""{_cbcea ._bafd .BasedOn =nil ;}else {_cbcea ._bafd .BasedOn =_cc .NewCT_String ();_cbcea ._bafd .BasedOn .ValAttr =name ;};};
|
|
|
|
// SetInsideHorizontal sets the interior horizontal borders to a specified type, color and thickness.
|
|
func (_bbb CellBorders )SetInsideHorizontal (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_bbb ._cabe .InsideH =_cc .NewCT_Border ();_bfccc (_bbb ._cabe .InsideH ,t ,c ,thickness );};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_fdggb TableStyleProperties )X ()*_cc .CT_TblPrBase {return _fdggb ._dfcf };func (_cadd Footnote )id ()int64 {return _cadd ._effcg .IdAttr };
|
|
|
|
// SetKeepWithNext controls if this paragraph should be kept with the next.
|
|
func (_begbf ParagraphProperties )SetKeepWithNext (b bool ){if !b {_begbf ._bfdca .KeepNext =nil ;}else {_begbf ._bfdca .KeepNext =_cc .NewCT_OnOff ();};};func (_adef *Document )validateTableCells ()error {for _ ,_ddda :=range _adef ._aeb .Body .EG_BlockLevelElts {for _ ,_dbgg :=range _ddda .EG_ContentBlockContent {for _ ,_gfc :=range _dbgg .Tbl {for _ ,_gfbbf :=range _gfc .EG_ContentRowContent {for _ ,_abfa :=range _gfbbf .Tr {_faffa :=false ;for _ ,_acgd :=range _abfa .EG_ContentCellContent {_facc :=false ;for _ ,_efga :=range _acgd .Tc {_faffa =true ;for _ ,_efcg :=range _efga .EG_BlockLevelElts {for _ ,_ddgf :=range _efcg .EG_ContentBlockContent {if len (_ddgf .P )> 0{_facc =true ;break ;};};};};if !_facc {return _ea .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 !_faffa {return _ea .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 ;};
|
|
|
|
// RemoveRun removes a child run from a paragraph.
|
|
func (_eggfg Paragraph )RemoveRun (r Run ){for _ ,_ggde :=range _eggfg ._dadg .EG_PContent {for _adefa ,_bgggf :=range _ggde .EG_ContentRunContent {if _bgggf .R ==r ._abeed {copy (_ggde .EG_ContentRunContent [_adefa :],_ggde .EG_ContentRunContent [_adefa +1:]);_ggde .EG_ContentRunContent =_ggde .EG_ContentRunContent [0:len (_ggde .EG_ContentRunContent )-1];};if _bgggf .Sdt !=nil &&_bgggf .Sdt .SdtContent !=nil {for _dfea ,_gedce :=range _bgggf .Sdt .SdtContent .EG_ContentRunContent {if _gedce .R ==r ._abeed {copy (_bgggf .Sdt .SdtContent .EG_ContentRunContent [_dfea :],_bgggf .Sdt .SdtContent .EG_ContentRunContent [_dfea +1:]);_bgggf .Sdt .SdtContent .EG_ContentRunContent =_bgggf .Sdt .SdtContent .EG_ContentRunContent [0:len (_bgggf .Sdt .SdtContent .EG_ContentRunContent )-1];};};};};};};
|
|
|
|
// SetCellSpacingAuto sets the cell spacing within a table to automatic.
|
|
func (_afcfd TableStyleProperties )SetCellSpacingAuto (){_afcfd ._dfcf .TblCellSpacing =_cc .NewCT_TblWidth ();_afcfd ._dfcf .TblCellSpacing .TypeAttr =_cc .ST_TblWidthAuto ;};
|
|
|
|
// Emboss returns true if paragraph emboss is on.
|
|
func (_adgb ParagraphProperties )Emboss ()bool {return _fcaaa (_adgb ._bfdca .RPr .Emboss )};func (_eaaa Paragraph )ensurePPr (){if _eaaa ._dadg .PPr ==nil {_eaaa ._dadg .PPr =_cc .NewCT_PPr ();};};
|
|
|
|
// 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 (_ead AnchoredDrawing )SetOffset (x ,y _bd .Distance ){_ead .SetXOffset (x );_ead .SetYOffset (y )};
|
|
|
|
// SetInsideVertical sets the interior vertical borders to a specified type, color and thickness.
|
|
func (_caaa TableBorders )SetInsideVertical (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_caaa ._bfabb .InsideV =_cc .NewCT_Border ();_bfccc (_caaa ._bfabb .InsideV ,t ,c ,thickness );};
|
|
|
|
// 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 (_gedc Footer )Index ()int {for _ecdb ,_cadbe :=range _gedc ._acab ._ebda {if _cadbe ==_gedc ._gceg {return _ecdb ;};};return -1;};
|
|
|
|
// Row is a row within a table within a document.
|
|
type Row struct{_aeff *Document ;_dbcg *_cc .CT_Row ;};func _cece (_fcfe Paragraph )*_cc .CT_NumPr {_fcfe .ensurePPr ();if _fcfe ._dadg .PPr .NumPr ==nil {return nil ;};return _fcfe ._dadg .PPr .NumPr ;};
|
|
|
|
// SizeValue returns the value of paragraph font size in points.
|
|
func (_dfdg ParagraphProperties )SizeValue ()float64 {if _cffg :=_dfdg ._bfdca .RPr .Sz ;_cffg !=nil {_cdba :=_cffg .ValAttr ;if _cdba .ST_UnsignedDecimalNumber !=nil {return float64 (*_cdba .ST_UnsignedDecimalNumber )/2;};};return 0.0;};
|
|
|
|
// ParagraphBorders allows manipulation of borders on a paragraph.
|
|
type ParagraphBorders struct{_cgebe *Document ;_fgda *_cc .CT_PBdr ;};
|
|
|
|
// SetPicture sets the watermark picture.
|
|
func (_fdaac *WatermarkPicture )SetPicture (imageRef _acb .ImageRef ){_bdbe :=imageRef .RelID ();_cdbb :=_fdaac .getShape ();if _fdaac ._fcggb !=nil {_bacag :=_fdaac ._fcggb .EG_ShapeElements ;if len (_bacag )> 0&&_bacag [0].Imagedata !=nil {_bacag [0].Imagedata .IdAttr =&_bdbe ;};}else {_beec :=_fdaac .findNode (_cdbb ,"\u0069m\u0061\u0067\u0065\u0064\u0061\u0074a");for _defbf ,_ggcf :=range _beec .Attrs {if _ggcf .Name .Local =="\u0069\u0064"{_beec .Attrs [_defbf ].Value =_bdbe ;};};};};
|
|
|
|
// SetKeepOnOnePage controls if all lines in a paragraph are kept on the same
|
|
// page.
|
|
func (_cfecc ParagraphProperties )SetKeepOnOnePage (b bool ){if !b {_cfecc ._bfdca .KeepLines =nil ;}else {_cfecc ._bfdca .KeepLines =_cc .NewCT_OnOff ();};};
|
|
|
|
// AddDropdownList adds dropdown list form field to the paragraph and returns it.
|
|
func (_ebedg Paragraph )AddDropdownList (name string )FormField {_beeb :=_ebedg .addFldCharsForField (name ,"\u0046\u004f\u0052M\u0044\u0052\u004f\u0050\u0044\u004f\u0057\u004e");_beeb ._dbfcc .DdList =_cc .NewCT_FFDDList ();return _beeb ;};
|
|
|
|
// OnOffValue represents an on/off value that can also be unset
|
|
type OnOffValue byte ;
|
|
|
|
// GetImage returns the ImageRef associated with an InlineDrawing.
|
|
func (_gaefa InlineDrawing )GetImage ()(_acb .ImageRef ,bool ){_dbagb :=_gaefa ._faeff .Graphic .GraphicData .Any ;if len (_dbagb )> 0{_begd ,_aabg :=_dbagb [0].(*_fd .Pic );if _aabg {if _begd .BlipFill !=nil &&_begd .BlipFill .Blip !=nil &&_begd .BlipFill .Blip .EmbedAttr !=nil {return _gaefa ._ccfc .GetImageByRelID (*_begd .BlipFill .Blip .EmbedAttr );};};};return _acb .ImageRef {},false ;};func _bfccc (_bfdg *_cc .CT_Border ,_bbgdf _cc .ST_Border ,_bacg _aeg .Color ,_dgge _bd .Distance ){_bfdg .ValAttr =_bbgdf ;_bfdg .ColorAttr =&_cc .ST_HexColor {};if _bacg .IsAuto (){_bfdg .ColorAttr .ST_HexColorAuto =_cc .ST_HexColorAutoAuto ;}else {_bfdg .ColorAttr .ST_HexColorRGB =_bacg .AsRGBString ();};if _dgge !=_bd .Zero {_bfdg .SzAttr =_e .Uint64 (uint64 (_dgge /_bd .Point *8));};};
|
|
|
|
// SetTop sets the cell top margin
|
|
func (_dega CellMargins )SetTop (d _bd .Distance ){_dega ._gdc .Top =_cc .NewCT_TblWidth ();_bfc (_dega ._gdc .Top ,d );};
|
|
|
|
// SetTextWrapSquare sets the text wrap to square with a given wrap type.
|
|
func (_faff AnchoredDrawing )SetTextWrapSquare (t _cc .WdST_WrapText ){_faff ._gg .Choice =&_cc .WdEG_WrapTypeChoice {};_faff ._gg .Choice .WrapSquare =_cc .NewWdCT_WrapSquare ();_faff ._gg .Choice .WrapSquare .WrapTextAttr =t ;};
|
|
|
|
// CharacterSpacingValue returns the value of characters spacing in twips (1/20 of point).
|
|
func (_bgfd ParagraphProperties )CharacterSpacingValue ()int64 {if _feaf :=_bgfd ._bfdca .RPr .Spacing ;_feaf !=nil {_ggbd :=_feaf .ValAttr ;if _ggbd .Int64 !=nil {return *_ggbd .Int64 ;};};return int64 (0);};
|
|
|
|
// 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 (_egbge Paragraph )AddEndnote (text string )Endnote {var _abga int64 ;if _egbge ._gefc .HasEndnotes (){for _ ,_gbgc :=range _egbge ._gefc .Endnotes (){if _gbgc .id ()> _abga {_abga =_gbgc .id ();};};_abga ++;}else {_abga =0;_egbge ._gefc ._cde =&_cc .Endnotes {};};_eeda :=_cc .NewCT_FtnEdn ();_bdcaf :=_cc .NewCT_FtnEdnRef ();_bdcaf .IdAttr =_abga ;_egbge ._gefc ._cde .CT_Endnotes .Endnote =append (_egbge ._gefc ._cde .CT_Endnotes .Endnote ,_eeda );_geca :=_egbge .AddRun ();_becg :=_geca .Properties ();_becg .SetStyle ("\u0045\u006e\u0064\u006e\u006f\u0074\u0065\u0041\u006e\u0063\u0068\u006f\u0072");_geca ._abeed .EG_RunInnerContent =[]*_cc .EG_RunInnerContent {_cc .NewEG_RunInnerContent ()};_geca ._abeed .EG_RunInnerContent [0].EndnoteReference =_bdcaf ;_addg :=Endnote {_egbge ._gefc ,_eeda };_addg ._fcgd .IdAttr =_abga ;_addg ._fcgd .EG_BlockLevelElts =[]*_cc .EG_BlockLevelElts {_cc .NewEG_BlockLevelElts ()};_bgebb :=_addg .AddParagraph ();_bgebb .Properties ().SetStyle ("\u0045n\u0064\u006e\u006f\u0074\u0065");_bgebb ._dadg .PPr .RPr =_cc .NewCT_ParaRPr ();_acbca :=_bgebb .AddRun ();_acbca .AddTab ();_acbca .AddText (text );return _addg ;};
|
|
|
|
// MultiLevelType returns the multilevel type, or ST_MultiLevelTypeUnset if not set.
|
|
func (_bfaaa NumberingDefinition )MultiLevelType ()_cc .ST_MultiLevelType {if _bfaaa ._fabc .MultiLevelType !=nil {return _bfaaa ._fabc .MultiLevelType .ValAttr ;}else {return _cc .ST_MultiLevelTypeUnset ;};};
|
|
|
|
// Bookmarks returns all of the bookmarks defined in the document.
|
|
func (_fdff Document )Bookmarks ()[]Bookmark {if _fdff ._aeb .Body ==nil {return nil ;};_fadc :=[]Bookmark {};for _ ,_gaga :=range _fdff ._aeb .Body .EG_BlockLevelElts {for _ ,_eaffa :=range _gaga .EG_ContentBlockContent {for _ ,_debf :=range _ebbc (_eaffa ){_fadc =append (_fadc ,_debf );};};};return _fadc ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_cffa TableWidth )X ()*_cc .CT_TblWidth {return _cffa ._fcfbc };
|
|
|
|
// PossibleValues returns the possible values for a FormFieldTypeDropDown.
|
|
func (_cacgf FormField )PossibleValues ()[]string {if _cacgf ._dbfcc .DdList ==nil {return nil ;};_dgcf :=[]string {};for _ ,_dceg :=range _cacgf ._dbfcc .DdList .ListEntry {if _dceg ==nil {continue ;};_dgcf =append (_dgcf ,_dceg .ValAttr );};return _dgcf ;};
|
|
|
|
// StyleID returns the style ID.
|
|
func (_abggc Style )StyleID ()string {if _abggc ._bafd .StyleIdAttr ==nil {return "";};return *_abggc ._bafd .StyleIdAttr ;};
|
|
|
|
// Themes returns document's themes.
|
|
func (_gaac *Document )Themes ()[]*_cg .Theme {return _gaac ._agc };
|
|
|
|
// Styles is the document wide styles contained in styles.xml.
|
|
type Styles struct{_ecgbf *_cc .Styles };
|
|
|
|
// AddBreak adds a line break to a run.
|
|
func (_ebcb Run )AddBreak (){_bgdda :=_ebcb .newIC ();_bgdda .Br =_cc .NewCT_Br ()};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_gfbdd Numbering )X ()*_cc .Numbering {return _gfbdd ._bedb };
|
|
|
|
// Endnotes returns the endnotes defined in the document.
|
|
func (_dcdac *Document )Endnotes ()[]Endnote {_gga :=[]Endnote {};for _ ,_adf :=range _dcdac ._cde .CT_Endnotes .Endnote {_gga =append (_gga ,Endnote {_dcdac ,_adf });};return _gga ;};
|
|
|
|
// InlineDrawing is an inlined image within a run.
|
|
type InlineDrawing struct{_ccfc *Document ;_faeff *_cc .WdInline ;};
|
|
|
|
// AddDrawingInline adds an inline drawing from an ImageRef.
|
|
func (_fddea Run )AddDrawingInline (img _acb .ImageRef )(InlineDrawing ,error ){_gaacf :=_fddea .newIC ();_gaacf .Drawing =_cc .NewCT_Drawing ();_eagg :=_cc .NewWdInline ();_caaf :=InlineDrawing {_fddea ._bdaag ,_eagg };_eagg .CNvGraphicFramePr =_cg .NewCT_NonVisualGraphicFrameProperties ();_gaacf .Drawing .Inline =append (_gaacf .Drawing .Inline ,_eagg );_eagg .Graphic =_cg .NewGraphic ();_eagg .Graphic .GraphicData =_cg .NewCT_GraphicalObjectData ();_eagg .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";_eagg .DistTAttr =_e .Uint32 (0);_eagg .DistLAttr =_e .Uint32 (0);_eagg .DistBAttr =_e .Uint32 (0);_eagg .DistRAttr =_e .Uint32 (0);_eagg .Extent .CxAttr =int64 (float64 (img .Size ().X *_bd .Pixel72 )/_bd .EMU );_eagg .Extent .CyAttr =int64 (float64 (img .Size ().Y *_bd .Pixel72 )/_bd .EMU );_acad :=0x7FFFFFFF&_eg .Uint32 ();_eagg .DocPr .IdAttr =_acad ;_fbgb :=_fd .NewPic ();_fbgb .NvPicPr .CNvPr .IdAttr =_acad ;_ddcdg :=img .RelID ();if _ddcdg ==""{return _caaf ,_ea .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");};_eagg .Graphic .GraphicData .Any =append (_eagg .Graphic .GraphicData .Any ,_fbgb );_fbgb .BlipFill =_cg .NewCT_BlipFillProperties ();_fbgb .BlipFill .Blip =_cg .NewCT_Blip ();_fbgb .BlipFill .Blip .EmbedAttr =&_ddcdg ;_fbgb .BlipFill .Stretch =_cg .NewCT_StretchInfoProperties ();_fbgb .BlipFill .Stretch .FillRect =_cg .NewCT_RelativeRect ();_fbgb .SpPr =_cg .NewCT_ShapeProperties ();_fbgb .SpPr .Xfrm =_cg .NewCT_Transform2D ();_fbgb .SpPr .Xfrm .Off =_cg .NewCT_Point2D ();_fbgb .SpPr .Xfrm .Off .XAttr .ST_CoordinateUnqualified =_e .Int64 (0);_fbgb .SpPr .Xfrm .Off .YAttr .ST_CoordinateUnqualified =_e .Int64 (0);_fbgb .SpPr .Xfrm .Ext =_cg .NewCT_PositiveSize2D ();_fbgb .SpPr .Xfrm .Ext .CxAttr =int64 (img .Size ().X *_bd .Point );_fbgb .SpPr .Xfrm .Ext .CyAttr =int64 (img .Size ().Y *_bd .Point );_fbgb .SpPr .PrstGeom =_cg .NewCT_PresetGeometry2D ();_fbgb .SpPr .PrstGeom .PrstAttr =_cg .ST_ShapeTypeRect ;return _caaf ,nil ;};
|
|
|
|
// GetWrapPathLineTo return wrapPath lineTo value.
|
|
func (_ebf AnchorDrawWrapOptions )GetWrapPathLineTo ()[]*_cg .CT_Point2D {return _ebf ._egd };
|
|
|
|
// NumId return numbering numId that being use by style properties.
|
|
func (_bdbdd ParagraphStyleProperties )NumId ()int64 {if _bdbdd ._feffd .NumPr !=nil {if _bdbdd ._feffd .NumPr .NumId !=nil {return _bdbdd ._feffd .NumPr .NumId .ValAttr ;};};return -1;};
|
|
|
|
// SetLeftIndent controls the left indent of the paragraph.
|
|
func (_gbdb ParagraphStyleProperties )SetLeftIndent (m _bd .Distance ){if _gbdb ._feffd .Ind ==nil {_gbdb ._feffd .Ind =_cc .NewCT_Ind ();};if m ==_bd .Zero {_gbdb ._feffd .Ind .LeftAttr =nil ;}else {_gbdb ._feffd .Ind .LeftAttr =&_cc .ST_SignedTwipsMeasure {};_gbdb ._feffd .Ind .LeftAttr .Int64 =_e .Int64 (int64 (m /_bd .Twips ));};};
|
|
|
|
// AddParagraph adds a new paragraph to the document body.
|
|
func (_agecf *Document )AddParagraph ()Paragraph {_dafd :=_cc .NewEG_BlockLevelElts ();_agecf ._aeb .Body .EG_BlockLevelElts =append (_agecf ._aeb .Body .EG_BlockLevelElts ,_dafd );_bffd :=_cc .NewEG_ContentBlockContent ();_dafd .EG_ContentBlockContent =append (_dafd .EG_ContentBlockContent ,_bffd );_fgg :=_cc .NewCT_P ();_bffd .P =append (_bffd .P ,_fgg );return Paragraph {_agecf ,_fgg };};
|
|
|
|
// SetSize sets the font size for a run.
|
|
func (_cgcdb RunProperties )SetSize (size _bd .Distance ){_cgcdb ._acgcd .Sz =_cc .NewCT_HpsMeasure ();_cgcdb ._acgcd .Sz .ValAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (size /_bd .HalfPoint ));_cgcdb ._acgcd .SzCs =_cc .NewCT_HpsMeasure ();_cgcdb ._acgcd .SzCs .ValAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (size /_bd .HalfPoint ));};
|
|
|
|
// CellProperties are a table cells properties within a document.
|
|
type CellProperties struct{_cbfg *_cc .CT_TcPr };
|
|
|
|
// SetAll sets all of the borders to a given value.
|
|
func (_cbfaf ParagraphBorders )SetAll (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_cbfaf .SetBottom (t ,c ,thickness );_cbfaf .SetLeft (t ,c ,thickness );_cbfaf .SetRight (t ,c ,thickness );_cbfaf .SetTop (t ,c ,thickness );};
|
|
|
|
// SetBottom sets the bottom border to a specified type, color and thickness.
|
|
func (_bggc TableBorders )SetBottom (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_bggc ._bfabb .Bottom =_cc .NewCT_Border ();_bfccc (_bggc ._bfabb .Bottom ,t ,c ,thickness );};
|
|
|
|
// SetTargetByRef sets the URL target of the hyperlink and is more efficient if a link
|
|
// destination will be used many times.
|
|
func (_gdeb HyperLink )SetTargetByRef (link _acb .Hyperlink ){_gdeb ._bfde .IdAttr =_e .String (_acb .Relationship (link ).ID ());_gdeb ._bfde .AnchorAttr =nil ;};
|
|
|
|
// GetText returns text in the watermark.
|
|
func (_egecb *WatermarkText )GetText ()string {_faabb :=_egecb .getShape ();if _egecb ._eeced !=nil {_aebg :=_egecb ._eeced .EG_ShapeElements ;if len (_aebg )> 0&&_aebg [0].Textpath !=nil {return *_aebg [0].Textpath .StringAttr ;};}else {_cbdfe :=_egecb .findNode (_faabb ,"\u0074\u0065\u0078\u0074\u0070\u0061\u0074\u0068");for _ ,_acgg :=range _cbdfe .Attrs {if _acgg .Name .Local =="\u0073\u0074\u0072\u0069\u006e\u0067"{return _acgg .Value ;};};};return "";};
|
|
|
|
// InsertParagraphAfter adds a new empty paragraph after the relativeTo
|
|
// paragraph.
|
|
func (_gaae *Document )InsertParagraphAfter (relativeTo Paragraph )Paragraph {return _gaae .insertParagraph (relativeTo ,false );};func (_fea *chart )RelId ()string {return _fea ._cag };
|
|
|
|
// SetBottomPct sets the cell bottom margin
|
|
func (_fe CellMargins )SetBottomPct (pct float64 ){_fe ._gdc .Bottom =_cc .NewCT_TblWidth ();_bea (_fe ._gdc .Bottom ,pct );};
|
|
|
|
// Bold returns true if paragraph font is bold.
|
|
func (_ebdad ParagraphProperties )Bold ()bool {_eeef :=_ebdad ._bfdca .RPr ;return _fcaaa (_eeef .B )||_fcaaa (_eeef .BCs );};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_bdad Footnote )X ()*_cc .CT_FtnEdn {return _bdad ._effcg };
|
|
|
|
// ParagraphStyles returns only the paragraph styles.
|
|
func (_dffed Styles )ParagraphStyles ()[]Style {_ddedf :=[]Style {};for _ ,_fggd :=range _dffed ._ecgbf .Style {if _fggd .TypeAttr !=_cc .ST_StyleTypeParagraph {continue ;};_ddedf =append (_ddedf ,Style {_fggd });};return _ddedf ;};
|
|
|
|
// MergeFields returns the list of all mail merge fields found in the document.
|
|
func (_caed Document )MergeFields ()[]string {_gaaef :=map[string ]struct{}{};for _ ,_bgbea :=range _caed .mergeFields (){_gaaef [_bgbea ._ffedf ]=struct{}{};};_fgbfd :=[]string {};for _ccbd :=range _gaaef {_fgbfd =append (_fgbfd ,_ccbd );};return _fgbfd ;};
|
|
|
|
// SetLeft sets the cell left margin
|
|
func (_ag CellMargins )SetLeft (d _bd .Distance ){_ag ._gdc .Left =_cc .NewCT_TblWidth ();_bfc (_ag ._gdc .Left ,d );};
|
|
|
|
// TableLook is the conditional formatting associated with a table style that
|
|
// has been assigned to a table.
|
|
type TableLook struct{_gbfc *_cc .CT_TblLook };
|
|
|
|
// ParagraphProperties are the properties for a paragraph.
|
|
type ParagraphProperties struct{_bacb *Document ;_bfdca *_cc .CT_PPr ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_geead Paragraph )X ()*_cc .CT_P {return _geead ._dadg };func _gacfc ()*_af .Path {_dbcc :=_af .NewPath ();_dbcc .ExtrusionokAttr =_ebd .ST_TrueFalseTrue ;_dbcc .GradientshapeokAttr =_ebd .ST_TrueFalseTrue ;_dbcc .ConnecttypeAttr =_af .OfcST_ConnectTypeRect ;return _dbcc ;};
|
|
|
|
// Levels returns all of the numbering levels defined in the definition.
|
|
func (_gefg NumberingDefinition )Levels ()[]NumberingLevel {_ggab :=[]NumberingLevel {};for _ ,_fecf :=range _gefg ._fabc .Lvl {_ggab =append (_ggab ,NumberingLevel {_fecf });};return _ggab ;};
|
|
|
|
// SetStyle sets style to the text in watermark.
|
|
func (_aaed *WatermarkText )SetStyle (style _ad .TextpathStyle ){_fbcdf :=_aaed .getShape ();if _aaed ._eeced !=nil {_bfdgg :=_aaed ._eeced .EG_ShapeElements ;if len (_bfdgg )> 0&&_bfdgg [0].Textpath !=nil {var _cedcf =style .String ();_bfdgg [0].Textpath .StyleAttr =&_cedcf ;};return ;};_gedd :=_aaed .findNode (_fbcdf ,"\u0074\u0065\u0078\u0074\u0070\u0061\u0074\u0068");for _ggbdd ,_fbefd :=range _gedd .Attrs {if _fbefd .Name .Local =="\u0073\u0074\u0079l\u0065"{_gedd .Attrs [_ggbdd ].Value =style .String ();};};};
|
|
|
|
// RunProperties returns the RunProperties controlling numbering level font, etc.
|
|
func (_agfb NumberingLevel )RunProperties ()RunProperties {if _agfb ._befe .RPr ==nil {_agfb ._befe .RPr =_cc .NewCT_RPr ();};return RunProperties {_agfb ._befe .RPr };};
|
|
|
|
// SetVAlignment sets the vertical alignment for an anchored image.
|
|
func (_ggd AnchoredDrawing )SetVAlignment (v _cc .WdST_AlignV ){_ggd ._gg .PositionV .Choice =&_cc .WdCT_PosVChoice {};_ggd ._gg .PositionV .Choice .Align =v ;};
|
|
|
|
// FindNodeByCondition return node based on condition function,
|
|
// if wholeElements is true, its will extract childs as next node elements.
|
|
func (_eafef *Nodes )FindNodeByCondition (f func (_eebdd *Node )bool ,wholeElements bool )[]Node {_aadfe :=[]Node {};for _ ,_gcbc :=range _eafef ._cebe {if f (&_gcbc ){_aadfe =append (_aadfe ,_gcbc );};if wholeElements {_bgcb :=Nodes {_cebe :_gcbc .Children };_aadfe =append (_aadfe ,_bgcb .FindNodeByCondition (f ,wholeElements )...);};};return _aadfe ;};
|
|
|
|
// SetNumberingLevel sets the numbering level of a paragraph. If used, then the
|
|
// NumberingDefinition must also be set via SetNumberingDefinition or
|
|
// SetNumberingDefinitionByID.
|
|
func (_gfbg Paragraph )SetNumberingLevel (listLevel int ){_gfbg .ensurePPr ();if _gfbg ._dadg .PPr .NumPr ==nil {_gfbg ._dadg .PPr .NumPr =_cc .NewCT_NumPr ();};_befgg :=_cc .NewCT_DecimalNumber ();_befgg .ValAttr =int64 (listLevel );_gfbg ._dadg .PPr .NumPr .Ilvl =_befgg ;};
|
|
|
|
// Properties returns the table properties.
|
|
func (_egca Table )Properties ()TableProperties {if _egca ._fagd .TblPr ==nil {_egca ._fagd .TblPr =_cc .NewCT_TblPr ();};return TableProperties {_egca ._fagd .TblPr };};
|
|
|
|
// Table is a table within a document.
|
|
type Table struct{_caff *Document ;_fagd *_cc .CT_Tbl ;};
|
|
|
|
// Properties returns the row properties.
|
|
func (_dfae Row )Properties ()RowProperties {if _dfae ._dbcg .TrPr ==nil {_dfae ._dbcg .TrPr =_cc .NewCT_TrPr ();};return RowProperties {_dfae ._dbcg .TrPr };};
|
|
|
|
// AddHeader creates a header associated with the document, but doesn't add it
|
|
// to the document for display.
|
|
func (_fg *Document )AddHeader ()Header {_aea :=_cc .NewHdr ();_fg ._dgbf =append (_fg ._dgbf ,_aea );_dbd :=_gb .Sprintf ("\u0068\u0065\u0061d\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c",len (_fg ._dgbf ));_fg ._ebfd .AddRelationship (_dbd ,_e .HeaderType );_fg .ContentTypes .AddOverride ("\u002f\u0077\u006f\u0072\u0064\u002f"+_dbd ,"\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");_fg ._edc =append (_fg ._edc ,_acb .NewRelationships ());return Header {_fg ,_aea };};
|
|
|
|
// 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 (_abccd Paragraph )AddBookmark (name string )Bookmark {_egee :=_cc .NewEG_PContent ();_gbaa :=_cc .NewEG_ContentRunContent ();_egee .EG_ContentRunContent =append (_egee .EG_ContentRunContent ,_gbaa );_gcdd :=_cc .NewEG_RunLevelElts ();_gbaa .EG_RunLevelElts =append (_gbaa .EG_RunLevelElts ,_gcdd );_cegc :=_cc .NewEG_RangeMarkupElements ();_faed :=_cc .NewCT_Bookmark ();_cegc .BookmarkStart =_faed ;_gcdd .EG_RangeMarkupElements =append (_gcdd .EG_RangeMarkupElements ,_cegc );_cegc =_cc .NewEG_RangeMarkupElements ();_cegc .BookmarkEnd =_cc .NewCT_MarkupRange ();_gcdd .EG_RangeMarkupElements =append (_gcdd .EG_RangeMarkupElements ,_cegc );_abccd ._dadg .EG_PContent =append (_abccd ._dadg .EG_PContent ,_egee );_fedf :=Bookmark {_faed };_fedf .SetName (name );return _fedf ;};
|
|
|
|
// SetKerning sets the run's font kerning.
|
|
func (_eded RunProperties )SetKerning (size _bd .Distance ){_eded ._acgcd .Kern =_cc .NewCT_HpsMeasure ();_eded ._acgcd .Kern .ValAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (size /_bd .HalfPoint ));};
|
|
|
|
// 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 (_dgbg Paragraph )AddFootnote (text string )Footnote {var _cbdfg int64 ;if _dgbg ._gefc .HasFootnotes (){for _ ,_bgde :=range _dgbg ._gefc .Footnotes (){if _bgde .id ()> _cbdfg {_cbdfg =_bgde .id ();};};_cbdfg ++;}else {_cbdfg =0;_dgbg ._gefc ._cdg =&_cc .Footnotes {};_dgbg ._gefc ._cdg .CT_Footnotes =_cc .CT_Footnotes {};_dgbg ._gefc ._cdg .Footnote =make ([]*_cc .CT_FtnEdn ,0);};_edgea :=_cc .NewCT_FtnEdn ();_eed :=_cc .NewCT_FtnEdnRef ();_eed .IdAttr =_cbdfg ;_dgbg ._gefc ._cdg .CT_Footnotes .Footnote =append (_dgbg ._gefc ._cdg .CT_Footnotes .Footnote ,_edgea );_faea :=_dgbg .AddRun ();_eage :=_faea .Properties ();_eage .SetStyle ("\u0046\u006f\u006f\u0074\u006e\u006f\u0074\u0065\u0041n\u0063\u0068\u006f\u0072");_faea ._abeed .EG_RunInnerContent =[]*_cc .EG_RunInnerContent {_cc .NewEG_RunInnerContent ()};_faea ._abeed .EG_RunInnerContent [0].FootnoteReference =_eed ;_ceaag :=Footnote {_dgbg ._gefc ,_edgea };_ceaag ._effcg .IdAttr =_cbdfg ;_ceaag ._effcg .EG_BlockLevelElts =[]*_cc .EG_BlockLevelElts {_cc .NewEG_BlockLevelElts ()};_faeec :=_ceaag .AddParagraph ();_faeec .Properties ().SetStyle ("\u0046\u006f\u006f\u0074\u006e\u006f\u0074\u0065");_faeec ._dadg .PPr .RPr =_cc .NewCT_ParaRPr ();_eacf :=_faeec .AddRun ();_eacf .AddTab ();_eacf .AddText (text );return _ceaag ;};func _debd ()*_af .OfcLock {_ffcg :=_af .NewOfcLock ();_ffcg .ExtAttr =_af .ST_ExtEdit ;_ffcg .TextAttr =_ebd .ST_TrueFalseTrue ;_ffcg .ShapetypeAttr =_ebd .ST_TrueFalseTrue ;return _ffcg ;};func (_gecca Paragraph )addBeginFldChar (_gcade string )*_cc .CT_FFData {_fced :=_gecca .addFldChar ();_fced .FldCharTypeAttr =_cc .ST_FldCharTypeBegin ;_fced .FfData =_cc .NewCT_FFData ();_efgfb :=_cc .NewCT_FFName ();_efgfb .ValAttr =&_gcade ;_fced .FfData .Name =[]*_cc .CT_FFName {_efgfb };return _fced .FfData ;};
|
|
|
|
// Open opens and reads a document from a file (.docx).
|
|
func Open (filename string )(*Document ,error ){_gaag ,_edd :=_fa .Open (filename );if _edd !=nil {return nil ,_gb .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,_edd );};defer _gaag .Close ();_adbe ,_edd :=_fa .Stat (filename );if _edd !=nil {return nil ,_gb .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,_edd );};_ =_adbe ;return Read (_gaag ,_adbe .Size ());};
|
|
|
|
// AddLevel adds a new numbering level to a NumberingDefinition.
|
|
func (_bfagf NumberingDefinition )AddLevel ()NumberingLevel {_fgbe :=_cc .NewCT_Lvl ();_fgbe .Start =&_cc .CT_DecimalNumber {ValAttr :1};_fgbe .IlvlAttr =int64 (len (_bfagf ._fabc .Lvl ));_bfagf ._fabc .Lvl =append (_bfagf ._fabc .Lvl ,_fgbe );return NumberingLevel {_fgbe };};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_dgba Style )X ()*_cc .CT_Style {return _dgba ._bafd };
|
|
|
|
// Properties returns the numbering level paragraph properties.
|
|
func (_cddfc NumberingLevel )Properties ()ParagraphStyleProperties {if _cddfc ._befe .PPr ==nil {_cddfc ._befe .PPr =_cc .NewCT_PPrGeneral ();};return ParagraphStyleProperties {_cddfc ._befe .PPr };};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_cedcg Table )X ()*_cc .CT_Tbl {return _cedcg ._fagd };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_bfcff InlineDrawing )X ()*_cc .WdInline {return _bfcff ._faeff };
|
|
|
|
// AddTab adds tab to a run and can be used with the the Paragraph's tab stops.
|
|
func (_cfcef Run )AddTab (){_fegf :=_cfcef .newIC ();_fegf .Tab =_cc .NewCT_Empty ()};
|
|
|
|
// AddRow adds a row to a table.
|
|
func (_cfbf Table )AddRow ()Row {_eadae :=_cc .NewEG_ContentRowContent ();_cfbf ._fagd .EG_ContentRowContent =append (_cfbf ._fagd .EG_ContentRowContent ,_eadae );_cede :=_cc .NewCT_Row ();_eadae .Tr =append (_eadae .Tr ,_cede );return Row {_cfbf ._caff ,_cede };};
|
|
|
|
// FindNodeByText return node based on matched text and return a slice of node.
|
|
func (_cfga *Nodes )FindNodeByRegexp (r *_f .Regexp )[]Node {_bfgg :=[]Node {};for _ ,_bgef :=range _cfga ._cebe {if r .MatchString (_bgef .Text ()){_bfgg =append (_bfgg ,_bgef );};_dgfa :=Nodes {_cebe :_bgef .Children };_bfgg =append (_bfgg ,_dgfa .FindNodeByRegexp (r )...);};return _bfgg ;};
|
|
|
|
// SetLeftIndent controls left indent of paragraph.
|
|
func (_adca Paragraph )SetLeftIndent (m _bd .Distance ){_adca .ensurePPr ();_adecd :=_adca ._dadg .PPr ;if _adecd .Ind ==nil {_adecd .Ind =_cc .NewCT_Ind ();};if m ==_bd .Zero {_adecd .Ind .LeftAttr =nil ;}else {_adecd .Ind .LeftAttr =&_cc .ST_SignedTwipsMeasure {};_adecd .Ind .LeftAttr .Int64 =_e .Int64 (int64 (m /_bd .Twips ));};};
|
|
|
|
// RowProperties are the properties for a row within a table
|
|
type RowProperties struct{_gddc *_cc .CT_TrPr };
|
|
|
|
// 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 (_ebga *Document )BodySection ()Section {if _ebga ._aeb .Body .SectPr ==nil {_ebga ._aeb .Body .SectPr =_cc .NewCT_SectPr ();};return Section {_ebga ,_ebga ._aeb .Body .SectPr };};func _cdde ()*_af .Textpath {_fdeaa :=_af .NewTextpath ();_fdeaa .OnAttr =_ebd .ST_TrueFalseTrue ;_fdeaa .FitshapeAttr =_ebd .ST_TrueFalseTrue ;return _fdeaa ;};func (_bgfbb *WatermarkText )getShape ()*_e .XSDAny {return _bgfbb .getInnerElement ("\u0073\u0068\u0061p\u0065");};
|
|
|
|
// AddTextInput adds text input form field to the paragraph and returns it.
|
|
func (_fbcdc Paragraph )AddTextInput (name string )FormField {_dbbc :=_fbcdc .addFldCharsForField (name ,"\u0046\u004f\u0052\u004d\u0054\u0045\u0058\u0054");_dbbc ._dbfcc .TextInput =_cc .NewCT_FFTextInput ();return _dbbc ;};
|
|
|
|
// Underline returns the type of run underline.
|
|
func (_fgddb RunProperties )Underline ()_cc .ST_Underline {if _deaa :=_fgddb ._acgcd .U ;_deaa !=nil {return _deaa .ValAttr ;};return 0;};
|
|
|
|
// SetLineSpacing controls the line spacing of the paragraph.
|
|
func (_dgaee ParagraphStyleProperties )SetLineSpacing (m _bd .Distance ,rule _cc .ST_LineSpacingRule ){if _dgaee ._feffd .Spacing ==nil {_dgaee ._feffd .Spacing =_cc .NewCT_Spacing ();};if rule ==_cc .ST_LineSpacingRuleUnset {_dgaee ._feffd .Spacing .LineRuleAttr =_cc .ST_LineSpacingRuleUnset ;_dgaee ._feffd .Spacing .LineAttr =nil ;}else {_dgaee ._feffd .Spacing .LineRuleAttr =rule ;_dgaee ._feffd .Spacing .LineAttr =&_cc .ST_SignedTwipsMeasure {};_dgaee ._feffd .Spacing .LineAttr .Int64 =_e .Int64 (int64 (m /_bd .Twips ));};};
|
|
|
|
// SetTextStyleBold set text style of watermark to bold.
|
|
func (_cfgaa *WatermarkText )SetTextStyleBold (value bool ){if _cfgaa ._eeced !=nil {_bfdcfg :=_cfgaa .GetStyle ();_bfdcfg .SetBold (value );_cfgaa .SetStyle (_bfdcfg );};};func (_fdfc FormFieldType )String ()string {if _fdfc >=FormFieldType (len (_dddc )-1){return _gb .Sprintf ("\u0046\u006f\u0072\u006d\u0046\u0069\u0065\u006c\u0064\u0054\u0079\u0070e\u0028\u0025\u0064\u0029",_fdfc );};return _fccg [_dddc [_fdfc ]:_dddc [_fdfc +1]];};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_adgc RunProperties )X ()*_cc .CT_RPr {return _adgc ._acgcd };
|
|
|
|
// ExtractTextOptions extraction text options.
|
|
type ExtractTextOptions struct{
|
|
|
|
// WithNumbering extract numbering elements if set to `true`.
|
|
WithNumbering bool ;
|
|
|
|
// NumberingIndent default value of numbering indent.
|
|
NumberingIndent string ;
|
|
|
|
// RunsOnNewLine write each of runs text on new line if set to `true`.
|
|
RunsOnNewLine bool ;};
|
|
|
|
// Footnote returns the footnote based on the ID; this can be used nicely with
|
|
// the run.IsFootnote() functionality.
|
|
func (_abbe *Document )Footnote (id int64 )Footnote {for _ ,_ebdb :=range _abbe .Footnotes (){if _ebdb .id ()==id {return _ebdb ;};};return Footnote {};};
|
|
|
|
// PutNodeBefore put node to position before relativeTo.
|
|
func (_cbcb *Document )PutNodeBefore (relativeTo ,node Node ){_cbcb .putNode (relativeTo ,node ,true )};
|
|
|
|
// 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 (_accc Header )AddImage (i _acb .Image )(_acb .ImageRef ,error ){var _ebed _acb .Relationships ;for _abbg ,_cacd :=range _accc ._edgdf ._dgbf {if _cacd ==_accc ._abed {_ebed =_accc ._edgdf ._edc [_abbg ];};};_adec :=_acb .MakeImageRef (i ,&_accc ._edgdf .DocBase ,_ebed );if i .Data ==nil &&i .Path ==""{return _adec ,_ea .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 _adec ,_ea .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 _adec ,_ea .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");};_accc ._edgdf .Images =append (_accc ._edgdf .Images ,_adec );_gaefd :=_gb .Sprintf ("\u006d\u0065d\u0069\u0061\u002fi\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073",len (_accc ._edgdf .Images ),i .Format );_eeca :=_ebed .AddRelationship (_gaefd ,_e .ImageType );_adec .SetRelID (_eeca .X ().IdAttr );return _adec ,nil ;};func _bege (_cfec *_cc .CT_P ,_cfad *_cc .CT_Hyperlink ,_acde *TableInfo ,_edcc *DrawingInfo ,_gaacd []*_cc .EG_ContentRunContent )[]TextItem {_adbbfd :=[]TextItem {};for _ ,_bdge :=range _gaacd {if _dcdf :=_bdge .Sdt ;_dcdf !=nil {if _afbd :=_dcdf .SdtContent ;_afbd !=nil {_adbbfd =append (_adbbfd ,_bege (_cfec ,_cfad ,_acde ,_edcc ,_afbd .EG_ContentRunContent )...);};};if _dccb :=_bdge .R ;_dccb !=nil {_abecc :=_de .NewBuffer ([]byte {});for _ ,_bacd :=range _dccb .EG_RunInnerContent {if _bacd .Br !=nil {_abecc .WriteString ("\u000a");};if _bacd .Tab !=nil {_abecc .WriteString ("\u0009");};if _bacd .T !=nil &&_bacd .T .Content !=""{_abecc .WriteString (_bacd .T .Content );};if _bacd .Pict !=nil &&len (_bacd .Pict .Any )> 0{for _ ,_edec :=range _bacd .Pict .Any {if _cbfa ,_fbeg :=_edec .(*_af .Shape );_fbeg {for _ ,_dbgc :=range _cbfa .EG_ShapeElements {if _bfbf :=_dbgc .Textbox ;_bfbf !=nil {if _bfbf .TxbxContent !=nil {_adbbfd =append (_adbbfd ,_bgeec (_bfbf .TxbxContent .EG_ContentBlockContent ,nil )...);};};};};};};};_adbbfd =append (_adbbfd ,TextItem {Text :_abecc .String (),DrawingInfo :_edcc ,Paragraph :_cfec ,Hyperlink :_cfad ,Run :_dccb ,TableInfo :_acde });for _ ,_fdbc :=range _dccb .Extra {if _efee ,_ecbcc :=_fdbc .(*_cc .AlternateContentRun );_ecbcc {_defeb :=&DrawingInfo {Drawing :_efee .Choice .Drawing };for _ ,_cdb :=range _defeb .Drawing .Anchor {for _ ,_gbfaa :=range _cdb .Graphic .GraphicData .Any {if _cdeg ,_fada :=_gbfaa .(*_cc .WdWsp );_fada {if _cdeg .WChoice !=nil {if _abfb :=_cdeg .SpPr ;_abfb !=nil {if _gfe :=_abfb .Xfrm ;_gfe !=nil {if _ggaf :=_gfe .Ext ;_ggaf !=nil {_defeb .Width =_ggaf .CxAttr ;_defeb .Height =_ggaf .CyAttr ;};};};for _ ,_cfbd :=range _cdeg .WChoice .Txbx .TxbxContent .EG_ContentBlockContent {_adbbfd =append (_adbbfd ,_egaa (_cfbd .P ,_acde ,_defeb )...);};};};};};};};};};return _adbbfd ;};
|
|
|
|
// AddCell adds a cell to a row and returns it
|
|
func (_egec Row )AddCell ()Cell {_bafg :=_cc .NewEG_ContentCellContent ();_egec ._dbcg .EG_ContentCellContent =append (_egec ._dbcg .EG_ContentCellContent ,_bafg );_dgaeb :=_cc .NewCT_Tc ();_bafg .Tc =append (_bafg .Tc ,_dgaeb );return Cell {_egec ._aeff ,_dgaeb };};
|
|
|
|
// SaveToFile writes the document out to a file.
|
|
func (_ffb *Document )SaveToFile (path string )error {_cbdef ,_fcc :=_fa .Create (path );if _fcc !=nil {return _fcc ;};defer _cbdef .Close ();return _ffb .Save (_cbdef );};func _fcaaa (_eebdf *_cc .CT_OnOff )bool {return _eebdf !=nil };
|
|
|
|
// Caps returns true if paragraph font is capitalized.
|
|
func (_ebaa ParagraphProperties )Caps ()bool {return _fcaaa (_ebaa ._bfdca .RPr .Caps )};func (_acda Paragraph )addEndBookmark (_ggfe int64 )*_cc .CT_MarkupRange {_cgfg :=_cc .NewEG_PContent ();_acda ._dadg .EG_PContent =append (_acda ._dadg .EG_PContent ,_cgfg );_ffad :=_cc .NewEG_ContentRunContent ();_cbae :=_cc .NewEG_RunLevelElts ();_fcdeg :=_cc .NewEG_RangeMarkupElements ();_eecdg :=_cc .NewCT_MarkupRange ();_eecdg .IdAttr =_ggfe ;_fcdeg .BookmarkEnd =_eecdg ;_cgfg .EG_ContentRunContent =append (_cgfg .EG_ContentRunContent ,_ffad );_ffad .EG_RunLevelElts =append (_ffad .EG_RunLevelElts ,_cbae );_cbae .EG_RangeMarkupElements =append (_cbae .EG_RangeMarkupElements ,_fcdeg );return _eecdg ;};
|
|
|
|
// X return slice of node.
|
|
func (_cabg *Nodes )X ()[]Node {return _cabg ._cebe };
|
|
|
|
// SetFontFamily sets the Ascii & HAnsi fonly family for a run.
|
|
func (_ddefc RunProperties )SetFontFamily (family string ){if _ddefc ._acgcd .RFonts ==nil {_ddefc ._acgcd .RFonts =_cc .NewCT_Fonts ();};_ddefc ._acgcd .RFonts .AsciiAttr =_e .String (family );_ddefc ._acgcd .RFonts .HAnsiAttr =_e .String (family );_ddefc ._acgcd .RFonts .EastAsiaAttr =_e .String (family );};
|
|
|
|
// SetColor sets a specific color or auto.
|
|
func (_bad Color )SetColor (v _aeg .Color ){if v .IsAuto (){_bad ._bdf .ValAttr .ST_HexColorAuto =_cc .ST_HexColorAutoAuto ;_bad ._bdf .ValAttr .ST_HexColorRGB =nil ;}else {_bad ._bdf .ValAttr .ST_HexColorAuto =_cc .ST_HexColorAutoUnset ;_bad ._bdf .ValAttr .ST_HexColorRGB =v .AsRGBString ();};};
|
|
|
|
// RStyle returns the name of character style.
|
|
// It is defined here http://officeopenxml.com/WPstyleCharStyles.php
|
|
func (_fcbgb ParagraphProperties )RStyle ()string {if _fcbgb ._bfdca .RPr .RStyle !=nil {return _fcbgb ._bfdca .RPr .RStyle .ValAttr ;};return "";};
|
|
|
|
// Nodes return the document's element as nodes.
|
|
func (_ggac *Document )Nodes ()Nodes {_fdcd :=[]Node {};for _ ,_dfdc :=range _ggac ._aeb .Body .EG_BlockLevelElts {_fdcd =append (_fdcd ,_bfdad (_ggac ,_dfdc .EG_ContentBlockContent ,nil )...);};if _ggac ._aeb .Body .SectPr !=nil {_fdcd =append (_fdcd ,Node {_bgba :_ggac ._aeb .Body .SectPr });};_eggd :=Nodes {_cebe :_fdcd };return _eggd ;};
|
|
|
|
// Name returns the name of the field.
|
|
func (_accab FormField )Name ()string {return *_accab ._dbfcc .Name [0].ValAttr };
|
|
|
|
// TableBorders allows manipulation of borders on a table.
|
|
type TableBorders struct{_bfabb *_cc .CT_TblBorders };
|
|
|
|
// NewSettings constructs a new empty Settings
|
|
func NewSettings ()Settings {_fggba :=_cc .NewSettings ();_fggba .Compat =_cc .NewCT_Compat ();_fcfd :=_cc .NewCT_CompatSetting ();_fcfd .NameAttr =_e .String ("\u0063\u006f\u006d\u0070\u0061\u0074\u0069\u0062\u0069\u006c\u0069\u0074y\u004d\u006f\u0064\u0065");_fcfd .UriAttr =_e .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");_fcfd .ValAttr =_e .String ("\u0031\u0035");_fggba .Compat .CompatSetting =append (_fggba .Compat .CompatSetting ,_fcfd );return Settings {_fggba };};
|
|
|
|
// Pict returns the pict object.
|
|
func (_beaea *WatermarkText )Pict ()*_cc .CT_Picture {return _beaea ._adfba };
|
|
|
|
// Shadow returns true if run shadow is on.
|
|
func (_agegd RunProperties )Shadow ()bool {return _fcaaa (_agegd ._acgcd .Shadow )};
|
|
|
|
// AppendNode append node to document element.
|
|
func (_gafc *Document )AppendNode (node Node ){_gafc .insertImageFromNode (node );_gafc .insertStyleFromNode (node );for _ ,_gcgg :=range node .Children {_gafc .insertImageFromNode (_gcgg );_gafc .insertStyleFromNode (_gcgg );};switch _ecca :=node .X ().(type ){case *Paragraph :_gafc .appendParagraph (nil ,*_ecca ,false );case *Table :_gafc .appendTable (nil ,*_ecca ,false );};if node ._egfb !=nil {if node ._egfb ._agc !=nil {if _cacb :=_gafc ._ebfd .FindRIDForN (0,_e .ThemeType );_cacb ==""{if _dda :=node ._egfb ._ebfd .FindRIDForN (0,_e .ThemeType );_dda !=""{_gafc ._agc =append (_gafc ._agc ,node ._egfb ._agc ...);_bdfa :=node ._egfb ._ebfd .GetTargetByRelId (_dda );_gafc .ContentTypes .AddOverride ("\u002f\u0077\u006f\u0072\u0064\u002f"+_bdfa ,"\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");_gafc ._ebfd .AddRelationship (_bdfa ,_e .ThemeType );};};};_ggaa :=_gafc ._ebg ;_bebbb :=node ._egfb ._ebg ;if _ggaa !=nil {if _bebbb !=nil {if _ggaa .Font !=nil {if _bebbb .Font !=nil {for _ ,_bfacc :=range _bebbb .Font {_gecb :=true ;for _ ,_dbcb :=range _ggaa .Font {if _dbcb .NameAttr ==_bfacc .NameAttr {_gecb =false ;break ;};};if _gecb {_ggaa .Font =append (_ggaa .Font ,_bfacc );};};};}else {_ggaa .Font =_bebbb .Font ;};};}else if _bebbb !=nil {_ggaa =_bebbb ;};_gafc ._ebg =_ggaa ;if _cdef :=_gafc ._ebfd .FindRIDForN (0,_e .FontTableType );_cdef ==""{_gafc .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");_gafc ._ebfd .AddRelationship ("\u0066\u006f\u006e\u0074\u0054\u0061\u0062\u006c\u0065\u002e\u0078\u006d\u006c",_e .FontTableType );};};};
|
|
|
|
// SetAlignment controls the paragraph alignment
|
|
func (_dcgag ParagraphProperties )SetAlignment (align _cc .ST_Jc ){if align ==_cc .ST_JcUnset {_dcgag ._bfdca .Jc =nil ;}else {_dcgag ._bfdca .Jc =_cc .NewCT_Jc ();_dcgag ._bfdca .Jc .ValAttr =align ;};};
|
|
|
|
// SetHeader sets a section header.
|
|
func (_bagg Section )SetHeader (h Header ,t _cc .ST_HdrFtr ){_bcecc :=_cc .NewEG_HdrFtrReferences ();_bagg ._cdac .EG_HdrFtrReferences =append (_bagg ._cdac .EG_HdrFtrReferences ,_bcecc );_bcecc .HeaderReference =_cc .NewCT_HdrFtrRef ();_bcecc .HeaderReference .TypeAttr =t ;_eegg :=_bagg ._aafce ._ebfd .FindRIDForN (h .Index (),_e .HeaderType );if _eegg ==""{_bg .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");};_bcecc .HeaderReference .IdAttr =_eegg ;};type mergeFieldInfo struct{_ffedf string ;_cfgb string ;_gfee string ;_fgeff bool ;_cegf bool ;_fcac bool ;_cfff bool ;_gffce Paragraph ;_eegb ,_bgeg ,_dgfe int ;_afba *_cc .EG_PContent ;_bbfc bool ;};
|
|
|
|
// EastAsiaFont returns the name of run font family for East Asia.
|
|
func (_dgcge RunProperties )EastAsiaFont ()string {if _dfcd :=_dgcge ._acgcd .RFonts ;_dfcd !=nil {if _dfcd .EastAsiaAttr !=nil {return *_dfcd .EastAsiaAttr ;};};return "";};
|
|
|
|
// Paragraphs returns the paragraphs within a structured document tag.
|
|
func (_ffadg StructuredDocumentTag )Paragraphs ()[]Paragraph {if _ffadg ._cgdef .SdtContent ==nil {return nil ;};_fddae :=[]Paragraph {};for _ ,_dgfdd :=range _ffadg ._cgdef .SdtContent .P {_fddae =append (_fddae ,Paragraph {_ffadg ._eebg ,_dgfdd });};return _fddae ;};func _aff (_dgd *_cc .CT_Tbl ,_dagc *_cc .CT_P ,_cgbf bool )*_cc .CT_Tbl {for _ ,_dagcd :=range _dgd .EG_ContentRowContent {for _ ,_bfe :=range _dagcd .Tr {for _ ,_ffc :=range _bfe .EG_ContentCellContent {for _ ,_bgbb :=range _ffc .Tc {for _affa ,_aec :=range _bgbb .EG_BlockLevelElts {for _ ,_ddc :=range _aec .EG_ContentBlockContent {for _befc ,_fde :=range _ddc .P {if _fde ==_dagc {_beag :=_cc .NewEG_BlockLevelElts ();_fbfb :=_cc .NewEG_ContentBlockContent ();_beag .EG_ContentBlockContent =append (_beag .EG_ContentBlockContent ,_fbfb );_cfc :=_cc .NewCT_Tbl ();_fbfb .Tbl =append (_fbfb .Tbl ,_cfc );_bgbb .EG_BlockLevelElts =append (_bgbb .EG_BlockLevelElts ,nil );if _cgbf {copy (_bgbb .EG_BlockLevelElts [_affa +1:],_bgbb .EG_BlockLevelElts [_affa :]);_bgbb .EG_BlockLevelElts [_affa ]=_beag ;if _befc !=0{_bed :=_cc .NewEG_BlockLevelElts ();_ccba :=_cc .NewEG_ContentBlockContent ();_bed .EG_ContentBlockContent =append (_bed .EG_ContentBlockContent ,_ccba );_ccba .P =_ddc .P [:_befc ];_bgbb .EG_BlockLevelElts =append (_bgbb .EG_BlockLevelElts ,nil );copy (_bgbb .EG_BlockLevelElts [_affa +1:],_bgbb .EG_BlockLevelElts [_affa :]);_bgbb .EG_BlockLevelElts [_affa ]=_bed ;};_ddc .P =_ddc .P [_befc :];}else {copy (_bgbb .EG_BlockLevelElts [_affa +2:],_bgbb .EG_BlockLevelElts [_affa +1:]);_bgbb .EG_BlockLevelElts [_affa +1]=_beag ;if _befc !=len (_ddc .P )-1{_dacfg :=_cc .NewEG_BlockLevelElts ();_dbe :=_cc .NewEG_ContentBlockContent ();_dacfg .EG_ContentBlockContent =append (_dacfg .EG_ContentBlockContent ,_dbe );_dbe .P =_ddc .P [_befc +1:];_bgbb .EG_BlockLevelElts =append (_bgbb .EG_BlockLevelElts ,nil );copy (_bgbb .EG_BlockLevelElts [_affa +3:],_bgbb .EG_BlockLevelElts [_affa +2:]);_bgbb .EG_BlockLevelElts [_affa +2]=_dacfg ;}else {_dcb :=_cc .NewEG_BlockLevelElts ();_gebf :=_cc .NewEG_ContentBlockContent ();_dcb .EG_ContentBlockContent =append (_dcb .EG_ContentBlockContent ,_gebf );_gebf .P =[]*_cc .CT_P {_cc .NewCT_P ()};_bgbb .EG_BlockLevelElts =append (_bgbb .EG_BlockLevelElts ,nil );copy (_bgbb .EG_BlockLevelElts [_affa +3:],_bgbb .EG_BlockLevelElts [_affa +2:]);_bgbb .EG_BlockLevelElts [_affa +2]=_dcb ;};_ddc .P =_ddc .P [:_befc +1];};return _cfc ;};};for _ ,_adbb :=range _ddc .Tbl {_dbag :=_aff (_adbb ,_dagc ,_cgbf );if _dbag !=nil {return _dbag ;};};};};};};};};return nil ;};
|
|
|
|
// SearchStyleByName return style by its name.
|
|
func (_ggcc Styles )SearchStyleByName (name string )(Style ,bool ){for _ ,_bcgce :=range _ggcc ._ecgbf .Style {if _bcgce .Name !=nil {if _bcgce .Name .ValAttr ==name {return Style {_bcgce },true ;};};};return Style {},false ;};
|
|
|
|
// Footer is a footer for a document section.
|
|
type Footer struct{_acab *Document ;_gceg *_cc .Ftr ;};
|
|
|
|
// SetDoubleStrikeThrough sets the run to double strike-through.
|
|
func (_ddde RunProperties )SetDoubleStrikeThrough (b bool ){if !b {_ddde ._acgcd .Dstrike =nil ;}else {_ddde ._acgcd .Dstrike =_cc .NewCT_OnOff ();};};func _cbd ()(*_cg .CT_Point2D ,[]*_cg .CT_Point2D ){var (_dc int64 =0;_edg int64 =21600;);_cca :=_cg .ST_Coordinate {ST_CoordinateUnqualified :&_dc ,ST_UniversalMeasure :nil };_abe :=_cg .ST_Coordinate {ST_CoordinateUnqualified :&_edg ,ST_UniversalMeasure :nil };_ebe :=_cg .NewCT_Point2D ();_ebe .XAttr =_cca ;_ebe .YAttr =_cca ;_afb :=[]*_cg .CT_Point2D {&_cg .CT_Point2D {XAttr :_cca ,YAttr :_abe },&_cg .CT_Point2D {XAttr :_abe ,YAttr :_abe },&_cg .CT_Point2D {XAttr :_abe ,YAttr :_cca },_ebe };return _ebe ,_afb ;};
|
|
|
|
// SetFirstColumn controls the conditional formatting for the first column in a table.
|
|
func (_dege TableLook )SetFirstColumn (on bool ){if !on {_dege ._gbfc .FirstColumnAttr =&_ebd .ST_OnOff {};_dege ._gbfc .FirstColumnAttr .ST_OnOff1 =_ebd .ST_OnOff1Off ;}else {_dege ._gbfc .FirstColumnAttr =&_ebd .ST_OnOff {};_dege ._gbfc .FirstColumnAttr .ST_OnOff1 =_ebd .ST_OnOff1On ;};};
|
|
|
|
// AddTable adds a table to the table cell.
|
|
func (_ded Cell )AddTable ()Table {_gae :=_cc .NewEG_BlockLevelElts ();_ded ._gbb .EG_BlockLevelElts =append (_ded ._gbb .EG_BlockLevelElts ,_gae );_cbde :=_cc .NewEG_ContentBlockContent ();_gae .EG_ContentBlockContent =append (_gae .EG_ContentBlockContent ,_cbde );_efa :=_cc .NewCT_Tbl ();_cbde .Tbl =append (_cbde .Tbl ,_efa );return Table {_ded ._bcc ,_efa };};
|
|
|
|
// GetStyle returns string style of the text in watermark and format it to TextpathStyle.
|
|
func (_gaacg *WatermarkText )GetStyle ()_ad .TextpathStyle {_eadb :=_gaacg .getShape ();if _gaacg ._eeced !=nil {_ccgd :=_gaacg ._eeced .EG_ShapeElements ;if len (_ccgd )> 0&&_ccgd [0].Textpath !=nil {return _ad .NewTextpathStyle (*_ccgd [0].Textpath .StyleAttr );};}else {_dcff :=_gaacg .findNode (_eadb ,"\u0074\u0065\u0078\u0074\u0070\u0061\u0074\u0068");for _ ,_cafa :=range _dcff .Attrs {if _cafa .Name .Local =="\u0073\u0074\u0079l\u0065"{return _ad .NewTextpathStyle (_cafa .Value );};};};return _ad .NewTextpathStyle ("");};
|
|
|
|
// ComplexSizeValue returns the value of paragraph font size for complex fonts in points.
|
|
func (_efgc ParagraphProperties )ComplexSizeValue ()float64 {if _cfdc :=_efgc ._bfdca .RPr .SzCs ;_cfdc !=nil {_gfef :=_cfdc .ValAttr ;if _gfef .ST_UnsignedDecimalNumber !=nil {return float64 (*_gfef .ST_UnsignedDecimalNumber )/2;};};return 0.0;};
|
|
|
|
// 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 (_bgdd Header )Index ()int {for _aabc ,_bebcd :=range _bgdd ._edgdf ._dgbf {if _bebcd ==_bgdd ._abed {return _aabc ;};};return -1;};
|
|
|
|
// Bold returns true if run font is bold.
|
|
func (_gggc RunProperties )Bold ()bool {_cfcf :=_gggc ._acgcd ;return _fcaaa (_cfcf .B )||_fcaaa (_cfcf .BCs );};
|
|
|
|
// Node is document element node,
|
|
// contains Paragraph or Table element.
|
|
type Node struct{_egfb *Document ;_bgba interface{};Style Style ;AnchoredDrawings []AnchoredDrawing ;InlineDrawings []InlineDrawing ;Children []Node ;};
|
|
|
|
// SearchStylesById returns style by its id.
|
|
func (_edbd Styles )SearchStyleById (id string )(Style ,bool ){for _ ,_eaebe :=range _edbd ._ecgbf .Style {if _eaebe .StyleIdAttr !=nil {if *_eaebe .StyleIdAttr ==id {return Style {_eaebe },true ;};};};return Style {},false ;};
|
|
|
|
// SetChecked marks a FormFieldTypeCheckBox as checked or unchecked.
|
|
func (_bdab FormField )SetChecked (b bool ){if _bdab ._dbfcc .CheckBox ==nil {return ;};if !b {_bdab ._dbfcc .CheckBox .Checked =nil ;}else {_bdab ._dbfcc .CheckBox .Checked =_cc .NewCT_OnOff ();};};func (_dddb Paragraph )addStartBookmark (_ggga int64 ,_fbfd string )*_cc .CT_Bookmark {_cafd :=_cc .NewEG_PContent ();_dddb ._dadg .EG_PContent =append (_dddb ._dadg .EG_PContent ,_cafd );_dgcfd :=_cc .NewEG_ContentRunContent ();_dffbea :=_cc .NewEG_RunLevelElts ();_gfgb :=_cc .NewEG_RangeMarkupElements ();_adafd :=_cc .NewCT_Bookmark ();_adafd .NameAttr =_fbfd ;_adafd .IdAttr =_ggga ;_gfgb .BookmarkStart =_adafd ;_cafd .EG_ContentRunContent =append (_cafd .EG_ContentRunContent ,_dgcfd );_dgcfd .EG_RunLevelElts =append (_dgcfd .EG_RunLevelElts ,_dffbea );_dffbea .EG_RangeMarkupElements =append (_dffbea .EG_RangeMarkupElements ,_gfgb );return _adafd ;};
|
|
|
|
// VerticalAlign returns the value of paragraph vertical align.
|
|
func (_caggb ParagraphProperties )VerticalAlignment ()_ebd .ST_VerticalAlignRun {if _aeaba :=_caggb ._bfdca .RPr .VertAlign ;_aeaba !=nil {return _aeaba .ValAttr ;};return 0;};
|
|
|
|
// InitializeDefault constructs the default styles.
|
|
func (_gdeeag Styles )InitializeDefault (){_gdeeag .initializeDocDefaults ();_gdeeag .initializeStyleDefaults ();};
|
|
|
|
// SetNumberingDefinitionByID sets the numbering definition ID directly, which must
|
|
// match an ID defined in numbering.xml
|
|
func (_agdcb Paragraph )SetNumberingDefinitionByID (abstractNumberID int64 ){_agdcb .ensurePPr ();if _agdcb ._dadg .PPr .NumPr ==nil {_agdcb ._dadg .PPr .NumPr =_cc .NewCT_NumPr ();};_eaca :=_cc .NewCT_DecimalNumber ();_eaca .ValAttr =int64 (abstractNumberID );_agdcb ._dadg .PPr .NumPr .NumId =_eaca ;};
|
|
|
|
// SetSemiHidden controls if the style is hidden in the UI.
|
|
func (_bcece Style )SetSemiHidden (b bool ){if b {_bcece ._bafd .SemiHidden =_cc .NewCT_OnOff ();}else {_bcece ._bafd .SemiHidden =nil ;};};
|
|
|
|
// Margins allows controlling individual cell margins.
|
|
func (_gdf CellProperties )Margins ()CellMargins {if _gdf ._cbfg .TcMar ==nil {_gdf ._cbfg .TcMar =_cc .NewCT_TcMar ();};return CellMargins {_gdf ._cbfg .TcMar };};
|
|
|
|
// AddImageRef add ImageRef to header as relationship, returning ImageRef
|
|
// that can be used to be placed as header content.
|
|
func (_gfbd Header )AddImageRef (r _acb .ImageRef )(_acb .ImageRef ,error ){var _ffbe _acb .Relationships ;for _dgea ,_cfgc :=range _gfbd ._edgdf ._dgbf {if _cfgc ==_gfbd ._abed {_ffbe =_gfbd ._edgdf ._edc [_dgea ];};};_daca :=_ffbe .AddRelationship (r .Target (),_e .ImageType );r .SetRelID (_daca .X ().IdAttr );return r ,nil ;};
|
|
|
|
// SetColumnBandSize sets the number of Columns in the column band
|
|
func (_bedf TableStyleProperties )SetColumnBandSize (cols int64 ){_bedf ._dfcf .TblStyleColBandSize =_cc .NewCT_DecimalNumber ();_bedf ._dfcf .TblStyleColBandSize .ValAttr =cols ;};
|
|
|
|
// InitializeDefault constructs a default numbering.
|
|
func (_aabd Numbering )InitializeDefault (){_egdg :=_cc .NewCT_AbstractNum ();_egdg .MultiLevelType =_cc .NewCT_MultiLevelType ();_egdg .MultiLevelType .ValAttr =_cc .ST_MultiLevelTypeHybridMultilevel ;_aabd ._bedb .AbstractNum =append (_aabd ._bedb .AbstractNum ,_egdg );_egdg .AbstractNumIdAttr =1;const _fgdfe =720;const _cfgcc =720;const _dcfe =360;for _gggd :=0;_gggd < 9;_gggd ++{_bdfg :=_cc .NewCT_Lvl ();_bdfg .IlvlAttr =int64 (_gggd );_bdfg .Start =_cc .NewCT_DecimalNumber ();_bdfg .Start .ValAttr =1;_bdfg .NumFmt =_cc .NewCT_NumFmt ();_bdfg .NumFmt .ValAttr =_cc .ST_NumberFormatBullet ;_bdfg .Suff =_cc .NewCT_LevelSuffix ();_bdfg .Suff .ValAttr =_cc .ST_LevelSuffixNothing ;_bdfg .LvlText =_cc .NewCT_LevelText ();_bdfg .LvlText .ValAttr =_e .String ("\uf0b7");_bdfg .LvlJc =_cc .NewCT_Jc ();_bdfg .LvlJc .ValAttr =_cc .ST_JcLeft ;_bdfg .RPr =_cc .NewCT_RPr ();_bdfg .RPr .RFonts =_cc .NewCT_Fonts ();_bdfg .RPr .RFonts .AsciiAttr =_e .String ("\u0053\u0079\u006d\u0062\u006f\u006c");_bdfg .RPr .RFonts .HAnsiAttr =_e .String ("\u0053\u0079\u006d\u0062\u006f\u006c");_bdfg .RPr .RFonts .HintAttr =_cc .ST_HintDefault ;_bdfg .PPr =_cc .NewCT_PPrGeneral ();_bccdc :=int64 (_gggd *_cfgcc +_fgdfe );_bdfg .PPr .Ind =_cc .NewCT_Ind ();_bdfg .PPr .Ind .LeftAttr =&_cc .ST_SignedTwipsMeasure {};_bdfg .PPr .Ind .LeftAttr .Int64 =_e .Int64 (_bccdc );_bdfg .PPr .Ind .HangingAttr =&_ebd .ST_TwipsMeasure {};_bdfg .PPr .Ind .HangingAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (_dcfe ));_egdg .Lvl =append (_egdg .Lvl ,_bdfg );};_cdge :=_cc .NewCT_Num ();_cdge .NumIdAttr =1;_cdge .AbstractNumId =_cc .NewCT_DecimalNumber ();_cdge .AbstractNumId .ValAttr =1;_aabd ._bedb .Num =append (_aabd ._bedb .Num ,_cdge );};
|
|
|
|
// SetAlignment controls the paragraph alignment
|
|
func (_bcef ParagraphStyleProperties )SetAlignment (align _cc .ST_Jc ){if align ==_cc .ST_JcUnset {_bcef ._feffd .Jc =nil ;}else {_bcef ._feffd .Jc =_cc .NewCT_Jc ();_bcef ._feffd .Jc .ValAttr =align ;};};
|
|
|
|
// Text returns text from the document as one string separated with line breaks.
|
|
func (_agca *DocText )Text ()string {_gaeb :=_de .NewBuffer ([]byte {});for _ ,_bdgb :=range _agca .Items {if _bdgb .Text !=""{_gaeb .WriteString (_bdgb .Text );_gaeb .WriteString ("\u000a");};};return _gaeb .String ();};
|
|
|
|
// AddDrawingAnchored adds an anchored (floating) drawing from an ImageRef.
|
|
func (_afff Run )AddDrawingAnchored (img _acb .ImageRef )(AnchoredDrawing ,error ){_bdec :=_afff .newIC ();_bdec .Drawing =_cc .NewCT_Drawing ();_gdcbd :=_cc .NewWdAnchor ();_ccde :=AnchoredDrawing {_afff ._bdaag ,_gdcbd };_gdcbd .SimplePosAttr =_e .Bool (false );_gdcbd .AllowOverlapAttr =true ;_gdcbd .CNvGraphicFramePr =_cg .NewCT_NonVisualGraphicFrameProperties ();_bdec .Drawing .Anchor =append (_bdec .Drawing .Anchor ,_gdcbd );_gdcbd .Graphic =_cg .NewGraphic ();_gdcbd .Graphic .GraphicData =_cg .NewCT_GraphicalObjectData ();_gdcbd .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";_gdcbd .SimplePos .XAttr .ST_CoordinateUnqualified =_e .Int64 (0);_gdcbd .SimplePos .YAttr .ST_CoordinateUnqualified =_e .Int64 (0);_gdcbd .PositionH .RelativeFromAttr =_cc .WdST_RelFromHPage ;_gdcbd .PositionH .Choice =&_cc .WdCT_PosHChoice {};_gdcbd .PositionH .Choice .PosOffset =_e .Int32 (0);_gdcbd .PositionV .RelativeFromAttr =_cc .WdST_RelFromVPage ;_gdcbd .PositionV .Choice =&_cc .WdCT_PosVChoice {};_gdcbd .PositionV .Choice .PosOffset =_e .Int32 (0);_gdcbd .Extent .CxAttr =int64 (float64 (img .Size ().X *_bd .Pixel72 )/_bd .EMU );_gdcbd .Extent .CyAttr =int64 (float64 (img .Size ().Y *_bd .Pixel72 )/_bd .EMU );_gdcbd .Choice =&_cc .WdEG_WrapTypeChoice {};_gdcbd .Choice .WrapSquare =_cc .NewWdCT_WrapSquare ();_gdcbd .Choice .WrapSquare .WrapTextAttr =_cc .WdST_WrapTextBothSides ;_ecfbc :=0x7FFFFFFF&_eg .Uint32 ();_gdcbd .DocPr .IdAttr =_ecfbc ;_cgdc :=_fd .NewPic ();_cgdc .NvPicPr .CNvPr .IdAttr =_ecfbc ;_aggf :=img .RelID ();if _aggf ==""{return _ccde ,_ea .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");};_gdcbd .Graphic .GraphicData .Any =append (_gdcbd .Graphic .GraphicData .Any ,_cgdc );_cgdc .BlipFill =_cg .NewCT_BlipFillProperties ();_cgdc .BlipFill .Blip =_cg .NewCT_Blip ();_cgdc .BlipFill .Blip .EmbedAttr =&_aggf ;_cgdc .BlipFill .Stretch =_cg .NewCT_StretchInfoProperties ();_cgdc .BlipFill .Stretch .FillRect =_cg .NewCT_RelativeRect ();_cgdc .SpPr =_cg .NewCT_ShapeProperties ();_cgdc .SpPr .Xfrm =_cg .NewCT_Transform2D ();_cgdc .SpPr .Xfrm .Off =_cg .NewCT_Point2D ();_cgdc .SpPr .Xfrm .Off .XAttr .ST_CoordinateUnqualified =_e .Int64 (0);_cgdc .SpPr .Xfrm .Off .YAttr .ST_CoordinateUnqualified =_e .Int64 (0);_cgdc .SpPr .Xfrm .Ext =_cg .NewCT_PositiveSize2D ();_cgdc .SpPr .Xfrm .Ext .CxAttr =int64 (img .Size ().X *_bd .Point );_cgdc .SpPr .Xfrm .Ext .CyAttr =int64 (img .Size ().Y *_bd .Point );_cgdc .SpPr .PrstGeom =_cg .NewCT_PresetGeometry2D ();_cgdc .SpPr .PrstGeom .PrstAttr =_cg .ST_ShapeTypeRect ;return _ccde ,nil ;};
|
|
|
|
// FindNodeByStyleId return slice of node base on style id.
|
|
func (_ffbg *Nodes )FindNodeByStyleId (styleId string )[]Node {_dcaeg :=[]Node {};for _ ,_gbbf :=range _ffbg ._cebe {switch _cdbd :=_gbbf ._bgba .(type ){case *Paragraph :if _cdbd !=nil &&_cdbd .Style ()==styleId {_dcaeg =append (_dcaeg ,_gbbf );};case *Table :if _cdbd !=nil &&_cdbd .Style ()==styleId {_dcaeg =append (_dcaeg ,_gbbf );};};_fbdg :=Nodes {_cebe :_gbbf .Children };_dcaeg =append (_dcaeg ,_fbdg .FindNodeByStyleId (styleId )...);};return _dcaeg ;};
|
|
|
|
// Footers returns the footers defined in the document.
|
|
func (_dba *Document )Footers ()[]Footer {_fga :=[]Footer {};for _ ,_ecd :=range _dba ._ebda {_fga =append (_fga ,Footer {_dba ,_ecd });};return _fga ;};func (_fdgd Paragraph )addInstrText (_gdfg string )*_cc .CT_Text {_egab :=_fdgd .AddRun ();_bfab :=_egab .X ();_fgaf :=_cc .NewEG_RunInnerContent ();_gbabb :=_cc .NewCT_Text ();_bfcfc :="\u0070\u0072\u0065\u0073\u0065\u0072\u0076\u0065";_gbabb .SpaceAttr =&_bfcfc ;_gbabb .Content ="\u0020"+_gdfg +"\u0020";_fgaf .InstrText =_gbabb ;_bfab .EG_RunInnerContent =append (_bfab .EG_RunInnerContent ,_fgaf );return _gbabb ;};
|
|
|
|
// SetHANSITheme sets the font H ANSI Theme.
|
|
func (_debga Fonts )SetHANSITheme (t _cc .ST_Theme ){_debga ._dgef .HAnsiThemeAttr =t };
|
|
|
|
// AddStyle adds a new empty style, if styleID is already exists, it will return the style.
|
|
func (_gbed Styles )AddStyle (styleID string ,t _cc .ST_StyleType ,isDefault bool )Style {if _dfbc ,_gdbf :=_gbed .SearchStyleById (styleID );_gdbf {return _dfbc ;};_bgce :=_cc .NewCT_Style ();_bgce .TypeAttr =t ;if isDefault {_bgce .DefaultAttr =&_ebd .ST_OnOff {};_bgce .DefaultAttr .Bool =_e .Bool (isDefault );};_bgce .StyleIdAttr =_e .String (styleID );_gbed ._ecgbf .Style =append (_gbed ._ecgbf .Style ,_bgce );return Style {_bgce };};
|
|
|
|
// RightToLeft returns true if run text goes from right to left.
|
|
func (_fedef RunProperties )RightToLeft ()bool {return _fcaaa (_fedef ._acgcd .Rtl )};func _cecg (_cdeb *_cc .CT_OnOff )OnOffValue {if _cdeb ==nil {return OnOffValueUnset ;};if _cdeb .ValAttr !=nil &&_cdeb .ValAttr .Bool !=nil &&*_cdeb .ValAttr .Bool ==false {return OnOffValueOff ;};return OnOffValueOn ;};
|
|
|
|
// SetLeftPct sets the cell left margin
|
|
func (_eef CellMargins )SetLeftPct (pct float64 ){_eef ._gdc .Left =_cc .NewCT_TblWidth ();_bea (_eef ._gdc .Left ,pct );};
|
|
|
|
// AddWatermarkPicture adds new watermark picture to document.
|
|
func (_ggae *Document )AddWatermarkPicture (imageRef _acb .ImageRef )WatermarkPicture {var _dcgg []Header ;if _fab ,_dedba :=_ggae .BodySection ().GetHeader (_cc .ST_HdrFtrDefault );_dedba {_dcgg =append (_dcgg ,_fab );};if _bead ,_eebe :=_ggae .BodySection ().GetHeader (_cc .ST_HdrFtrEven );_eebe {_dcgg =append (_dcgg ,_bead );};if _cgdaa ,_bfee :=_ggae .BodySection ().GetHeader (_cc .ST_HdrFtrFirst );_bfee {_dcgg =append (_dcgg ,_cgdaa );};if len (_dcgg )< 1{_bgabc :=_ggae .AddHeader ();_ggae .BodySection ().SetHeader (_bgabc ,_cc .ST_HdrFtrDefault );_dcgg =append (_dcgg ,_bgabc );};var _fbef error ;_ecage :=NewWatermarkPicture ();for _ ,_ffg :=range _dcgg {imageRef ,_fbef =_ffg .AddImageRef (imageRef );if _fbef !=nil {return WatermarkPicture {};};_fgaa :=_ffg .Paragraphs ();if len (_fgaa )< 1{_bgeb :=_ffg .AddParagraph ();_bgeb .AddRun ().AddText ("");};for _ ,_dfab :=range _ffg .X ().EG_ContentBlockContent {for _ ,_afcfa :=range _dfab .P {for _ ,_cdffg :=range _afcfa .EG_PContent {for _ ,_dafa :=range _cdffg .EG_ContentRunContent {if _dafa .R ==nil {continue ;};for _ ,_gfgce :=range _dafa .R .EG_RunInnerContent {_gfgce .Pict =_ecage ._egag ;break ;};};};};};};_ecage .SetPicture (imageRef );return _ecage ;};
|
|
|
|
// SetWrapPathStart sets wrapPath start value.
|
|
func (_ga AnchorDrawWrapOptions )SetWrapPathStart (coordinate *_cg .CT_Point2D ){_ga ._cbf =coordinate };
|
|
|
|
// GetColor returns the color.Color object representing the run color.
|
|
func (_cdga RunProperties )GetColor ()_aeg .Color {if _ffbad :=_cdga ._acgcd .Color ;_ffbad !=nil {_bfbge :=_ffbad .ValAttr ;if _bfbge .ST_HexColorRGB !=nil {return _aeg .FromHex (*_bfbge .ST_HexColorRGB );};};return _aeg .Color {};};func (_gcbcc *WatermarkPicture )getShapeType ()*_e .XSDAny {return _gcbcc .getInnerElement ("\u0073h\u0061\u0070\u0065\u0074\u0079\u0070e");};
|
|
|
|
// SetTextWrapBehindText sets the text wrap to behind text.
|
|
func (_cbe AnchoredDrawing )SetTextWrapBehindText (){_cbe ._gg .Choice =&_cc .WdEG_WrapTypeChoice {};_cbe ._gg .Choice .WrapNone =_cc .NewWdCT_WrapNone ();_cbe ._gg .BehindDocAttr =true ;_cbe ._gg .LayoutInCellAttr =true ;_cbe ._gg .AllowOverlapAttr =true ;};func _bcbe (_dged string )mergeFieldInfo {_gefd :=[]string {};_dafdc :=_de .Buffer {};_ecgc :=-1;for _ffde ,_fdfca :=range _dged {switch _fdfca {case ' ':if _dafdc .Len ()!=0{_gefd =append (_gefd ,_dafdc .String ());};_dafdc .Reset ();case '"':if _ecgc !=-1{_gefd =append (_gefd ,_dged [_ecgc +1:_ffde ]);_ecgc =-1;}else {_ecgc =_ffde ;};default:_dafdc .WriteRune (_fdfca );};};if _dafdc .Len ()!=0{_gefd =append (_gefd ,_dafdc .String ());};_degb :=mergeFieldInfo {};for _aaca :=0;_aaca < len (_gefd )-1;_aaca ++{_cfeee :=_gefd [_aaca ];switch _cfeee {case "\u004d\u0045\u0052\u0047\u0045\u0046\u0049\u0045\u004c\u0044":_degb ._ffedf =_gefd [_aaca +1];_aaca ++;case "\u005c\u0066":_degb ._cfgb =_gefd [_aaca +1];_aaca ++;case "\u005c\u0062":_degb ._gfee =_gefd [_aaca +1];_aaca ++;case "\u005c\u002a":switch _gefd [_aaca +1]{case "\u0055\u0070\u0070e\u0072":_degb ._fgeff =true ;case "\u004c\u006f\u0077e\u0072":_degb ._cegf =true ;case "\u0043\u0061\u0070\u0073":_degb ._cfff =true ;case "\u0046\u0069\u0072\u0073\u0074\u0043\u0061\u0070":_degb ._fcac =true ;};_aaca ++;};};return _degb ;};func _bgeec (_gbcda []*_cc .EG_ContentBlockContent ,_dbae *TableInfo )[]TextItem {_gfad :=[]TextItem {};for _ ,_gdeea :=range _gbcda {if _cbddg :=_gdeea .Sdt ;_cbddg !=nil {if _bcfa :=_cbddg .SdtContent ;_bcfa !=nil {_gfad =append (_gfad ,_egaa (_bcfa .P ,_dbae ,nil )...);};};_gfad =append (_gfad ,_egaa (_gdeea .P ,_dbae ,nil )...);for _ ,_adcd :=range _gdeea .Tbl {for _fggc ,_eaebd :=range _adcd .EG_ContentRowContent {for _ ,_bfad :=range _eaebd .Tr {for _ecde ,_fabbe :=range _bfad .EG_ContentCellContent {for _ ,_cfae :=range _fabbe .Tc {_egbb :=&TableInfo {Table :_adcd ,Row :_bfad ,Cell :_cfae ,RowIndex :_fggc ,ColIndex :_ecde };for _ ,_dgbeg :=range _cfae .EG_BlockLevelElts {_gfad =append (_gfad ,_bgeec (_dgbeg .EG_ContentBlockContent ,_egbb )...);};};};};};};};return _gfad ;};
|
|
|
|
// GetColor returns the color.Color object representing the run color.
|
|
func (_afec ParagraphProperties )GetColor ()_aeg .Color {if _begda :=_afec ._bfdca .RPr .Color ;_begda !=nil {_abdbd :=_begda .ValAttr ;if _abdbd .ST_HexColorRGB !=nil {return _aeg .FromHex (*_abdbd .ST_HexColorRGB );};};return _aeg .Color {};};
|
|
|
|
// SetBottom sets the bottom border to a specified type, color and thickness.
|
|
func (_dggfd ParagraphBorders )SetBottom (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_dggfd ._fgda .Bottom =_cc .NewCT_Border ();_aeggb (_dggfd ._fgda .Bottom ,t ,c ,thickness );};
|
|
|
|
// SetCellSpacing sets the cell spacing within a table.
|
|
func (_faaba TableProperties )SetCellSpacing (m _bd .Distance ){_faaba ._bebbgd .TblCellSpacing =_cc .NewCT_TblWidth ();_faaba ._bebbgd .TblCellSpacing .TypeAttr =_cc .ST_TblWidthDxa ;_faaba ._bebbgd .TblCellSpacing .WAttr =&_cc .ST_MeasurementOrPercent {};_faaba ._bebbgd .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent =&_cc .ST_DecimalNumberOrPercent {};_faaba ._bebbgd .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_e .Int64 (int64 (m /_bd .Dxa ));};
|
|
|
|
// SetCantSplit set row properties for Can't Split value.
|
|
func (_befcd RowProperties )SetCantSplit (val bool ){if !val {_befcd ._gddc .CantSplit =nil ;}else {_abbf :=_cc .NewCT_OnOff ();_befcd ._gddc .CantSplit =[]*_cc .CT_OnOff {_abbf };};};
|
|
|
|
// Section return paragraph properties section value.
|
|
func (_gbabd ParagraphProperties )Section ()(Section ,bool ){if _gbabd ._bfdca .SectPr !=nil {return Section {_gbabd ._bacb ,_gbabd ._bfdca .SectPr },true ;};return Section {},false ;};func (_bdfb *Document )getWatermarkHeaderInnerContentPictures ()[]*_cc .CT_Picture {var _abcc []*_cc .CT_Picture ;for _ ,_feggb :=range _bdfb .Headers (){for _ ,_fega :=range _feggb .X ().EG_ContentBlockContent {for _ ,_def :=range _fega .P {for _ ,_faeg :=range _def .EG_PContent {for _ ,_deea :=range _faeg .EG_ContentRunContent {if _deea .R ==nil {continue ;};for _ ,_dbce :=range _deea .R .EG_RunInnerContent {if _dbce .Pict ==nil {continue ;};_cfdb :=false ;for _ ,_ggeb :=range _dbce .Pict .Any {_cad ,_aeab :=_ggeb .(*_e .XSDAny );if _aeab &&_cad .XMLName .Local =="\u0073\u0068\u0061p\u0065"{_cfdb =true ;};};if _cfdb {_abcc =append (_abcc ,_dbce .Pict );};};};};};};};return _abcc ;};
|
|
|
|
// SetAfter sets the spacing that comes after the paragraph.
|
|
func (_ccgb ParagraphSpacing )SetAfter (after _bd .Distance ){_ccgb ._cgaa .AfterAttr =&_ebd .ST_TwipsMeasure {};_ccgb ._cgaa .AfterAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (after /_bd .Twips ));};
|
|
|
|
// SetTop sets the top border to a specified type, color and thickness.
|
|
func (_egb CellBorders )SetTop (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_egb ._cabe .Top =_cc .NewCT_Border ();_bfccc (_egb ._cabe .Top ,t ,c ,thickness );};
|
|
|
|
// BoldValue returns the precise nature of the bold setting (unset, off or on).
|
|
func (_abef RunProperties )BoldValue ()OnOffValue {return _cecg (_abef ._acgcd .B )};
|
|
|
|
// Paragraph is a paragraph within a document.
|
|
type Paragraph struct{_gefc *Document ;_dadg *_cc .CT_P ;};
|
|
|
|
// FontTable returns document fontTable element.
|
|
func (_fdba *Document )FontTable ()*_cc .Fonts {return _fdba ._ebg };
|
|
|
|
// Fonts returns the style's Fonts.
|
|
func (_egafe RunProperties )Fonts ()Fonts {if _egafe ._acgcd .RFonts ==nil {_egafe ._acgcd .RFonts =_cc .NewCT_Fonts ();};return Fonts {_egafe ._acgcd .RFonts };};
|
|
|
|
// Clear removes all of the content from within a run.
|
|
func (_bfaad Run )Clear (){_bfaad ._abeed .EG_RunInnerContent =nil };func (_fbbe *Document )insertStyleFromNode (_gbce Node ){if _gbce .Style .X ()!=nil {if _ ,_daeb :=_fbbe .Styles .SearchStyleById (_gbce .Style .StyleID ());!_daeb {_fbbe .Styles .InsertStyle (_gbce .Style );_cdfc :=_gbce .Style .ParagraphProperties ();_fbbe .insertNumberingFromStyleProperties (_gbce ._egfb .Numbering ,_cdfc );};};};
|
|
|
|
// SetTextWrapInFrontOfText sets the text wrap to in front of text.
|
|
func (_da AnchoredDrawing )SetTextWrapInFrontOfText (){_da ._gg .Choice =&_cc .WdEG_WrapTypeChoice {};_da ._gg .Choice .WrapNone =_cc .NewWdCT_WrapNone ();_da ._gg .BehindDocAttr =false ;_da ._gg .LayoutInCellAttr =true ;_da ._gg .AllowOverlapAttr =true ;};
|
|
|
|
// RemoveEndnote removes a endnote from both the paragraph and the document
|
|
// the requested endnote must be anchored on the paragraph being referenced.
|
|
func (_abdbg Paragraph )RemoveEndnote (id int64 ){_ceae :=_abdbg ._gefc ._cde ;var _fcbef int ;for _cccc ,_eeff :=range _ceae .CT_Endnotes .Endnote {if _eeff .IdAttr ==id {_fcbef =_cccc ;};};_fcbef =0;_ceae .CT_Endnotes .Endnote [_fcbef ]=nil ;_ceae .CT_Endnotes .Endnote [_fcbef ]=_ceae .CT_Endnotes .Endnote [len (_ceae .CT_Endnotes .Endnote )-1];_ceae .CT_Endnotes .Endnote =_ceae .CT_Endnotes .Endnote [:len (_ceae .CT_Endnotes .Endnote )-1];var _bgca Run ;for _ ,_gfab :=range _abdbg .Runs (){if _fegab ,_edgcc :=_gfab .IsEndnote ();_fegab {if _edgcc ==id {_bgca =_gfab ;};};};_abdbg .RemoveRun (_bgca );};
|
|
|
|
// 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 (_bcfdf Settings )SetUpdateFieldsOnOpen (b bool ){if !b {_bcfdf ._bbdg .UpdateFields =nil ;}else {_bcfdf ._bbdg .UpdateFields =_cc .NewCT_OnOff ();};};
|
|
|
|
// SetLayoutInCell sets the layoutInCell attribute of anchor.
|
|
func (_ccf AnchoredDrawing )SetLayoutInCell (val bool ){_ccf ._gg .LayoutInCellAttr =val };
|
|
|
|
// SetTopPct sets the cell top margin
|
|
func (_fdg CellMargins )SetTopPct (pct float64 ){_fdg ._gdc .Top =_cc .NewCT_TblWidth ();_bea (_fdg ._gdc .Top ,pct );};
|
|
|
|
// SetXOffset sets the X offset for an image relative to the origin.
|
|
func (_bb AnchoredDrawing )SetXOffset (x _bd .Distance ){_bb ._gg .PositionH .Choice =&_cc .WdCT_PosHChoice {};_bb ._gg .PositionH .Choice .PosOffset =_e .Int32 (int32 (x /_bd .EMU ));};
|
|
|
|
// SetBottom sets the bottom border to a specified type, color and thickness.
|
|
func (_fad CellBorders )SetBottom (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_fad ._cabe .Bottom =_cc .NewCT_Border ();_bfccc (_fad ._cabe .Bottom ,t ,c ,thickness );};
|
|
|
|
// Type returns the type of the field.
|
|
func (_edef FormField )Type ()FormFieldType {if _edef ._dbfcc .TextInput !=nil {return FormFieldTypeText ;}else if _edef ._dbfcc .CheckBox !=nil {return FormFieldTypeCheckBox ;}else if _edef ._dbfcc .DdList !=nil {return FormFieldTypeDropDown ;};return FormFieldTypeUnknown ;};
|
|
|
|
// SetEnabled marks a FormField as enabled or disabled.
|
|
func (_gagad FormField )SetEnabled (enabled bool ){_bcag :=_cc .NewCT_OnOff ();_bcag .ValAttr =&_ebd .ST_OnOff {Bool :&enabled };_gagad ._dbfcc .Enabled =[]*_cc .CT_OnOff {_bcag };};func (_acgc *Document )InsertTableAfter (relativeTo Paragraph )Table {return _acgc .insertTable (relativeTo ,false );};
|
|
|
|
// SetEmboss sets the run to embossed text.
|
|
func (_ccefd RunProperties )SetEmboss (b bool ){if !b {_ccefd ._acgcd .Emboss =nil ;}else {_ccefd ._acgcd .Emboss =_cc .NewCT_OnOff ();};};
|
|
|
|
// GetImage returns the ImageRef associated with an AnchoredDrawing.
|
|
func (_afg AnchoredDrawing )GetImage ()(_acb .ImageRef ,bool ){_ge :=_afg ._gg .Graphic .GraphicData .Any ;if len (_ge )> 0{_bda ,_aege :=_ge [0].(*_fd .Pic );if _aege {if _bda .BlipFill !=nil &&_bda .BlipFill .Blip !=nil &&_bda .BlipFill .Blip .EmbedAttr !=nil {return _afg ._fc .GetImageByRelID (*_bda .BlipFill .Blip .EmbedAttr );};};};return _acb .ImageRef {},false ;};
|
|
|
|
// Properties returns the paragraph properties.
|
|
func (_cffb Paragraph )Properties ()ParagraphProperties {_cffb .ensurePPr ();return ParagraphProperties {_cffb ._gefc ,_cffb ._dadg .PPr };};func _bfaa (_cdee _c .ReaderAt ,_ggg int64 ,_eagd string )(*Document ,error ){const _gebd ="\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0052\u0065\u0061\u0064";if !_gc .GetLicenseKey ().IsLicensed ()&&!_ecag {_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 ,_ea .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");};_edb :=New ();_edb .Numbering ._bedb =nil ;if len (_eagd )> 0{_edb ._dedb =_eagd ;}else {_ebfbe ,_baaa :=_gc .GenRefId ("\u0064\u0072");if _baaa !=nil {_bg .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_baaa );return nil ,_baaa ;};_edb ._dedb =_ebfbe ;};if _gge :=_gc .Track (_edb ._dedb ,_gebd );_gge !=nil {_bg .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_gge );return nil ,_gge ;};_dbg ,_egc :=_deb .TempDir ("\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065-\u0064\u006f\u0063\u0078");if _egc !=nil {return nil ,_egc ;};_edb .TmpPath =_dbg ;_bbgcb ,_egc :=_g .NewReader (_cdee ,_ggg );if _egc !=nil {return nil ,_gb .Errorf ("\u0070a\u0072s\u0069\u006e\u0067\u0020\u007a\u0069\u0070\u003a\u0020\u0025\u0073",_egc );};_ebbdg :=[]*_g .File {};_ebbdg =append (_ebbdg ,_bbgcb .File ...);_ffa :=false ;for _ ,_efab :=range _ebbdg {if _efab .FileHeader .Name =="\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c"{_ffa =true ;break ;};};if _ffa {_edb .CreateCustomProperties ();};_dgbd :=_edb ._aeb .ConformanceAttr ;_dcbbb :=_gbf .DecodeMap {};_dcbbb .SetOnNewRelationshipFunc (_edb .onNewRelationship );_dcbbb .AddTarget (_e .ContentTypesFilename ,_edb .ContentTypes .X (),"",0);_dcbbb .AddTarget (_e .BaseRelsFilename ,_edb .Rels .X (),"",0);if _cbef :=_dcbbb .Decode (_ebbdg );_cbef !=nil {return nil ,_cbef ;};_edb ._aeb .ConformanceAttr =_dgbd ;for _ ,_effa :=range _ebbdg {if _effa ==nil {continue ;};if _dced :=_edb .AddExtraFileFromZip (_effa );_dced !=nil {return nil ,_dced ;};};if _ffa {_cbdd :=false ;for _ ,_dae :=range _edb .Rels .X ().Relationship {if _dae .TargetAttr =="\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c"{_cbdd =true ;break ;};};if !_cbdd {_edb .AddCustomRelationships ();};};return _edb ,nil ;};func _ebaff ()*_af .Textpath {_fagf :=_af .NewTextpath ();_cedf :="\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";_fagf .StyleAttr =&_cedf ;_caaec :="\u0041\u0053\u0041\u0050";_fagf .StringAttr =&_caaec ;return _fagf ;};
|
|
|
|
// SetAlignment set alignment of paragraph.
|
|
func (_bbagd Paragraph )SetAlignment (alignment _cc .ST_Jc ){_bbagd .ensurePPr ();if _bbagd ._dadg .PPr .Jc ==nil {_bbagd ._dadg .PPr .Jc =_cc .NewCT_Jc ();};_bbagd ._dadg .PPr .Jc .ValAttr =alignment ;};
|
|
|
|
// SetContextualSpacing controls whether to Ignore Spacing Above and Below When
|
|
// Using Identical Styles
|
|
func (_ddebb ParagraphStyleProperties )SetContextualSpacing (b bool ){if !b {_ddebb ._feffd .ContextualSpacing =nil ;}else {_ddebb ._feffd .ContextualSpacing =_cc .NewCT_OnOff ();};};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_acaf TableProperties )X ()*_cc .CT_TblPr {return _acaf ._bebbgd };
|
|
|
|
// SetAlignment positions an anchored image via alignment. Offset is
|
|
// incompatible with SetOffset, whichever is called last is applied.
|
|
func (_dgc AnchoredDrawing )SetAlignment (h _cc .WdST_AlignH ,v _cc .WdST_AlignV ){_dgc .SetHAlignment (h );_dgc .SetVAlignment (v );};
|
|
|
|
// SetLinkedStyle sets the style that this style is linked to.
|
|
func (_cfef Style )SetLinkedStyle (name string ){if name ==""{_cfef ._bafd .Link =nil ;}else {_cfef ._bafd .Link =_cc .NewCT_String ();_cfef ._bafd .Link .ValAttr =name ;};};
|
|
|
|
// SetStartIndent controls the start indentation.
|
|
func (_gfeb ParagraphProperties )SetStartIndent (m _bd .Distance ){if _gfeb ._bfdca .Ind ==nil {_gfeb ._bfdca .Ind =_cc .NewCT_Ind ();};if m ==_bd .Zero {_gfeb ._bfdca .Ind .StartAttr =nil ;}else {_gfeb ._bfdca .Ind .StartAttr =&_cc .ST_SignedTwipsMeasure {};_gfeb ._bfdca .Ind .StartAttr .Int64 =_e .Int64 (int64 (m /_bd .Twips ));};};
|
|
|
|
// AbstractNumberID returns the ID that is unique within all numbering
|
|
// definitions that is used to assign the definition to a paragraph.
|
|
func (_cdfbc NumberingDefinition )AbstractNumberID ()int64 {return _cdfbc ._fabc .AbstractNumIdAttr };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_bcd Row )X ()*_cc .CT_Row {return _bcd ._dbcg };
|
|
|
|
// Clear content of node element.
|
|
func (_faccd *Node )Clear (){_faccd ._bgba =nil };
|
|
|
|
// SetFollowImageShape sets wrapPath to follow image shape,
|
|
// if nil return wrapPath that follow image size.
|
|
func (_ee AnchorDrawWrapOptions )SetFollowImageShape (val bool ){_ee ._gdb =val ;if !val {_aegg ,_db :=_cbd ();_ee ._cbf =_aegg ;_ee ._egd =_db ;};};
|
|
|
|
// AnchorDrawWrapOptions is options to set
|
|
// wrapPolygon for wrap text through and tight.
|
|
type AnchorDrawWrapOptions struct{_gdb bool ;_cbf *_cg .CT_Point2D ;_egd []*_cg .CT_Point2D ;};
|
|
|
|
// SetThemeShade sets the shade based off the theme color.
|
|
func (_abg Color )SetThemeShade (s uint8 ){_bcg :=_gb .Sprintf ("\u0025\u0030\u0032\u0078",s );_abg ._bdf .ThemeShadeAttr =&_bcg ;};
|
|
|
|
// Cells returns the cells defined in the table.
|
|
func (_cbgb Row )Cells ()[]Cell {_bddd :=[]Cell {};for _ ,_gggb :=range _cbgb ._dbcg .EG_ContentCellContent {for _ ,_bfdeg :=range _gggb .Tc {_bddd =append (_bddd ,Cell {_cbgb ._aeff ,_bfdeg });};if _gggb .Sdt !=nil &&_gggb .Sdt .SdtContent !=nil {for _ ,_cace :=range _gggb .Sdt .SdtContent .Tc {_bddd =append (_bddd ,Cell {_cbgb ._aeff ,_cace });};};};return _bddd ;};
|
|
|
|
// AddTable adds a new table to the document body.
|
|
func (_gfbb *Document )AddTable ()Table {_abgc :=_cc .NewEG_BlockLevelElts ();_gfbb ._aeb .Body .EG_BlockLevelElts =append (_gfbb ._aeb .Body .EG_BlockLevelElts ,_abgc );_cbce :=_cc .NewEG_ContentBlockContent ();_abgc .EG_ContentBlockContent =append (_abgc .EG_ContentBlockContent ,_cbce );_age :=_cc .NewCT_Tbl ();_cbce .Tbl =append (_cbce .Tbl ,_age );return Table {_gfbb ,_age };};
|
|
|
|
// EastAsiaFont returns the name of paragraph font family for East Asia.
|
|
func (_gea ParagraphProperties )EastAsiaFont ()string {if _ggafa :=_gea ._bfdca .RPr .RFonts ;_ggafa !=nil {if _ggafa .EastAsiaAttr !=nil {return *_ggafa .EastAsiaAttr ;};};return "";};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_abdg ParagraphStyleProperties )X ()*_cc .CT_PPrGeneral {return _abdg ._feffd };
|
|
|
|
// TableInfo is used for keep information about a table, a row and a cell where the text is located.
|
|
type TableInfo struct{Table *_cc .CT_Tbl ;Row *_cc .CT_Row ;Cell *_cc .CT_Tc ;RowIndex int ;ColIndex int ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_gccc *Document )X ()*_cc .Document {return _gccc ._aeb };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_be AnchoredDrawing )X ()*_cc .WdAnchor {return _be ._gg };func _dbgd ()*_af .Path {_eeggf :=_af .NewPath ();_eeggf .TextpathokAttr =_ebd .ST_TrueFalseTrue ;_eeggf .ConnecttypeAttr =_af .OfcST_ConnectTypeCustom ;_geceb :="\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";_eeggf .ConnectlocsAttr =&_geceb ;_bbbgc :="\u0032\u0037\u0030,\u0031\u0038\u0030\u002c\u0039\u0030\u002c\u0030";_eeggf .ConnectanglesAttr =&_bbbgc ;return _eeggf ;};
|
|
|
|
// SetTextWrapTopAndBottom sets the text wrap to top and bottom.
|
|
func (_bga AnchoredDrawing )SetTextWrapTopAndBottom (){_bga ._gg .Choice =&_cc .WdEG_WrapTypeChoice {};_bga ._gg .Choice .WrapTopAndBottom =_cc .NewWdCT_WrapTopBottom ();_bga ._gg .LayoutInCellAttr =true ;_bga ._gg .AllowOverlapAttr =true ;};
|
|
|
|
// Nodes contains slice of Node element.
|
|
type Nodes struct{_cebe []Node };
|
|
|
|
// Italic returns true if paragraph font is italic.
|
|
func (_efcfd ParagraphProperties )Italic ()bool {_gegfd :=_efcfd ._bfdca .RPr ;return _fcaaa (_gegfd .I )||_fcaaa (_gegfd .ICs );};
|
|
|
|
// SetAllowOverlapAttr sets the allowOverlap attribute of anchor.
|
|
func (_gd AnchoredDrawing )SetAllowOverlapAttr (val bool ){_gd ._gg .AllowOverlapAttr =val };
|
|
|
|
// SetHangingIndent controls the indentation of the non-first lines in a paragraph.
|
|
func (_aae ParagraphProperties )SetHangingIndent (m _bd .Distance ){if _aae ._bfdca .Ind ==nil {_aae ._bfdca .Ind =_cc .NewCT_Ind ();};if m ==_bd .Zero {_aae ._bfdca .Ind .HangingAttr =nil ;}else {_aae ._bfdca .Ind .HangingAttr =&_ebd .ST_TwipsMeasure {};_aae ._bfdca .Ind .HangingAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (m /_bd .Twips ));};};
|
|
|
|
// SetOutline sets the run to outlined text.
|
|
func (_aabdc RunProperties )SetOutline (b bool ){if !b {_aabdc ._acgcd .Outline =nil ;}else {_aabdc ._acgcd .Outline =_cc .NewCT_OnOff ();};};
|
|
|
|
// Paragraphs returns the paragraphs defined in an endnote.
|
|
func (_fgabe Endnote )Paragraphs ()[]Paragraph {_defd :=[]Paragraph {};for _ ,_edgf :=range _fgabe .content (){for _ ,_eddg :=range _edgf .P {_defd =append (_defd ,Paragraph {_fgabe ._accf ,_eddg });};};return _defd ;};
|
|
|
|
// SetLeft sets the left border to a specified type, color and thickness.
|
|
func (_dcedb TableBorders )SetLeft (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_dcedb ._bfabb .Left =_cc .NewCT_Border ();_bfccc (_dcedb ._bfabb .Left ,t ,c ,thickness );};
|
|
|
|
// SetFooter sets a section footer.
|
|
func (_agfbb Section )SetFooter (f Footer ,t _cc .ST_HdrFtr ){_adfbg :=_cc .NewEG_HdrFtrReferences ();_agfbb ._cdac .EG_HdrFtrReferences =append (_agfbb ._cdac .EG_HdrFtrReferences ,_adfbg );_adfbg .FooterReference =_cc .NewCT_HdrFtrRef ();_adfbg .FooterReference .TypeAttr =t ;_bgfdd :=_agfbb ._aafce ._ebfd .FindRIDForN (f .Index (),_e .FooterType );if _bgfdd ==""{_bg .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");};_adfbg .FooterReference .IdAttr =_bgfdd ;};
|
|
|
|
// SetVerticalAlignment sets the vertical alignment of content within a table cell.
|
|
func (_gdd CellProperties )SetVerticalAlignment (align _cc .ST_VerticalJc ){if align ==_cc .ST_VerticalJcUnset {_gdd ._cbfg .VAlign =nil ;}else {_gdd ._cbfg .VAlign =_cc .NewCT_VerticalJc ();_gdd ._cbfg .VAlign .ValAttr =align ;};};func (_efcf Document )mergeFields ()[]mergeFieldInfo {_cbbed :=[]Paragraph {};_agaf :=[]mergeFieldInfo {};for _ ,_bcae :=range _efcf .Tables (){for _ ,_gbde :=range _bcae .Rows (){for _ ,_bfag :=range _gbde .Cells (){_cbbed =append (_cbbed ,_bfag .Paragraphs ()...);};};};_cbbed =append (_cbbed ,_efcf .Paragraphs ()...);for _ ,_gad :=range _efcf .Headers (){_cbbed =append (_cbbed ,_gad .Paragraphs ()...);for _ ,_bdca :=range _gad .Tables (){for _ ,_dfgeg :=range _bdca .Rows (){for _ ,_ebfg :=range _dfgeg .Cells (){_cbbed =append (_cbbed ,_ebfg .Paragraphs ()...);};};};};for _ ,_cfeca :=range _efcf .Footers (){_cbbed =append (_cbbed ,_cfeca .Paragraphs ()...);for _ ,_gfce :=range _cfeca .Tables (){for _ ,_agge :=range _gfce .Rows (){for _ ,_aacc :=range _agge .Cells (){_cbbed =append (_cbbed ,_aacc .Paragraphs ()...);};};};};for _ ,_gccca :=range _cbbed {_ebdeg :=_gccca .Runs ();_agbf :=-1;_aeaaf :=-1;_dddafd :=-1;_caae :=mergeFieldInfo {};for _ ,_gada :=range _gccca ._dadg .EG_PContent {for _ ,_edge :=range _gada .FldSimple {if _d .Contains (_edge .InstrAttr ,"\u004d\u0045\u0052\u0047\u0045\u0046\u0049\u0045\u004c\u0044"){_dgbca :=_bcbe (_edge .InstrAttr );_dgbca ._bbfc =true ;_dgbca ._gffce =_gccca ;_dgbca ._afba =_gada ;_agaf =append (_agaf ,_dgbca );};};};for _daaa :=0;_daaa < len (_ebdeg );_daaa ++{_fabdg :=_ebdeg [_daaa ];for _ ,_bfda :=range _fabdg .X ().EG_RunInnerContent {if _bfda .FldChar !=nil {switch _bfda .FldChar .FldCharTypeAttr {case _cc .ST_FldCharTypeBegin :_agbf =_daaa ;case _cc .ST_FldCharTypeSeparate :_aeaaf =_daaa ;case _cc .ST_FldCharTypeEnd :_dddafd =_daaa ;if _caae ._ffedf !=""{_caae ._gffce =_gccca ;_caae ._eegb =_agbf ;_caae ._dgfe =_dddafd ;_caae ._bgeg =_aeaaf ;_agaf =append (_agaf ,_caae );};_agbf =-1;_aeaaf =-1;_dddafd =-1;_caae =mergeFieldInfo {};};}else if _bfda .InstrText !=nil &&_d .Contains (_bfda .InstrText .Content ,"\u004d\u0045\u0052\u0047\u0045\u0046\u0049\u0045\u004c\u0044"){if _agbf !=-1&&_dddafd ==-1{_caae =_bcbe (_bfda .InstrText .Content );};};};};};return _agaf ;};func (_gfdda *WatermarkPicture )findNode (_gedcb *_e .XSDAny ,_gaacdc string )*_e .XSDAny {for _ ,_aceb :=range _gedcb .Nodes {if _aceb .XMLName .Local ==_gaacdc {return _aceb ;};};return nil ;};
|
|
|
|
// 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 (_daab Document )SetStrict (strict bool ){if strict {_daab ._aeb .ConformanceAttr =_ebd .ST_ConformanceClassStrict ;}else {_daab ._aeb .ConformanceAttr =_ebd .ST_ConformanceClassTransitional ;};};
|
|
|
|
// Properties returns the cell properties.
|
|
func (_bac Cell )Properties ()CellProperties {if _bac ._gbb .TcPr ==nil {_bac ._gbb .TcPr =_cc .NewCT_TcPr ();};return CellProperties {_bac ._gbb .TcPr };};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_eega HyperLink )X ()*_cc .CT_Hyperlink {return _eega ._bfde };
|
|
|
|
// Footnotes returns the footnotes defined in the document.
|
|
func (_eee *Document )Footnotes ()[]Footnote {_ebfba :=[]Footnote {};for _ ,_eeg :=range _eee ._cdg .CT_Footnotes .Footnote {_ebfba =append (_ebfba ,Footnote {_eee ,_eeg });};return _ebfba ;};
|
|
|
|
// SetLastColumn controls the conditional formatting for the last column in a table.
|
|
func (_fdeef TableLook )SetLastColumn (on bool ){if !on {_fdeef ._gbfc .LastColumnAttr =&_ebd .ST_OnOff {};_fdeef ._gbfc .LastColumnAttr .ST_OnOff1 =_ebd .ST_OnOff1Off ;}else {_fdeef ._gbfc .LastColumnAttr =&_ebd .ST_OnOff {};_fdeef ._gbfc .LastColumnAttr .ST_OnOff1 =_ebd .ST_OnOff1On ;};};func (_cffcd Paragraph )addEndFldChar ()*_cc .CT_FldChar {_ddeb :=_cffcd .addFldChar ();_ddeb .FldCharTypeAttr =_cc .ST_FldCharTypeEnd ;return _ddeb ;};func _afbf ()*_af .Formulas {_dgcfe :=_af .NewFormulas ();_dgcfe .F =[]*_af .CT_F {_ad .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"),_ad .CreateFormula ("\u0073\u0075\u006d\u0020\u0040\u0030\u0020\u0031\u0020\u0030"),_ad .CreateFormula ("\u0073\u0075\u006d\u0020\u0030\u0020\u0030\u0020\u0040\u0031"),_ad .CreateFormula ("p\u0072\u006f\u0064\u0020\u0040\u0032\u0020\u0031\u0020\u0032"),_ad .CreateFormula ("\u0070r\u006f\u0064\u0020\u0040\u0033\u0020\u0032\u0031\u0036\u0030\u0030 \u0070\u0069\u0078\u0065\u006c\u0057\u0069\u0064\u0074\u0068"),_ad .CreateFormula ("\u0070r\u006f\u0064\u0020\u00403\u0020\u0032\u0031\u0036\u00300\u0020p\u0069x\u0065\u006c\u0048\u0065\u0069\u0067\u0068t"),_ad .CreateFormula ("\u0073\u0075\u006d\u0020\u0040\u0030\u0020\u0030\u0020\u0031"),_ad .CreateFormula ("p\u0072\u006f\u0064\u0020\u0040\u0036\u0020\u0031\u0020\u0032"),_ad .CreateFormula ("\u0070r\u006f\u0064\u0020\u0040\u0037\u0020\u0032\u0031\u0036\u0030\u0030 \u0070\u0069\u0078\u0065\u006c\u0057\u0069\u0064\u0074\u0068"),_ad .CreateFormula ("\u0073\u0075\u006d\u0020\u0040\u0038\u0020\u0032\u00316\u0030\u0030\u0020\u0030"),_ad .CreateFormula ("\u0070r\u006f\u0064\u0020\u00407\u0020\u0032\u0031\u0036\u00300\u0020p\u0069x\u0065\u006c\u0048\u0065\u0069\u0067\u0068t"),_ad .CreateFormula ("\u0073u\u006d \u0040\u0031\u0030\u0020\u0032\u0031\u0036\u0030\u0030\u0020\u0030")};return _dgcfe ;};
|
|
|
|
// ItalicValue returns the precise nature of the italic setting (unset, off or on).
|
|
func (_gaddg RunProperties )ItalicValue ()OnOffValue {return _cecg (_gaddg ._acgcd .I )};
|
|
|
|
// Pict returns the pict object.
|
|
func (_cabfg *WatermarkPicture )Pict ()*_cc .CT_Picture {return _cabfg ._egag };
|
|
|
|
// 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 (_abedf Run )IsEndnote ()(bool ,int64 ){if _abedf ._abeed .EG_RunInnerContent !=nil {if _abedf ._abeed .EG_RunInnerContent [0].EndnoteReference !=nil {return true ,_abedf ._abeed .EG_RunInnerContent [0].EndnoteReference .IdAttr ;};};return false ,0;};
|
|
|
|
// RunProperties controls run styling properties
|
|
type RunProperties struct{_acgcd *_cc .CT_RPr };
|
|
|
|
// ClearContent clears any content in the run (text, tabs, breaks, etc.)
|
|
func (_bdcb Run )ClearContent (){_bdcb ._abeed .EG_RunInnerContent =nil };
|
|
|
|
// AddParagraph adds a paragraph to the footnote.
|
|
func (_egcb Footnote )AddParagraph ()Paragraph {_ebbb :=_cc .NewEG_ContentBlockContent ();_cdcga :=len (_egcb ._effcg .EG_BlockLevelElts [0].EG_ContentBlockContent );_egcb ._effcg .EG_BlockLevelElts [0].EG_ContentBlockContent =append (_egcb ._effcg .EG_BlockLevelElts [0].EG_ContentBlockContent ,_ebbb );_cdcdf :=_cc .NewCT_P ();var _bgebf *_cc .CT_String ;if _cdcga !=0{_baaab :=len (_egcb ._effcg .EG_BlockLevelElts [0].EG_ContentBlockContent [_cdcga -1].P );_bgebf =_egcb ._effcg .EG_BlockLevelElts [0].EG_ContentBlockContent [_cdcga -1].P [_baaab -1].PPr .PStyle ;}else {_bgebf =_cc .NewCT_String ();_bgebf .ValAttr ="\u0046\u006f\u006f\u0074\u006e\u006f\u0074\u0065";};_ebbb .P =append (_ebbb .P ,_cdcdf );_dcce :=Paragraph {_egcb ._eeec ,_cdcdf };_dcce ._dadg .PPr =_cc .NewCT_PPr ();_dcce ._dadg .PPr .PStyle =_bgebf ;_dcce ._dadg .PPr .RPr =_cc .NewCT_ParaRPr ();return _dcce ;};const (FormFieldTypeUnknown FormFieldType =iota ;FormFieldTypeText ;FormFieldTypeCheckBox ;FormFieldTypeDropDown ;);
|
|
|
|
// IsBold returns true if the run has been set to bold.
|
|
func (_gbdg RunProperties )IsBold ()bool {return _gbdg .BoldValue ()==OnOffValueOn };
|
|
|
|
// SetCSTheme sets the font complex script theme.
|
|
func (_dbcf Fonts )SetCSTheme (t _cc .ST_Theme ){_dbcf ._dgef .CsthemeAttr =t };
|
|
|
|
// SetUnderline controls underline for a run style.
|
|
func (_fbfc RunProperties )SetUnderline (style _cc .ST_Underline ,c _aeg .Color ){if style ==_cc .ST_UnderlineUnset {_fbfc ._acgcd .U =nil ;}else {_fbfc ._acgcd .U =_cc .NewCT_Underline ();_fbfc ._acgcd .U .ColorAttr =&_cc .ST_HexColor {};_fbfc ._acgcd .U .ColorAttr .ST_HexColorRGB =c .AsRGBString ();_fbfc ._acgcd .U .ValAttr =style ;};};
|
|
|
|
// SetTableIndent sets the Table Indent from the Leading Margin
|
|
func (_ffbgg TableStyleProperties )SetTableIndent (ind _bd .Distance ){_ffbgg ._dfcf .TblInd =_cc .NewCT_TblWidth ();_ffbgg ._dfcf .TblInd .TypeAttr =_cc .ST_TblWidthDxa ;_ffbgg ._dfcf .TblInd .WAttr =&_cc .ST_MeasurementOrPercent {};_ffbgg ._dfcf .TblInd .WAttr .ST_DecimalNumberOrPercent =&_cc .ST_DecimalNumberOrPercent {};_ffbgg ._dfcf .TblInd .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_e .Int64 (int64 (ind /_bd .Dxa ));};
|
|
|
|
// SetItalic sets the run to italic.
|
|
func (_edac RunProperties )SetItalic (b bool ){if !b {_edac ._acgcd .I =nil ;_edac ._acgcd .ICs =nil ;}else {_edac ._acgcd .I =_cc .NewCT_OnOff ();_edac ._acgcd .ICs =_cc .NewCT_OnOff ();};};
|
|
|
|
// TableLook returns the table look, or conditional formatting applied to a table style.
|
|
func (_ceab TableProperties )TableLook ()TableLook {if _ceab ._bebbgd .TblLook ==nil {_ceab ._bebbgd .TblLook =_cc .NewCT_TblLook ();};return TableLook {_ceab ._bebbgd .TblLook };};
|
|
|
|
// Spacing returns the paragraph spacing settings.
|
|
func (_bcgdd ParagraphProperties )Spacing ()ParagraphSpacing {if _bcgdd ._bfdca .Spacing ==nil {_bcgdd ._bfdca .Spacing =_cc .NewCT_Spacing ();};return ParagraphSpacing {_bcgdd ._bfdca .Spacing };};
|
|
|
|
// ParagraphSpacing controls the spacing for a paragraph and its lines.
|
|
type ParagraphSpacing struct{_cgaa *_cc .CT_Spacing };func (_gdfcd Paragraph )addSeparateFldChar ()*_cc .CT_FldChar {_bcgcg :=_gdfcd .addFldChar ();_bcgcg .FldCharTypeAttr =_cc .ST_FldCharTypeSeparate ;return _bcgcg ;};
|
|
|
|
// SetWidthPercent sets the table to a width percentage.
|
|
func (_bedc TableProperties )SetWidthPercent (pct float64 ){_bedc ._bebbgd .TblW =_cc .NewCT_TblWidth ();_bedc ._bebbgd .TblW .TypeAttr =_cc .ST_TblWidthPct ;_bedc ._bebbgd .TblW .WAttr =&_cc .ST_MeasurementOrPercent {};_bedc ._bebbgd .TblW .WAttr .ST_DecimalNumberOrPercent =&_cc .ST_DecimalNumberOrPercent {};_bedc ._bebbgd .TblW .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_e .Int64 (int64 (pct *50));};
|
|
|
|
// ComplexSizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.
|
|
func (_gadd ParagraphProperties )ComplexSizeMeasure ()string {if _cdadf :=_gadd ._bfdca .RPr .SzCs ;_cdadf !=nil {_gdeaf :=_cdadf .ValAttr ;if _gdeaf .ST_PositiveUniversalMeasure !=nil {return *_gdeaf .ST_PositiveUniversalMeasure ;};};return "";};
|
|
|
|
// SetStyle sets the font size.
|
|
func (_gaaca RunProperties )SetStyle (style string ){if style ==""{_gaaca ._acgcd .RStyle =nil ;}else {_gaaca ._acgcd .RStyle =_cc .NewCT_String ();_gaaca ._acgcd .RStyle .ValAttr =style ;};};
|
|
|
|
// SetHangingIndent controls special indent of paragraph.
|
|
func (_dfcc Paragraph )SetHangingIndent (m _bd .Distance ){_dfcc .ensurePPr ();_aedf :=_dfcc ._dadg .PPr ;if _aedf .Ind ==nil {_aedf .Ind =_cc .NewCT_Ind ();};if m ==_bd .Zero {_aedf .Ind .HangingAttr =nil ;}else {_aedf .Ind .HangingAttr =&_ebd .ST_TwipsMeasure {};_aedf .Ind .HangingAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (m /_bd .Twips ));};};
|
|
|
|
// RemoveMailMerge removes any mail merge settings
|
|
func (_efdb Settings )RemoveMailMerge (){_efdb ._bbdg .MailMerge =nil };func (_gfdf Footnote )content ()[]*_cc .EG_ContentBlockContent {var _dfega []*_cc .EG_ContentBlockContent ;for _ ,_bgfb :=range _gfdf ._effcg .EG_BlockLevelElts {_dfega =append (_dfega ,_bgfb .EG_ContentBlockContent ...);};return _dfega ;};
|
|
|
|
// SetWrapPathLineTo sets wrapPath lineTo value.
|
|
func (_dac AnchorDrawWrapOptions )SetWrapPathLineTo (coordinates []*_cg .CT_Point2D ){_dac ._egd =coordinates ;};
|
|
|
|
// ReplaceText replace text inside node.
|
|
func (_debgad *Nodes )ReplaceText (oldText ,newText string ){for _ ,_dcec :=range _debgad ._cebe {_dcec .ReplaceText (oldText ,newText );};};
|
|
|
|
// Runs returns all of the runs in a paragraph.
|
|
func (_eecf Paragraph )Runs ()[]Run {_aegf :=[]Run {};for _ ,_bgad :=range _eecf ._dadg .EG_PContent {if _bgad .Hyperlink !=nil &&_bgad .Hyperlink .EG_ContentRunContent !=nil {for _ ,_ecfae :=range _bgad .Hyperlink .EG_ContentRunContent {if _ecfae .R !=nil {_aegf =append (_aegf ,Run {_eecf ._gefc ,_ecfae .R });};};};for _ ,_gbba :=range _bgad .EG_ContentRunContent {if _gbba .R !=nil {_aegf =append (_aegf ,Run {_eecf ._gefc ,_gbba .R });};if _gbba .Sdt !=nil &&_gbba .Sdt .SdtContent !=nil {for _ ,_cada :=range _gbba .Sdt .SdtContent .EG_ContentRunContent {if _cada .R !=nil {_aegf =append (_aegf ,Run {_eecf ._gefc ,_cada .R });};};};};};return _aegf ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_cdfg Color )X ()*_cc .CT_Color {return _cdfg ._bdf };
|
|
|
|
// IsItalic returns true if the run has been set to italics.
|
|
func (_abffd RunProperties )IsItalic ()bool {return _abffd .ItalicValue ()==OnOffValueOn };
|
|
|
|
// RemoveParagraph removes a paragraph from a footer.
|
|
func (_efdeg Footer )RemoveParagraph (p Paragraph ){for _ ,_becdf :=range _efdeg ._gceg .EG_ContentBlockContent {for _fgef ,_bdfae :=range _becdf .P {if _bdfae ==p ._dadg {copy (_becdf .P [_fgef :],_becdf .P [_fgef +1:]);_becdf .P =_becdf .P [0:len (_becdf .P )-1];return ;};};};};
|
|
|
|
// SetFirstRow controls the conditional formatting for the first row in a table.
|
|
func (_dfcad TableLook )SetFirstRow (on bool ){if !on {_dfcad ._gbfc .FirstRowAttr =&_ebd .ST_OnOff {};_dfcad ._gbfc .FirstRowAttr .ST_OnOff1 =_ebd .ST_OnOff1Off ;}else {_dfcad ._gbfc .FirstRowAttr =&_ebd .ST_OnOff {};_dfcad ._gbfc .FirstRowAttr .ST_OnOff1 =_ebd .ST_OnOff1On ;};};
|
|
|
|
// Name returns the name of the style if set.
|
|
func (_cggc Style )Name ()string {if _cggc ._bafd .Name ==nil {return "";};return _cggc ._bafd .Name .ValAttr ;};
|
|
|
|
// RemoveParagraph removes a paragraph from the footnote.
|
|
func (_cbfc Footnote )RemoveParagraph (p Paragraph ){for _ ,_eeeb :=range _cbfc .content (){for _ffgb ,_dddaa :=range _eeeb .P {if _dddaa ==p ._dadg {copy (_eeeb .P [_ffgb :],_eeeb .P [_ffgb +1:]);_eeeb .P =_eeeb .P [0:len (_eeeb .P )-1];return ;};};};};
|
|
|
|
// Headers returns the headers defined in the document.
|
|
func (_aag *Document )Headers ()[]Header {_dcd :=[]Header {};for _ ,_gfb :=range _aag ._dgbf {_dcd =append (_dcd ,Header {_aag ,_gfb });};return _dcd ;};
|
|
|
|
// SizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.
|
|
func (_adde ParagraphProperties )SizeMeasure ()string {if _dbfae :=_adde ._bfdca .RPr .Sz ;_dbfae !=nil {_eafg :=_dbfae .ValAttr ;if _eafg .ST_PositiveUniversalMeasure !=nil {return *_eafg .ST_PositiveUniversalMeasure ;};};return "";};
|
|
|
|
// Endnote returns the endnote based on the ID; this can be used nicely with
|
|
// the run.IsEndnote() functionality.
|
|
func (_dbec *Document )Endnote (id int64 )Endnote {for _ ,_ddd :=range _dbec .Endnotes (){if _ddd .id ()==id {return _ddd ;};};return Endnote {};};
|
|
|
|
// SetAfterAuto controls if spacing after a paragraph is automatically determined.
|
|
func (_deeb ParagraphSpacing )SetAfterAuto (b bool ){if b {_deeb ._cgaa .AfterAutospacingAttr =&_ebd .ST_OnOff {};_deeb ._cgaa .AfterAutospacingAttr .Bool =_e .Bool (true );}else {_deeb ._cgaa .AfterAutospacingAttr =nil ;};};func (_aegga *WatermarkPicture )getInnerElement (_gbdbf string )*_e .XSDAny {for _ ,_gfdfe :=range _aegga ._egag .Any {_cbdfd ,_bgga :=_gfdfe .(*_e .XSDAny );if _bgga &&(_cbdfd .XMLName .Local ==_gbdbf ||_cbdfd .XMLName .Local =="\u0076\u003a"+_gbdbf ){return _cbdfd ;};};return nil ;};func (_bdea *Document )insertImageFromNode (_fdfa Node ){for _ ,_fbeb :=range _fdfa .AnchoredDrawings {if _abbc ,_babb :=_fbeb .GetImage ();_babb {_bbcb ,_egae :=_acb .ImageFromFile (_abbc .Path ());if _egae !=nil {_bg .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",_egae );};_cdae ,_egae :=_bdea .AddImage (_bbcb );if _egae !=nil {_bg .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",_egae );};_fbge :=_bdea ._ebfd .GetByRelId (_cdae .RelID ());_fbge .SetID (_abbc .RelID ());};};for _ ,_gaab :=range _fdfa .InlineDrawings {if _baea ,_gbcd :=_gaab .GetImage ();_gbcd {_dgde ,_gbff :=_acb .ImageFromFile (_baea .Path ());if _gbff !=nil {_bg .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",_gbff );};_cadg ,_gbff :=_bdea .AddImage (_dgde );if _gbff !=nil {_bg .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",_gbff );};_cbdc :=_bdea ._ebfd .GetByRelId (_cadg .RelID ());_cbdc .SetID (_baea .RelID ());};};};func _aeggb (_aeag *_cc .CT_Border ,_cagd _cc .ST_Border ,_aceg _aeg .Color ,_ffdb _bd .Distance ){_aeag .ValAttr =_cagd ;_aeag .ColorAttr =&_cc .ST_HexColor {};if _aceg .IsAuto (){_aeag .ColorAttr .ST_HexColorAuto =_cc .ST_HexColorAutoAuto ;}else {_aeag .ColorAttr .ST_HexColorRGB =_aceg .AsRGBString ();};if _ffdb !=_bd .Zero {_aeag .SzAttr =_e .Uint64 (uint64 (_ffdb /_bd .Point *8));};};func (_gaa *Document )appendTable (_dbf *Paragraph ,_ecbc Table ,_aaa bool )Table {_dedg :=_gaa ._aeb .Body ;_geeg :=_cc .NewEG_BlockLevelElts ();_gaa ._aeb .Body .EG_BlockLevelElts =append (_gaa ._aeb .Body .EG_BlockLevelElts ,_geeg );_cbea :=_cc .NewEG_ContentBlockContent ();_geeg .EG_ContentBlockContent =append (_geeg .EG_ContentBlockContent ,_cbea );if _dbf !=nil {_ccd :=_dbf .X ();for _edeg ,_fgb :=range _dedg .EG_BlockLevelElts {for _ ,_dfg :=range _fgb .EG_ContentBlockContent {for _bab ,_fbe :=range _cbea .P {if _fbe ==_ccd {_gfg :=_ecbc .X ();_eade :=_cc .NewEG_BlockLevelElts ();_fdd :=_cc .NewEG_ContentBlockContent ();_eade .EG_ContentBlockContent =append (_eade .EG_ContentBlockContent ,_fdd );_fdd .Tbl =append (_fdd .Tbl ,_gfg );_dedg .EG_BlockLevelElts =append (_dedg .EG_BlockLevelElts ,nil );if _aaa {copy (_dedg .EG_BlockLevelElts [_edeg +1:],_dedg .EG_BlockLevelElts [_edeg :]);_dedg .EG_BlockLevelElts [_edeg ]=_eade ;if _bab !=0{_fcde :=_cc .NewEG_BlockLevelElts ();_edcf :=_cc .NewEG_ContentBlockContent ();_fcde .EG_ContentBlockContent =append (_fcde .EG_ContentBlockContent ,_edcf );_edcf .P =_dfg .P [:_bab ];_dedg .EG_BlockLevelElts =append (_dedg .EG_BlockLevelElts ,nil );copy (_dedg .EG_BlockLevelElts [_edeg +1:],_dedg .EG_BlockLevelElts [_edeg :]);_dedg .EG_BlockLevelElts [_edeg ]=_fcde ;};_dfg .P =_dfg .P [_bab :];}else {copy (_dedg .EG_BlockLevelElts [_edeg +2:],_dedg .EG_BlockLevelElts [_edeg +1:]);_dedg .EG_BlockLevelElts [_edeg +1]=_eade ;if _bab !=len (_dfg .P )-1{_bee :=_cc .NewEG_BlockLevelElts ();_ebbe :=_cc .NewEG_ContentBlockContent ();_bee .EG_ContentBlockContent =append (_bee .EG_ContentBlockContent ,_ebbe );_ebbe .P =_dfg .P [_bab +1:];_dedg .EG_BlockLevelElts =append (_dedg .EG_BlockLevelElts ,nil );copy (_dedg .EG_BlockLevelElts [_edeg +3:],_dedg .EG_BlockLevelElts [_edeg +2:]);_dedg .EG_BlockLevelElts [_edeg +2]=_bee ;};_dfg .P =_dfg .P [:_bab +1];};break ;};};for _ ,_ecagc :=range _dfg .Tbl {_dabf :=_aff (_ecagc ,_ccd ,_aaa );if _dabf !=nil {break ;};};};};}else {_cbea .Tbl =append (_cbea .Tbl ,_ecbc .X ());};return Table {_gaa ,_ecbc .X ()};};
|
|
|
|
// GetFooter gets a section Footer for given type
|
|
func (_bbagdg Section )GetFooter (t _cc .ST_HdrFtr )(Footer ,bool ){for _ ,_bccgc :=range _bbagdg ._cdac .EG_HdrFtrReferences {if _bccgc .FooterReference .TypeAttr ==t {for _ ,_eebf :=range _bbagdg ._aafce .Footers (){_dbgb :=_bbagdg ._aafce ._ebfd .FindRIDForN (_eebf .Index (),_e .FooterType );if _dbgb ==_bccgc .FooterReference .IdAttr {return _eebf ,true ;};};};};return Footer {},false ;};
|
|
|
|
// AddFooter creates a Footer associated with the document, but doesn't add it
|
|
// to the document for display.
|
|
func (_faa *Document )AddFooter ()Footer {_dd :=_cc .NewFtr ();_faa ._ebda =append (_faa ._ebda ,_dd );_ebee :=_gb .Sprintf ("\u0066\u006f\u006ft\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c",len (_faa ._ebda ));_faa ._ebfd .AddRelationship (_ebee ,_e .FooterType );_faa .ContentTypes .AddOverride ("\u002f\u0077\u006f\u0072\u0064\u002f"+_ebee ,"\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");_faa ._dfa =append (_faa ._dfa ,_acb .NewRelationships ());return Footer {_faa ,_dd };};
|
|
|
|
// Italic returns true if run font is italic.
|
|
func (_aagc RunProperties )Italic ()bool {_cedb :=_aagc ._acgcd ;return _fcaaa (_cedb .I )||_fcaaa (_cedb .ICs );};
|
|
|
|
// Tables returns the tables defined in the header.
|
|
func (_bbac Header )Tables ()[]Table {_bccb :=[]Table {};if _bbac ._abed ==nil {return nil ;};for _ ,_gdcc :=range _bbac ._abed .EG_ContentBlockContent {for _ ,_agde :=range _bbac ._edgdf .tables (_gdcc ){_bccb =append (_bccb ,_agde );};};return _bccb ;};
|
|
|
|
// GetTargetByRelId returns a target path with the associated relation ID in the
|
|
// document.
|
|
func (_ccbaa *Document )GetTargetByRelId (idAttr string )string {return _ccbaa ._ebfd .GetTargetByRelId (idAttr );};
|
|
|
|
// NumberingLevel is the definition for numbering for a particular level within
|
|
// a NumberingDefinition.
|
|
type NumberingLevel struct{_befe *_cc .CT_Lvl };
|
|
|
|
// AddPageBreak adds a page break to a run.
|
|
func (_bdfde Run )AddPageBreak (){_aeec :=_bdfde .newIC ();_aeec .Br =_cc .NewCT_Br ();_aeec .Br .TypeAttr =_cc .ST_BrTypePage ;};const (OnOffValueUnset OnOffValue =iota ;OnOffValueOff ;OnOffValueOn ;);
|
|
|
|
// Color returns the style's Color.
|
|
func (_cbdg RunProperties )Color ()Color {if _cbdg ._acgcd .Color ==nil {_cbdg ._acgcd .Color =_cc .NewCT_Color ();};return Color {_cbdg ._acgcd .Color };};
|
|
|
|
// NewTableWidth returns a newly intialized TableWidth
|
|
func NewTableWidth ()TableWidth {return TableWidth {_cc .NewCT_TblWidth ()}};
|
|
|
|
// SetLeft sets the left border to a specified type, color and thickness.
|
|
func (_ddcd ParagraphBorders )SetLeft (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_ddcd ._fgda .Left =_cc .NewCT_Border ();_aeggb (_ddcd ._fgda .Left ,t ,c ,thickness );};
|
|
|
|
// SetSmallCaps sets the run to small caps.
|
|
func (_ddgbe RunProperties )SetSmallCaps (b bool ){if !b {_ddgbe ._acgcd .SmallCaps =nil ;}else {_ddgbe ._acgcd .SmallCaps =_cc .NewCT_OnOff ();};};func _agbc (_bcgf *_cc .CT_Tbl ,_gbfb map[string ]string ){for _ ,_feff :=range _bcgf .EG_ContentRowContent {for _ ,_bgee :=range _feff .Tr {for _ ,_ecbe :=range _bgee .EG_ContentCellContent {for _ ,_gaedf :=range _ecbe .Tc {for _ ,_dadf :=range _gaedf .EG_BlockLevelElts {for _ ,_gbfa :=range _dadf .EG_ContentBlockContent {for _ ,_ddfgd :=range _gbfa .P {_abbaa (_ddfgd ,_gbfb );};for _ ,_gdfc :=range _gbfa .Tbl {_agbc (_gdfc ,_gbfb );};};};};};};};};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_aabce TableLook )X ()*_cc .CT_TblLook {return _aabce ._gbfc };
|
|
|
|
// Outline returns true if run outline is on.
|
|
func (_bdbc RunProperties )Outline ()bool {return _fcaaa (_bdbc ._acgcd .Outline )};
|
|
|
|
// SetHorizontalBanding controls the conditional formatting for horizontal banding.
|
|
func (_gfbgc TableLook )SetHorizontalBanding (on bool ){if !on {_gfbgc ._gbfc .NoHBandAttr =&_ebd .ST_OnOff {};_gfbgc ._gbfc .NoHBandAttr .ST_OnOff1 =_ebd .ST_OnOff1On ;}else {_gfbgc ._gbfc .NoHBandAttr =&_ebd .ST_OnOff {};_gfbgc ._gbfc .NoHBandAttr .ST_OnOff1 =_ebd .ST_OnOff1Off ;};};
|
|
|
|
// StructuredDocumentTags returns the structured document tags in the document
|
|
// which are commonly used in document templates.
|
|
func (_cgce *Document )StructuredDocumentTags ()[]StructuredDocumentTag {_gdde :=[]StructuredDocumentTag {};for _ ,_fbbd :=range _cgce ._aeb .Body .EG_BlockLevelElts {for _ ,_cagcd :=range _fbbd .EG_ContentBlockContent {if _cagcd .Sdt !=nil {_gdde =append (_gdde ,StructuredDocumentTag {_cgce ,_cagcd .Sdt });};};};return _gdde ;};
|
|
|
|
// Text return node and its child text,
|
|
func (_fec *Node )Text ()string {_adece :=_de .NewBuffer ([]byte {});switch _dcfa :=_fec .X ().(type ){case *Paragraph :for _ ,_eecgb :=range _dcfa .Runs (){if _eecgb .Text ()!=""{_adece .WriteString (_eecgb .Text ());_adece .WriteString ("\u000a");};};};for _ ,_cbdf :=range _fec .Children {_adece .WriteString (_cbdf .Text ());};return _adece .String ();};
|
|
|
|
// AddHyperLink adds a new hyperlink to a parapgraph.
|
|
func (_cfbdc Paragraph )AddHyperLink ()HyperLink {_ebab :=_cc .NewEG_PContent ();_cfbdc ._dadg .EG_PContent =append (_cfbdc ._dadg .EG_PContent ,_ebab );_ebab .Hyperlink =_cc .NewCT_Hyperlink ();return HyperLink {_cfbdc ._gefc ,_ebab .Hyperlink };};
|
|
|
|
// AddText adds text to a run.
|
|
func (_afeb Run )AddText (s string ){_fgec :=_cc .NewEG_RunInnerContent ();_afeb ._abeed .EG_RunInnerContent =append (_afeb ._abeed .EG_RunInnerContent ,_fgec );_fgec .T =_cc .NewCT_Text ();if _e .NeedsSpacePreserve (s ){_aabdg :="\u0070\u0072\u0065\u0073\u0065\u0072\u0076\u0065";_fgec .T .SpaceAttr =&_aabdg ;};_fgec .T .Content =s ;};func (_aacfb Paragraph )addFldChar ()*_cc .CT_FldChar {_adga :=_aacfb .AddRun ();_cdegd :=_adga .X ();_eefff :=_cc .NewEG_RunInnerContent ();_gaebd :=_cc .NewCT_FldChar ();_eefff .FldChar =_gaebd ;_cdegd .EG_RunInnerContent =append (_cdegd .EG_RunInnerContent ,_eefff );return _gaebd ;};
|
|
|
|
// ParagraphStyleProperties is the styling information for a paragraph.
|
|
type ParagraphStyleProperties struct{_feffd *_cc .CT_PPrGeneral };
|
|
|
|
// TextWithOptions extract text with options.
|
|
func (_efea *DocText )TextWithOptions (options ExtractTextOptions )string {_gafb :=make (map[int64 ]map[int64 ]int64 ,0);_dgaec :=_de .NewBuffer ([]byte {});_baff :=int64 (0);_edada :=int64 (0);_egff :=int64 (0);for _fbd ,_cbgd :=range _efea .Items {_aadf :=false ;if _cbgd .Text !=""{if _fbd > 0{if _cbgd .Paragraph !=_efea .Items [_fbd -1].Paragraph {_aadf =true ;};if !options .RunsOnNewLine &&_aadf {_dgaec .WriteString ("\u000a");}else if options .RunsOnNewLine {_dgaec .WriteString ("\u000a");};}else {_aadf =true ;};if options .WithNumbering {if _aadf {for _ ,_fbafe :=range _efea ._eddgd {if _fbafe .FromParagraph ==nil {continue ;};if _fbafe .FromParagraph .X ()==_cbgd .Paragraph {if _bdbd :=_fbafe .NumberingLevel .X ();_bdbd !=nil {if _fbafe .AbstractNumId !=nil &&_efea ._gfae [*_fbafe .AbstractNumId ][_bdbd .IlvlAttr ]> 0{if _ ,_ceeff :=_gafb [*_fbafe .AbstractNumId ];_ceeff {if _ ,_baed :=_gafb [*_fbafe .AbstractNumId ][_bdbd .IlvlAttr ];_baed {_gafb [*_fbafe .AbstractNumId ][_bdbd .IlvlAttr ]++;}else {_gafb [*_fbafe .AbstractNumId ][_bdbd .IlvlAttr ]=1;};}else {_gafb [*_fbafe .AbstractNumId ]=map[int64 ]int64 {_bdbd .IlvlAttr :1};};if _baff ==_fbafe .NumberingLevel .X ().IlvlAttr &&_bdbd .IlvlAttr > 0{_edada ++;}else {_edada =_gafb [*_fbafe .AbstractNumId ][_bdbd .IlvlAttr ];if _bdbd .IlvlAttr > _baff &&_egff ==*_fbafe .AbstractNumId {_edada =1;};};_cddd :="";if _bdbd .LvlText .ValAttr !=nil {_cddd =*_bdbd .LvlText .ValAttr ;};_bbcg :=_eb .FormatNumberingText (_edada ,_bdbd .IlvlAttr ,_cddd ,_bdbd .NumFmt ,_gafb [*_fbafe .AbstractNumId ]);_dgaec .WriteString (_bbcg );_efea ._gfae [*_fbafe .AbstractNumId ][_bdbd .IlvlAttr ]--;_baff =_bdbd .IlvlAttr ;_egff =*_fbafe .AbstractNumId ;if options .NumberingIndent !=""{_dgaec .WriteString (options .NumberingIndent );};};};break ;};};};};_dgaec .WriteString (_cbgd .Text );};};return _dgaec .String ();};
|
|
|
|
// Run is a run of text within a paragraph that shares the same formatting.
|
|
type Run struct{_bdaag *Document ;_abeed *_cc .CT_R ;};
|
|
|
|
// HasEndnotes returns a bool based on the presence or abscence of endnotes within
|
|
// the document.
|
|
func (_cgfa *Document )HasEndnotes ()bool {return _cgfa ._cde !=nil };func _aaga (_eafeb *Document ,_fdbg Paragraph )listItemInfo {if _eafeb .Numbering .X ()==nil {return listItemInfo {};};if len (_eafeb .Numbering .Definitions ())< 1{return listItemInfo {};};_baba :=_cece (_fdbg );if _baba ==nil {return listItemInfo {};};_bafed :=_eafeb .GetNumberingLevelByIds (_baba .NumId .ValAttr ,_baba .Ilvl .ValAttr );if _dbff :=_bafed .X ();_dbff ==nil {return listItemInfo {};};_ebgaf :=int64 (0);for _ ,_gacb :=range _eafeb .Numbering ._bedb .Num {if _gacb !=nil &&_gacb .NumIdAttr ==_baba .NumId .ValAttr {_ebgaf =_gacb .AbstractNumId .ValAttr ;};};return listItemInfo {FromParagraph :&_fdbg ,AbstractNumId :&_ebgaf ,NumberingLevel :&_bafed };};
|
|
|
|
// FindNodeByText return node based on matched text and return a slice of node.
|
|
func (_cdbdg *Nodes )FindNodeByText (text string )[]Node {_dggc :=[]Node {};for _ ,_gadb :=range _cdbdg ._cebe {if _d .TrimSpace (_gadb .Text ())==text {_dggc =append (_dggc ,_gadb );};_dagce :=Nodes {_cebe :_gadb .Children };_dggc =append (_dggc ,_dagce .FindNodeByText (text )...);};return _dggc ;};
|
|
|
|
// SetHangingIndent controls the hanging indent of the paragraph.
|
|
func (_ccddd ParagraphStyleProperties )SetHangingIndent (m _bd .Distance ){if _ccddd ._feffd .Ind ==nil {_ccddd ._feffd .Ind =_cc .NewCT_Ind ();};if m ==_bd .Zero {_ccddd ._feffd .Ind .HangingAttr =nil ;}else {_ccddd ._feffd .Ind .HangingAttr =&_ebd .ST_TwipsMeasure {};_ccddd ._feffd .Ind .HangingAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (m /_bd .Twips ));};};func (_gefb Styles )initializeStyleDefaults (){_afdce :=_gefb .AddStyle ("\u004e\u006f\u0072\u006d\u0061\u006c",_cc .ST_StyleTypeParagraph ,true );_afdce .SetName ("\u004e\u006f\u0072\u006d\u0061\u006c");_afdce .SetPrimaryStyle (true );_gcdg :=_gefb .AddStyle ("D\u0065f\u0061\u0075\u006c\u0074\u0050\u0061\u0072\u0061g\u0072\u0061\u0070\u0068Fo\u006e\u0074",_cc .ST_StyleTypeCharacter ,true );_gcdg .SetName ("\u0044\u0065\u0066\u0061ul\u0074\u0020\u0050\u0061\u0072\u0061\u0067\u0072\u0061\u0070\u0068\u0020\u0046\u006fn\u0074");_gcdg .SetUISortOrder (1);_gcdg .SetSemiHidden (true );_gcdg .SetUnhideWhenUsed (true );_ffeb :=_gefb .AddStyle ("\u0054i\u0074\u006c\u0065\u0043\u0068\u0061r",_cc .ST_StyleTypeCharacter ,false );_ffeb .SetName ("\u0054\u0069\u0074\u006c\u0065\u0020\u0043\u0068\u0061\u0072");_ffeb .SetBasedOn (_gcdg .StyleID ());_ffeb .SetLinkedStyle ("\u0054\u0069\u0074l\u0065");_ffeb .SetUISortOrder (10);_ffeb .RunProperties ().Fonts ().SetASCIITheme (_cc .ST_ThemeMajorAscii );_ffeb .RunProperties ().Fonts ().SetEastAsiaTheme (_cc .ST_ThemeMajorEastAsia );_ffeb .RunProperties ().Fonts ().SetHANSITheme (_cc .ST_ThemeMajorHAnsi );_ffeb .RunProperties ().Fonts ().SetCSTheme (_cc .ST_ThemeMajorBidi );_ffeb .RunProperties ().SetSize (28*_bd .Point );_ffeb .RunProperties ().SetKerning (14*_bd .Point );_ffeb .RunProperties ().SetCharacterSpacing (-10*_bd .Twips );_bfbdb :=_gefb .AddStyle ("\u0054\u0069\u0074l\u0065",_cc .ST_StyleTypeParagraph ,false );_bfbdb .SetName ("\u0054\u0069\u0074l\u0065");_bfbdb .SetBasedOn (_afdce .StyleID ());_bfbdb .SetNextStyle (_afdce .StyleID ());_bfbdb .SetLinkedStyle (_ffeb .StyleID ());_bfbdb .SetUISortOrder (10);_bfbdb .SetPrimaryStyle (true );_bfbdb .ParagraphProperties ().SetContextualSpacing (true );_bfbdb .RunProperties ().Fonts ().SetASCIITheme (_cc .ST_ThemeMajorAscii );_bfbdb .RunProperties ().Fonts ().SetEastAsiaTheme (_cc .ST_ThemeMajorEastAsia );_bfbdb .RunProperties ().Fonts ().SetHANSITheme (_cc .ST_ThemeMajorHAnsi );_bfbdb .RunProperties ().Fonts ().SetCSTheme (_cc .ST_ThemeMajorBidi );_bfbdb .RunProperties ().SetSize (28*_bd .Point );_bfbdb .RunProperties ().SetKerning (14*_bd .Point );_bfbdb .RunProperties ().SetCharacterSpacing (-10*_bd .Twips );_fdfad :=_gefb .AddStyle ("T\u0061\u0062\u006c\u0065\u004e\u006f\u0072\u006d\u0061\u006c",_cc .ST_StyleTypeTable ,false );_fdfad .SetName ("\u004e\u006f\u0072m\u0061\u006c\u0020\u0054\u0061\u0062\u006c\u0065");_fdfad .SetUISortOrder (99);_fdfad .SetSemiHidden (true );_fdfad .SetUnhideWhenUsed (true );_fdfad .X ().TblPr =_cc .NewCT_TblPrBase ();_gfbaa :=NewTableWidth ();_fdfad .X ().TblPr .TblInd =_gfbaa .X ();_gfbaa .SetValue (0*_bd .Dxa );_fdfad .X ().TblPr .TblCellMar =_cc .NewCT_TblCellMar ();_gfbaa =NewTableWidth ();_fdfad .X ().TblPr .TblCellMar .Top =_gfbaa .X ();_gfbaa .SetValue (0*_bd .Dxa );_gfbaa =NewTableWidth ();_fdfad .X ().TblPr .TblCellMar .Bottom =_gfbaa .X ();_gfbaa .SetValue (0*_bd .Dxa );_gfbaa =NewTableWidth ();_fdfad .X ().TblPr .TblCellMar .Left =_gfbaa .X ();_gfbaa .SetValue (108*_bd .Dxa );_gfbaa =NewTableWidth ();_fdfad .X ().TblPr .TblCellMar .Right =_gfbaa .X ();_gfbaa .SetValue (108*_bd .Dxa );_dece :=_gefb .AddStyle ("\u004e\u006f\u004c\u0069\u0073\u0074",_cc .ST_StyleTypeNumbering ,false );_dece .SetName ("\u004eo\u0020\u004c\u0069\u0073\u0074");_dece .SetUISortOrder (1);_dece .SetSemiHidden (true );_dece .SetUnhideWhenUsed (true );_bbcdf :=[]_bd .Distance {16,13,12,11,11,11,11,11,11};_fbgd :=[]_bd .Distance {240,40,40,40,40,40,40,40,40};for _eface :=0;_eface < 9;_eface ++{_efgdd :=_gb .Sprintf ("\u0048e\u0061\u0064\u0069\u006e\u0067\u0025d",_eface +1);_cgcbg :=_gefb .AddStyle (_efgdd +"\u0043\u0068\u0061\u0072",_cc .ST_StyleTypeCharacter ,false );_cgcbg .SetName (_gb .Sprintf ("\u0048e\u0061d\u0069\u006e\u0067\u0020\u0025\u0064\u0020\u0043\u0068\u0061\u0072",_eface +1));_cgcbg .SetBasedOn (_gcdg .StyleID ());_cgcbg .SetLinkedStyle (_efgdd );_cgcbg .SetUISortOrder (9+_eface );_cgcbg .RunProperties ().SetSize (_bbcdf [_eface ]*_bd .Point );_ffcf :=_gefb .AddStyle (_efgdd ,_cc .ST_StyleTypeParagraph ,false );_ffcf .SetName (_gb .Sprintf ("\u0068\u0065\u0061\u0064\u0069\u006e\u0067\u0020\u0025\u0064",_eface +1));_ffcf .SetNextStyle (_afdce .StyleID ());_ffcf .SetLinkedStyle (_ffcf .StyleID ());_ffcf .SetUISortOrder (9+_eface );_ffcf .SetPrimaryStyle (true );_ffcf .ParagraphProperties ().SetKeepNext (true );_ffcf .ParagraphProperties ().SetSpacing (_fbgd [_eface ]*_bd .Twips ,0);_ffcf .ParagraphProperties ().SetOutlineLevel (_eface );_ffcf .RunProperties ().SetSize (_bbcdf [_eface ]*_bd .Point );};};
|
|
|
|
// GetImageByRelID returns an ImageRef with the associated relation ID in the
|
|
// document.
|
|
func (_effc *Document )GetImageByRelID (relID string )(_acb .ImageRef ,bool ){_cfbad :=_effc ._ebfd .GetTargetByRelId (relID );_ffdc :="";for _ ,_aacf :=range _effc ._edc {if _ffdc !=""{break ;};_ffdc =_aacf .GetTargetByRelId (relID );};for _ ,_dcg :=range _effc .Images {if _dcg .RelID ()==relID {return _dcg ,true ;};if _cfbad !=""{_gfgc :=_d .Replace (_dcg .Target (),"\u0077\u006f\u0072d\u002f","",1);if _gfgc ==_cfbad {if _dcg .RelID ()==""{_dcg .SetRelID (relID );};return _dcg ,true ;};};if _ffdc !=""{_gbac :=_d .Replace (_dcg .Target (),"\u0077\u006f\u0072d\u002f","",1);if _gbac ==_ffdc {if _dcg .RelID ()==""{_dcg .SetRelID (relID );};return _dcg ,true ;};};};return _acb .ImageRef {},false ;};
|
|
|
|
// SetTextStyleItalic set text style of watermark to italic.
|
|
func (_bgadf *WatermarkText )SetTextStyleItalic (value bool ){if _bgadf ._eeced !=nil {_fbgdf :=_bgadf .GetStyle ();_fbgdf .SetItalic (value );_bgadf .SetStyle (_fbgdf );};};
|
|
|
|
// SetAll sets all of the borders to a given value.
|
|
func (_geg CellBorders )SetAll (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_geg .SetBottom (t ,c ,thickness );_geg .SetLeft (t ,c ,thickness );_geg .SetRight (t ,c ,thickness );_geg .SetTop (t ,c ,thickness );_geg .SetInsideHorizontal (t ,c ,thickness );_geg .SetInsideVertical (t ,c ,thickness );};
|
|
|
|
// New constructs an empty document that content can be added to.
|
|
func New ()*Document {_cbdee :=&Document {_aeb :_cc .NewDocument ()};_cbdee .ContentTypes =_acb .NewContentTypes ();_cbdee ._aeb .Body =_cc .NewCT_Body ();_cbdee ._aeb .ConformanceAttr =_ebd .ST_ConformanceClassTransitional ;_cbdee ._ebfd =_acb .NewRelationships ();_cbdee .AppProperties =_acb .NewAppProperties ();_cbdee .CoreProperties =_acb .NewCoreProperties ();_cbdee .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");_cbdee .Settings =NewSettings ();_cbdee ._ebfd .AddRelationship ("\u0073\u0065\u0074t\u0069\u006e\u0067\u0073\u002e\u0078\u006d\u006c",_e .SettingsType );_cbdee .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");_cbdee .Rels =_acb .NewRelationships ();_cbdee .Rels .AddRelationship (_e .RelativeFilename (_e .DocTypeDocument ,"",_e .CorePropertiesType ,0),_e .CorePropertiesType );_cbdee .Rels .AddRelationship ("\u0064\u006fc\u0050\u0072\u006fp\u0073\u002f\u0061\u0070\u0070\u002e\u0078\u006d\u006c",_e .ExtendedPropertiesType );_cbdee .Rels .AddRelationship ("\u0077\u006f\u0072\u0064\u002f\u0064\u006f\u0063\u0075\u006d\u0065\u006et\u002e\u0078\u006d\u006c",_e .OfficeDocumentType );_cbdee .Numbering =NewNumbering ();_cbdee .Numbering .InitializeDefault ();_cbdee .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");_cbdee ._ebfd .AddRelationship ("\u006e\u0075\u006d\u0062\u0065\u0072\u0069\u006e\u0067\u002e\u0078\u006d\u006c",_e .NumberingType );_cbdee .Styles =NewStyles ();_cbdee .Styles .InitializeDefault ();_cbdee .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");_cbdee ._ebfd .AddRelationship ("\u0073\u0074\u0079\u006c\u0065\u0073\u002e\u0078\u006d\u006c",_e .StylesType );_cbdee ._aeb .Body =_cc .NewCT_Body ();return _cbdee ;};
|
|
|
|
// CellProperties returns the cell properties.
|
|
func (_agad TableConditionalFormatting )CellProperties ()CellProperties {if _agad ._fgcg .TcPr ==nil {_agad ._fgcg .TcPr =_cc .NewCT_TcPr ();};return CellProperties {_agad ._fgcg .TcPr };};
|
|
|
|
// ReplaceTextByRegexp replace text inside node using regexp.
|
|
func (_baffc *Nodes )ReplaceTextByRegexp (expr *_f .Regexp ,newText string ){for _ ,_defbd :=range _baffc ._cebe {_defbd .ReplaceTextByRegexp (expr ,newText );};};func _faabc (_dca *_cc .CT_Tbl ,_ffba map[string ]string ){for _ ,_ddfd :=range _dca .EG_ContentRowContent {for _ ,_eggg :=range _ddfd .Tr {for _ ,_ffgg :=range _eggg .EG_ContentCellContent {for _ ,_cgeg :=range _ffgg .Tc {for _ ,_eadfaa :=range _cgeg .EG_BlockLevelElts {for _ ,_dafae :=range _eadfaa .EG_ContentBlockContent {for _ ,_eagf :=range _dafae .P {_fcbd (_eagf ,_ffba );};for _ ,_cdcd :=range _dafae .Tbl {_faabc (_cdcd ,_ffba );};};};};};};};};
|
|
|
|
// AddTabStop adds a tab stop to the paragraph.
|
|
func (_dcfef ParagraphStyleProperties )AddTabStop (position _bd .Distance ,justificaton _cc .ST_TabJc ,leader _cc .ST_TabTlc ){if _dcfef ._feffd .Tabs ==nil {_dcfef ._feffd .Tabs =_cc .NewCT_Tabs ();};_dcedc :=_cc .NewCT_TabStop ();_dcedc .LeaderAttr =leader ;_dcedc .ValAttr =justificaton ;_dcedc .PosAttr .Int64 =_e .Int64 (int64 (position /_bd .Twips ));_dcfef ._feffd .Tabs .Tab =append (_dcfef ._feffd .Tabs .Tab ,_dcedc );};
|
|
|
|
// PutNodeAfter put node to position after relativeTo.
|
|
func (_bbdd *Document )PutNodeAfter (relativeTo ,node Node ){_bbdd .putNode (relativeTo ,node ,false )};
|
|
|
|
// SetTarget sets the URL target of the hyperlink.
|
|
func (_edcac HyperLink )SetTarget (url string ){_bfdee :=_edcac ._fdaa .AddHyperlink (url );_edcac ._bfde .IdAttr =_e .String (_acb .Relationship (_bfdee ).ID ());_edcac ._bfde .AnchorAttr =nil ;};
|
|
|
|
// SetBeforeSpacing sets spacing above paragraph.
|
|
func (_cdfge Paragraph )SetBeforeSpacing (d _bd .Distance ){_cdfge .ensurePPr ();if _cdfge ._dadg .PPr .Spacing ==nil {_cdfge ._dadg .PPr .Spacing =_cc .NewCT_Spacing ();};_bbdc :=_cdfge ._dadg .PPr .Spacing ;_bbdc .BeforeAttr =&_ebd .ST_TwipsMeasure {};_bbdc .BeforeAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (d /_bd .Twips ));};
|
|
|
|
// ReplaceTextByRegexp replace the text within node using regexp expression.
|
|
func (_beac *Node )ReplaceTextByRegexp (rgx *_f .Regexp ,newText string ){switch _gcab :=_beac .X ().(type ){case *Paragraph :for _ ,_gdcaf :=range _gcab .Runs (){for _ ,_fabf :=range _gdcaf ._abeed .EG_RunInnerContent {if _fabf .T !=nil {_gcgb :=_fabf .T .Content ;_gcgb =rgx .ReplaceAllString (_gcgb ,newText );_fabf .T .Content =_gcgb ;};};};};for _ ,_edbg :=range _beac .Children {_edbg .ReplaceTextByRegexp (rgx ,newText );};};func (_eeea Paragraph )insertRun (_gfdgf Run ,_eeebf bool )Run {for _ ,_afbad :=range _eeea ._dadg .EG_PContent {for _cagg ,_gcgd :=range _afbad .EG_ContentRunContent {if _gcgd .R ==_gfdgf .X (){_ggacd :=_cc .NewCT_R ();_afbad .EG_ContentRunContent =append (_afbad .EG_ContentRunContent ,nil );if _eeebf {copy (_afbad .EG_ContentRunContent [_cagg +1:],_afbad .EG_ContentRunContent [_cagg :]);_afbad .EG_ContentRunContent [_cagg ]=_cc .NewEG_ContentRunContent ();_afbad .EG_ContentRunContent [_cagg ].R =_ggacd ;}else {copy (_afbad .EG_ContentRunContent [_cagg +2:],_afbad .EG_ContentRunContent [_cagg +1:]);_afbad .EG_ContentRunContent [_cagg +1]=_cc .NewEG_ContentRunContent ();_afbad .EG_ContentRunContent [_cagg +1].R =_ggacd ;};return Run {_eeea ._gefc ,_ggacd };};if _gcgd .Sdt !=nil &&_gcgd .Sdt .SdtContent !=nil {for _ ,_bgcg :=range _gcgd .Sdt .SdtContent .EG_ContentRunContent {if _bgcg .R ==_gfdgf .X (){_bbgdc :=_cc .NewCT_R ();_gcgd .Sdt .SdtContent .EG_ContentRunContent =append (_gcgd .Sdt .SdtContent .EG_ContentRunContent ,nil );if _eeebf {copy (_gcgd .Sdt .SdtContent .EG_ContentRunContent [_cagg +1:],_gcgd .Sdt .SdtContent .EG_ContentRunContent [_cagg :]);_gcgd .Sdt .SdtContent .EG_ContentRunContent [_cagg ]=_cc .NewEG_ContentRunContent ();_gcgd .Sdt .SdtContent .EG_ContentRunContent [_cagg ].R =_bbgdc ;}else {copy (_gcgd .Sdt .SdtContent .EG_ContentRunContent [_cagg +2:],_gcgd .Sdt .SdtContent .EG_ContentRunContent [_cagg +1:]);_gcgd .Sdt .SdtContent .EG_ContentRunContent [_cagg +1]=_cc .NewEG_ContentRunContent ();_gcgd .Sdt .SdtContent .EG_ContentRunContent [_cagg +1].R =_bbgdc ;};return Run {_eeea ._gefc ,_bbgdc };};};};};};return _eeea .AddRun ();};
|
|
|
|
// Tables returns the tables defined in the footer.
|
|
func (_gfbbd Footer )Tables ()[]Table {_edbc :=[]Table {};if _gfbbd ._gceg ==nil {return nil ;};for _ ,_fdde :=range _gfbbd ._gceg .EG_ContentBlockContent {for _ ,_fcdc :=range _gfbbd ._acab .tables (_fdde ){_edbc =append (_edbc ,_fcdc );};};return _edbc ;};
|
|
|
|
// AddRun adds a run to a paragraph.
|
|
func (_gfbag Paragraph )AddRun ()Run {_adba :=_cc .NewEG_PContent ();_gfbag ._dadg .EG_PContent =append (_gfbag ._dadg .EG_PContent ,_adba );_bbadd :=_cc .NewEG_ContentRunContent ();_adba .EG_ContentRunContent =append (_adba .EG_ContentRunContent ,_bbadd );_gddd :=_cc .NewCT_R ();_bbadd .R =_gddd ;return Run {_gfbag ._gefc ,_gddd };};
|
|
|
|
// SetHAlignment sets the horizontal alignment for an anchored image.
|
|
func (_faf AnchoredDrawing )SetHAlignment (h _cc .WdST_AlignH ){_faf ._gg .PositionH .Choice =&_cc .WdCT_PosHChoice {};_faf ._gg .PositionH .Choice .Align =h ;};
|
|
|
|
// SetInsideHorizontal sets the interior horizontal borders to a specified type, color and thickness.
|
|
func (_defc TableBorders )SetInsideHorizontal (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_defc ._bfabb .InsideH =_cc .NewCT_Border ();_bfccc (_defc ._bfabb .InsideH ,t ,c ,thickness );};
|
|
|
|
// DoubleStrike returns true if paragraph is double striked.
|
|
func (_ddef ParagraphProperties )DoubleStrike ()bool {return _fcaaa (_ddef ._bfdca .RPr .Dstrike )};
|
|
|
|
// SetUISortOrder controls the order the style is displayed in the UI.
|
|
func (_gbbae Style )SetUISortOrder (order int ){_gbbae ._bafd .UiPriority =_cc .NewCT_DecimalNumber ();_gbbae ._bafd .UiPriority .ValAttr =int64 (order );};
|
|
|
|
// SizeValue returns the value of run font size in points.
|
|
func (_egffg RunProperties )SizeValue ()float64 {if _dbfd :=_egffg ._acgcd .Sz ;_dbfd !=nil {_dbca :=_dbfd .ValAttr ;if _dbca .ST_UnsignedDecimalNumber !=nil {return float64 (*_dbca .ST_UnsignedDecimalNumber )/2;};};return 0.0;};
|
|
|
|
// AddWatermarkText adds new watermark text to the document.
|
|
func (_beaf *Document )AddWatermarkText (text string )WatermarkText {var _gccf []Header ;if _adgd ,_aagge :=_beaf .BodySection ().GetHeader (_cc .ST_HdrFtrDefault );_aagge {_gccf =append (_gccf ,_adgd );};if _afcf ,_ffcd :=_beaf .BodySection ().GetHeader (_cc .ST_HdrFtrEven );_ffcd {_gccf =append (_gccf ,_afcf );};if _bebd ,_gdaa :=_beaf .BodySection ().GetHeader (_cc .ST_HdrFtrFirst );_gdaa {_gccf =append (_gccf ,_bebd );};if len (_gccf )< 1{_dgdg :=_beaf .AddHeader ();_beaf .BodySection ().SetHeader (_dgdg ,_cc .ST_HdrFtrDefault );_gccf =append (_gccf ,_dgdg );};_becd :=NewWatermarkText ();for _ ,_gcf :=range _gccf {_faab :=_gcf .Paragraphs ();if len (_faab )< 1{_faef :=_gcf .AddParagraph ();_faef .AddRun ().AddText ("");};for _ ,_efe :=range _gcf .X ().EG_ContentBlockContent {for _ ,_beee :=range _efe .P {for _ ,_bcggd :=range _beee .EG_PContent {for _ ,_ddff :=range _bcggd .EG_ContentRunContent {if _ddff .R ==nil {continue ;};for _ ,_ccga :=range _ddff .R .EG_RunInnerContent {_ccga .Pict =_becd ._adfba ;break ;};};};};};};_becd .SetText (text );return _becd ;};
|
|
|
|
// SetCellSpacingPercent sets the cell spacing within a table to a percent width.
|
|
func (_bcba TableStyleProperties )SetCellSpacingPercent (pct float64 ){_bcba ._dfcf .TblCellSpacing =_cc .NewCT_TblWidth ();_bcba ._dfcf .TblCellSpacing .TypeAttr =_cc .ST_TblWidthPct ;_bcba ._dfcf .TblCellSpacing .WAttr =&_cc .ST_MeasurementOrPercent {};_bcba ._dfcf .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent =&_cc .ST_DecimalNumberOrPercent {};_bcba ._dfcf .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_e .Int64 (int64 (pct *50));};
|
|
|
|
// SetText sets the watermark text.
|
|
func (_dabfe *WatermarkText )SetText (text string ){_deeca :=_dabfe .getShape ();if _dabfe ._eeced !=nil {_fggbae :=_dabfe ._eeced .EG_ShapeElements ;if len (_fggbae )> 0&&_fggbae [0].Textpath !=nil {_fggbae [0].Textpath .StringAttr =&text ;};}else {_abgee :=_dabfe .findNode (_deeca ,"\u0074\u0065\u0078\u0074\u0070\u0061\u0074\u0068");for _gbfae ,_gbbac :=range _abgee .Attrs {if _gbbac .Name .Local =="\u0073\u0074\u0072\u0069\u006e\u0067"{_abgee .Attrs [_gbfae ].Value =text ;};};};};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_fbdda TableConditionalFormatting )X ()*_cc .CT_TblStylePr {return _fbdda ._fgcg };
|
|
|
|
// SetLeft sets the left border to a specified type, color and thickness.
|
|
func (_ccef CellBorders )SetLeft (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_ccef ._cabe .Left =_cc .NewCT_Border ();_bfccc (_ccef ._cabe .Left ,t ,c ,thickness );};
|
|
|
|
// WatermarkPicture is watermark picture within document.
|
|
type WatermarkPicture struct{_egag *_cc .CT_Picture ;_ccec *_ad .ShapeStyle ;_fcggb *_af .Shape ;_cbgba *_af .Shapetype ;};
|
|
|
|
// SetFirstLineIndent controls the indentation of the first line in a paragraph.
|
|
func (_afag Paragraph )SetFirstLineIndent (m _bd .Distance ){_afag .ensurePPr ();_bbgbg :=_afag ._dadg .PPr ;if _bbgbg .Ind ==nil {_bbgbg .Ind =_cc .NewCT_Ind ();};if m ==_bd .Zero {_bbgbg .Ind .FirstLineAttr =nil ;}else {_bbgbg .Ind .FirstLineAttr =&_ebd .ST_TwipsMeasure {};_bbgbg .Ind .FirstLineAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (m /_bd .Twips ));};};
|
|
|
|
// 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 (_df AnchoredDrawing )SetTextWrapNone (){_df ._gg .Choice =&_cc .WdEG_WrapTypeChoice {};_df ._gg .Choice .WrapNone =_cc .NewWdCT_WrapNone ();};
|
|
|
|
// FindNodeByStyleName return slice of node base on style name.
|
|
func (_baecb *Nodes )FindNodeByStyleName (styleName string )[]Node {_bgcd :=[]Node {};for _ ,_feggc :=range _baecb ._cebe {switch _ecaa :=_feggc ._bgba .(type ){case *Paragraph :if _ecaa !=nil {if _faege ,_cfgf :=_feggc ._egfb .Styles .SearchStyleByName (styleName );_cfgf {_bbge :=_ecaa .Style ();if _bbge ==_faege .StyleID (){_bgcd =append (_bgcd ,_feggc );};};};case *Table :if _ecaa !=nil {if _agbce ,_gfgg :=_feggc ._egfb .Styles .SearchStyleByName (styleName );_gfgg {_aabf :=_ecaa .Style ();if _aabf ==_agbce .StyleID (){_bgcd =append (_bgcd ,_feggc );};};};};_babc :=Nodes {_cebe :_feggc .Children };_bgcd =append (_bgcd ,_babc .FindNodeByStyleName (styleName )...);};return _bgcd ;};
|
|
|
|
// SetRight sets the cell right margin
|
|
func (_cdce CellMargins )SetRight (d _bd .Distance ){_cdce ._gdc .Right =_cc .NewCT_TblWidth ();_bfc (_cdce ._gdc .Right ,d );};
|
|
|
|
// SetRowBandSize sets the number of Rows in the row band
|
|
func (_abaf TableStyleProperties )SetRowBandSize (rows int64 ){_abaf ._dfcf .TblStyleRowBandSize =_cc .NewCT_DecimalNumber ();_abaf ._dfcf .TblStyleRowBandSize .ValAttr =rows ;};
|
|
|
|
// SetRight sets the right border to a specified type, color and thickness.
|
|
func (_agebd TableBorders )SetRight (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_agebd ._bfabb .Right =_cc .NewCT_Border ();_bfccc (_agebd ._bfabb .Right ,t ,c ,thickness );};
|
|
|
|
// SetStyle sets the style of a paragraph and is identical to setting it on the
|
|
// paragraph's Properties()
|
|
func (_beea Paragraph )SetStyle (s string ){_beea .ensurePPr ();if s ==""{_beea ._dadg .PPr .PStyle =nil ;}else {_beea ._dadg .PPr .PStyle =_cc .NewCT_String ();_beea ._dadg .PPr .PStyle .ValAttr =s ;};};func (_bcfc *WatermarkPicture )getShapeImagedata ()*_e .XSDAny {return _bcfc .getInnerElement ("\u0069m\u0061\u0067\u0065\u0064\u0061\u0074a");};
|
|
|
|
// InsertRowBefore inserts a row before another row
|
|
func (_acabf Table )InsertRowBefore (r Row )Row {for _ebbbe ,_dfaed :=range _acabf ._fagd .EG_ContentRowContent {if len (_dfaed .Tr )> 0&&r .X ()==_dfaed .Tr [0]{_fbdf :=_cc .NewEG_ContentRowContent ();_acabf ._fagd .EG_ContentRowContent =append (_acabf ._fagd .EG_ContentRowContent ,nil );copy (_acabf ._fagd .EG_ContentRowContent [_ebbbe +1:],_acabf ._fagd .EG_ContentRowContent [_ebbbe :]);_acabf ._fagd .EG_ContentRowContent [_ebbbe ]=_fbdf ;_bfagc :=_cc .NewCT_Row ();_fbdf .Tr =append (_fbdf .Tr ,_bfagc );return Row {_acabf ._caff ,_bfagc };};};return _acabf .AddRow ();};func (_aecd Paragraph )addFldCharsForField (_ccdd ,_gaaf string )FormField {_ebec :=_aecd .addBeginFldChar (_ccdd );_efcc :=FormField {_dbfcc :_ebec };_gecab :=_aecd ._gefc .Bookmarks ();_bbdda :=int64 (len (_gecab ));if _ccdd !=""{_aecd .addStartBookmark (_bbdda ,_ccdd );};_aecd .addInstrText (_gaaf );_aecd .addSeparateFldChar ();if _gaaf =="\u0046\u004f\u0052\u004d\u0054\u0045\u0058\u0054"{_dfga :=_aecd .AddRun ();_gdfa :=_cc .NewEG_RunInnerContent ();_dfga ._abeed .EG_RunInnerContent =[]*_cc .EG_RunInnerContent {_gdfa };_efcc ._eagcf =_gdfa ;};_aecd .addEndFldChar ();if _ccdd !=""{_aecd .addEndBookmark (_bbdda );};return _efcc ;};
|
|
|
|
// SetTextWrapTight sets the text wrap to tight with a give wrap type.
|
|
func (_fdf AnchoredDrawing )SetTextWrapTight (option *AnchorDrawWrapOptions ){_fdf ._gg .Choice =&_cc .WdEG_WrapTypeChoice {};_fdf ._gg .Choice .WrapTight =_cc .NewWdCT_WrapTight ();_fdf ._gg .Choice .WrapTight .WrapTextAttr =_cc .WdST_WrapTextBothSides ;_cdc :=false ;_fdf ._gg .Choice .WrapTight .WrapPolygon .EditedAttr =&_cdc ;if option ==nil {option =NewAnchorDrawWrapOptions ();};_fdf ._gg .Choice .WrapTight .WrapPolygon .LineTo =option .GetWrapPathLineTo ();_fdf ._gg .Choice .WrapTight .WrapPolygon .Start =option .GetWrapPathStart ();_fdf ._gg .LayoutInCellAttr =true ;_fdf ._gg .AllowOverlapAttr =true ;};
|
|
|
|
// SetPageSizeAndOrientation sets the page size and orientation for a section.
|
|
func (_cabgc Section )SetPageSizeAndOrientation (w ,h _bd .Distance ,orientation _cc .ST_PageOrientation ){if _cabgc ._cdac .PgSz ==nil {_cabgc ._cdac .PgSz =_cc .NewCT_PageSz ();};_cabgc ._cdac .PgSz .OrientAttr =orientation ;if orientation ==_cc .ST_PageOrientationLandscape {_cabgc ._cdac .PgSz .WAttr =&_ebd .ST_TwipsMeasure {};_cabgc ._cdac .PgSz .WAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (h /_bd .Twips ));_cabgc ._cdac .PgSz .HAttr =&_ebd .ST_TwipsMeasure {};_cabgc ._cdac .PgSz .HAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (w /_bd .Twips ));}else {_cabgc ._cdac .PgSz .WAttr =&_ebd .ST_TwipsMeasure {};_cabgc ._cdac .PgSz .WAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (w /_bd .Twips ));_cabgc ._cdac .PgSz .HAttr =&_ebd .ST_TwipsMeasure {};_cabgc ._cdac .PgSz .HAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (h /_bd .Twips ));};};
|
|
|
|
// Validate validates the structure and in cases where it't possible, the ranges
|
|
// of elements within a document. A validation error dones't mean that the
|
|
// document won't work in MS Word or LibreOffice, but it's worth checking into.
|
|
func (_cdff *Document )Validate ()error {if _cdff ==nil ||_cdff ._aeb ==nil {return _ea .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 _ ,_eggf :=range []func ()error {_cdff .validateTableCells ,_cdff .validateBookmarks }{if _dbac :=_eggf ();_dbac !=nil {return _dbac ;};};if _bede :=_cdff ._aeb .Validate ();_bede !=nil {return _bede ;};return nil ;};
|
|
|
|
// VerticalAlign returns the value of run vertical align.
|
|
func (_ddae RunProperties )VerticalAlignment ()_ebd .ST_VerticalAlignRun {if _afda :=_ddae ._acgcd .VertAlign ;_afda !=nil {return _afda .ValAttr ;};return 0;};
|
|
|
|
// SetShading controls the cell shading.
|
|
func (_eec CellProperties )SetShading (shd _cc .ST_Shd ,foreground ,fill _aeg .Color ){if shd ==_cc .ST_ShdUnset {_eec ._cbfg .Shd =nil ;}else {_eec ._cbfg .Shd =_cc .NewCT_Shd ();_eec ._cbfg .Shd .ValAttr =shd ;_eec ._cbfg .Shd .ColorAttr =&_cc .ST_HexColor {};if foreground .IsAuto (){_eec ._cbfg .Shd .ColorAttr .ST_HexColorAuto =_cc .ST_HexColorAutoAuto ;}else {_eec ._cbfg .Shd .ColorAttr .ST_HexColorRGB =foreground .AsRGBString ();};_eec ._cbfg .Shd .FillAttr =&_cc .ST_HexColor {};if fill .IsAuto (){_eec ._cbfg .Shd .FillAttr .ST_HexColorAuto =_cc .ST_HexColorAutoAuto ;}else {_eec ._cbfg .Shd .FillAttr .ST_HexColorRGB =fill .AsRGBString ();};};};
|
|
|
|
// SetTop sets the top border to a specified type, color and thickness.
|
|
func (_cbda TableBorders )SetTop (t _cc .ST_Border ,c _aeg .Color ,thickness _bd .Distance ){_cbda ._bfabb .Top =_cc .NewCT_Border ();_bfccc (_cbda ._bfabb .Top ,t ,c ,thickness );};
|
|
|
|
// ClearColor clears the text color.
|
|
func (_acfe RunProperties )ClearColor (){_acfe ._acgcd .Color =nil };func _deba ()*_af .Imagedata {_ggff :=_af .NewImagedata ();_bbbg :="\u0072\u0049\u0064\u0031";_abegf :="\u0057A\u0054\u0045\u0052\u004d\u0041\u0052K";_ggff .IdAttr =&_bbbg ;_ggff .TitleAttr =&_abegf ;return _ggff ;};
|
|
|
|
// // SetBeforeLineSpacing sets spacing above paragraph in line units.
|
|
func (_ccbc Paragraph )SetBeforeLineSpacing (d _bd .Distance ){_ccbc .ensurePPr ();if _ccbc ._dadg .PPr .Spacing ==nil {_ccbc ._dadg .PPr .Spacing =_cc .NewCT_Spacing ();};_ecab :=_ccbc ._dadg .PPr .Spacing ;_ecab .BeforeLinesAttr =_e .Int64 (int64 (d /_bd .Twips ));};
|
|
|
|
// HasFootnotes returns a bool based on the presence or abscence of footnotes within
|
|
// the document.
|
|
func (_eadc *Document )HasFootnotes ()bool {return _eadc ._cdg !=nil };func _fcbd (_eaec *_cc .CT_P ,_fffe map[string ]string ){for _ ,_eada :=range _eaec .EG_PContent {if _eada .Hyperlink !=nil &&_eada .Hyperlink .IdAttr !=nil {if _faee ,_adbbfc :=_fffe [*_eada .Hyperlink .IdAttr ];_adbbfc {*_eada .Hyperlink .IdAttr =_faee ;};};};};
|
|
|
|
// InsertStyle insert style to styles.
|
|
func (_ecfda Styles )InsertStyle (ss Style ){_ecfda ._ecgbf .Style =append (_ecfda ._ecgbf .Style ,ss .X ())};
|
|
|
|
// TableProperties returns the table style properties.
|
|
func (_dgbae Style )TableProperties ()TableStyleProperties {if _dgbae ._bafd .TblPr ==nil {_dgbae ._bafd .TblPr =_cc .NewCT_TblPrBase ();};return TableStyleProperties {_dgbae ._bafd .TblPr };};
|
|
|
|
// SetVerticalBanding controls the conditional formatting for vertical banding.
|
|
func (_fcfbcc TableLook )SetVerticalBanding (on bool ){if !on {_fcfbcc ._gbfc .NoVBandAttr =&_ebd .ST_OnOff {};_fcfbcc ._gbfc .NoVBandAttr .ST_OnOff1 =_ebd .ST_OnOff1On ;}else {_fcfbcc ._gbfc .NoVBandAttr =&_ebd .ST_OnOff {};_fcfbcc ._gbfc .NoVBandAttr .ST_OnOff1 =_ebd .ST_OnOff1Off ;};};
|
|
|
|
// Clear clears all content within a header
|
|
func (_agg Header )Clear (){_agg ._abed .EG_ContentBlockContent =nil };
|
|
|
|
// SetEffect sets a text effect on the run.
|
|
func (_eegd RunProperties )SetEffect (e _cc .ST_TextEffect ){if e ==_cc .ST_TextEffectUnset {_eegd ._acgcd .Effect =nil ;}else {_eegd ._acgcd .Effect =_cc .NewCT_TextEffect ();_eegd ._acgcd .Effect .ValAttr =_cc .ST_TextEffectShimmer ;};};func _cbgdc (_edfc *Document )map[int64 ]map[int64 ]int64 {_abebd :=_edfc .Paragraphs ();_adee :=make (map[int64 ]map[int64 ]int64 ,0);for _ ,_dfba :=range _abebd {_eccg :=_aaga (_edfc ,_dfba );if _eccg .NumberingLevel !=nil &&_eccg .AbstractNumId !=nil {_efbb :=*_eccg .AbstractNumId ;if _ ,_cfdf :=_adee [_efbb ];_cfdf {if _cgceb :=_eccg .NumberingLevel .X ();_cgceb !=nil {if _ ,_ceda :=_adee [_efbb ][_cgceb .IlvlAttr ];_ceda {_adee [_efbb ][_cgceb .IlvlAttr ]++;}else {_adee [_efbb ][_cgceb .IlvlAttr ]=1;};};}else {if _bdgd :=_eccg .NumberingLevel .X ();_bdgd !=nil {_adee [_efbb ]=map[int64 ]int64 {_bdgd .IlvlAttr :1};};};};};return _adee ;};
|
|
|
|
// TableWidth controls width values in table settings.
|
|
type TableWidth struct{_fcfbc *_cc .CT_TblWidth };
|
|
|
|
// Clear clears all content within a footer
|
|
func (_faad Footer )Clear (){_faad ._gceg .EG_ContentBlockContent =nil };
|
|
|
|
// SetThemeColor sets the color from the theme.
|
|
func (_acc Color )SetThemeColor (t _cc .ST_ThemeColor ){_acc ._bdf .ThemeColorAttr =t };
|
|
|
|
// Bookmark is a bookmarked location within a document that can be referenced
|
|
// with a hyperlink.
|
|
type Bookmark struct{_cdcg *_cc .CT_Bookmark };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_ba Bookmark )X ()*_cc .CT_Bookmark {return _ba ._cdcg };
|
|
|
|
// SetNumberingDefinition sets the numbering definition ID via a NumberingDefinition
|
|
// defined in numbering.xml
|
|
func (_eaaded Paragraph )SetNumberingDefinition (nd NumberingDefinition ){_eaaded .ensurePPr ();if _eaaded ._dadg .PPr .NumPr ==nil {_eaaded ._dadg .PPr .NumPr =_cc .NewCT_NumPr ();};_fbff :=_cc .NewCT_DecimalNumber ();_fefd :=int64 (-1);for _ ,_gdcb :=range _eaaded ._gefc .Numbering ._bedb .Num {if _gdcb .AbstractNumId !=nil &&_gdcb .AbstractNumId .ValAttr ==nd .AbstractNumberID (){_fefd =_gdcb .NumIdAttr ;};};if _fefd ==-1{_dgab :=_cc .NewCT_Num ();_eaaded ._gefc .Numbering ._bedb .Num =append (_eaaded ._gefc .Numbering ._bedb .Num ,_dgab );_dgab .NumIdAttr =int64 (len (_eaaded ._gefc .Numbering ._bedb .Num ));_dgab .AbstractNumId =_cc .NewCT_DecimalNumber ();_dgab .AbstractNumId .ValAttr =nd .AbstractNumberID ();};_fbff .ValAttr =_fefd ;_eaaded ._dadg .PPr .NumPr .NumId =_fbff ;};
|
|
|
|
// SetLineSpacing sets the spacing between lines in a paragraph.
|
|
func (_bfeg ParagraphSpacing )SetLineSpacing (d _bd .Distance ,rule _cc .ST_LineSpacingRule ){if rule ==_cc .ST_LineSpacingRuleUnset {_bfeg ._cgaa .LineRuleAttr =_cc .ST_LineSpacingRuleUnset ;_bfeg ._cgaa .LineAttr =nil ;}else {_bfeg ._cgaa .LineRuleAttr =rule ;_bfeg ._cgaa .LineAttr =&_cc .ST_SignedTwipsMeasure {};_bfeg ._cgaa .LineAttr .Int64 =_e .Int64 (int64 (d /_bd .Twips ));};};
|
|
|
|
// SetPrimaryStyle marks the style as a primary style.
|
|
func (_eagga Style )SetPrimaryStyle (b bool ){if b {_eagga ._bafd .QFormat =_cc .NewCT_OnOff ();}else {_eagga ._bafd .QFormat =nil ;};};
|
|
|
|
// AddParagraph adds a paragraph to the table cell.
|
|
func (_dgb Cell )AddParagraph ()Paragraph {_adb :=_cc .NewEG_BlockLevelElts ();_dgb ._gbb .EG_BlockLevelElts =append (_dgb ._gbb .EG_BlockLevelElts ,_adb );_cdf :=_cc .NewEG_ContentBlockContent ();_adb .EG_ContentBlockContent =append (_adb .EG_ContentBlockContent ,_cdf );_fcf :=_cc .NewCT_P ();_cdf .P =append (_cdf .P ,_fcf );return Paragraph {_dgb ._bcc ,_fcf };};
|
|
|
|
// read reads a document from an io.Reader.
|
|
func Read (r _c .ReaderAt ,size int64 )(*Document ,error ){return _bfaa (r ,size ,"")};
|
|
|
|
// TableProperties are the properties for a table within a document
|
|
type TableProperties struct{_bebbgd *_cc .CT_TblPr };
|
|
|
|
// 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 *_cc .CT_P ;Hyperlink *_cc .CT_Hyperlink ;Run *_cc .CT_R ;TableInfo *TableInfo ;};func _bafgd ()*_af .Formulas {_fabg :=_af .NewFormulas ();_fabg .F =[]*_af .CT_F {_ad .CreateFormula ("\u0073\u0075\u006d\u0020\u0023\u0030\u0020\u0030\u00201\u0030\u0038\u0030\u0030"),_ad .CreateFormula ("p\u0072\u006f\u0064\u0020\u0023\u0030\u0020\u0032\u0020\u0031"),_ad .CreateFormula ("\u0073\u0075\u006d\u0020\u0032\u0031\u0036\u0030\u0030 \u0030\u0020\u0040\u0031"),_ad .CreateFormula ("\u0073\u0075\u006d\u0020\u0030\u0020\u0030\u0020\u0040\u0032"),_ad .CreateFormula ("\u0073\u0075\u006d\u0020\u0032\u0031\u0036\u0030\u0030 \u0030\u0020\u0040\u0033"),_ad .CreateFormula ("\u0069\u0066\u0020\u0040\u0030\u0020\u0040\u0033\u0020\u0030"),_ad .CreateFormula ("\u0069\u0066\u0020\u0040\u0030\u0020\u0032\u0031\u00360\u0030\u0020\u0040\u0031"),_ad .CreateFormula ("\u0069\u0066\u0020\u0040\u0030\u0020\u0030\u0020\u0040\u0032"),_ad .CreateFormula ("\u0069\u0066\u0020\u0040\u0030\u0020\u0040\u0034\u00202\u0031\u0036\u0030\u0030"),_ad .CreateFormula ("\u006di\u0064\u0020\u0040\u0035\u0020\u00406"),_ad .CreateFormula ("\u006di\u0064\u0020\u0040\u0038\u0020\u00405"),_ad .CreateFormula ("\u006di\u0064\u0020\u0040\u0037\u0020\u00408"),_ad .CreateFormula ("\u006di\u0064\u0020\u0040\u0036\u0020\u00407"),_ad .CreateFormula ("s\u0075\u006d\u0020\u0040\u0036\u0020\u0030\u0020\u0040\u0035")};return _fabg ;};
|
|
|
|
// SetOutlineLevel sets the outline level of this style.
|
|
func (_eacaf ParagraphStyleProperties )SetOutlineLevel (lvl int ){_eacaf ._feffd .OutlineLvl =_cc .NewCT_DecimalNumber ();_eacaf ._feffd .OutlineLvl .ValAttr =int64 (lvl );};
|
|
|
|
// SetBefore sets the spacing that comes before the paragraph.
|
|
func (_bcce ParagraphSpacing )SetBefore (before _bd .Distance ){_bcce ._cgaa .BeforeAttr =&_ebd .ST_TwipsMeasure {};_bcce ._cgaa .BeforeAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (before /_bd .Twips ));};
|
|
|
|
// Settings controls the document settings.
|
|
type Settings struct{_bbdg *_cc .Settings };
|
|
|
|
// SetPossibleValues sets possible values for a FormFieldTypeDropDown.
|
|
func (_edgc FormField )SetPossibleValues (values []string ){if _edgc ._dbfcc .DdList !=nil {for _ ,_defa :=range values {_gdce :=_cc .NewCT_String ();_gdce .ValAttr =_defa ;_edgc ._dbfcc .DdList .ListEntry =append (_edgc ._dbfcc .DdList .ListEntry ,_gdce );};};};
|
|
|
|
// RemoveFootnote removes a footnote from both the paragraph and the document
|
|
// the requested footnote must be anchored on the paragraph being referenced.
|
|
func (_cgde Paragraph )RemoveFootnote (id int64 ){_dgaaf :=_cgde ._gefc ._cdg ;var _efdf int ;for _gcadg ,_gbca :=range _dgaaf .CT_Footnotes .Footnote {if _gbca .IdAttr ==id {_efdf =_gcadg ;};};_efdf =0;_dgaaf .CT_Footnotes .Footnote [_efdf ]=nil ;_dgaaf .CT_Footnotes .Footnote [_efdf ]=_dgaaf .CT_Footnotes .Footnote [len (_dgaaf .CT_Footnotes .Footnote )-1];_dgaaf .CT_Footnotes .Footnote =_dgaaf .CT_Footnotes .Footnote [:len (_dgaaf .CT_Footnotes .Footnote )-1];var _cbeaa Run ;for _ ,_dbedd :=range _cgde .Runs (){if _afbdb ,_efgd :=_dbedd .IsFootnote ();_afbdb {if _efgd ==id {_cbeaa =_dbedd ;};};};_cgde .RemoveRun (_cbeaa );};
|
|
|
|
// InsertRunAfter inserts a run in the paragraph after the relative run.
|
|
func (_gdcg Paragraph )InsertRunAfter (relativeTo Run )Run {return _gdcg .insertRun (relativeTo ,false )};
|
|
|
|
// SetFirstLineIndent controls the first line indent of the paragraph.
|
|
func (_bddg ParagraphStyleProperties )SetFirstLineIndent (m _bd .Distance ){if _bddg ._feffd .Ind ==nil {_bddg ._feffd .Ind =_cc .NewCT_Ind ();};if m ==_bd .Zero {_bddg ._feffd .Ind .FirstLineAttr =nil ;}else {_bddg ._feffd .Ind .FirstLineAttr =&_ebd .ST_TwipsMeasure {};_bddg ._feffd .Ind .FirstLineAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (m /_bd .Twips ));};};
|
|
|
|
// X return element of Node as interface, can be either *Paragraph, *Table and Run.
|
|
func (_fcafe *Node )X ()interface{}{return _fcafe ._bgba };func _cefd (_ffac *_cc .CT_P ,_daba ,_fcaf map[int64 ]int64 ){for _ ,_fcbe :=range _ffac .EG_PContent {for _ ,_dace :=range _fcbe .EG_ContentRunContent {if _dace .R !=nil {for _ ,_egbg :=range _dace .R .EG_RunInnerContent {_bbgbe :=_egbg .EndnoteReference ;if _bbgbe !=nil &&_bbgbe .IdAttr > 0{if _bfdc ,_ffce :=_fcaf [_bbgbe .IdAttr ];_ffce {_bbgbe .IdAttr =_bfdc ;};};_cfaf :=_egbg .FootnoteReference ;if _cfaf !=nil &&_cfaf .IdAttr > 0{if _cfcb ,_fgbfa :=_daba [_cfaf .IdAttr ];_fgbfa {_cfaf .IdAttr =_cfcb ;};};};};};};};func _bdb (_cdgd *_cc .CT_Tbl ,_dgfd ,_gaff map[int64 ]int64 ){for _ ,_cfdbb :=range _cdgd .EG_ContentRowContent {for _ ,_dddad :=range _cfdbb .Tr {for _ ,_fdgb :=range _dddad .EG_ContentCellContent {for _ ,_bddae :=range _fdgb .Tc {for _ ,_ccbe :=range _bddae .EG_BlockLevelElts {for _ ,_baegg :=range _ccbe .EG_ContentBlockContent {for _ ,_bgdfb :=range _baegg .P {_cefd (_bgdfb ,_dgfd ,_gaff );};for _ ,_fabd :=range _baegg .Tbl {_bdb (_fabd ,_dgfd ,_gaff );};};};};};};};};
|
|
|
|
// SetHighlight highlights text in a specified color.
|
|
func (_addea RunProperties )SetHighlight (c _cc .ST_HighlightColor ){_addea ._acgcd .Highlight =_cc .NewCT_Highlight ();_addea ._acgcd .Highlight .ValAttr =c ;};
|
|
|
|
// TableConditionalFormatting controls the conditional formatting within a table
|
|
// style.
|
|
type TableConditionalFormatting struct{_fgcg *_cc .CT_TblStylePr };func _fcdg ()*_af .OfcLock {_begc :=_af .NewOfcLock ();_begc .ExtAttr =_af .ST_ExtEdit ;_begc .AspectratioAttr =_ebd .ST_TrueFalseTrue ;return _begc ;};
|
|
|
|
// SetVerticalAlignment controls the vertical alignment of the run, this is used
|
|
// to control if text is superscript/subscript.
|
|
func (_ececg RunProperties )SetVerticalAlignment (v _ebd .ST_VerticalAlignRun ){if v ==_ebd .ST_VerticalAlignRunUnset {_ececg ._acgcd .VertAlign =nil ;}else {_ececg ._acgcd .VertAlign =_cc .NewCT_VerticalAlignRun ();_ececg ._acgcd .VertAlign .ValAttr =v ;};};
|
|
|
|
// 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 ){_dcf ,_bbgf :=Open (filename );if _bbgf !=nil {return nil ,_bbgf ;};_dcf ._aeb .Body =_cc .NewCT_Body ();return _dcf ,nil ;};
|
|
|
|
// DrawingAnchored returns a slice of AnchoredDrawings.
|
|
func (_fdeaf Run )DrawingAnchored ()[]AnchoredDrawing {_acec :=[]AnchoredDrawing {};for _ ,_cfed :=range _fdeaf ._abeed .EG_RunInnerContent {if _cfed .Drawing ==nil {continue ;};for _ ,_edbf :=range _cfed .Drawing .Anchor {_acec =append (_acec ,AnchoredDrawing {_fdeaf ._bdaag ,_edbf });};};return _acec ;};
|
|
|
|
// SetName sets the name of the style.
|
|
func (_ggge Style )SetName (name string ){_ggge ._bafd .Name =_cc .NewCT_String ();_ggge ._bafd .Name .ValAttr =name ;};
|
|
|
|
// UnderlineColor returns the hex color value of run underline.
|
|
func (_feec RunProperties )UnderlineColor ()string {if _bedd :=_feec ._acgcd .U ;_bedd !=nil {_efagd :=_bedd .ColorAttr ;if _efagd !=nil &&_efagd .ST_HexColorRGB !=nil {return *_efagd .ST_HexColorRGB ;};};return "";};
|
|
|
|
// Borders allows manipulation of the table borders.
|
|
func (_bacdc TableStyleProperties )Borders ()TableBorders {if _bacdc ._dfcf .TblBorders ==nil {_bacdc ._dfcf .TblBorders =_cc .NewCT_TblBorders ();};return TableBorders {_bacdc ._dfcf .TblBorders };};
|
|
|
|
// RunProperties returns the run style properties.
|
|
func (_gbge Style )RunProperties ()RunProperties {if _gbge ._bafd .RPr ==nil {_gbge ._bafd .RPr =_cc .NewCT_RPr ();};return RunProperties {_gbge ._bafd .RPr };};
|
|
|
|
// InsertParagraphBefore adds a new empty paragraph before the relativeTo
|
|
// paragraph.
|
|
func (_aaaf *Document )InsertParagraphBefore (relativeTo Paragraph )Paragraph {return _aaaf .insertParagraph (relativeTo ,true );};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_acaab Header )X ()*_cc .Hdr {return _acaab ._abed };
|
|
|
|
// SetLastRow controls the conditional formatting for the last row in a table.
|
|
// This is called the 'Total' row within Word.
|
|
func (_eegea TableLook )SetLastRow (on bool ){if !on {_eegea ._gbfc .LastRowAttr =&_ebd .ST_OnOff {};_eegea ._gbfc .LastRowAttr .ST_OnOff1 =_ebd .ST_OnOff1Off ;}else {_eegea ._gbfc .LastRowAttr =&_ebd .ST_OnOff {};_eegea ._gbfc .LastRowAttr .ST_OnOff1 =_ebd .ST_OnOff1On ;};};
|
|
|
|
// X returns the inner wml.CT_TblBorders
|
|
func (_bcbef TableBorders )X ()*_cc .CT_TblBorders {return _bcbef ._bfabb };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";);
|
|
|
|
// IgnoreSpaceBetweenParagraphOfSameStyle sets contextual spacing.
|
|
func (_dgcc Paragraph )IgnoreSpaceBetweenParagraphOfSameStyle (){_dgcc .ensurePPr ();if _dgcc ._dadg .PPr .ContextualSpacing ==nil {_dgcc ._dadg .PPr .ContextualSpacing =_cc .NewCT_OnOff ();};_dgcc ._dadg .PPr .ContextualSpacing .ValAttr =&_ebd .ST_OnOff {ST_OnOff1 :_ebd .ST_OnOff1On };};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_ggaff ParagraphProperties )X ()*_cc .CT_PPr {return _ggaff ._bfdca };
|
|
|
|
// 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 (_eaade *Document )MailMerge (mergeContent map[string ]string ){_dabe :=_eaade .mergeFields ();_cege :=map[Paragraph ][]Run {};for _ ,_gbga :=range _dabe {_aabe ,_dgfgf :=mergeContent [_gbga ._ffedf ];if _dgfgf {if _gbga ._fgeff {_aabe =_d .ToUpper (_aabe );}else if _gbga ._cegf {_aabe =_d .ToLower (_aabe );}else if _gbga ._cfff {_aabe =_d .Title (_aabe );}else if _gbga ._fcac {_gcad :=_de .Buffer {};for _cgdb ,_degf :=range _aabe {if _cgdb ==0{_gcad .WriteRune (_ae .ToUpper (_degf ));}else {_gcad .WriteRune (_degf );};};_aabe =_gcad .String ();};if _aabe !=""&&_gbga ._gfee !=""{_aabe =_gbga ._gfee +_aabe ;};if _aabe !=""&&_gbga ._cfgb !=""{_aabe =_aabe +_gbga ._cfgb ;};};if _gbga ._bbfc {if len (_gbga ._afba .FldSimple )==1&&len (_gbga ._afba .FldSimple [0].EG_PContent )==1&&len (_gbga ._afba .FldSimple [0].EG_PContent [0].EG_ContentRunContent )==1{_ebfee :=&_cc .EG_ContentRunContent {};_ebfee .R =_gbga ._afba .FldSimple [0].EG_PContent [0].EG_ContentRunContent [0].R ;_gbga ._afba .FldSimple =nil ;_adae :=Run {_eaade ,_ebfee .R };_adae .ClearContent ();_adae .AddText (_aabe );_gbga ._afba .EG_ContentRunContent =append (_gbga ._afba .EG_ContentRunContent ,_ebfee );};}else {_gaagg :=_gbga ._gffce .Runs ();for _ddgb :=_gbga ._eegb ;_ddgb <=_gbga ._dgfe ;_ddgb ++{if _ddgb ==_gbga ._bgeg +1{_gaagg [_ddgb ].ClearContent ();_gaagg [_ddgb ].AddText (_aabe );}else {_cege [_gbga ._gffce ]=append (_cege [_gbga ._gffce ],_gaagg [_ddgb ]);};};};};for _efbf ,_beeg :=range _cege {for _ ,_caac :=range _beeg {_efbf .RemoveRun (_caac );};};_eaade .Settings .RemoveMailMerge ();};
|
|
|
|
// SetPictureSize set watermark picture size with given width and height.
|
|
func (_eged *WatermarkPicture )SetPictureSize (width ,height int64 ){if _eged ._fcggb !=nil {_bcfaf :=_eged .GetShapeStyle ();_bcfaf .SetWidth (float64 (width )*_bd .Point );_bcfaf .SetHeight (float64 (height )*_bd .Point );_eged .SetShapeStyle (_bcfaf );};};
|
|
|
|
// GetWrapPathStart return wrapPath start value.
|
|
func (_gde AnchorDrawWrapOptions )GetWrapPathStart ()*_cg .CT_Point2D {return _gde ._cbf };
|
|
|
|
// SetAlignment sets the alignment of a table within the page.
|
|
func (_efagc TableProperties )SetAlignment (align _cc .ST_JcTable ){if align ==_cc .ST_JcTableUnset {_efagc ._bebbgd .Jc =nil ;}else {_efagc ._bebbgd .Jc =_cc .NewCT_JcTable ();_efagc ._bebbgd .Jc .ValAttr =align ;};};
|
|
|
|
// WatermarkText is watermark text within the document.
|
|
type WatermarkText struct{_adfba *_cc .CT_Picture ;_gabg *_ad .TextpathStyle ;_eeced *_af .Shape ;_bdaaa *_af .Shapetype ;};
|
|
|
|
// SetAlignment sets the paragraph alignment
|
|
func (_aaad NumberingLevel )SetAlignment (j _cc .ST_Jc ){if j ==_cc .ST_JcUnset {_aaad ._befe .LvlJc =nil ;}else {_aaad ._befe .LvlJc =_cc .NewCT_Jc ();_aaad ._befe .LvlJc .ValAttr =j ;};};func (_dddaf *Document )putNode (_afgde ,_gddf Node ,_cabcb bool )bool {_dddaf .insertImageFromNode (_gddf );_dddaf .insertStyleFromNode (_gddf );switch _acd :=_gddf ._bgba .(type ){case *Paragraph :if _bbad ,_aefg :=_afgde .X ().(*Paragraph );_aefg {_dddaf .appendParagraph (_bbad ,*_acd ,_cabcb );return true ;}else {for _ ,_ecfa :=range _afgde .Children {if _fgce :=_dddaf .putNode (_ecfa ,_gddf ,_cabcb );_fgce {break ;};};};case *Table :if _baaffb ,_agcc :=_afgde .X ().(*Paragraph );_agcc {_efdea :=_dddaf .appendTable (_baaffb ,*_acd ,_cabcb );_efdea ._fagd =_acd ._fagd ;return true ;}else {for _ ,_eagc :=range _afgde .Children {if _dgae :=_dddaf .putNode (_eagc ,_gddf ,_cabcb );_dgae {break ;};};};};return false ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_eccaf Footer )X ()*_cc .Ftr {return _eccaf ._gceg };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_cdbe Styles )X ()*_cc .Styles {return _cdbe ._ecgbf };
|
|
|
|
// Emboss returns true if run emboss is on.
|
|
func (_abfg RunProperties )Emboss ()bool {return _fcaaa (_abfg ._acgcd .Emboss )};
|
|
|
|
// SetValue sets the width value.
|
|
func (_ccadc TableWidth )SetValue (m _bd .Distance ){_ccadc ._fcfbc .WAttr =&_cc .ST_MeasurementOrPercent {};_ccadc ._fcfbc .WAttr .ST_DecimalNumberOrPercent =&_cc .ST_DecimalNumberOrPercent {};_ccadc ._fcfbc .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_e .Int64 (int64 (m /_bd .Twips ));_ccadc ._fcfbc .TypeAttr =_cc .ST_TblWidthDxa ;};
|
|
|
|
// SetName sets the name of the image, visible in the properties of the image
|
|
// within Word.
|
|
func (_dg AnchoredDrawing )SetName (name string ){_dg ._gg .DocPr .NameAttr =name ;for _ ,_ggc :=range _dg ._gg .Graphic .GraphicData .Any {if _cgc ,_beg :=_ggc .(*_fd .Pic );_beg {_cgc .NvPicPr .CNvPr .DescrAttr =_e .String (name );};};};
|
|
|
|
// SetAllCaps sets the run to all caps.
|
|
func (_gddcf RunProperties )SetAllCaps (b bool ){if !b {_gddcf ._acgcd .Caps =nil ;}else {_gddcf ._acgcd .Caps =_cc .NewCT_OnOff ();};};
|
|
|
|
// SetWidthAuto sets the the cell width to automatic.
|
|
func (_cba CellProperties )SetWidthAuto (){_cba ._cbfg .TcW =_cc .NewCT_TblWidth ();_cba ._cbfg .TcW .TypeAttr =_cc .ST_TblWidthAuto ;};
|
|
|
|
// SetShadow sets the run to shadowed text.
|
|
func (_befcg RunProperties )SetShadow (b bool ){if !b {_befcg ._acgcd .Shadow =nil ;}else {_befcg ._acgcd .Shadow =_cc .NewCT_OnOff ();};};
|
|
|
|
// DrawingInfo is used for keep information about a drawing wrapping a textbox where the text is located.
|
|
type DrawingInfo struct{Drawing *_cc .CT_Drawing ;Width int64 ;Height int64 ;};
|
|
|
|
// Strike returns true if paragraph is striked.
|
|
func (_bebf ParagraphProperties )Strike ()bool {return _fcaaa (_bebf ._bfdca .RPr .Strike )};
|
|
|
|
// 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{_dbfcc *_cc .CT_FFData ;_eagcf *_cc .EG_RunInnerContent ;};
|
|
|
|
// Tables returns the tables defined in the document.
|
|
func (_efad *Document )Tables ()[]Table {_ecbb :=[]Table {};if _efad ._aeb .Body ==nil {return nil ;};for _ ,_bfbd :=range _efad ._aeb .Body .EG_BlockLevelElts {for _ ,_fgc :=range _bfbd .EG_ContentBlockContent {for _ ,_ecc :=range _efad .tables (_fgc ){_ecbb =append (_ecbb ,_ecc );};};};return _ecbb ;};
|
|
|
|
// Color controls the run or styles color.
|
|
type Color struct{_bdf *_cc .CT_Color };
|
|
|
|
// AnchoredDrawing is an absolutely positioned image within a document page.
|
|
type AnchoredDrawing struct{_fc *Document ;_gg *_cc .WdAnchor ;};
|
|
|
|
// SetSize sets the size of the displayed image on the page.
|
|
func (_aeac InlineDrawing )SetSize (w ,h _bd .Distance ){_aeac ._faeff .Extent .CxAttr =int64 (float64 (w *_bd .Pixel72 )/_bd .EMU );_aeac ._faeff .Extent .CyAttr =int64 (float64 (h *_bd .Pixel72 )/_bd .EMU );};
|
|
|
|
// SetColumnSpan sets the number of Grid Columns Spanned by the Cell. This is used
|
|
// to give the appearance of merged cells.
|
|
func (_ccefe CellProperties )SetColumnSpan (cols int ){if cols ==0{_ccefe ._cbfg .GridSpan =nil ;}else {_ccefe ._cbfg .GridSpan =_cc .NewCT_DecimalNumber ();_ccefe ._cbfg .GridSpan .ValAttr =int64 (cols );};};
|
|
|
|
// SetLineSpacing sets the spacing between lines in a paragraph.
|
|
func (_efgad Paragraph )SetLineSpacing (d _bd .Distance ,rule _cc .ST_LineSpacingRule ){_efgad .ensurePPr ();if _efgad ._dadg .PPr .Spacing ==nil {_efgad ._dadg .PPr .Spacing =_cc .NewCT_Spacing ();};_efag :=_efgad ._dadg .PPr .Spacing ;if rule ==_cc .ST_LineSpacingRuleUnset {_efag .LineRuleAttr =_cc .ST_LineSpacingRuleUnset ;_efag .LineAttr =nil ;}else {_efag .LineRuleAttr =rule ;_efag .LineAttr =&_cc .ST_SignedTwipsMeasure {};_efag .LineAttr .Int64 =_e .Int64 (int64 (d /_bd .Twips ));};};var _dddc =[...]uint8 {0,20,37,58,79};func (_dag *chart )X ()*_cd .ChartSpace {return _dag ._gbbda };
|
|
|
|
// Borders allows controlling individual cell borders.
|
|
func (_ebb CellProperties )Borders ()CellBorders {if _ebb ._cbfg .TcBorders ==nil {_ebb ._cbfg .TcBorders =_cc .NewCT_TcBorders ();};return CellBorders {_ebb ._cbfg .TcBorders };};
|
|
|
|
// Font returns the name of paragraph font family.
|
|
func (_adgag ParagraphProperties )Font ()string {if _dafc :=_adgag ._bfdca .RPr .RFonts ;_dafc !=nil {if _dafc .AsciiAttr !=nil {return *_dafc .AsciiAttr ;}else if _dafc .HAnsiAttr !=nil {return *_dafc .HAnsiAttr ;}else if _dafc .CsAttr !=nil {return *_dafc .CsAttr ;};};return "";};
|
|
|
|
// Borders returns the ParagraphBorders for setting-up border on paragraph.
|
|
func (_bffda Paragraph )Borders ()ParagraphBorders {_bffda .ensurePPr ();if _bffda ._dadg .PPr .PBdr ==nil {_bffda ._dadg .PPr .PBdr =_cc .NewCT_PBdr ();};return ParagraphBorders {_bffda ._gefc ,_bffda ._dadg .PPr .PBdr };};
|
|
|
|
// SetShapeStyle sets style to the element v:shape in watermark.
|
|
func (_aaae *WatermarkPicture )SetShapeStyle (shapeStyle _ad .ShapeStyle ){if _aaae ._fcggb !=nil {_egac :=shapeStyle .String ();_aaae ._fcggb .StyleAttr =&_egac ;};};
|
|
|
|
// Clear clears the styes.
|
|
func (_bgff Styles )Clear (){_bgff ._ecgbf .DocDefaults =nil ;_bgff ._ecgbf .LatentStyles =nil ;_bgff ._ecgbf .Style =nil ;};
|
|
|
|
// SetSize sets size attribute for a FormFieldTypeCheckBox in pt.
|
|
func (_accg FormField )SetSize (size uint64 ){size *=2;if _accg ._dbfcc .CheckBox !=nil {_accg ._dbfcc .CheckBox .Choice =_cc .NewCT_FFCheckBoxChoice ();_accg ._dbfcc .CheckBox .Choice .Size =_cc .NewCT_HpsMeasure ();_accg ._dbfcc .CheckBox .Choice .Size .ValAttr =_cc .ST_HpsMeasure {ST_UnsignedDecimalNumber :&size };};};
|
|
|
|
// Section is the beginning of a new section.
|
|
type Section struct{_aafce *Document ;_cdac *_cc .CT_SectPr ;};
|
|
|
|
// ExtractText returns text from the document as a DocText object.
|
|
func (_bcbg *Document )ExtractText ()*DocText {_fedc :=[]TextItem {};for _ ,_egfg :=range _bcbg ._aeb .Body .EG_BlockLevelElts {_fedc =append (_fedc ,_bgeec (_egfg .EG_ContentBlockContent ,nil )...);};var _abeb []listItemInfo ;_dbef :=_bcbg .Paragraphs ();for _ ,_febaa :=range _dbef {_acbd :=_aaga (_bcbg ,_febaa );_abeb =append (_abeb ,_acbd );};_fcgg :=_cbgdc (_bcbg );return &DocText {Items :_fedc ,_eddgd :_abeb ,_gfae :_fcgg };};
|
|
|
|
// SetCellSpacingPercent sets the cell spacing within a table to a percent width.
|
|
func (_efbbf TableProperties )SetCellSpacingPercent (pct float64 ){_efbbf ._bebbgd .TblCellSpacing =_cc .NewCT_TblWidth ();_efbbf ._bebbgd .TblCellSpacing .TypeAttr =_cc .ST_TblWidthPct ;_efbbf ._bebbgd .TblCellSpacing .WAttr =&_cc .ST_MeasurementOrPercent {};_efbbf ._bebbgd .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent =&_cc .ST_DecimalNumberOrPercent {};_efbbf ._bebbgd .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_e .Int64 (int64 (pct *50));};
|
|
|
|
// Outline returns true if paragraph outline is on.
|
|
func (_bfca ParagraphProperties )Outline ()bool {return _fcaaa (_bfca ._bfdca .RPr .Outline )};
|
|
|
|
// SetWidthAuto sets the the table width to automatic.
|
|
func (_egcg TableProperties )SetWidthAuto (){_egcg ._bebbgd .TblW =_cc .NewCT_TblWidth ();_egcg ._bebbgd .TblW .TypeAttr =_cc .ST_TblWidthAuto ;};
|
|
|
|
// SetAfterSpacing sets spacing below paragraph.
|
|
func (_debb Paragraph )SetAfterSpacing (d _bd .Distance ){_debb .ensurePPr ();if _debb ._dadg .PPr .Spacing ==nil {_debb ._dadg .PPr .Spacing =_cc .NewCT_Spacing ();};_bade :=_debb ._dadg .PPr .Spacing ;_bade .AfterAttr =&_ebd .ST_TwipsMeasure {};_bade .AfterAttr .ST_UnsignedDecimalNumber =_e .Uint64 (uint64 (d /_bd .Twips ));};
|
|
|
|
// Rows returns the rows defined in the table.
|
|
func (_dceaa Table )Rows ()[]Row {_feef :=[]Row {};for _ ,_cagda :=range _dceaa ._fagd .EG_ContentRowContent {for _ ,_gbbaef :=range _cagda .Tr {_feef =append (_feef ,Row {_dceaa ._caff ,_gbbaef });};if _cagda .Sdt !=nil &&_cagda .Sdt .SdtContent !=nil {for _ ,_dbcedb :=range _cagda .Sdt .SdtContent .Tr {_feef =append (_feef ,Row {_dceaa ._caff ,_dbcedb });};};};return _feef ;};
|
|
|
|
// ComplexSizeValue returns the value of run font size for complex fonts in points.
|
|
func (_ebbdf RunProperties )ComplexSizeValue ()float64 {if _ececgf :=_ebbdf ._acgcd .SzCs ;_ececgf !=nil {_aceag :=_ececgf .ValAttr ;if _aceag .ST_UnsignedDecimalNumber !=nil {return float64 (*_aceag .ST_UnsignedDecimalNumber )/2;};};return 0.0;};
|
|
|
|
// NewAnchorDrawWrapOptions return anchor drawing options property.
|
|
func NewAnchorDrawWrapOptions ()*AnchorDrawWrapOptions {_bc :=&AnchorDrawWrapOptions {};if !_bc ._gdb {_cf ,_ef :=_cbd ();_bc ._cbf =_cf ;_bc ._egd =_ef ;};return _bc ;};func _cfdcg ()*_af .Handles {_cefa :=_af .NewHandles ();_ddaf :=_af .NewCT_H ();_fdcg :="\u0023\u0030\u002c\u0062\u006f\u0074\u0074\u006f\u006dR\u0069\u0067\u0068\u0074";_ddaf .PositionAttr =&_fdcg ;_ddad :="\u0036\u0036\u0032\u0039\u002c\u0031\u0034\u0039\u0037\u0031";_ddaf .XrangeAttr =&_ddad ;_cefa .H =[]*_af .CT_H {_ddaf };return _cefa ;};
|
|
|
|
// SetTextWrapThrough sets the text wrap to through with a give wrap type.
|
|
func (_ca AnchoredDrawing )SetTextWrapThrough (option *AnchorDrawWrapOptions ){_ca ._gg .Choice =&_cc .WdEG_WrapTypeChoice {};_ca ._gg .Choice .WrapThrough =_cc .NewWdCT_WrapThrough ();_ca ._gg .Choice .WrapThrough .WrapTextAttr =_cc .WdST_WrapTextBothSides ;_fb :=false ;_ca ._gg .Choice .WrapThrough .WrapPolygon .EditedAttr =&_fb ;if option ==nil {option =NewAnchorDrawWrapOptions ();};_ca ._gg .Choice .WrapThrough .WrapPolygon .Start =option .GetWrapPathStart ();_ca ._gg .Choice .WrapThrough .WrapPolygon .LineTo =option .GetWrapPathLineTo ();_ca ._gg .LayoutInCellAttr =true ;_ca ._gg .AllowOverlapAttr =true ;};
|
|
|
|
// SetNextStyle sets the style that the next paragraph will use.
|
|
func (_geae Style )SetNextStyle (name string ){if name ==""{_geae ._bafd .Next =nil ;}else {_geae ._bafd .Next =_cc .NewCT_String ();_geae ._bafd .Next .ValAttr =name ;};};
|
|
|
|
// 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 (_ebbdc ParagraphProperties )SetHeadingLevel (idx int ){_ebbdc .SetStyle (_gb .Sprintf ("\u0048e\u0061\u0064\u0069\u006e\u0067\u0025d",idx ));if _ebbdc ._bfdca .NumPr ==nil {_ebbdc ._bfdca .NumPr =_cc .NewCT_NumPr ();};_ebbdc ._bfdca .NumPr .Ilvl =_cc .NewCT_DecimalNumber ();_ebbdc ._bfdca .NumPr .Ilvl .ValAttr =int64 (idx );};func (_fcbc *Document )insertParagraph (_ddfc Paragraph ,_dfad bool )Paragraph {if _fcbc ._aeb .Body ==nil {return _fcbc .AddParagraph ();};_dadee :=_ddfc .X ();for _ ,_dgdd :=range _fcbc ._aeb .Body .EG_BlockLevelElts {for _ ,_ced :=range _dgdd .EG_ContentBlockContent {for _bgda ,_ceaa :=range _ced .P {if _ceaa ==_dadee {_adgg :=_cc .NewCT_P ();_ced .P =append (_ced .P ,nil );if _dfad {copy (_ced .P [_bgda +1:],_ced .P [_bgda :]);_ced .P [_bgda ]=_adgg ;}else {copy (_ced .P [_bgda +2:],_ced .P [_bgda +1:]);_ced .P [_bgda +1]=_adgg ;};return Paragraph {_fcbc ,_adgg };};};for _ ,_geec :=range _ced .Tbl {for _ ,_gecf :=range _geec .EG_ContentRowContent {for _ ,_daef :=range _gecf .Tr {for _ ,_bdgc :=range _daef .EG_ContentCellContent {for _ ,_gegc :=range _bdgc .Tc {for _ ,_egga :=range _gegc .EG_BlockLevelElts {for _ ,_cgge :=range _egga .EG_ContentBlockContent {for _cabc ,_fdfeb :=range _cgge .P {if _fdfeb ==_dadee {_dacc :=_cc .NewCT_P ();_cgge .P =append (_cgge .P ,nil );if _dfad {copy (_cgge .P [_cabc +1:],_cgge .P [_cabc :]);_cgge .P [_cabc ]=_dacc ;}else {copy (_cgge .P [_cabc +2:],_cgge .P [_cabc +1:]);_cgge .P [_cabc +1]=_dacc ;};return Paragraph {_fcbc ,_dacc };};};};};};};};};};if _ced .Sdt !=nil &&_ced .Sdt .SdtContent !=nil &&_ced .Sdt .SdtContent .P !=nil {for _aged ,_aedcg :=range _ced .Sdt .SdtContent .P {if _aedcg ==_dadee {_cedc :=_cc .NewCT_P ();_ced .Sdt .SdtContent .P =append (_ced .Sdt .SdtContent .P ,nil );if _dfad {copy (_ced .Sdt .SdtContent .P [_aged +1:],_ced .Sdt .SdtContent .P [_aged :]);_ced .Sdt .SdtContent .P [_aged ]=_cedc ;}else {copy (_ced .Sdt .SdtContent .P [_aged +2:],_ced .Sdt .SdtContent .P [_aged +1:]);_ced .Sdt .SdtContent .P [_aged +1]=_cedc ;};return Paragraph {_fcbc ,_cedc };};};};};};return _fcbc .AddParagraph ();};
|
|
|
|
// GetDocRelTargetByID returns TargetAttr of document relationship given its IdAttr.
|
|
func (_bfga *Document )GetDocRelTargetByID (idAttr string )string {for _ ,_ffcdd :=range _bfga ._ebfd .X ().Relationship {if _ffcdd .IdAttr ==idAttr {return _ffcdd .TargetAttr ;};};return "";};
|
|
|
|
// 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 (_deaf *Document )Append (d1orig *Document )error {_bbbab ,_gefe :=d1orig .Copy ();if _gefe !=nil {return _gefe ;};_deaf .DocBase =_deaf .DocBase .Append (_bbbab .DocBase );if _bbbab ._aeb .ConformanceAttr !=_ebd .ST_ConformanceClassStrict {_deaf ._aeb .ConformanceAttr =_bbbab ._aeb .ConformanceAttr ;};_ega :=_deaf ._ebfd .X ().Relationship ;_fded :=_bbbab ._ebfd .X ().Relationship ;_gbda :=_bbbab ._aeb .Body ;_ebde :=map[string ]string {};_ffge :=map[int64 ]int64 {};_aega :=map[int64 ]int64 {};for _ ,_degg :=range _fded {_feeg :=true ;_begb :=_degg .IdAttr ;_efde :=_degg .TargetAttr ;_bgae :=_degg .TypeAttr ;_edag :=_bgae ==_e .ImageType ;_eaef :=_bgae ==_e .HyperLinkType ;var _befa string ;for _ ,_afcb :=range _ega {if _afcb .TypeAttr ==_bgae &&_afcb .TargetAttr ==_efde {_feeg =false ;_befa =_afcb .IdAttr ;break ;};};if _edag {_dagg :="\u0077\u006f\u0072d\u002f"+_efde ;for _ ,_egde :=range _bbbab .DocBase .Images {if _egde .Target ()==_dagg {_degad ,_ffdda :=_acb .ImageFromStorage (_egde .Path ());if _ffdda !=nil {return _ffdda ;};_bbd ,_ffdda :=_deaf .AddImage (_degad );if _ffdda !=nil {return _ffdda ;};_befa =_bbd .RelID ();break ;};};}else if _feeg {if _eaef {_beaa :=_deaf ._ebfd .AddHyperlink (_efde );_befa =_acb .Relationship (_beaa ).ID ();}else {_gbbbb :=_deaf ._ebfd .AddRelationship (_efde ,_bgae );_befa =_gbbbb .X ().IdAttr ;};};if _begb !=_befa {_ebde [_begb ]=_befa ;};};if _gbda .SectPr !=nil {for _ ,_eacg :=range _gbda .SectPr .EG_HdrFtrReferences {if _eacg .HeaderReference !=nil {if _gfbe ,_cdcfb :=_ebde [_eacg .HeaderReference .IdAttr ];_cdcfb {_eacg .HeaderReference .IdAttr =_gfbe ;_deaf ._edc =append (_deaf ._edc ,_acb .NewRelationships ());};}else if _eacg .FooterReference !=nil {if _bce ,_afd :=_ebde [_eacg .FooterReference .IdAttr ];_afd {_eacg .FooterReference .IdAttr =_bce ;_deaf ._dfa =append (_deaf ._dfa ,_acb .NewRelationships ());};};};};_bbc ,_adbbd :=_deaf ._cde ,_bbbab ._cde ;if _bbc !=nil {if _adbbd !=nil {if _bbc .Endnote !=nil {if _adbbd .Endnote !=nil {_fcdeb :=int64 (len (_bbc .Endnote )+1);for _ ,_ccefeb :=range _adbbd .Endnote {_feba :=_ccefeb .IdAttr ;if _feba > 0{_ccefeb .IdAttr =_fcdeb ;_bbc .Endnote =append (_bbc .Endnote ,_ccefeb );_aega [_feba ]=_fcdeb ;_fcdeb ++;};};};}else {_bbc .Endnote =_adbbd .Endnote ;};};}else if _adbbd !=nil {_bbc =_adbbd ;};_deaf ._cde =_bbc ;_fcded ,_bbeg :=_deaf ._cdg ,_bbbab ._cdg ;if _fcded !=nil {if _bbeg !=nil {if _fcded .Footnote !=nil {if _bbeg .Footnote !=nil {_abec :=int64 (len (_fcded .Footnote )+1);for _ ,_dbab :=range _bbeg .Footnote {_dfde :=_dbab .IdAttr ;if _dfde > 0{_dbab .IdAttr =_abec ;_fcded .Footnote =append (_fcded .Footnote ,_dbab );_ffge [_dfde ]=_abec ;_abec ++;};};};}else {_fcded .Footnote =_bbeg .Footnote ;};};}else if _bbeg !=nil {_fcded =_bbeg ;};_deaf ._cdg =_fcded ;for _ ,_geea :=range _gbda .EG_BlockLevelElts {for _ ,_bdfd :=range _geea .EG_ContentBlockContent {for _ ,_fafd :=range _bdfd .P {_abbaa (_fafd ,_ebde );_fcbd (_fafd ,_ebde );_cefd (_fafd ,_ffge ,_aega );};for _ ,_agedc :=range _bdfd .Tbl {_agbc (_agedc ,_ebde );_faabc (_agedc ,_ebde );_bdb (_agedc ,_ffge ,_aega );};};};_deaf ._aeb .Body .EG_BlockLevelElts =append (_deaf ._aeb .Body .EG_BlockLevelElts ,_bbbab ._aeb .Body .EG_BlockLevelElts ...);if _deaf ._aeb .Body .SectPr ==nil {_deaf ._aeb .Body .SectPr =_bbbab ._aeb .Body .SectPr ;}else {var _ebea ,_agdcf bool ;for _ ,_agfe :=range _deaf ._aeb .Body .SectPr .EG_HdrFtrReferences {if _agfe .HeaderReference !=nil {_ebea =true ;}else if _agfe .FooterReference !=nil {_agdcf =true ;};};if !_ebea {for _ ,_aedd :=range _bbbab ._aeb .Body .SectPr .EG_HdrFtrReferences {if _aedd .HeaderReference !=nil {_deaf ._aeb .Body .SectPr .EG_HdrFtrReferences =append (_deaf ._aeb .Body .SectPr .EG_HdrFtrReferences ,_aedd );break ;};};};if !_agdcf {for _ ,_gaef :=range _bbbab ._aeb .Body .SectPr .EG_HdrFtrReferences {if _gaef .FooterReference !=nil {_deaf ._aeb .Body .SectPr .EG_HdrFtrReferences =append (_deaf ._aeb .Body .SectPr .EG_HdrFtrReferences ,_gaef );break ;};};};if _deaf ._aeb .Body .SectPr .Cols ==nil &&_bbbab ._aeb .Body .SectPr .Cols !=nil {_deaf ._aeb .Body .SectPr .Cols =_bbbab ._aeb .Body .SectPr .Cols ;};};_dcgb :=_deaf .Numbering ._bedb ;_eddb :=_bbbab .Numbering ._bedb ;if _dcgb !=nil {if _eddb !=nil {_dcgb .NumPicBullet =append (_dcgb .NumPicBullet ,_eddb .NumPicBullet ...);_dcgb .AbstractNum =append (_dcgb .AbstractNum ,_eddb .AbstractNum ...);_dcgb .Num =append (_dcgb .Num ,_eddb .Num ...);};}else if _eddb !=nil {_dcgb =_eddb ;};_deaf .Numbering ._bedb =_dcgb ;if _deaf .Styles ._ecgbf ==nil &&_bbbab .Styles ._ecgbf !=nil {_deaf .Styles ._ecgbf =_bbbab .Styles ._ecgbf ;};_deaf ._agc =append (_deaf ._agc ,_bbbab ._agc ...);_deaf ._efd =append (_deaf ._efd ,_bbbab ._efd ...);if len (_deaf ._dgbf )==0{_deaf ._dgbf =_bbbab ._dgbf ;};if len (_deaf ._ebda )==0{_deaf ._ebda =_bbbab ._ebda ;};_adddf :=_deaf ._bfg ;_fge :=_bbbab ._bfg ;if _adddf !=nil {if _fge !=nil {if _adddf .Divs !=nil {if _fge .Divs !=nil {_adddf .Divs .Div =append (_adddf .Divs .Div ,_fge .Divs .Div ...);};}else {_adddf .Divs =_fge .Divs ;};};_adddf .Frameset =nil ;}else if _fge !=nil {_adddf =_fge ;_adddf .Frameset =nil ;};_deaf ._bfg =_adddf ;_bbaag :=_deaf ._ebg ;_eaeb :=_bbbab ._ebg ;if _bbaag !=nil {if _eaeb !=nil {if _bbaag .Font !=nil {if _eaeb .Font !=nil {for _ ,_addb :=range _eaeb .Font {_efff :=true ;for _ ,_dgcg :=range _bbaag .Font {if _dgcg .NameAttr ==_addb .NameAttr {_efff =false ;break ;};};if _efff {_bbaag .Font =append (_bbaag .Font ,_addb );};};};}else {_bbaag .Font =_eaeb .Font ;};};}else if _eaeb !=nil {_bbaag =_eaeb ;};_deaf ._ebg =_bbaag ;return nil ;};
|
|
|
|
// Clear resets the numbering.
|
|
func (_eccf Numbering )Clear (){_eccf ._bedb .AbstractNum =nil ;_eccf ._bedb .Num =nil ;_eccf ._bedb .NumIdMacAtCleanup =nil ;_eccf ._bedb .NumPicBullet =nil ;};
|
|
|
|
// SetRightPct sets the cell right margin
|
|
func (_ff CellMargins )SetRightPct (pct float64 ){_ff ._gdc .Right =_cc .NewCT_TblWidth ();_bea (_ff ._gdc .Right ,pct );};
|
|
|
|
// AddSection adds a new document section with an optional section break. If t
|
|
// is ST_SectionMarkUnset, then no break will be inserted.
|
|
func (_fccge ParagraphProperties )AddSection (t _cc .ST_SectionMark )Section {_fccge ._bfdca .SectPr =_cc .NewCT_SectPr ();if t !=_cc .ST_SectionMarkUnset {_fccge ._bfdca .SectPr .Type =_cc .NewCT_SectType ();_fccge ._bfdca .SectPr .Type .ValAttr =t ;};return Section {_fccge ._bacb ,_fccge ._bfdca .SectPr };};
|
|
|
|
// Style return the table style.
|
|
func (_fdgg Table )Style ()string {if _fdgg ._fagd .TblPr !=nil &&_fdgg ._fagd .TblPr .TblStyle !=nil {return _fdgg ._fagd .TblPr .TblStyle .ValAttr ;};return "";};func (_fedb Endnote )content ()[]*_cc .EG_ContentBlockContent {var _eceg []*_cc .EG_ContentBlockContent ;for _ ,_dbbde :=range _fedb ._fcgd .EG_BlockLevelElts {_eceg =append (_eceg ,_dbbde .EG_ContentBlockContent ...);};return _eceg ;};func _ebbc (_ebgb *_cc .EG_ContentBlockContent )[]Bookmark {_gac :=[]Bookmark {};for _ ,_gdca :=range _ebgb .P {for _ ,_bebbf :=range _gdca .EG_PContent {for _ ,_dfff :=range _bebbf .EG_ContentRunContent {for _ ,_aafa :=range _dfff .EG_RunLevelElts {for _ ,_gbeb :=range _aafa .EG_RangeMarkupElements {if _gbeb .BookmarkStart !=nil {_gac =append (_gac ,Bookmark {_gbeb .BookmarkStart });};};};};};};for _ ,_cdffe :=range _ebgb .EG_RunLevelElts {for _ ,_dbdg :=range _cdffe .EG_RangeMarkupElements {if _dbdg .BookmarkStart !=nil {_gac =append (_gac ,Bookmark {_dbdg .BookmarkStart });};};};for _ ,_egdd :=range _ebgb .Tbl {for _ ,_abcf :=range _egdd .EG_ContentRowContent {for _ ,_acge :=range _abcf .Tr {for _ ,_eebd :=range _acge .EG_ContentCellContent {for _ ,_dfcg :=range _eebd .Tc {for _ ,_ddb :=range _dfcg .EG_BlockLevelElts {for _ ,_bgcf :=range _ddb .EG_ContentBlockContent {for _ ,_edee :=range _ebbc (_bgcf ){_gac =append (_gac ,_edee );};};};};};};};};return _gac ;};func (_cegd *Document )onNewRelationship (_eeee *_gbf .DecodeMap ,_fede ,_fdfe string ,_eadg []*_g .File ,_fcaa *_bgb .Relationship ,_defb _gbf .Target )error {_baac :=_e .DocTypeDocument ;switch _fdfe {case _e .OfficeDocumentType ,_e .OfficeDocumentTypeStrict :_cegd ._aeb =_cc .NewDocument ();_eeee .AddTarget (_fede ,_cegd ._aeb ,_fdfe ,0);_eeee .AddTarget (_gbf .RelationsPathFor (_fede ),_cegd ._ebfd .X (),_fdfe ,0);_fcaa .TargetAttr =_e .RelativeFilename (_baac ,_defb .Typ ,_fdfe ,0);case _e .CorePropertiesType :_eeee .AddTarget (_fede ,_cegd .CoreProperties .X (),_fdfe ,0);_fcaa .TargetAttr =_e .RelativeFilename (_baac ,_defb .Typ ,_fdfe ,0);case _e .CustomPropertiesType :_eeee .AddTarget (_fede ,_cegd .CustomProperties .X (),_fdfe ,0);_fcaa .TargetAttr =_e .RelativeFilename (_baac ,_defb .Typ ,_fdfe ,0);case _e .ExtendedPropertiesType ,_e .ExtendedPropertiesTypeStrict :_eeee .AddTarget (_fede ,_cegd .AppProperties .X (),_fdfe ,0);_fcaa .TargetAttr =_e .RelativeFilename (_baac ,_defb .Typ ,_fdfe ,0);case _e .ThumbnailType ,_e .ThumbnailTypeStrict :for _ece ,_bbfe :=range _eadg {if _bbfe ==nil {continue ;};if _bbfe .Name ==_fede {_ggad ,_gaed :=_bbfe .Open ();if _gaed !=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",_gaed );};_cegd .Thumbnail ,_ ,_gaed =_ac .Decode (_ggad );_ggad .Close ();if _gaed !=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",_gaed );};_eadg [_ece ]=nil ;};};case _e .SettingsType ,_e .SettingsTypeStrict :_eeee .AddTarget (_fede ,_cegd .Settings .X (),_fdfe ,0);_fcaa .TargetAttr =_e .RelativeFilename (_baac ,_defb .Typ ,_fdfe ,0);case _e .NumberingType ,_e .NumberingTypeStrict :_cegd .Numbering =NewNumbering ();_eeee .AddTarget (_fede ,_cegd .Numbering .X (),_fdfe ,0);_fcaa .TargetAttr =_e .RelativeFilename (_baac ,_defb .Typ ,_fdfe ,0);case _e .StylesType ,_e .StylesTypeStrict :_cegd .Styles .Clear ();_eeee .AddTarget (_fede ,_cegd .Styles .X (),_fdfe ,0);_fcaa .TargetAttr =_e .RelativeFilename (_baac ,_defb .Typ ,_fdfe ,0);case _e .HeaderType ,_e .HeaderTypeStrict :_dffe :=_cc .NewHdr ();_eeee .AddTarget (_fede ,_dffe ,_fdfe ,uint32 (len (_cegd ._dgbf )));_cegd ._dgbf =append (_cegd ._dgbf ,_dffe );_fcaa .TargetAttr =_e .RelativeFilename (_baac ,_defb .Typ ,_fdfe ,len (_cegd ._dgbf ));_eaag :=_acb .NewRelationships ();_eeee .AddTarget (_gbf .RelationsPathFor (_fede ),_eaag .X (),_fdfe ,0);_cegd ._edc =append (_cegd ._edc ,_eaag );case _e .FooterType ,_e .FooterTypeStrict :_aegd :=_cc .NewFtr ();_eeee .AddTarget (_fede ,_aegd ,_fdfe ,uint32 (len (_cegd ._ebda )));_cegd ._ebda =append (_cegd ._ebda ,_aegd );_fcaa .TargetAttr =_e .RelativeFilename (_baac ,_defb .Typ ,_fdfe ,len (_cegd ._ebda ));_dbb :=_acb .NewRelationships ();_eeee .AddTarget (_gbf .RelationsPathFor (_fede ),_dbb .X (),_fdfe ,0);_cegd ._dfa =append (_cegd ._dfa ,_dbb );case _e .ThemeType ,_e .ThemeTypeStrict :_eadef :=_cg .NewTheme ();_eeee .AddTarget (_fede ,_eadef ,_fdfe ,uint32 (len (_cegd ._agc )));_cegd ._agc =append (_cegd ._agc ,_eadef );_fcaa .TargetAttr =_e .RelativeFilename (_baac ,_defb .Typ ,_fdfe ,len (_cegd ._agc ));case _e .WebSettingsType ,_e .WebSettingsTypeStrict :_cegd ._bfg =_cc .NewWebSettings ();_eeee .AddTarget (_fede ,_cegd ._bfg ,_fdfe ,0);_fcaa .TargetAttr =_e .RelativeFilename (_baac ,_defb .Typ ,_fdfe ,0);case _e .FontTableType ,_e .FontTableTypeStrict :_cegd ._ebg =_cc .NewFonts ();_eeee .AddTarget (_fede ,_cegd ._ebg ,_fdfe ,0);_fcaa .TargetAttr =_e .RelativeFilename (_baac ,_defb .Typ ,_fdfe ,0);case _e .EndNotesType ,_e .EndNotesTypeStrict :_cegd ._cde =_cc .NewEndnotes ();_eeee .AddTarget (_fede ,_cegd ._cde ,_fdfe ,0);_fcaa .TargetAttr =_e .RelativeFilename (_baac ,_defb .Typ ,_fdfe ,0);case _e .FootNotesType ,_e .FootNotesTypeStrict :_cegd ._cdg =_cc .NewFootnotes ();_eeee .AddTarget (_fede ,_cegd ._cdg ,_fdfe ,0);_fcaa .TargetAttr =_e .RelativeFilename (_baac ,_defb .Typ ,_fdfe ,0);case _e .ImageType ,_e .ImageTypeStrict :var _bgdf _acb .ImageRef ;for _edad ,_bafe :=range _eadg {if _bafe ==nil {continue ;};if _bafe .Name ==_fede {_ebgf ,_aaba :=_gbf .ExtractToDiskTmp (_bafe ,_cegd .TmpPath );if _aaba !=nil {return _aaba ;};_eecd ,_aaba :=_acb .ImageFromStorage (_ebgf );if _aaba !=nil {return _aaba ;};_bgdf =_acb .MakeImageRef (_eecd ,&_cegd .DocBase ,_cegd ._ebfd );_eadg [_edad ]=nil ;};};if _bgdf .Format ()!=""{_gccg :="\u002e"+_d .ToLower (_bgdf .Format ());_fcaa .TargetAttr =_e .RelativeFilename (_baac ,_defb .Typ ,_fdfe ,len (_cegd .Images )+1);if _daeg :=_ec .Ext (_fcaa .TargetAttr );_daeg !=_gccg {_fcaa .TargetAttr =_fcaa .TargetAttr [0:len (_fcaa .TargetAttr )-len (_daeg )]+_gccg ;};_bgdf .SetTarget ("\u0077\u006f\u0072d\u002f"+_fcaa .TargetAttr );_cegd .Images =append (_cegd .Images ,_bgdf );};case _e .ControlType ,_e .ControlTypeStrict :_dffc :=_bf .NewOcx ();_ceed :=_e .RelativeFilename (_baac ,_defb .Typ ,_fdfe ,len (_cegd ._efd )+1);_fbga :="\u0077\u006f\u0072d\u002f"+_ceed [:len (_ceed )-4]+"\u002e\u0062\u0069\u006e";for _gbgg ,_gbbdc :=range _eadg {if _gbbdc ==nil {continue ;};if _gbbdc .Name ==_fbga {_dfec ,_bgc :=_gbf .ExtractToDiskTmp (_gbbdc ,_cegd .TmpPath );if _bgc !=nil {return _bgc ;};_bfdd ,_bgc :=_cb .ImportFromFile (_dfec );if _bgc ==nil {_bfdd .TargetAttr =_ceed ;_bfdd .Ocx =_dffc ;_cegd ._efd =append (_cegd ._efd ,_bfdd );_eeee .AddTarget (_fede ,_dffc ,_fdfe ,uint32 (len (_cegd ._efd )));_fcaa .TargetAttr =_ceed ;_eadg [_gbgg ]=nil ;}else {_bg .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",_fbga ,_bgc .Error ());};break ;};};case _e .ChartType :_bbec :=chart {_gbbda :_cd .NewChartSpace ()};_decg :=uint32 (len (_cegd ._afgd ));_eeee .AddTarget (_fede ,_bbec ._gbbda ,_fdfe ,_decg );_cegd ._afgd =append (_cegd ._afgd ,&_bbec );_fcaa .TargetAttr =_e .RelativeFilename (_baac ,_defb .Typ ,_fdfe ,len (_cegd ._afgd ));_bbec ._ada =_fcaa .TargetAttr ;default:_bg .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",_fdfe ,_fede );};return nil ;};
|
|
|
|
// NewWatermarkText generates a new WatermarkText.
|
|
func NewWatermarkText ()WatermarkText {_ddee :=_af .NewShapetype ();_gcda :=_af .NewEG_ShapeElements ();_gcda .Formulas =_bafgd ();_gcda .Path =_dbgd ();_gcda .Textpath =_cdde ();_gcda .Handles =_cfdcg ();_gcda .Lock =_debd ();_ddee .EG_ShapeElements =[]*_af .EG_ShapeElements {_gcda };var (_caedc ="_\u0078\u0030\u0030\u0030\u0030\u005f\u0074\u0031\u0033\u0036";_cbceg ="2\u0031\u0036\u0030\u0030\u002c\u0032\u0031\u0036\u0030\u0030";_egcf =float32 (136.0);_bafc ="\u0031\u0030\u00380\u0030";_aaec ="m\u0040\u0037\u002c\u006c\u0040\u0038,\u006d\u0040\u0035\u002c\u0032\u0031\u0036\u0030\u0030l\u0040\u0036\u002c2\u00316\u0030\u0030\u0065";);_ddee .IdAttr =&_caedc ;_ddee .CoordsizeAttr =&_cbceg ;_ddee .SptAttr =&_egcf ;_ddee .AdjAttr =&_bafc ;_ddee .PathAttr =&_aaec ;_ecge :=_af .NewShape ();_bfbef :=_af .NewEG_ShapeElements ();_bfbef .Textpath =_ebaff ();_ecge .EG_ShapeElements =[]*_af .EG_ShapeElements {_bfbef };var (_dbdgb ="\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";_efeg ="\u005f\u0078\u00300\u0030\u0030\u005f\u0073\u0032\u0030\u0035\u0031";_dgee ="\u0023\u005f\u00780\u0030\u0030\u0030\u005f\u0074\u0031\u0033\u0036";_caea ="";_ccdb ="\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";_eaab ="\u0073\u0069\u006c\u0076\u0065\u0072";);_ecge .IdAttr =&_dbdgb ;_ecge .SpidAttr =&_efeg ;_ecge .TypeAttr =&_dgee ;_ecge .AltAttr =&_caea ;_ecge .StyleAttr =&_ccdb ;_ecge .AllowincellAttr =_ebd .ST_TrueFalseFalse ;_ecge .FillcolorAttr =&_eaab ;_ecge .StrokedAttr =_ebd .ST_TrueFalseFalse ;_aaccc :=_cc .NewCT_Picture ();_aaccc .Any =[]_e .Any {_ddee ,_ecge };return WatermarkText {_adfba :_aaccc ,_eeced :_ecge ,_bdaaa :_ddee };};
|
|
|
|
// SetBehindDoc sets the behindDoc attribute of anchor.
|
|
func (_ab AnchoredDrawing )SetBehindDoc (val bool ){_ab ._gg .BehindDocAttr =val };func (_eddga Styles )initializeDocDefaults (){_eddga ._ecgbf .DocDefaults =_cc .NewCT_DocDefaults ();_eddga ._ecgbf .DocDefaults .RPrDefault =_cc .NewCT_RPrDefault ();_eddga ._ecgbf .DocDefaults .RPrDefault .RPr =_cc .NewCT_RPr ();_cfbb :=RunProperties {_eddga ._ecgbf .DocDefaults .RPrDefault .RPr };_cfbb .SetSize (12*_bd .Point );_cfbb .Fonts ().SetASCIITheme (_cc .ST_ThemeMajorAscii );_cfbb .Fonts ().SetEastAsiaTheme (_cc .ST_ThemeMajorEastAsia );_cfbb .Fonts ().SetHANSITheme (_cc .ST_ThemeMajorHAnsi );_cfbb .Fonts ().SetCSTheme (_cc .ST_ThemeMajorBidi );_cfbb .X ().Lang =_cc .NewCT_Language ();_cfbb .X ().Lang .ValAttr =_e .String ("\u0065\u006e\u002dU\u0053");_cfbb .X ().Lang .EastAsiaAttr =_e .String ("\u0065\u006e\u002dU\u0053");_cfbb .X ().Lang .BidiAttr =_e .String ("\u0061\u0072\u002dS\u0041");_eddga ._ecgbf .DocDefaults .PPrDefault =_cc .NewCT_PPrDefault ();};
|
|
|
|
// Caps returns true if run font is capitalized.
|
|
func (_addeb RunProperties )Caps ()bool {return _fcaaa (_addeb ._acgcd .Caps )};
|
|
|
|
// Paragraphs returns the paragraphs defined in the cell.
|
|
func (_cce Cell )Paragraphs ()[]Paragraph {_dfc :=[]Paragraph {};for _ ,_acg :=range _cce ._gbb .EG_BlockLevelElts {for _ ,_cab :=range _acg .EG_ContentBlockContent {for _ ,_dade :=range _cab .P {_dfc =append (_dfc ,Paragraph {_cce ._bcc ,_dade });};};};return _dfc ;};
|
|
|
|
// SetToolTip sets the tooltip text for a hyperlink.
|
|
func (_dbee HyperLink )SetToolTip (text string ){if text ==""{_dbee ._bfde .TooltipAttr =nil ;}else {_dbee ._bfde .TooltipAttr =_e .String (text );};};
|
|
|
|
// ExtractFromHeader returns text from the document header as an array of TextItems.
|
|
func ExtractFromHeader (header *_cc .Hdr )[]TextItem {return _bgeec (header .EG_ContentBlockContent ,nil )};func (_efbda *WatermarkText )getShapeType ()*_e .XSDAny {return _efbda .getInnerElement ("\u0073h\u0061\u0070\u0065\u0074\u0079\u0070e");};
|
|
|
|
// 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 (_caa *Document )Copy ()(*Document ,error ){_cbag :=_de .NewBuffer ([]byte {});_cfeg :=_caa .save (_cbag ,_caa ._dedb );if _cfeg !=nil {return nil ,_cfeg ;};_badgg :=_cbag .Bytes ();_fgbf :=_de .NewReader (_badgg );return _bfaa (_fgbf ,int64 (_fgbf .Len ()),_caa ._dedb );};
|
|
|
|
// TableStyleProperties are table properties as defined in a style.
|
|
type TableStyleProperties struct{_dfcf *_cc .CT_TblPrBase }; |