mirror of
https://github.com/unidoc/unioffice.git
synced 2025-04-29 13:49:10 +08:00
1773 lines
271 KiB
Go
1773 lines
271 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 (_dbd "archive/zip";_ag "bytes";_de "errors";_ga "fmt";_g "github.com/unidoc/unioffice";_ca "github.com/unidoc/unioffice/color";_cd "github.com/unidoc/unioffice/common";_gb "github.com/unidoc/unioffice/common/axcontrol";_bc "github.com/unidoc/unioffice/common/logger";_bg "github.com/unidoc/unioffice/common/tempstorage";_aa "github.com/unidoc/unioffice/internal/formatutils";_dc "github.com/unidoc/unioffice/internal/license";_dd "github.com/unidoc/unioffice/measurement";_daf "github.com/unidoc/unioffice/schema/schemas.microsoft.com/office/activeX";_cgb "github.com/unidoc/unioffice/schema/soo/dml";_cg "github.com/unidoc/unioffice/schema/soo/dml/chart";_ggb "github.com/unidoc/unioffice/schema/soo/dml/picture";_ge "github.com/unidoc/unioffice/schema/soo/ofc/sharedTypes";_bgc "github.com/unidoc/unioffice/schema/soo/pkg/relationships";_dag "github.com/unidoc/unioffice/schema/soo/wml";_ec "github.com/unidoc/unioffice/schema/urn/schemas_microsoft_com/vml";_fgcb "github.com/unidoc/unioffice/vmldrawing";_b "github.com/unidoc/unioffice/zippkg";_e "image";_c "image/jpeg";_da "io";_fg "math/rand";_gg "os";_a "path/filepath";_d "regexp";_fgc "strings";_db "unicode";);
|
|
|
|
// GetWrapPathLineTo return wrapPath lineTo value.
|
|
func (_ebf AnchorDrawWrapOptions )GetWrapPathLineTo ()[]*_cgb .CT_Point2D {return _ebf ._bf };func _gfggb (_fabe *_dag .CT_OnOff )OnOffValue {if _fabe ==nil {return OnOffValueUnset ;};if _fabe .ValAttr !=nil &&_fabe .ValAttr .Bool !=nil &&*_fabe .ValAttr .Bool ==false {return OnOffValueOff ;};return OnOffValueOn ;};
|
|
|
|
// PutNodeAfter put node to position after relativeTo.
|
|
func (_fadc *Document )PutNodeAfter (relativeTo ,node Node ){_fadc .putNode (relativeTo ,node ,false )};
|
|
|
|
// DrawingInline return a slice of InlineDrawings.
|
|
func (_efgae Run )DrawingInline ()[]InlineDrawing {_aabg :=[]InlineDrawing {};for _ ,_adda :=range _efgae ._ccad .EG_RunInnerContent {if _adda .Drawing ==nil {continue ;};for _ ,_aee :=range _adda .Drawing .Inline {_aabg =append (_aabg ,InlineDrawing {_efgae ._gcba ,_aee });};};return _aabg ;};const (OnOffValueUnset OnOffValue =iota ;OnOffValueOff ;OnOffValueOn ;);
|
|
|
|
// Color returns the style's Color.
|
|
func (_ddgb RunProperties )Color ()Color {if _ddgb ._becb .Color ==nil {_ddgb ._becb .Color =_dag .NewCT_Color ();};return Color {_ddgb ._becb .Color };};func _cgca (_bdff *_dag .CT_Tbl ,_cbegg map[string ]string ){for _ ,_fceg :=range _bdff .EG_ContentRowContent {for _ ,_faafa :=range _fceg .Tr {for _ ,_eagb :=range _faafa .EG_ContentCellContent {for _ ,_fgafe :=range _eagb .Tc {for _ ,_ffce :=range _fgafe .EG_BlockLevelElts {for _ ,_fadd :=range _ffce .EG_ContentBlockContent {for _ ,_ggggg :=range _fadd .P {_bagcb (_ggggg ,_cbegg );};for _ ,_cgcac :=range _fadd .Tbl {_cgca (_cgcac ,_cbegg );};};};};};};};};
|
|
|
|
// RowProperties are the properties for a row within a table
|
|
type RowProperties struct{_dbaab *_dag .CT_TrPr };
|
|
|
|
// Control returns an *axcontrol.Control object contained in the run or the nil value in case of no controls.
|
|
func (_afdf Run )Control ()*_gb .Control {if _cgea :=_afdf ._ccad .EG_RunInnerContent ;_cgea !=nil {if _dgfff :=_cgea [0].Object ;_dgfff !=nil {if _daff :=_dgfff .Choice ;_daff !=nil {if _egca :=_daff .Control ;_egca !=nil {if _egca .IdAttr !=nil {_cbcb :=_afdf ._gcba .GetDocRelTargetByID (*_egca .IdAttr );for _ ,_adfe :=range _afdf ._gcba ._add {if _cbcb ==_adfe .TargetAttr {return _adfe ;};};};};};};};return nil ;};func (_fdee FormFieldType )String ()string {if _fdee >=FormFieldType (len (_ccab )-1){return _ga .Sprintf ("\u0046\u006f\u0072\u006d\u0046\u0069\u0065\u006c\u0064\u0054\u0079\u0070e\u0028\u0025\u0064\u0029",_fdee );};return _eeagd [_ccab [_fdee ]:_ccab [_fdee +1]];};
|
|
|
|
// RunProperties controls run styling properties.
|
|
type RunProperties struct{_becb *_dag .CT_RPr };func _abcf ()*_ec .Path {_deacf :=_ec .NewPath ();_deacf .TextpathokAttr =_ge .ST_TrueFalseTrue ;_deacf .ConnecttypeAttr =_ec .OfcST_ConnectTypeCustom ;_bgea :="\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";_deacf .ConnectlocsAttr =&_bgea ;_fege :="\u0032\u0037\u0030,\u0031\u0038\u0030\u002c\u0039\u0030\u002c\u0030";_deacf .ConnectanglesAttr =&_fege ;return _deacf ;};
|
|
|
|
// SetWidthAuto sets the the table width to automatic.
|
|
func (_ababe TableProperties )SetWidthAuto (){_ababe ._befe .TblW =_dag .NewCT_TblWidth ();_ababe ._befe .TblW .TypeAttr =_dag .ST_TblWidthAuto ;};
|
|
|
|
// X return slice of node.
|
|
func (_ccccd *Nodes )X ()[]Node {return _ccccd ._cace };func _gaa (_ddee *_dag .CT_Tbl ,_fbbg *_dag .CT_P ,_debg bool )*_dag .CT_Tbl {for _ ,_dbab :=range _ddee .EG_ContentRowContent {for _ ,_gge :=range _dbab .Tr {for _ ,_ddec :=range _gge .EG_ContentCellContent {for _ ,_bee :=range _ddec .Tc {for _efc ,_ggda :=range _bee .EG_BlockLevelElts {for _ ,_fgdb :=range _ggda .EG_ContentBlockContent {for _cce ,_agbd :=range _fgdb .P {if _agbd ==_fbbg {_eada :=_dag .NewEG_BlockLevelElts ();_dbga :=_dag .NewEG_ContentBlockContent ();_eada .EG_ContentBlockContent =append (_eada .EG_ContentBlockContent ,_dbga );_gfdd :=_dag .NewCT_Tbl ();_dbga .Tbl =append (_dbga .Tbl ,_gfdd );_bee .EG_BlockLevelElts =append (_bee .EG_BlockLevelElts ,nil );if _debg {copy (_bee .EG_BlockLevelElts [_efc +1:],_bee .EG_BlockLevelElts [_efc :]);_bee .EG_BlockLevelElts [_efc ]=_eada ;if _cce !=0{_acd :=_dag .NewEG_BlockLevelElts ();_gdba :=_dag .NewEG_ContentBlockContent ();_acd .EG_ContentBlockContent =append (_acd .EG_ContentBlockContent ,_gdba );_gdba .P =_fgdb .P [:_cce ];_bee .EG_BlockLevelElts =append (_bee .EG_BlockLevelElts ,nil );copy (_bee .EG_BlockLevelElts [_efc +1:],_bee .EG_BlockLevelElts [_efc :]);_bee .EG_BlockLevelElts [_efc ]=_acd ;};_fgdb .P =_fgdb .P [_cce :];}else {copy (_bee .EG_BlockLevelElts [_efc +2:],_bee .EG_BlockLevelElts [_efc +1:]);_bee .EG_BlockLevelElts [_efc +1]=_eada ;if _cce !=len (_fgdb .P )-1{_cbff :=_dag .NewEG_BlockLevelElts ();_ebad :=_dag .NewEG_ContentBlockContent ();_cbff .EG_ContentBlockContent =append (_cbff .EG_ContentBlockContent ,_ebad );_ebad .P =_fgdb .P [_cce +1:];_bee .EG_BlockLevelElts =append (_bee .EG_BlockLevelElts ,nil );copy (_bee .EG_BlockLevelElts [_efc +3:],_bee .EG_BlockLevelElts [_efc +2:]);_bee .EG_BlockLevelElts [_efc +2]=_cbff ;}else {_fec :=_dag .NewEG_BlockLevelElts ();_adb :=_dag .NewEG_ContentBlockContent ();_fec .EG_ContentBlockContent =append (_fec .EG_ContentBlockContent ,_adb );_adb .P =[]*_dag .CT_P {_dag .NewCT_P ()};_bee .EG_BlockLevelElts =append (_bee .EG_BlockLevelElts ,nil );copy (_bee .EG_BlockLevelElts [_efc +3:],_bee .EG_BlockLevelElts [_efc +2:]);_bee .EG_BlockLevelElts [_efc +2]=_fec ;};_fgdb .P =_fgdb .P [:_cce +1];};return _gfdd ;};};for _ ,_adeb :=range _fgdb .Tbl {_dbf :=_gaa (_adeb ,_fbbg ,_debg );if _dbf !=nil {return _dbf ;};};};};};};};};return nil ;};
|
|
|
|
// RemoveFootnote removes a footnote from both the paragraph and the document
|
|
// the requested footnote must be anchored on the paragraph being referenced.
|
|
func (_cbbe Paragraph )RemoveFootnote (id int64 ){_abcdb :=_cbbe ._ebddd ._dde ;var _fcbda int ;for _ggffe ,_deegg :=range _abcdb .CT_Footnotes .Footnote {if _deegg .IdAttr ==id {_fcbda =_ggffe ;};};_fcbda =0;_abcdb .CT_Footnotes .Footnote [_fcbda ]=nil ;_abcdb .CT_Footnotes .Footnote [_fcbda ]=_abcdb .CT_Footnotes .Footnote [len (_abcdb .CT_Footnotes .Footnote )-1];_abcdb .CT_Footnotes .Footnote =_abcdb .CT_Footnotes .Footnote [:len (_abcdb .CT_Footnotes .Footnote )-1];var _eaec Run ;for _ ,_aggd :=range _cbbe .Runs (){if _gbggd ,_gabcc :=_aggd .IsFootnote ();_gbggd {if _gabcc ==id {_eaec =_aggd ;};};};_cbbe .RemoveRun (_eaec );};
|
|
|
|
// SetLeft sets the left border to a specified type, color and thickness.
|
|
func (_bcgd ParagraphBorders )SetLeft (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_bcgd ._gfae .Left =_dag .NewCT_Border ();_bgcge (_bcgd ._gfae .Left ,t ,c ,thickness );};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_cdag Run )X ()*_dag .CT_R {return _cdag ._ccad };
|
|
|
|
// Clear clears all content within a footer
|
|
func (_ecce Footer )Clear (){_ecce ._gbdc .EG_ContentBlockContent =nil };
|
|
|
|
// Emboss returns true if run emboss is on.
|
|
func (_cgcc RunProperties )Emboss ()bool {return _dcda (_cgcc ._becb .Emboss )};
|
|
|
|
// Header is a header for a document section.
|
|
type Header struct{_gcaa *Document ;_ddaf *_dag .Hdr ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_bdb Color )X ()*_dag .CT_Color {return _bdb ._dcb };
|
|
|
|
// SetValue sets the width value.
|
|
func (_bfag TableWidth )SetValue (m _dd .Distance ){_bfag ._beeag .WAttr =&_dag .ST_MeasurementOrPercent {};_bfag ._beeag .WAttr .ST_DecimalNumberOrPercent =&_dag .ST_DecimalNumberOrPercent {};_bfag ._beeag .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_g .Int64 (int64 (m /_dd .Twips ));_bfag ._beeag .TypeAttr =_dag .ST_TblWidthDxa ;};
|
|
|
|
// SetTextWrapSquare sets the text wrap to square with a given wrap type.
|
|
func (_gef AnchoredDrawing )SetTextWrapSquare (t _dag .WdST_WrapText ){_gef ._af .Choice =&_dag .WdEG_WrapTypeChoice {};_gef ._af .Choice .WrapSquare =_dag .NewWdCT_WrapSquare ();_gef ._af .Choice .WrapSquare .WrapTextAttr =t ;};
|
|
|
|
// ParagraphStyleProperties is the styling information for a paragraph.
|
|
type ParagraphStyleProperties struct{_ffgg *_dag .CT_PPrGeneral };
|
|
|
|
// SetCellSpacingAuto sets the cell spacing within a table to automatic.
|
|
func (_dabe TableProperties )SetCellSpacingAuto (){_dabe ._befe .TblCellSpacing =_dag .NewCT_TblWidth ();_dabe ._befe .TblCellSpacing .TypeAttr =_dag .ST_TblWidthAuto ;};func (_dbfbd *WatermarkPicture )getInnerElement (_ffedc string )*_g .XSDAny {for _ ,_acfdg :=range _dbfbd ._ecfd .Any {_cgaee ,_fdffc :=_acfdg .(*_g .XSDAny );if _fdffc &&(_cgaee .XMLName .Local ==_ffedc ||_cgaee .XMLName .Local =="\u0076\u003a"+_ffedc ){return _cgaee ;};};return nil ;};
|
|
|
|
// Footers returns the footers defined in the document.
|
|
func (_bbg *Document )Footers ()[]Footer {_abec :=[]Footer {};for _ ,_dgb :=range _bbg ._geb {_abec =append (_abec ,Footer {_bbg ,_dgb });};return _abec ;};func _ddeb ()*_ec .OfcLock {_ddffe :=_ec .NewOfcLock ();_ddffe .ExtAttr =_ec .ST_ExtEdit ;_ddffe .AspectratioAttr =_ge .ST_TrueFalseTrue ;return _ddffe ;};
|
|
|
|
// StyleID returns the style ID.
|
|
func (_gggb Style )StyleID ()string {if _gggb ._ffabb .StyleIdAttr ==nil {return "";};return *_gggb ._ffabb .StyleIdAttr ;};
|
|
|
|
// Tables returns the tables defined in the header.
|
|
func (_gacef Header )Tables ()[]Table {_cgag :=[]Table {};if _gacef ._ddaf ==nil {return nil ;};for _ ,_eeadd :=range _gacef ._ddaf .EG_ContentBlockContent {for _ ,_faab :=range _gacef ._gcaa .tables (_eeadd ){_cgag =append (_cgag ,_faab );};};return _cgag ;};
|
|
|
|
// SetTextWrapTight sets the text wrap to tight with a give wrap type.
|
|
func (_ecag AnchoredDrawing )SetTextWrapTight (option *AnchorDrawWrapOptions ){_ecag ._af .Choice =&_dag .WdEG_WrapTypeChoice {};_ecag ._af .Choice .WrapTight =_dag .NewWdCT_WrapTight ();_ecag ._af .Choice .WrapTight .WrapTextAttr =_dag .WdST_WrapTextBothSides ;_fcb :=false ;_ecag ._af .Choice .WrapTight .WrapPolygon .EditedAttr =&_fcb ;if option ==nil {option =NewAnchorDrawWrapOptions ();};_ecag ._af .Choice .WrapTight .WrapPolygon .LineTo =option .GetWrapPathLineTo ();_ecag ._af .Choice .WrapTight .WrapPolygon .Start =option .GetWrapPathStart ();_ecag ._af .LayoutInCellAttr =true ;_ecag ._af .AllowOverlapAttr =true ;};
|
|
|
|
// SetVerticalMerge controls the vertical merging of cells.
|
|
func (_dfcg CellProperties )SetVerticalMerge (mergeVal _dag .ST_Merge ){if mergeVal ==_dag .ST_MergeUnset {_dfcg ._bce .VMerge =nil ;}else {_dfcg ._bce .VMerge =_dag .NewCT_VMerge ();_dfcg ._bce .VMerge .ValAttr =mergeVal ;};};
|
|
|
|
// SetFirstLineIndent controls the indentation of the first line in a paragraph.
|
|
func (_fdeag Paragraph )SetFirstLineIndent (m _dd .Distance ){_fdeag .ensurePPr ();_bbceg :=_fdeag ._gbfgc .PPr ;if _bbceg .Ind ==nil {_bbceg .Ind =_dag .NewCT_Ind ();};if m ==_dd .Zero {_bbceg .Ind .FirstLineAttr =nil ;}else {_bbceg .Ind .FirstLineAttr =&_ge .ST_TwipsMeasure {};_bbceg .Ind .FirstLineAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (m /_dd .Twips ));};};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_fdaf Row )X ()*_dag .CT_Row {return _fdaf ._gcce };
|
|
|
|
// Footnote is an individual footnote reference within the document.
|
|
type Footnote struct{_cbffe *Document ;_eefc *_dag .CT_FtnEdn ;};
|
|
|
|
// SetStyle sets the font size.
|
|
func (_acefb RunProperties )SetStyle (style string ){if style ==""{_acefb ._becb .RStyle =nil ;}else {_acefb ._becb .RStyle =_dag .NewCT_String ();_acefb ._becb .RStyle .ValAttr =style ;};};
|
|
|
|
// X returns the internally wrapped *wml.CT_SectPr.
|
|
func (_ggaef Section )X ()*_dag .CT_SectPr {return _ggaef ._gbfbf };
|
|
|
|
// TableWidth controls width values in table settings.
|
|
type TableWidth struct{_beeag *_dag .CT_TblWidth };
|
|
|
|
// AddRun adds a run to a paragraph.
|
|
func (_adgca Paragraph )AddRun ()Run {_eegce :=_dag .NewEG_PContent ();_adgca ._gbfgc .EG_PContent =append (_adgca ._gbfgc .EG_PContent ,_eegce );_ffdac :=_dag .NewEG_ContentRunContent ();_eegce .EG_ContentRunContent =append (_eegce .EG_ContentRunContent ,_ffdac );_deedb :=_dag .NewCT_R ();_ffdac .R =_deedb ;return Run {_adgca ._ebddd ,_deedb };};
|
|
|
|
// SetFirstLineIndent controls the first line indent of the paragraph.
|
|
func (_fcgf ParagraphStyleProperties )SetFirstLineIndent (m _dd .Distance ){if _fcgf ._ffgg .Ind ==nil {_fcgf ._ffgg .Ind =_dag .NewCT_Ind ();};if m ==_dd .Zero {_fcgf ._ffgg .Ind .FirstLineAttr =nil ;}else {_fcgf ._ffgg .Ind .FirstLineAttr =&_ge .ST_TwipsMeasure {};_fcgf ._ffgg .Ind .FirstLineAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (m /_dd .Twips ));};};
|
|
|
|
// FindNodeByCondition return node based on condition function,
|
|
// if wholeElements is true, its will extract childs as next node elements.
|
|
func (_ccebd *Nodes )FindNodeByCondition (f func (_fggc *Node )bool ,wholeElements bool )[]Node {_eafee :=[]Node {};for _ ,_ffddg :=range _ccebd ._cace {if f (&_ffddg ){_eafee =append (_eafee ,_ffddg );};if wholeElements {_gefd :=Nodes {_cace :_ffddg .Children };_eafee =append (_eafee ,_gefd .FindNodeByCondition (f ,wholeElements )...);};};return _eafee ;};
|
|
|
|
// Endnotes returns the endnotes defined in the document.
|
|
func (_aeg *Document )Endnotes ()[]Endnote {_gad :=[]Endnote {};for _ ,_cge :=range _aeg ._acc .CT_Endnotes .Endnote {_gad =append (_gad ,Endnote {_aeg ,_cge });};return _gad ;};
|
|
|
|
// SetTextWrapBehindText sets the text wrap to behind text.
|
|
func (_dg AnchoredDrawing )SetTextWrapBehindText (){_dg ._af .Choice =&_dag .WdEG_WrapTypeChoice {};_dg ._af .Choice .WrapNone =_dag .NewWdCT_WrapNone ();_dg ._af .BehindDocAttr =true ;_dg ._af .LayoutInCellAttr =true ;_dg ._af .AllowOverlapAttr =true ;};
|
|
|
|
// SetEndIndent controls the end indentation.
|
|
func (_ffcfd ParagraphProperties )SetEndIndent (m _dd .Distance ){if _ffcfd ._gfeb .Ind ==nil {_ffcfd ._gfeb .Ind =_dag .NewCT_Ind ();};if m ==_dd .Zero {_ffcfd ._gfeb .Ind .EndAttr =nil ;}else {_ffcfd ._gfeb .Ind .EndAttr =&_dag .ST_SignedTwipsMeasure {};_ffcfd ._gfeb .Ind .EndAttr .Int64 =_g .Int64 (int64 (m /_dd .Twips ));};};
|
|
|
|
// TableInfo is used for keep information about a table, a row and a cell where the text is located.
|
|
type TableInfo struct{Table *_dag .CT_Tbl ;Row *_dag .CT_Row ;Cell *_dag .CT_Tc ;RowIndex int ;ColIndex int ;};
|
|
|
|
// Paragraphs returns the paragraphs defined in the cell.
|
|
func (_fbb Cell )Paragraphs ()[]Paragraph {_gfd :=[]Paragraph {};for _ ,_fdb :=range _fbb ._fb .EG_BlockLevelElts {for _ ,_gaf :=range _fdb .EG_ContentBlockContent {for _ ,_gdf :=range _gaf .P {_gfd =append (_gfd ,Paragraph {_fbb ._fcbc ,_gdf });};};};return _gfd ;};
|
|
|
|
// SetWidthAuto sets the the cell width to automatic.
|
|
func (_ecae CellProperties )SetWidthAuto (){_ecae ._bce .TcW =_dag .NewCT_TblWidth ();_ecae ._bce .TcW .TypeAttr =_dag .ST_TblWidthAuto ;};
|
|
|
|
// HyperLink is a link within a document.
|
|
type HyperLink struct{_fceaa *Document ;_abfc *_dag .CT_Hyperlink ;};func (_ebcf Paragraph )addBeginFldChar (_gedg string )*_dag .CT_FFData {_dcabd :=_ebcf .addFldChar ();_dcabd .FldCharTypeAttr =_dag .ST_FldCharTypeBegin ;_dcabd .FfData =_dag .NewCT_FFData ();_ebac :=_dag .NewCT_FFName ();_ebac .ValAttr =&_gedg ;_dcabd .FfData .Name =[]*_dag .CT_FFName {_ebac };return _dcabd .FfData ;};
|
|
|
|
// SetRight sets the right border to a specified type, color and thickness.
|
|
func (_cbfg ParagraphBorders )SetRight (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_cbfg ._gfae .Right =_dag .NewCT_Border ();_bgcge (_cbfg ._gfae .Right ,t ,c ,thickness );};
|
|
|
|
// SetBetween sets the between border to a specified type, color and thickness between paragraph.
|
|
func (_dcbcg ParagraphBorders )SetBetween (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_dcbcg ._gfae .Between =_dag .NewCT_Border ();_bgcge (_dcbcg ._gfae .Between ,t ,c ,thickness );};
|
|
|
|
// SetSize sets size attribute for a FormFieldTypeCheckBox in pt.
|
|
func (_aagb FormField )SetSize (size uint64 ){size *=2;if _aagb ._dgfaa .CheckBox !=nil {_aagb ._dgfaa .CheckBox .Choice =_dag .NewCT_FFCheckBoxChoice ();_aagb ._dgfaa .CheckBox .Choice .Size =_dag .NewCT_HpsMeasure ();_aagb ._dgfaa .CheckBox .Choice .Size .ValAttr =_dag .ST_HpsMeasure {ST_UnsignedDecimalNumber :&size };};};
|
|
|
|
// Footnote returns the footnote based on the ID; this can be used nicely with
|
|
// the run.IsFootnote() functionality.
|
|
func (_faac *Document )Footnote (id int64 )Footnote {for _ ,_fcg :=range _faac .Footnotes (){if _fcg .id ()==id {return _fcg ;};};return Footnote {};};
|
|
|
|
// SetLayoutInCell sets the layoutInCell attribute of anchor.
|
|
func (_fgd AnchoredDrawing )SetLayoutInCell (val bool ){_fgd ._af .LayoutInCellAttr =val };
|
|
|
|
// SetEnabled marks a FormField as enabled or disabled.
|
|
func (_egbe FormField )SetEnabled (enabled bool ){_ffcbb :=_dag .NewCT_OnOff ();_ffcbb .ValAttr =&_ge .ST_OnOff {Bool :&enabled };_egbe ._dgfaa .Enabled =[]*_dag .CT_OnOff {_ffcbb };};
|
|
|
|
// SetDefaultValue sets the default value of a FormFieldTypeDropDown. For
|
|
// FormFieldTypeDropDown, the value must be one of the fields possible values.
|
|
func (_cbade FormField )SetDefaultValue (v string ){if _cbade ._dgfaa .DdList !=nil {for _edaa ,_eggec :=range _cbade .PossibleValues (){if _eggec ==v {_cbade ._dgfaa .DdList .Default =_dag .NewCT_DecimalNumber ();_cbade ._dgfaa .DdList .Default .ValAttr =int64 (_edaa );break ;};};};};
|
|
|
|
// InitializeDefault constructs the default styles.
|
|
func (_gcgb Styles )InitializeDefault (){_gcgb .initializeDocDefaults ();_gcgb .initializeStyleDefaults ();};
|
|
|
|
// New constructs an empty document that content can be added to.
|
|
func New ()*Document {_bea :=&Document {_ceeb :_dag .NewDocument ()};_bea .ContentTypes =_cd .NewContentTypes ();_bea ._ceeb .Body =_dag .NewCT_Body ();_bea ._ceeb .ConformanceAttr =_ge .ST_ConformanceClassTransitional ;_bea ._dbce =_cd .NewRelationships ();_bea .AppProperties =_cd .NewAppProperties ();_bea .CoreProperties =_cd .NewCoreProperties ();_bea .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");_bea .Settings =NewSettings ();_bea ._dbce .AddRelationship ("\u0073\u0065\u0074t\u0069\u006e\u0067\u0073\u002e\u0078\u006d\u006c",_g .SettingsType );_bea .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");_bea .Rels =_cd .NewRelationships ();_bea .Rels .AddRelationship (_g .RelativeFilename (_g .DocTypeDocument ,"",_g .CorePropertiesType ,0),_g .CorePropertiesType );_bea .Rels .AddRelationship ("\u0064\u006fc\u0050\u0072\u006fp\u0073\u002f\u0061\u0070\u0070\u002e\u0078\u006d\u006c",_g .ExtendedPropertiesType );_bea .Rels .AddRelationship ("\u0077\u006f\u0072\u0064\u002f\u0064\u006f\u0063\u0075\u006d\u0065\u006et\u002e\u0078\u006d\u006c",_g .OfficeDocumentType );_bea .Numbering =NewNumbering ();_bea .Numbering .InitializeDefault ();_bea .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");_bea ._dbce .AddRelationship ("\u006e\u0075\u006d\u0062\u0065\u0072\u0069\u006e\u0067\u002e\u0078\u006d\u006c",_g .NumberingType );_bea .Styles =NewStyles ();_bea .Styles .InitializeDefault ();_bea .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");_bea ._dbce .AddRelationship ("\u0073\u0074\u0079\u006c\u0065\u0073\u002e\u0078\u006d\u006c",_g .StylesType );_bea ._ceeb .Body =_dag .NewCT_Body ();return _bea ;};
|
|
|
|
// SetLeft sets the left border to a specified type, color and thickness.
|
|
func (_dcg CellBorders )SetLeft (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_dcg ._gbe .Left =_dag .NewCT_Border ();_fbgeg (_dcg ._gbe .Left ,t ,c ,thickness );};
|
|
|
|
// SetLeft sets the left border to a specified type, color and thickness.
|
|
func (_beed TableBorders )SetLeft (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_beed ._dfeff .Left =_dag .NewCT_Border ();_fbgeg (_beed ._dfeff .Left ,t ,c ,thickness );};func (_afba *WatermarkText )findNode (_fbdb *_g .XSDAny ,_fdbeg string )*_g .XSDAny {for _ ,_adcf :=range _fbdb .Nodes {if _adcf .XMLName .Local ==_fdbeg {return _adcf ;};};return nil ;};func (_dfcbga Styles )initializeStyleDefaults (){_ddce :=_dfcbga .AddStyle ("\u004e\u006f\u0072\u006d\u0061\u006c",_dag .ST_StyleTypeParagraph ,true );_ddce .SetName ("\u004e\u006f\u0072\u006d\u0061\u006c");_ddce .SetPrimaryStyle (true );_dgdeg :=_dfcbga .AddStyle ("D\u0065f\u0061\u0075\u006c\u0074\u0050\u0061\u0072\u0061g\u0072\u0061\u0070\u0068Fo\u006e\u0074",_dag .ST_StyleTypeCharacter ,true );_dgdeg .SetName ("\u0044\u0065\u0066\u0061ul\u0074\u0020\u0050\u0061\u0072\u0061\u0067\u0072\u0061\u0070\u0068\u0020\u0046\u006fn\u0074");_dgdeg .SetUISortOrder (1);_dgdeg .SetSemiHidden (true );_dgdeg .SetUnhideWhenUsed (true );_adge :=_dfcbga .AddStyle ("\u0054i\u0074\u006c\u0065\u0043\u0068\u0061r",_dag .ST_StyleTypeCharacter ,false );_adge .SetName ("\u0054\u0069\u0074\u006c\u0065\u0020\u0043\u0068\u0061\u0072");_adge .SetBasedOn (_dgdeg .StyleID ());_adge .SetLinkedStyle ("\u0054\u0069\u0074l\u0065");_adge .SetUISortOrder (10);_adge .RunProperties ().Fonts ().SetASCIITheme (_dag .ST_ThemeMajorAscii );_adge .RunProperties ().Fonts ().SetEastAsiaTheme (_dag .ST_ThemeMajorEastAsia );_adge .RunProperties ().Fonts ().SetHANSITheme (_dag .ST_ThemeMajorHAnsi );_adge .RunProperties ().Fonts ().SetCSTheme (_dag .ST_ThemeMajorBidi );_adge .RunProperties ().SetSize (28*_dd .Point );_adge .RunProperties ().SetKerning (14*_dd .Point );_adge .RunProperties ().SetCharacterSpacing (-10*_dd .Twips );_fecafe :=_dfcbga .AddStyle ("\u0054\u0069\u0074l\u0065",_dag .ST_StyleTypeParagraph ,false );_fecafe .SetName ("\u0054\u0069\u0074l\u0065");_fecafe .SetBasedOn (_ddce .StyleID ());_fecafe .SetNextStyle (_ddce .StyleID ());_fecafe .SetLinkedStyle (_adge .StyleID ());_fecafe .SetUISortOrder (10);_fecafe .SetPrimaryStyle (true );_fecafe .ParagraphProperties ().SetContextualSpacing (true );_fecafe .RunProperties ().Fonts ().SetASCIITheme (_dag .ST_ThemeMajorAscii );_fecafe .RunProperties ().Fonts ().SetEastAsiaTheme (_dag .ST_ThemeMajorEastAsia );_fecafe .RunProperties ().Fonts ().SetHANSITheme (_dag .ST_ThemeMajorHAnsi );_fecafe .RunProperties ().Fonts ().SetCSTheme (_dag .ST_ThemeMajorBidi );_fecafe .RunProperties ().SetSize (28*_dd .Point );_fecafe .RunProperties ().SetKerning (14*_dd .Point );_fecafe .RunProperties ().SetCharacterSpacing (-10*_dd .Twips );_bcec :=_dfcbga .AddStyle ("T\u0061\u0062\u006c\u0065\u004e\u006f\u0072\u006d\u0061\u006c",_dag .ST_StyleTypeTable ,false );_bcec .SetName ("\u004e\u006f\u0072m\u0061\u006c\u0020\u0054\u0061\u0062\u006c\u0065");_bcec .SetUISortOrder (99);_bcec .SetSemiHidden (true );_bcec .SetUnhideWhenUsed (true );_bcec .X ().TblPr =_dag .NewCT_TblPrBase ();_dfcfb :=NewTableWidth ();_bcec .X ().TblPr .TblInd =_dfcfb .X ();_dfcfb .SetValue (0*_dd .Dxa );_bcec .X ().TblPr .TblCellMar =_dag .NewCT_TblCellMar ();_dfcfb =NewTableWidth ();_bcec .X ().TblPr .TblCellMar .Top =_dfcfb .X ();_dfcfb .SetValue (0*_dd .Dxa );_dfcfb =NewTableWidth ();_bcec .X ().TblPr .TblCellMar .Bottom =_dfcfb .X ();_dfcfb .SetValue (0*_dd .Dxa );_dfcfb =NewTableWidth ();_bcec .X ().TblPr .TblCellMar .Left =_dfcfb .X ();_dfcfb .SetValue (108*_dd .Dxa );_dfcfb =NewTableWidth ();_bcec .X ().TblPr .TblCellMar .Right =_dfcfb .X ();_dfcfb .SetValue (108*_dd .Dxa );_agdae :=_dfcbga .AddStyle ("\u004e\u006f\u004c\u0069\u0073\u0074",_dag .ST_StyleTypeNumbering ,false );_agdae .SetName ("\u004eo\u0020\u004c\u0069\u0073\u0074");_agdae .SetUISortOrder (1);_agdae .SetSemiHidden (true );_agdae .SetUnhideWhenUsed (true );_eeec :=[]_dd .Distance {16,13,12,11,11,11,11,11,11};_bdgf :=[]_dd .Distance {240,40,40,40,40,40,40,40,40};for _cbcfc :=0;_cbcfc < 9;_cbcfc ++{_ebecf :=_ga .Sprintf ("\u0048e\u0061\u0064\u0069\u006e\u0067\u0025d",_cbcfc +1);_fdaa :=_dfcbga .AddStyle (_ebecf +"\u0043\u0068\u0061\u0072",_dag .ST_StyleTypeCharacter ,false );_fdaa .SetName (_ga .Sprintf ("\u0048e\u0061d\u0069\u006e\u0067\u0020\u0025\u0064\u0020\u0043\u0068\u0061\u0072",_cbcfc +1));_fdaa .SetBasedOn (_dgdeg .StyleID ());_fdaa .SetLinkedStyle (_ebecf );_fdaa .SetUISortOrder (9+_cbcfc );_fdaa .RunProperties ().SetSize (_eeec [_cbcfc ]*_dd .Point );_aedbc :=_dfcbga .AddStyle (_ebecf ,_dag .ST_StyleTypeParagraph ,false );_aedbc .SetName (_ga .Sprintf ("\u0068\u0065\u0061\u0064\u0069\u006e\u0067\u0020\u0025\u0064",_cbcfc +1));_aedbc .SetNextStyle (_ddce .StyleID ());_aedbc .SetLinkedStyle (_aedbc .StyleID ());_aedbc .SetUISortOrder (9+_cbcfc );_aedbc .SetPrimaryStyle (true );_aedbc .ParagraphProperties ().SetKeepNext (true );_aedbc .ParagraphProperties ().SetSpacing (_bdgf [_cbcfc ]*_dd .Twips ,0);_aedbc .ParagraphProperties ().SetOutlineLevel (_cbcfc );_aedbc .RunProperties ().SetSize (_eeec [_cbcfc ]*_dd .Point );};};
|
|
|
|
// RemoveParagraph removes a paragraph from the endnote.
|
|
func (_cedge Endnote )RemoveParagraph (p Paragraph ){for _ ,_agfd :=range _cedge .content (){for _gffc ,_gecb :=range _agfd .P {if _gecb ==p ._gbfgc {copy (_agfd .P [_gffc :],_agfd .P [_gffc +1:]);_agfd .P =_agfd .P [0:len (_agfd .P )-1];return ;};};};};
|
|
|
|
// TableLook returns the table look, or conditional formatting applied to a table style.
|
|
func (_dfcfg TableProperties )TableLook ()TableLook {if _dfcfg ._befe .TblLook ==nil {_dfcfg ._befe .TblLook =_dag .NewCT_TblLook ();};return TableLook {_dfcfg ._befe .TblLook };};
|
|
|
|
// OnOffValue represents an on/off value that can also be unset
|
|
type OnOffValue byte ;
|
|
|
|
// UnderlineColor returns the hex color value of paragraph underline.
|
|
func (_aedb ParagraphProperties )UnderlineColor ()string {if _bgggb :=_aedb ._gfeb .RPr .U ;_bgggb !=nil {_ebdaf :=_bgggb .ColorAttr ;if _ebdaf !=nil &&_ebdaf .ST_HexColorRGB !=nil {return *_ebdaf .ST_HexColorRGB ;};};return "";};
|
|
|
|
// Underline returns the type of run underline.
|
|
func (_ddgfa RunProperties )Underline ()_dag .ST_Underline {if _ebfcg :=_ddgfa ._becb .U ;_ebfcg !=nil {return _ebfcg .ValAttr ;};return 0;};
|
|
|
|
// Clear resets the numbering.
|
|
func (_dfcbg Numbering )Clear (){_dfcbg ._bagd .AbstractNum =nil ;_dfcbg ._bagd .Num =nil ;_dfcbg ._bagd .NumIdMacAtCleanup =nil ;_dfcbg ._bagd .NumPicBullet =nil ;};func (_gabgb Paragraph )addEndFldChar ()*_dag .CT_FldChar {_gdfffc :=_gabgb .addFldChar ();_gdfffc .FldCharTypeAttr =_dag .ST_FldCharTypeEnd ;return _gdfffc ;};
|
|
|
|
// 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 (_gccaf Footer )Index ()int {for _dggf ,_ccee :=range _gccaf ._cdfa ._geb {if _ccee ==_gccaf ._gbdc {return _dggf ;};};return -1;};
|
|
|
|
// RunProperties returns the run properties controlling text formatting within the table.
|
|
func (_dbfc TableConditionalFormatting )RunProperties ()RunProperties {if _dbfc ._cfbcc .RPr ==nil {_dbfc ._cfbcc .RPr =_dag .NewCT_RPr ();};return RunProperties {_dbfc ._cfbcc .RPr };};
|
|
|
|
// SetTarget sets the URL target of the hyperlink.
|
|
func (_aeafg HyperLink )SetTarget (url string ){_babf :=_aeafg ._fceaa .AddHyperlink (url );_aeafg ._abfc .IdAttr =_g .String (_cd .Relationship (_babf ).ID ());_aeafg ._abfc .AnchorAttr =nil ;};
|
|
|
|
// SetWidthPercent sets the cell to a width percentage.
|
|
func (_eea CellProperties )SetWidthPercent (pct float64 ){_eea ._bce .TcW =_dag .NewCT_TblWidth ();_eea ._bce .TcW .TypeAttr =_dag .ST_TblWidthPct ;_eea ._bce .TcW .WAttr =&_dag .ST_MeasurementOrPercent {};_eea ._bce .TcW .WAttr .ST_DecimalNumberOrPercent =&_dag .ST_DecimalNumberOrPercent {};_eea ._bce .TcW .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_g .Int64 (int64 (pct *50));};
|
|
|
|
// AddText adds text to a run.
|
|
func (_cfeab Run )AddText (s string ){_bagg :=_dag .NewEG_RunInnerContent ();_cfeab ._ccad .EG_RunInnerContent =append (_cfeab ._ccad .EG_RunInnerContent ,_bagg );_bagg .T =_dag .NewCT_Text ();if _g .NeedsSpacePreserve (s ){_deab :="\u0070\u0072\u0065\u0073\u0065\u0072\u0076\u0065";_bagg .T .SpaceAttr =&_deab ;};_bagg .T .Content =s ;};
|
|
|
|
// Type returns the type of the field.
|
|
func (_agef FormField )Type ()FormFieldType {if _agef ._dgfaa .TextInput !=nil {return FormFieldTypeText ;}else if _agef ._dgfaa .CheckBox !=nil {return FormFieldTypeCheckBox ;}else if _agef ._dgfaa .DdList !=nil {return FormFieldTypeDropDown ;};return FormFieldTypeUnknown ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_gafac Paragraph )X ()*_dag .CT_P {return _gafac ._gbfgc };
|
|
|
|
// GetImage returns the ImageRef associated with an InlineDrawing.
|
|
func (_bgfb InlineDrawing )GetImage ()(_cd .ImageRef ,bool ){_eaef :=_bgfb ._cafea .Graphic .GraphicData .Any ;if len (_eaef )> 0{_accf ,_dgae :=_eaef [0].(*_ggb .Pic );if _dgae {if _accf .BlipFill !=nil &&_accf .BlipFill .Blip !=nil &&_accf .BlipFill .Blip .EmbedAttr !=nil {return _bgfb ._cgcd .GetImageByRelID (*_accf .BlipFill .Blip .EmbedAttr );};};};return _cd .ImageRef {},false ;};
|
|
|
|
// Fonts allows manipulating a style or run's fonts.
|
|
type Fonts struct{_gacg *_dag .CT_Fonts };
|
|
|
|
// SetCSTheme sets the font complex script theme.
|
|
func (_cfec Fonts )SetCSTheme (t _dag .ST_Theme ){_cfec ._gacg .CsthemeAttr =t };
|
|
|
|
// AddPageBreak adds a page break to a run.
|
|
func (_bcfc Run )AddPageBreak (){_egfc :=_bcfc .newIC ();_egfc .Br =_dag .NewCT_Br ();_egfc .Br .TypeAttr =_dag .ST_BrTypePage ;};
|
|
|
|
// GetImageObjByRelId returns a common.Image with the associated relation ID in the
|
|
// document.
|
|
func (_abffd *Document )GetImageObjByRelId (relId string )(_cd .Image ,error ){_feef :=_abffd ._dbce .GetTargetByRelIdAndType (relId ,_g .ImageType );if _feef ==""{for _ ,_gcfe :=range _abffd ._baf {_feef =_gcfe .GetTargetByRelIdAndType (relId ,_g .ImageType );};};if _feef ==""{for _ ,_gabg :=range _abffd ._gfef {_feef =_gabg .GetTargetByRelIdAndType (relId ,_g .ImageType );};};return _abffd .DocBase .GetImageBytesByTarget (_feef );};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_aaf Fonts )X ()*_dag .CT_Fonts {return _aaf ._gacg };
|
|
|
|
// SetPicture sets the watermark picture.
|
|
func (_edga *WatermarkPicture )SetPicture (imageRef _cd .ImageRef ){_fbeec :=imageRef .RelID ();_gcgd :=_edga .getShape ();if _edga ._cebdc !=nil {_babfd :=_edga ._cebdc .EG_ShapeElements ;if len (_babfd )> 0&&_babfd [0].Imagedata !=nil {_babfd [0].Imagedata .IdAttr =&_fbeec ;};}else {_dfgbf :=_edga .findNode (_gcgd ,"\u0069m\u0061\u0067\u0065\u0064\u0061\u0074a");for _aeef ,_ccaaa :=range _dfgbf .Attrs {if _ccaaa .Name .Local =="\u0069\u0064"{_dfgbf .Attrs [_aeef ].Value =_fbeec ;};};};};func (_bfaaf Document )mergeFields ()[]mergeFieldInfo {_bgcea :=[]Paragraph {};_fecc :=[]mergeFieldInfo {};for _ ,_aafb :=range _bfaaf .Tables (){for _ ,_cfef :=range _aafb .Rows (){for _ ,_bcaab :=range _cfef .Cells (){_bgcea =append (_bgcea ,_bcaab .Paragraphs ()...);};};};_bgcea =append (_bgcea ,_bfaaf .Paragraphs ()...);for _ ,_bffeg :=range _bfaaf .Headers (){_bgcea =append (_bgcea ,_bffeg .Paragraphs ()...);for _ ,_fdbe :=range _bffeg .Tables (){for _ ,_dbfbf :=range _fdbe .Rows (){for _ ,_eafe :=range _dbfbf .Cells (){_bgcea =append (_bgcea ,_eafe .Paragraphs ()...);};};};};for _ ,_abbc :=range _bfaaf .Footers (){_bgcea =append (_bgcea ,_abbc .Paragraphs ()...);for _ ,_eggg :=range _abbc .Tables (){for _ ,_acae :=range _eggg .Rows (){for _ ,_ebdeg :=range _acae .Cells (){_bgcea =append (_bgcea ,_ebdeg .Paragraphs ()...);};};};};for _ ,_bbcbc :=range _bgcea {_cfdg :=_bbcbc .Runs ();_ddcc :=-1;_bbea :=-1;_agbee :=-1;_cggag :=mergeFieldInfo {};for _ ,_gaegg :=range _bbcbc ._gbfgc .EG_PContent {for _ ,_fcag :=range _gaegg .FldSimple {if _fgc .Contains (_fcag .InstrAttr ,"\u004d\u0045\u0052\u0047\u0045\u0046\u0049\u0045\u004c\u0044"){_acgd :=_ebda (_fcag .InstrAttr );_acgd ._gacee =true ;_acgd ._cddd =_bbcbc ;_acgd ._gedd =_gaegg ;_fecc =append (_fecc ,_acgd );};};};for _acdb :=0;_acdb < len (_cfdg );_acdb ++{_afgg :=_cfdg [_acdb ];for _ ,_fcbfe :=range _afgg .X ().EG_RunInnerContent {if _fcbfe .FldChar !=nil {switch _fcbfe .FldChar .FldCharTypeAttr {case _dag .ST_FldCharTypeBegin :_ddcc =_acdb ;case _dag .ST_FldCharTypeSeparate :_bbea =_acdb ;case _dag .ST_FldCharTypeEnd :_agbee =_acdb ;if _cggag ._afac !=""{_cggag ._cddd =_bbcbc ;_cggag ._efabc =_ddcc ;_cggag ._fbfe =_agbee ;_cggag ._bfbf =_bbea ;_fecc =append (_fecc ,_cggag );};_ddcc =-1;_bbea =-1;_agbee =-1;_cggag =mergeFieldInfo {};};}else if _fcbfe .InstrText !=nil &&_fgc .Contains (_fcbfe .InstrText .Content ,"\u004d\u0045\u0052\u0047\u0045\u0046\u0049\u0045\u004c\u0044"){if _ddcc !=-1&&_agbee ==-1{_cggag =_ebda (_fcbfe .InstrText .Content );};};};};};return _fecc ;};
|
|
|
|
// SetPageBreakBefore controls if there is a page break before this paragraph.
|
|
func (_aeccf ParagraphProperties )SetPageBreakBefore (b bool ){if !b {_aeccf ._gfeb .PageBreakBefore =nil ;}else {_aeccf ._gfeb .PageBreakBefore =_dag .NewCT_OnOff ();};};
|
|
|
|
// SetInsideHorizontal sets the interior horizontal borders to a specified type, color and thickness.
|
|
func (_faaf CellBorders )SetInsideHorizontal (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_faaf ._gbe .InsideH =_dag .NewCT_Border ();_fbgeg (_faaf ._gbe .InsideH ,t ,c ,thickness );};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_bdcg Footnote )X ()*_dag .CT_FtnEdn {return _bdcg ._eefc };func (_gdbe *Document )validateTableCells ()error {for _ ,_eeaa :=range _gdbe ._ceeb .Body .EG_BlockLevelElts {for _ ,_dded :=range _eeaa .EG_ContentBlockContent {for _ ,_cfd :=range _dded .Tbl {for _ ,_cdbe :=range _cfd .EG_ContentRowContent {for _ ,_aag :=range _cdbe .Tr {_ffe :=false ;for _ ,_cbdg :=range _aag .EG_ContentCellContent {_dgfg :=false ;for _ ,_eaeg :=range _cbdg .Tc {_ffe =true ;for _ ,_abeaa :=range _eaeg .EG_BlockLevelElts {for _ ,_baad :=range _abeaa .EG_ContentBlockContent {if len (_baad .P )> 0{_dgfg =true ;break ;};};};};if !_dgfg {return _de .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 !_ffe {return _de .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 ;};
|
|
|
|
// Margins allows controlling individual cell margins.
|
|
func (_cgf CellProperties )Margins ()CellMargins {if _cgf ._bce .TcMar ==nil {_cgf ._bce .TcMar =_dag .NewCT_TcMar ();};return CellMargins {_cgf ._bce .TcMar };};func _gfba (_ebeg *_cgb .CT_Blip ,_decg map[string ]string ){if _ebeg .EmbedAttr !=nil {if _fgab ,_dgfa :=_decg [*_ebeg .EmbedAttr ];_dgfa {*_ebeg .EmbedAttr =_fgab ;};};};
|
|
|
|
// Footnotes returns the footnotes defined in the document.
|
|
func (_dccc *Document )Footnotes ()[]Footnote {_ecec :=[]Footnote {};for _ ,_bbcb :=range _dccc ._dde .CT_Footnotes .Footnote {_ecec =append (_ecec ,Footnote {_dccc ,_bbcb });};return _ecec ;};
|
|
|
|
// WatermarkText is watermark text within the document.
|
|
type WatermarkText struct{_bgcdc *_dag .CT_Picture ;_fdgcf *_fgcb .TextpathStyle ;_efac *_ec .Shape ;_deabb *_ec .Shapetype ;};
|
|
|
|
// 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 (_fded Paragraph )AddFootnote (text string )Footnote {var _aaba int64 ;if _fded ._ebddd .HasFootnotes (){for _ ,_eggge :=range _fded ._ebddd .Footnotes (){if _eggge .id ()> _aaba {_aaba =_eggge .id ();};};_aaba ++;}else {_aaba =0;_fded ._ebddd ._dde =&_dag .Footnotes {};_fded ._ebddd ._dde .CT_Footnotes =_dag .CT_Footnotes {};_fded ._ebddd ._dde .Footnote =make ([]*_dag .CT_FtnEdn ,0);};_bbfb :=_dag .NewCT_FtnEdn ();_dffaf :=_dag .NewCT_FtnEdnRef ();_dffaf .IdAttr =_aaba ;_fded ._ebddd ._dde .CT_Footnotes .Footnote =append (_fded ._ebddd ._dde .CT_Footnotes .Footnote ,_bbfb );_bcbg :=_fded .AddRun ();_ecga :=_bcbg .Properties ();_ecga .SetStyle ("\u0046\u006f\u006f\u0074\u006e\u006f\u0074\u0065\u0041n\u0063\u0068\u006f\u0072");_bcbg ._ccad .EG_RunInnerContent =[]*_dag .EG_RunInnerContent {_dag .NewEG_RunInnerContent ()};_bcbg ._ccad .EG_RunInnerContent [0].FootnoteReference =_dffaf ;_ccdgc :=Footnote {_fded ._ebddd ,_bbfb };_ccdgc ._eefc .IdAttr =_aaba ;_ccdgc ._eefc .EG_BlockLevelElts =[]*_dag .EG_BlockLevelElts {_dag .NewEG_BlockLevelElts ()};_adec :=_ccdgc .AddParagraph ();_adec .Properties ().SetStyle ("\u0046\u006f\u006f\u0074\u006e\u006f\u0074\u0065");_adec ._gbfgc .PPr .RPr =_dag .NewCT_ParaRPr ();_cdee :=_adec .AddRun ();_cdee .AddTab ();_cdee .AddText (text );return _ccdgc ;};
|
|
|
|
// CharacterSpacingValue returns the value of characters spacing in twips (1/20 of point).
|
|
func (_ebdab ParagraphProperties )CharacterSpacingValue ()int64 {if _gefb :=_ebdab ._gfeb .RPr .Spacing ;_gefb !=nil {_gdea :=_gefb .ValAttr ;if _gdea .Int64 !=nil {return *_gdea .Int64 ;};};return int64 (0);};
|
|
|
|
// Type returns the type of the style.
|
|
func (_ebddc Style )Type ()_dag .ST_StyleType {return _ebddc ._ffabb .TypeAttr };
|
|
|
|
// SetPictureWashout set washout to watermark picture.
|
|
func (_fcde *WatermarkPicture )SetPictureWashout (isWashout bool ){if _fcde ._cebdc !=nil {_aaagf :=_fcde ._cebdc .EG_ShapeElements ;if len (_aaagf )> 0&&_aaagf [0].Imagedata !=nil {if isWashout {_dgdab :="\u0031\u0039\u0036\u0036\u0031\u0066";_cegbb :="\u0032\u0032\u0039\u0033\u0038\u0066";_aaagf [0].Imagedata .GainAttr =&_dgdab ;_aaagf [0].Imagedata .BlacklevelAttr =&_cegbb ;};};};};
|
|
|
|
// DocRels returns document relationship.
|
|
func (_bebb *Document )DocRels ()_cd .Relationships {return _bebb ._dbce };func _ebce (_dagab *_dag .CT_P ,_cbgeb map[string ]string ){for _ ,_facd :=range _dagab .EG_PContent {for _ ,_eggc :=range _facd .EG_ContentRunContent {if _eggc .R !=nil {for _ ,_efff :=range _eggc .R .EG_RunInnerContent {_acbe :=_efff .Drawing ;if _acbe !=nil {for _ ,_eeeac :=range _acbe .Anchor {for _ ,_bddb :=range _eeeac .Graphic .GraphicData .Any {switch _cgbc :=_bddb .(type ){case *_ggb .Pic :if _cgbc .BlipFill !=nil &&_cgbc .BlipFill .Blip !=nil {_gfba (_cgbc .BlipFill .Blip ,_cbgeb );};default:};};};for _ ,_fbga :=range _acbe .Inline {for _ ,_abfb :=range _fbga .Graphic .GraphicData .Any {switch _bfgd :=_abfb .(type ){case *_ggb .Pic :if _bfgd .BlipFill !=nil &&_bfgd .BlipFill .Blip !=nil {_gfba (_bfgd .BlipFill .Blip ,_cbgeb );};default:};};};};};};};};};
|
|
|
|
// Name returns the name of the style if set.
|
|
func (_geed Style )Name ()string {if _geed ._ffabb .Name ==nil {return "";};return _geed ._ffabb .Name .ValAttr ;};
|
|
|
|
// NumberingDefinition defines a numbering definition for a list of pragraphs.
|
|
type NumberingDefinition struct{_edef *_dag .CT_AbstractNum };
|
|
|
|
// Spacing returns the paragraph spacing settings.
|
|
func (_bbcge ParagraphProperties )Spacing ()ParagraphSpacing {if _bbcge ._gfeb .Spacing ==nil {_bbcge ._gfeb .Spacing =_dag .NewCT_Spacing ();};return ParagraphSpacing {_bbcge ._gfeb .Spacing };};
|
|
|
|
// Caps returns true if run font is capitalized.
|
|
func (_bdafb RunProperties )Caps ()bool {return _dcda (_bdafb ._becb .Caps )};
|
|
|
|
// SetBottom sets the bottom border to a specified type, color and thickness.
|
|
func (_caebd TableBorders )SetBottom (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_caebd ._dfeff .Bottom =_dag .NewCT_Border ();_fbgeg (_caebd ._dfeff .Bottom ,t ,c ,thickness );};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_dbaaa NumberingDefinition )X ()*_dag .CT_AbstractNum {return _dbaaa ._edef };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_ddgfg ParagraphProperties )X ()*_dag .CT_PPr {return _ddgfg ._gfeb };
|
|
|
|
// SetUnderline controls underline for a run style.
|
|
func (_aaee RunProperties )SetUnderline (style _dag .ST_Underline ,c _ca .Color ){if style ==_dag .ST_UnderlineUnset {_aaee ._becb .U =nil ;}else {_aaee ._becb .U =_dag .NewCT_Underline ();_aaee ._becb .U .ColorAttr =&_dag .ST_HexColor {};_aaee ._becb .U .ColorAttr .ST_HexColorRGB =c .AsRGBString ();_aaee ._becb .U .ValAttr =style ;};};
|
|
|
|
// Bold returns true if run font is bold.
|
|
func (_effc RunProperties )Bold ()bool {_fedc :=_effc ._becb ;return _dcda (_fedc .B )||_dcda (_fedc .BCs );};
|
|
|
|
// 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 (_ffgb Document )SetConformance (conformanceAttr _ge .ST_ConformanceClass ){_ffgb ._ceeb .ConformanceAttr =conformanceAttr ;};
|
|
|
|
// SetAlignment controls the paragraph alignment
|
|
func (_aeced ParagraphProperties )SetAlignment (align _dag .ST_Jc ){if align ==_dag .ST_JcUnset {_aeced ._gfeb .Jc =nil ;}else {_aeced ._gfeb .Jc =_dag .NewCT_Jc ();_aeced ._gfeb .Jc .ValAttr =align ;};};
|
|
|
|
// SetTop sets the top border to a specified type, color and thickness.
|
|
func (_aeccd ParagraphBorders )SetTop (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_aeccd ._gfae .Top =_dag .NewCT_Border ();_bgcge (_aeccd ._gfae .Top ,t ,c ,thickness );};func (_cgg *Document )InsertTableAfter (relativeTo Paragraph )Table {return _cgg .insertTable (relativeTo ,false );};
|
|
|
|
// SearchStyleByName return style by its name.
|
|
func (_bdgd Styles )SearchStyleByName (name string )(Style ,bool ){for _ ,_affe :=range _bdgd ._bdad .Style {if _affe .Name !=nil {if _affe .Name .ValAttr ==name {return Style {_affe },true ;};};};return Style {},false ;};
|
|
|
|
// 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 (_geg AnchoredDrawing )SetTextWrapNone (){_geg ._af .Choice =&_dag .WdEG_WrapTypeChoice {};_geg ._af .Choice .WrapNone =_dag .NewWdCT_WrapNone ();};
|
|
|
|
// SetAll sets all of the borders to a given value.
|
|
func (_dfag TableBorders )SetAll (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_dfag .SetBottom (t ,c ,thickness );_dfag .SetLeft (t ,c ,thickness );_dfag .SetRight (t ,c ,thickness );_dfag .SetTop (t ,c ,thickness );_dfag .SetInsideHorizontal (t ,c ,thickness );_dfag .SetInsideVertical (t ,c ,thickness );};
|
|
|
|
// 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 (_egf *Document )Append (d1orig *Document )error {_gddc ,_aaca :=d1orig .Copy ();if _aaca !=nil {return _aaca ;};_egf .DocBase =_egf .DocBase .Append (_gddc .DocBase );if _gddc ._ceeb .ConformanceAttr !=_ge .ST_ConformanceClassStrict {_egf ._ceeb .ConformanceAttr =_gddc ._ceeb .ConformanceAttr ;};_eedc :=_egf ._dbce .X ().Relationship ;_dcbc :=_gddc ._dbce .X ().Relationship ;_dbfeg :=_gddc ._ceeb .Body ;_cebfa :=map[string ]string {};_ebca :=map[int64 ]int64 {};_dbfd :=map[int64 ]int64 {};for _ ,_abdb :=range _dcbc {_bdcd :=true ;_gbc :=_abdb .IdAttr ;_face :=_abdb .TargetAttr ;_fdccb :=_abdb .TypeAttr ;_cfdf :=_fdccb ==_g .ImageType ;_bgab :=_fdccb ==_g .HyperLinkType ;var _ffae string ;for _ ,_gcee :=range _eedc {if _gcee .TypeAttr ==_fdccb &&_gcee .TargetAttr ==_face {_bdcd =false ;_ffae =_gcee .IdAttr ;break ;};};if _cfdf {_dff :="\u0077\u006f\u0072d\u002f"+_face ;for _ ,_edfa :=range _gddc .DocBase .Images {if _edfa .Target ()==_dff {_debgd ,_aeab :=_cd .ImageFromStorage (_edfa .Path ());if _aeab !=nil {return _aeab ;};_bdac ,_aeab :=_egf .AddImage (_debgd );if _aeab !=nil {return _aeab ;};_ffae =_bdac .RelID ();break ;};};}else if _bdcd {if _bgab {_feee :=_egf ._dbce .AddHyperlink (_face );_ffae =_cd .Relationship (_feee ).ID ();}else {_gdbag :=_egf ._dbce .AddRelationship (_face ,_fdccb );_ffae =_gdbag .X ().IdAttr ;};};if _gbc !=_ffae {_cebfa [_gbc ]=_ffae ;};};if _dbfeg .SectPr !=nil {for _ ,_aefb :=range _dbfeg .SectPr .EG_HdrFtrReferences {if _aefb .HeaderReference !=nil {if _cagd ,_cbdbg :=_cebfa [_aefb .HeaderReference .IdAttr ];_cbdbg {_aefb .HeaderReference .IdAttr =_cagd ;_egf ._baf =append (_egf ._baf ,_cd .NewRelationships ());};}else if _aefb .FooterReference !=nil {if _faadc ,_gacc :=_cebfa [_aefb .FooterReference .IdAttr ];_gacc {_aefb .FooterReference .IdAttr =_faadc ;_egf ._gfef =append (_egf ._gfef ,_cd .NewRelationships ());};};};};_eafc ,_cbed :=_egf ._acc ,_gddc ._acc ;if _eafc !=nil {if _cbed !=nil {if _eafc .Endnote !=nil {if _cbed .Endnote !=nil {_gebc :=int64 (len (_eafc .Endnote )+1);for _ ,_cde :=range _cbed .Endnote {_baeg :=_cde .IdAttr ;if _baeg > 0{_cde .IdAttr =_gebc ;_eafc .Endnote =append (_eafc .Endnote ,_cde );_dbfd [_baeg ]=_gebc ;_gebc ++;};};};}else {_eafc .Endnote =_cbed .Endnote ;};};}else if _cbed !=nil {_eafc =_cbed ;};_egf ._acc =_eafc ;_fce ,_dbda :=_egf ._dde ,_gddc ._dde ;if _fce !=nil {if _dbda !=nil {if _fce .Footnote !=nil {if _dbda .Footnote !=nil {_cgfe :=int64 (len (_fce .Footnote )+1);for _ ,_edcb :=range _dbda .Footnote {_aecdb :=_edcb .IdAttr ;if _aecdb > 0{_edcb .IdAttr =_cgfe ;_fce .Footnote =append (_fce .Footnote ,_edcb );_ebca [_aecdb ]=_cgfe ;_cgfe ++;};};};}else {_fce .Footnote =_dbda .Footnote ;};};}else if _dbda !=nil {_fce =_dbda ;};_egf ._dde =_fce ;for _ ,_dfgf :=range _dbfeg .EG_BlockLevelElts {for _ ,_efad :=range _dfgf .EG_ContentBlockContent {for _ ,_ebde :=range _efad .P {_ebce (_ebde ,_cebfa );_bagcb (_ebde ,_cebfa );_bfdee (_ebde ,_ebca ,_dbfd );};for _ ,_gdaa :=range _efad .Tbl {_cbee (_gdaa ,_cebfa );_cgca (_gdaa ,_cebfa );_bdgb (_gdaa ,_ebca ,_dbfd );};};};_egf ._ceeb .Body .EG_BlockLevelElts =append (_egf ._ceeb .Body .EG_BlockLevelElts ,_gddc ._ceeb .Body .EG_BlockLevelElts ...);if _egf ._ceeb .Body .SectPr ==nil {_egf ._ceeb .Body .SectPr =_gddc ._ceeb .Body .SectPr ;}else {var _ddba ,_ddcd bool ;for _ ,_cbdgg :=range _egf ._ceeb .Body .SectPr .EG_HdrFtrReferences {if _cbdgg .HeaderReference !=nil {_ddba =true ;}else if _cbdgg .FooterReference !=nil {_ddcd =true ;};};if !_ddba {for _ ,_acgc :=range _gddc ._ceeb .Body .SectPr .EG_HdrFtrReferences {if _acgc .HeaderReference !=nil {_egf ._ceeb .Body .SectPr .EG_HdrFtrReferences =append (_egf ._ceeb .Body .SectPr .EG_HdrFtrReferences ,_acgc );break ;};};};if !_ddcd {for _ ,_efbe :=range _gddc ._ceeb .Body .SectPr .EG_HdrFtrReferences {if _efbe .FooterReference !=nil {_egf ._ceeb .Body .SectPr .EG_HdrFtrReferences =append (_egf ._ceeb .Body .SectPr .EG_HdrFtrReferences ,_efbe );break ;};};};if _egf ._ceeb .Body .SectPr .Cols ==nil &&_gddc ._ceeb .Body .SectPr .Cols !=nil {_egf ._ceeb .Body .SectPr .Cols =_gddc ._ceeb .Body .SectPr .Cols ;};};_faee :=_egf .Numbering ._bagd ;_gabd :=_gddc .Numbering ._bagd ;if _faee !=nil {if _gabd !=nil {_faee .NumPicBullet =append (_faee .NumPicBullet ,_gabd .NumPicBullet ...);_faee .AbstractNum =append (_faee .AbstractNum ,_gabd .AbstractNum ...);_faee .Num =append (_faee .Num ,_gabd .Num ...);};}else if _gabd !=nil {_faee =_gabd ;};_egf .Numbering ._bagd =_faee ;if _egf .Styles ._bdad ==nil &&_gddc .Styles ._bdad !=nil {_egf .Styles ._bdad =_gddc .Styles ._bdad ;};_egf ._gdfa =append (_egf ._gdfa ,_gddc ._gdfa ...);_egf ._add =append (_egf ._add ,_gddc ._add ...);if len (_egf ._abcg )==0{_egf ._abcg =_gddc ._abcg ;};if len (_egf ._geb )==0{_egf ._geb =_gddc ._geb ;};_egbb :=_egf ._dfd ;_bgba :=_gddc ._dfd ;if _egbb !=nil {if _bgba !=nil {if _egbb .Divs !=nil {if _bgba .Divs !=nil {_egbb .Divs .Div =append (_egbb .Divs .Div ,_bgba .Divs .Div ...);};}else {_egbb .Divs =_bgba .Divs ;};};_egbb .Frameset =nil ;}else if _bgba !=nil {_egbb =_bgba ;_egbb .Frameset =nil ;};_egf ._dfd =_egbb ;_dgdd :=_egf ._dbac ;_fag :=_gddc ._dbac ;if _dgdd !=nil {if _fag !=nil {if _dgdd .Font !=nil {if _fag .Font !=nil {for _ ,_abgf :=range _fag .Font {_gaccb :=true ;for _ ,_gggg :=range _dgdd .Font {if _gggg .NameAttr ==_abgf .NameAttr {_gaccb =false ;break ;};};if _gaccb {_dgdd .Font =append (_dgdd .Font ,_abgf );};};};}else {_dgdd .Font =_fag .Font ;};};}else if _fag !=nil {_dgdd =_fag ;};_egf ._dbac =_dgdd ;return nil ;};
|
|
|
|
// Bold returns true if paragraph font is bold.
|
|
func (_fbge ParagraphProperties )Bold ()bool {_gccb :=_fbge ._gfeb .RPr ;return _dcda (_gccb .B )||_dcda (_gccb .BCs );};func (_debd *Document )insertStyleFromNode (_debda Node ){if _debda .Style .X ()!=nil {if _ ,_eefd :=_debd .Styles .SearchStyleById (_debda .Style .StyleID ());!_eefd {_debd .Styles .InsertStyle (_debda .Style );_fedeg :=_debda .Style .ParagraphProperties ();_debd .insertNumberingFromStyleProperties (_debda ._efgg .Numbering ,_fedeg );};};};
|
|
|
|
// SetLeftIndent controls left indent of paragraph.
|
|
func (_afedc Paragraph )SetLeftIndent (m _dd .Distance ){_afedc .ensurePPr ();_febg :=_afedc ._gbfgc .PPr ;if _febg .Ind ==nil {_febg .Ind =_dag .NewCT_Ind ();};if m ==_dd .Zero {_febg .Ind .LeftAttr =nil ;}else {_febg .Ind .LeftAttr =&_dag .ST_SignedTwipsMeasure {};_febg .Ind .LeftAttr .Int64 =_g .Int64 (int64 (m /_dd .Twips ));};};
|
|
|
|
// AddTable adds a new table to the document body.
|
|
func (_fbbf *Document )AddTable ()Table {_gae :=_dag .NewEG_BlockLevelElts ();_fbbf ._ceeb .Body .EG_BlockLevelElts =append (_fbbf ._ceeb .Body .EG_BlockLevelElts ,_gae );_agdc :=_dag .NewEG_ContentBlockContent ();_gae .EG_ContentBlockContent =append (_gae .EG_ContentBlockContent ,_agdc );_acb :=_dag .NewCT_Tbl ();_agdc .Tbl =append (_agdc .Tbl ,_acb );return Table {_fbbf ,_acb };};
|
|
|
|
// SetPictureSize set watermark picture size with given width and height.
|
|
func (_acgg *WatermarkPicture )SetPictureSize (width ,height int64 ){if _acgg ._cebdc !=nil {_bdbe :=_acgg .GetShapeStyle ();_bdbe .SetWidth (float64 (width )*_dd .Point );_bdbe .SetHeight (float64 (height )*_dd .Point );_acgg .SetShapeStyle (_bdbe );};};
|
|
|
|
// Pict returns the pict object.
|
|
func (_aeacd *WatermarkText )Pict ()*_dag .CT_Picture {return _aeacd ._bgcdc };func (_cfbcd *WatermarkText )getShapeType ()*_g .XSDAny {return _cfbcd .getInnerElement ("\u0073h\u0061\u0070\u0065\u0074\u0079\u0070e");};
|
|
|
|
// Styles is the document wide styles contained in styles.xml.
|
|
type Styles struct{_bdad *_dag .Styles };
|
|
|
|
// HasEndnotes returns a bool based on the presence or abscence of endnotes within
|
|
// the document.
|
|
func (_gfgfd *Document )HasEndnotes ()bool {return _gfgfd ._acc !=nil };func (_debfd *WatermarkText )getInnerElement (_fcbg string )*_g .XSDAny {for _ ,_gfac :=range _debfd ._bgcdc .Any {_caddb ,_agced :=_gfac .(*_g .XSDAny );if _agced &&(_caddb .XMLName .Local ==_fcbg ||_caddb .XMLName .Local =="\u0076\u003a"+_fcbg ){return _caddb ;};};return nil ;};func _bdgb (_agee *_dag .CT_Tbl ,_egebb ,_gfde map[int64 ]int64 ){for _ ,_cbabb :=range _agee .EG_ContentRowContent {for _ ,_cdff :=range _cbabb .Tr {for _ ,_baea :=range _cdff .EG_ContentCellContent {for _ ,_cdge :=range _baea .Tc {for _ ,_baaa :=range _cdge .EG_BlockLevelElts {for _ ,_bdae :=range _baaa .EG_ContentBlockContent {for _ ,_cbbc :=range _bdae .P {_bfdee (_cbbc ,_egebb ,_gfde );};for _ ,_bdcdg :=range _bdae .Tbl {_bdgb (_bdcdg ,_egebb ,_gfde );};};};};};};};};func (_gccg Paragraph )insertRun (_cffdd Run ,_dbbc bool )Run {for _ ,_dbdefc :=range _gccg ._gbfgc .EG_PContent {for _cdgg ,_eefe :=range _dbdefc .EG_ContentRunContent {if _eefe .R ==_cffdd .X (){_dgfd :=_dag .NewCT_R ();_dbdefc .EG_ContentRunContent =append (_dbdefc .EG_ContentRunContent ,nil );if _dbbc {copy (_dbdefc .EG_ContentRunContent [_cdgg +1:],_dbdefc .EG_ContentRunContent [_cdgg :]);_dbdefc .EG_ContentRunContent [_cdgg ]=_dag .NewEG_ContentRunContent ();_dbdefc .EG_ContentRunContent [_cdgg ].R =_dgfd ;}else {copy (_dbdefc .EG_ContentRunContent [_cdgg +2:],_dbdefc .EG_ContentRunContent [_cdgg +1:]);_dbdefc .EG_ContentRunContent [_cdgg +1]=_dag .NewEG_ContentRunContent ();_dbdefc .EG_ContentRunContent [_cdgg +1].R =_dgfd ;};return Run {_gccg ._ebddd ,_dgfd };};if _eefe .Sdt !=nil &&_eefe .Sdt .SdtContent !=nil {for _ ,_cage :=range _eefe .Sdt .SdtContent .EG_ContentRunContent {if _cage .R ==_cffdd .X (){_aadc :=_dag .NewCT_R ();_eefe .Sdt .SdtContent .EG_ContentRunContent =append (_eefe .Sdt .SdtContent .EG_ContentRunContent ,nil );if _dbbc {copy (_eefe .Sdt .SdtContent .EG_ContentRunContent [_cdgg +1:],_eefe .Sdt .SdtContent .EG_ContentRunContent [_cdgg :]);_eefe .Sdt .SdtContent .EG_ContentRunContent [_cdgg ]=_dag .NewEG_ContentRunContent ();_eefe .Sdt .SdtContent .EG_ContentRunContent [_cdgg ].R =_aadc ;}else {copy (_eefe .Sdt .SdtContent .EG_ContentRunContent [_cdgg +2:],_eefe .Sdt .SdtContent .EG_ContentRunContent [_cdgg +1:]);_eefe .Sdt .SdtContent .EG_ContentRunContent [_cdgg +1]=_dag .NewEG_ContentRunContent ();_eefe .Sdt .SdtContent .EG_ContentRunContent [_cdgg +1].R =_aadc ;};return Run {_gccg ._ebddd ,_aadc };};};};};};return _gccg .AddRun ();};
|
|
|
|
// SetSize sets the size of the displayed image on the page.
|
|
func (_gfe AnchoredDrawing )SetSize (w ,h _dd .Distance ){_gfe ._af .Extent .CxAttr =int64 (float64 (w *_dd .Pixel72 )/_dd .EMU );_gfe ._af .Extent .CyAttr =int64 (float64 (h *_dd .Pixel72 )/_dd .EMU );};
|
|
|
|
// GetStyleByID returns Style by it's IdAttr.
|
|
func (_fgfc *Document )GetStyleByID (id string )Style {for _ ,_gagg :=range _fgfc .Styles ._bdad .Style {if _gagg .StyleIdAttr !=nil &&*_gagg .StyleIdAttr ==id {return Style {_gagg };};};return Style {};};
|
|
|
|
// SetBefore sets the spacing that comes before the paragraph.
|
|
func (_fcbcd ParagraphSpacing )SetBefore (before _dd .Distance ){_fcbcd ._bced .BeforeAttr =&_ge .ST_TwipsMeasure {};_fcbcd ._bced .BeforeAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (before /_dd .Twips ));};func _agbgd ()*_ec .Textpath {_dgbga :=_ec .NewTextpath ();_dgbga .OnAttr =_ge .ST_TrueFalseTrue ;_dgbga .FitshapeAttr =_ge .ST_TrueFalseTrue ;return _dgbga ;};
|
|
|
|
// GetChartSpaceByRelId returns a *crt.ChartSpace with the associated relation ID in the
|
|
// document.
|
|
func (_acbb *Document )GetChartSpaceByRelId (relId string )*_cg .ChartSpace {_ageeg :=_acbb ._dbce .GetTargetByRelId (relId );for _ ,_gbbf :=range _acbb ._fgcg {if _ageeg ==_gbbf .Target (){return _gbbf ._gfea ;};};return nil ;};
|
|
|
|
// read reads a document from an io.Reader.
|
|
func Read (r _da .ReaderAt ,size int64 )(*Document ,error ){return _cadd (r ,size ,"")};
|
|
|
|
// 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 (_dgacf Header )AddImage (i _cd .Image )(_cd .ImageRef ,error ){var _gfgb _cd .Relationships ;for _agbg ,_beeae :=range _dgacf ._gcaa ._abcg {if _beeae ==_dgacf ._ddaf {_gfgb =_dgacf ._gcaa ._baf [_agbg ];};};_febc :=_cd .MakeImageRef (i ,&_dgacf ._gcaa .DocBase ,_gfgb );if i .Data ==nil &&i .Path ==""{return _febc ,_de .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 _febc ,_de .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 _febc ,_de .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");};_dgacf ._gcaa .Images =append (_dgacf ._gcaa .Images ,_febc );_babcgd :=_ga .Sprintf ("\u006d\u0065d\u0069\u0061\u002fi\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073",len (_dgacf ._gcaa .Images ),i .Format );_aaff :=_gfgb .AddRelationship (_babcgd ,_g .ImageType );_febc .SetRelID (_aaff .X ().IdAttr );return _febc ,nil ;};
|
|
|
|
// Italic returns true if paragraph font is italic.
|
|
func (_dbbb ParagraphProperties )Italic ()bool {_gggfa :=_dbbb ._gfeb .RPr ;return _dcda (_gggfa .I )||_dcda (_gggfa .ICs );};
|
|
|
|
// SetVerticalAlignment sets the vertical alignment of content within a table cell.
|
|
func (_dgf CellProperties )SetVerticalAlignment (align _dag .ST_VerticalJc ){if align ==_dag .ST_VerticalJcUnset {_dgf ._bce .VAlign =nil ;}else {_dgf ._bce .VAlign =_dag .NewCT_VerticalJc ();_dgf ._bce .VAlign .ValAttr =align ;};};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_faa Cell )X ()*_dag .CT_Tc {return _faa ._fb };
|
|
|
|
// RemoveParagraph removes a paragraph from a footer.
|
|
func (_dcgca Header )RemoveParagraph (p Paragraph ){for _ ,_gafcf :=range _dcgca ._ddaf .EG_ContentBlockContent {for _cfcb ,_dbbf :=range _gafcf .P {if _dbbf ==p ._gbfgc {copy (_gafcf .P [_cfcb :],_gafcf .P [_cfcb +1:]);_gafcf .P =_gafcf .P [0:len (_gafcf .P )-1];return ;};};};};func _ffaa (_eddg []*_dag .CT_P ,_gbaeg *TableInfo ,_fegf *DrawingInfo )[]TextItem {_cbeb :=[]TextItem {};for _ ,_fbgb :=range _eddg {_cbeb =append (_cbeb ,_defg (_fbgb ,nil ,_gbaeg ,_fegf ,_fbgb .EG_PContent )...);};return _cbeb ;};
|
|
|
|
// SetLeftPct sets the cell left margin
|
|
func (_bbe CellMargins )SetLeftPct (pct float64 ){_bbe ._cc .Left =_dag .NewCT_TblWidth ();_efe (_bbe ._cc .Left ,pct );};
|
|
|
|
// Styles returns all styles.
|
|
func (_bcgb Styles )Styles ()[]Style {_gfeaf :=[]Style {};for _ ,_aaagg :=range _bcgb ._bdad .Style {_gfeaf =append (_gfeaf ,Style {_aaagg });};return _gfeaf ;};func (_begec *WatermarkPicture )getShapeImagedata ()*_g .XSDAny {return _begec .getInnerElement ("\u0069m\u0061\u0067\u0065\u0064\u0061\u0074a");};
|
|
|
|
// SetStyle sets the style of a paragraph and is identical to setting it on the
|
|
// paragraph's Properties()
|
|
func (_dcde Paragraph )SetStyle (s string ){_dcde .ensurePPr ();if s ==""{_dcde ._gbfgc .PPr .PStyle =nil ;}else {_dcde ._gbfgc .PPr .PStyle =_dag .NewCT_String ();_dcde ._gbfgc .PPr .PStyle .ValAttr =s ;};};func (_def *Document )appendTable (_dfce *Paragraph ,_dbad Table ,_fcf bool )Table {_eee :=_def ._ceeb .Body ;_fbf :=_dag .NewEG_BlockLevelElts ();_def ._ceeb .Body .EG_BlockLevelElts =append (_def ._ceeb .Body .EG_BlockLevelElts ,_fbf );_gbb :=_dag .NewEG_ContentBlockContent ();_fbf .EG_ContentBlockContent =append (_fbf .EG_ContentBlockContent ,_gbb );if _dfce !=nil {_ffg :=_dfce .X ();for _dfeac ,_bffa :=range _eee .EG_BlockLevelElts {for _ ,_bdc :=range _bffa .EG_ContentBlockContent {for _fede ,_gce :=range _gbb .P {if _gce ==_ffg {_ega :=_dbad .X ();_cfb :=_dag .NewEG_BlockLevelElts ();_gbd :=_dag .NewEG_ContentBlockContent ();_cfb .EG_ContentBlockContent =append (_cfb .EG_ContentBlockContent ,_gbd );_gbd .Tbl =append (_gbd .Tbl ,_ega );_eee .EG_BlockLevelElts =append (_eee .EG_BlockLevelElts ,nil );if _fcf {copy (_eee .EG_BlockLevelElts [_dfeac +1:],_eee .EG_BlockLevelElts [_dfeac :]);_eee .EG_BlockLevelElts [_dfeac ]=_cfb ;if _fede !=0{_aea :=_dag .NewEG_BlockLevelElts ();_fad :=_dag .NewEG_ContentBlockContent ();_aea .EG_ContentBlockContent =append (_aea .EG_ContentBlockContent ,_fad );_fad .P =_bdc .P [:_fede ];_eee .EG_BlockLevelElts =append (_eee .EG_BlockLevelElts ,nil );copy (_eee .EG_BlockLevelElts [_dfeac +1:],_eee .EG_BlockLevelElts [_dfeac :]);_eee .EG_BlockLevelElts [_dfeac ]=_aea ;};_bdc .P =_bdc .P [_fede :];}else {copy (_eee .EG_BlockLevelElts [_dfeac +2:],_eee .EG_BlockLevelElts [_dfeac +1:]);_eee .EG_BlockLevelElts [_dfeac +1]=_cfb ;if _fede !=len (_bdc .P )-1{_gfff :=_dag .NewEG_BlockLevelElts ();_bebfb :=_dag .NewEG_ContentBlockContent ();_gfff .EG_ContentBlockContent =append (_gfff .EG_ContentBlockContent ,_bebfb );_bebfb .P =_bdc .P [_fede +1:];_eee .EG_BlockLevelElts =append (_eee .EG_BlockLevelElts ,nil );copy (_eee .EG_BlockLevelElts [_dfeac +3:],_eee .EG_BlockLevelElts [_dfeac +2:]);_eee .EG_BlockLevelElts [_dfeac +2]=_gfff ;};_bdc .P =_bdc .P [:_fede +1];};break ;};};for _ ,_fff :=range _bdc .Tbl {_bffd :=_gaa (_fff ,_ffg ,_fcf );if _bffd !=nil {break ;};};};};}else {_gbb .Tbl =append (_gbb .Tbl ,_dbad .X ());};return Table {_def ,_dbad .X ()};};
|
|
|
|
// SetFirstColumn controls the conditional formatting for the first column in a table.
|
|
func (_dccdc TableLook )SetFirstColumn (on bool ){if !on {_dccdc ._bfbbe .FirstColumnAttr =&_ge .ST_OnOff {};_dccdc ._bfbbe .FirstColumnAttr .ST_OnOff1 =_ge .ST_OnOff1Off ;}else {_dccdc ._bfbbe .FirstColumnAttr =&_ge .ST_OnOff {};_dccdc ._bfbbe .FirstColumnAttr .ST_OnOff1 =_ge .ST_OnOff1On ;};};
|
|
|
|
// AddStyle adds a new empty style, if styleID is already exists, it will return the style.
|
|
func (_ggdg Styles )AddStyle (styleID string ,t _dag .ST_StyleType ,isDefault bool )Style {if _bdga ,_ffcbf :=_ggdg .SearchStyleById (styleID );_ffcbf {return _bdga ;};_dcabdb :=_dag .NewCT_Style ();_dcabdb .TypeAttr =t ;if isDefault {_dcabdb .DefaultAttr =&_ge .ST_OnOff {};_dcabdb .DefaultAttr .Bool =_g .Bool (isDefault );};_dcabdb .StyleIdAttr =_g .String (styleID );_ggdg ._bdad .Style =append (_ggdg ._bdad .Style ,_dcabdb );return Style {_dcabdb };};
|
|
|
|
// DoubleStrike returns true if run is double striked.
|
|
func (_dbefg RunProperties )DoubleStrike ()bool {return _dcda (_dbefg ._becb .Dstrike )};
|
|
|
|
// SetDoubleStrikeThrough sets the run to double strike-through.
|
|
func (_gdga RunProperties )SetDoubleStrikeThrough (b bool ){if !b {_gdga ._becb .Dstrike =nil ;}else {_gdga ._becb .Dstrike =_dag .NewCT_OnOff ();};};
|
|
|
|
// CellBorders are the borders for an individual
|
|
type CellBorders struct{_gbe *_dag .CT_TcBorders };
|
|
|
|
// 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 (_aacb *Document )FormFields ()[]FormField {_efdd :=[]FormField {};for _ ,_dgee :=range _aacb .Paragraphs (){_caba :=_dgee .Runs ();for _aede ,_efgc :=range _caba {for _ ,_dabb :=range _efgc ._ccad .EG_RunInnerContent {if _dabb .FldChar ==nil ||_dabb .FldChar .FfData ==nil {continue ;};if _dabb .FldChar .FldCharTypeAttr ==_dag .ST_FldCharTypeBegin {if len (_dabb .FldChar .FfData .Name )==0||_dabb .FldChar .FfData .Name [0].ValAttr ==nil {continue ;};_ffge :=FormField {_dgfaa :_dabb .FldChar .FfData };if _dabb .FldChar .FfData .TextInput !=nil {for _dagg :=_aede +1;_dagg < len (_caba )-1;_dagg ++{if len (_caba [_dagg ]._ccad .EG_RunInnerContent )==0{continue ;};_gaaa :=_caba [_dagg ]._ccad .EG_RunInnerContent [0];if _gaaa .FldChar !=nil &&_gaaa .FldChar .FldCharTypeAttr ==_dag .ST_FldCharTypeSeparate {if len (_caba [_dagg +1]._ccad .EG_RunInnerContent )==0{continue ;};if _caba [_dagg +1]._ccad .EG_RunInnerContent [0].FldChar ==nil {_ffge ._cceb =_caba [_dagg +1]._ccad .EG_RunInnerContent [0];break ;};};};};_efdd =append (_efdd ,_ffge );};};};};for _ ,_aaag :=range _aacb .Headers (){for _ ,_cbcde :=range _aaag .Paragraphs (){_gffd :=_cbcde .Runs ();for _eccc ,_fgaf :=range _gffd {for _ ,_ecb :=range _fgaf ._ccad .EG_RunInnerContent {if _ecb .FldChar ==nil ||_ecb .FldChar .FfData ==nil {continue ;};if _ecb .FldChar .FldCharTypeAttr ==_dag .ST_FldCharTypeBegin {if len (_ecb .FldChar .FfData .Name )==0||_ecb .FldChar .FfData .Name [0].ValAttr ==nil {continue ;};_aead :=FormField {_dgfaa :_ecb .FldChar .FfData };if _ecb .FldChar .FfData .TextInput !=nil {for _fbbd :=_eccc +1;_fbbd < len (_gffd )-1;_fbbd ++{if len (_gffd [_fbbd ]._ccad .EG_RunInnerContent )==0{continue ;};_ebcb :=_gffd [_fbbd ]._ccad .EG_RunInnerContent [0];if _ebcb .FldChar !=nil &&_ebcb .FldChar .FldCharTypeAttr ==_dag .ST_FldCharTypeSeparate {if len (_gffd [_fbbd +1]._ccad .EG_RunInnerContent )==0{continue ;};if _gffd [_fbbd +1]._ccad .EG_RunInnerContent [0].FldChar ==nil {_aead ._cceb =_gffd [_fbbd +1]._ccad .EG_RunInnerContent [0];break ;};};};};_efdd =append (_efdd ,_aead );};};};};};for _ ,_bedf :=range _aacb .Footers (){for _ ,_cdfd :=range _bedf .Paragraphs (){_dbaca :=_cdfd .Runs ();for _ggca ,_baec :=range _dbaca {for _ ,_dafb :=range _baec ._ccad .EG_RunInnerContent {if _dafb .FldChar ==nil ||_dafb .FldChar .FfData ==nil {continue ;};if _dafb .FldChar .FldCharTypeAttr ==_dag .ST_FldCharTypeBegin {if len (_dafb .FldChar .FfData .Name )==0||_dafb .FldChar .FfData .Name [0].ValAttr ==nil {continue ;};_bffda :=FormField {_dgfaa :_dafb .FldChar .FfData };if _dafb .FldChar .FfData .TextInput !=nil {for _bfa :=_ggca +1;_bfa < len (_dbaca )-1;_bfa ++{if len (_dbaca [_bfa ]._ccad .EG_RunInnerContent )==0{continue ;};_begb :=_dbaca [_bfa ]._ccad .EG_RunInnerContent [0];if _begb .FldChar !=nil &&_begb .FldChar .FldCharTypeAttr ==_dag .ST_FldCharTypeSeparate {if len (_dbaca [_bfa +1]._ccad .EG_RunInnerContent )==0{continue ;};if _dbaca [_bfa +1]._ccad .EG_RunInnerContent [0].FldChar ==nil {_bffda ._cceb =_dbaca [_bfa +1]._ccad .EG_RunInnerContent [0];break ;};};};};_efdd =append (_efdd ,_bffda );};};};};};return _efdd ;};
|
|
|
|
// SetStyle sets the style of a paragraph.
|
|
func (_feefe ParagraphProperties )SetStyle (s string ){if s ==""{_feefe ._gfeb .PStyle =nil ;}else {_feefe ._gfeb .PStyle =_dag .NewCT_String ();_feefe ._gfeb .PStyle .ValAttr =s ;};};
|
|
|
|
// SetTextWrapTopAndBottom sets the text wrap to top and bottom.
|
|
func (_ab AnchoredDrawing )SetTextWrapTopAndBottom (){_ab ._af .Choice =&_dag .WdEG_WrapTypeChoice {};_ab ._af .Choice .WrapTopAndBottom =_dag .NewWdCT_WrapTopBottom ();_ab ._af .LayoutInCellAttr =true ;_ab ._af .AllowOverlapAttr =true ;};
|
|
|
|
// SetWidthPercent sets the table to a width percentage.
|
|
func (_efeb TableProperties )SetWidthPercent (pct float64 ){_efeb ._befe .TblW =_dag .NewCT_TblWidth ();_efeb ._befe .TblW .TypeAttr =_dag .ST_TblWidthPct ;_efeb ._befe .TblW .WAttr =&_dag .ST_MeasurementOrPercent {};_efeb ._befe .TblW .WAttr .ST_DecimalNumberOrPercent =&_dag .ST_DecimalNumberOrPercent {};_efeb ._befe .TblW .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_g .Int64 (int64 (pct *50));};
|
|
|
|
// TableConditionalFormatting returns a conditional formatting object of a given
|
|
// type. Calling this method repeatedly will return the same object.
|
|
func (_ddccb Style )TableConditionalFormatting (typ _dag .ST_TblStyleOverrideType )TableConditionalFormatting {for _ ,_egcag :=range _ddccb ._ffabb .TblStylePr {if _egcag .TypeAttr ==typ {return TableConditionalFormatting {_egcag };};};_gfbc :=_dag .NewCT_TblStylePr ();_gfbc .TypeAttr =typ ;_ddccb ._ffabb .TblStylePr =append (_ddccb ._ffabb .TblStylePr ,_gfbc );return TableConditionalFormatting {_gfbc };};
|
|
|
|
// AddTab adds tab to a run and can be used with the the Paragraph's tab stops.
|
|
func (_bcdc Run )AddTab (){_cgfa :=_bcdc .newIC ();_cgfa .Tab =_dag .NewCT_Empty ()};
|
|
|
|
// Themes returns document's themes.
|
|
func (_ggad *Document )Themes ()[]*_cgb .Theme {return _ggad ._gdfa };func _eagf (_dcab *Document )map[int64 ]map[int64 ]int64 {_eaeb :=_dcab .Paragraphs ();_edfc :=make (map[int64 ]map[int64 ]int64 ,0);for _ ,_abbb :=range _eaeb {_efcf :=_bafe (_dcab ,_abbb );if _efcf .NumberingLevel !=nil &&_efcf .AbstractNumId !=nil {_edgge :=*_efcf .AbstractNumId ;if _ ,_ffeg :=_edfc [_edgge ];_ffeg {if _baacg :=_efcf .NumberingLevel .X ();_baacg !=nil {if _ ,_fadbb :=_edfc [_edgge ][_baacg .IlvlAttr ];_fadbb {_edfc [_edgge ][_baacg .IlvlAttr ]++;}else {_edfc [_edgge ][_baacg .IlvlAttr ]=1;};};}else {if _ffeb :=_efcf .NumberingLevel .X ();_ffeb !=nil {_edfc [_edgge ]=map[int64 ]int64 {_ffeb .IlvlAttr :1};};};};};return _edfc ;};
|
|
|
|
// SetCellSpacingPercent sets the cell spacing within a table to a percent width.
|
|
func (_fagde TableProperties )SetCellSpacingPercent (pct float64 ){_fagde ._befe .TblCellSpacing =_dag .NewCT_TblWidth ();_fagde ._befe .TblCellSpacing .TypeAttr =_dag .ST_TblWidthPct ;_fagde ._befe .TblCellSpacing .WAttr =&_dag .ST_MeasurementOrPercent {};_fagde ._befe .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent =&_dag .ST_DecimalNumberOrPercent {};_fagde ._befe .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_g .Int64 (int64 (pct *50));};
|
|
|
|
// SetXOffset sets the X offset for an image relative to the origin.
|
|
func (_bd AnchoredDrawing )SetXOffset (x _dd .Distance ){_bd ._af .PositionH .Choice =&_dag .WdCT_PosHChoice {};_bd ._af .PositionH .Choice .PosOffset =_g .Int32 (int32 (x /_dd .EMU ));};
|
|
|
|
// X returns the inner wrapped type
|
|
func (_agd CellBorders )X ()*_dag .CT_TcBorders {return _agd ._gbe };
|
|
|
|
// Paragraphs returns the paragraphs defined in an endnote.
|
|
func (_dddfg Endnote )Paragraphs ()[]Paragraph {_bdea :=[]Paragraph {};for _ ,_dbace :=range _dddfg .content (){for _ ,_dcfe :=range _dbace .P {_bdea =append (_bdea ,Paragraph {_dddfg ._gdfaf ,_dcfe });};};return _bdea ;};func (_aecc *Document )insertTable (_ege Paragraph ,_aebg bool )Table {_cebf :=_aecc ._ceeb .Body ;if _cebf ==nil {return _aecc .AddTable ();};_gdc :=_ege .X ();for _bebfd ,_bebe :=range _cebf .EG_BlockLevelElts {for _ ,_dgdg :=range _bebe .EG_ContentBlockContent {for _fdea ,_eaf :=range _dgdg .P {if _eaf ==_gdc {_ffd :=_dag .NewCT_Tbl ();_gga :=_dag .NewEG_BlockLevelElts ();_bbc :=_dag .NewEG_ContentBlockContent ();_gga .EG_ContentBlockContent =append (_gga .EG_ContentBlockContent ,_bbc );_bbc .Tbl =append (_bbc .Tbl ,_ffd );_cebf .EG_BlockLevelElts =append (_cebf .EG_BlockLevelElts ,nil );if _aebg {copy (_cebf .EG_BlockLevelElts [_bebfd +1:],_cebf .EG_BlockLevelElts [_bebfd :]);_cebf .EG_BlockLevelElts [_bebfd ]=_gga ;if _fdea !=0{_babc :=_dag .NewEG_BlockLevelElts ();_afg :=_dag .NewEG_ContentBlockContent ();_babc .EG_ContentBlockContent =append (_babc .EG_ContentBlockContent ,_afg );_afg .P =_dgdg .P [:_fdea ];_cebf .EG_BlockLevelElts =append (_cebf .EG_BlockLevelElts ,nil );copy (_cebf .EG_BlockLevelElts [_bebfd +1:],_cebf .EG_BlockLevelElts [_bebfd :]);_cebf .EG_BlockLevelElts [_bebfd ]=_babc ;};_dgdg .P =_dgdg .P [_fdea :];}else {copy (_cebf .EG_BlockLevelElts [_bebfd +2:],_cebf .EG_BlockLevelElts [_bebfd +1:]);_cebf .EG_BlockLevelElts [_bebfd +1]=_gga ;if _fdea !=len (_dgdg .P )-1{_cef :=_dag .NewEG_BlockLevelElts ();_eac :=_dag .NewEG_ContentBlockContent ();_cef .EG_ContentBlockContent =append (_cef .EG_ContentBlockContent ,_eac );_eac .P =_dgdg .P [_fdea +1:];_cebf .EG_BlockLevelElts =append (_cebf .EG_BlockLevelElts ,nil );copy (_cebf .EG_BlockLevelElts [_bebfd +3:],_cebf .EG_BlockLevelElts [_bebfd +2:]);_cebf .EG_BlockLevelElts [_bebfd +2]=_cef ;};_dgdg .P =_dgdg .P [:_fdea +1];};return Table {_aecc ,_ffd };};};for _ ,_daa :=range _dgdg .Tbl {_cbf :=_gaa (_daa ,_gdc ,_aebg );if _cbf !=nil {return Table {_aecc ,_cbf };};};};};return _aecc .AddTable ();};
|
|
|
|
// 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 (_ffgga Run )IsEndnote ()(bool ,int64 ){if _ffgga ._ccad .EG_RunInnerContent !=nil {if _ffgga ._ccad .EG_RunInnerContent [0].EndnoteReference !=nil {return true ,_ffgga ._ccad .EG_RunInnerContent [0].EndnoteReference .IdAttr ;};};return false ,0;};
|
|
|
|
// AddDefinition adds a new numbering definition.
|
|
func (_effe Numbering )AddDefinition ()NumberingDefinition {_egfe :=_dag .NewCT_Num ();_ceag :=int64 (1);for _ ,_afdg :=range _effe .Definitions (){if _afdg .AbstractNumberID ()>=_ceag {_ceag =_afdg .AbstractNumberID ()+1;};};_cdddf :=int64 (1);for _ ,_dbbaa :=range _effe .X ().Num {if _dbbaa .NumIdAttr >=_cdddf {_cdddf =_dbbaa .NumIdAttr +1;};};_egfe .NumIdAttr =_cdddf ;_egfe .AbstractNumId =_dag .NewCT_DecimalNumber ();_egfe .AbstractNumId .ValAttr =_ceag ;_eebb :=_dag .NewCT_AbstractNum ();_eebb .AbstractNumIdAttr =_ceag ;_effe ._bagd .AbstractNum =append (_effe ._bagd .AbstractNum ,_eebb );_effe ._bagd .Num =append (_effe ._bagd .Num ,_egfe );return NumberingDefinition {_eebb };};
|
|
|
|
// FindNodeByText return node based on matched text and return a slice of node.
|
|
func (_gbfg *Nodes )FindNodeByRegexp (r *_d .Regexp )[]Node {_cafa :=[]Node {};for _ ,_acdfg :=range _gbfg ._cace {if r .MatchString (_acdfg .Text ()){_cafa =append (_cafa ,_acdfg );};_dagf :=Nodes {_cace :_acdfg .Children };_cafa =append (_cafa ,_dagf .FindNodeByRegexp (r )...);};return _cafa ;};
|
|
|
|
// Strike returns true if paragraph is striked.
|
|
func (_dcbdb ParagraphProperties )Strike ()bool {return _dcda (_dcbdb ._gfeb .RPr .Strike )};
|
|
|
|
// GetEffect returns the effect of the run.
|
|
func (_cgafd RunProperties )GetEffect ()_dag .ST_TextEffect {if _cgafd ._becb .Effect ==nil {return _dag .ST_TextEffectUnset ;};return _cgafd ._becb .Effect .ValAttr ;};
|
|
|
|
// GetKerning returns the kerning (character spacing) of a run
|
|
func (_acfde RunProperties )GetKerning ()_dd .Distance {if _acfde ._becb .Kern !=nil {return _dd .Distance (float64 (*_acfde ._becb .Kern .ValAttr .ST_UnsignedDecimalNumber )*_dd .HalfPoint );};return 0;};
|
|
|
|
// 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 *_dag .CT_P ;Hyperlink *_dag .CT_Hyperlink ;Run *_dag .CT_R ;TableInfo *TableInfo ;};
|
|
|
|
// AddLevel adds a new numbering level to a NumberingDefinition.
|
|
func (_dafdf NumberingDefinition )AddLevel ()NumberingLevel {_bfge :=_dag .NewCT_Lvl ();_bfge .Start =&_dag .CT_DecimalNumber {ValAttr :1};_bfge .IlvlAttr =int64 (len (_dafdf ._edef .Lvl ));_dafdf ._edef .Lvl =append (_dafdf ._edef .Lvl ,_bfge );return NumberingLevel {_bfge };};
|
|
|
|
// Nodes contains slice of Node element.
|
|
type Nodes struct{_cace []Node };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_bfede TableConditionalFormatting )X ()*_dag .CT_TblStylePr {return _bfede ._cfbcc };
|
|
|
|
// SetText sets the text to be used in bullet mode.
|
|
func (_edad NumberingLevel )SetText (t string ){if t ==""{_edad ._fbaa .LvlText =nil ;}else {_edad ._fbaa .LvlText =_dag .NewCT_LevelText ();_edad ._fbaa .LvlText .ValAttr =_g .String (t );};};
|
|
|
|
// SetSpacing sets the spacing that comes before and after the paragraph.
|
|
func (_edgeae ParagraphStyleProperties )SetSpacing (before ,after _dd .Distance ){if _edgeae ._ffgg .Spacing ==nil {_edgeae ._ffgg .Spacing =_dag .NewCT_Spacing ();};if before ==_dd .Zero {_edgeae ._ffgg .Spacing .BeforeAttr =nil ;}else {_edgeae ._ffgg .Spacing .BeforeAttr =&_ge .ST_TwipsMeasure {};_edgeae ._ffgg .Spacing .BeforeAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (before /_dd .Twips ));};if after ==_dd .Zero {_edgeae ._ffgg .Spacing .AfterAttr =nil ;}else {_edgeae ._ffgg .Spacing .AfterAttr =&_ge .ST_TwipsMeasure {};_edgeae ._ffgg .Spacing .AfterAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (after /_dd .Twips ));};};
|
|
|
|
// AddImageRef add ImageRef to header as relationship, returning ImageRef
|
|
// that can be used to be placed as header content.
|
|
func (_abba Header )AddImageRef (r _cd .ImageRef )(_cd .ImageRef ,error ){var _fged _cd .Relationships ;for _geef ,_fgfg :=range _abba ._gcaa ._abcg {if _fgfg ==_abba ._ddaf {_fged =_abba ._gcaa ._baf [_geef ];};};_dcge :=_fged .AddRelationship (r .Target (),_g .ImageType );r .SetRelID (_dcge .X ().IdAttr );return r ,nil ;};
|
|
|
|
// AddTable adds a table to the table cell.
|
|
func (_fdd Cell )AddTable ()Table {_dfg :=_dag .NewEG_BlockLevelElts ();_fdd ._fb .EG_BlockLevelElts =append (_fdd ._fb .EG_BlockLevelElts ,_dfg );_gea :=_dag .NewEG_ContentBlockContent ();_dfg .EG_ContentBlockContent =append (_dfg .EG_ContentBlockContent ,_gea );_dfc :=_dag .NewCT_Tbl ();_gea .Tbl =append (_gea .Tbl ,_dfc );return Table {_fdd ._fcbc ,_dfc };};
|
|
|
|
// Value returns the tring value of a FormFieldTypeText or FormFieldTypeDropDown.
|
|
func (_dggd FormField )Value ()string {if _dggd ._dgfaa .TextInput !=nil &&_dggd ._cceb .T !=nil {return _dggd ._cceb .T .Content ;}else if _dggd ._dgfaa .DdList !=nil &&_dggd ._dgfaa .DdList .Result !=nil {_fdcg :=_dggd .PossibleValues ();_bgae :=int (_dggd ._dgfaa .DdList .Result .ValAttr );if _bgae < len (_fdcg ){return _fdcg [_bgae ];};}else if _dggd ._dgfaa .CheckBox !=nil {if _dggd .IsChecked (){return "\u0074\u0072\u0075\u0065";};return "\u0066\u0061\u006cs\u0065";};return "";};
|
|
|
|
// AddCheckBox adds checkbox form field to the paragraph and returns it.
|
|
func (_aecf Paragraph )AddCheckBox (name string )FormField {_gefa :=_aecf .addFldCharsForField (name ,"\u0046\u004f\u0052M\u0043\u0048\u0045\u0043\u004b\u0042\u004f\u0058");_gefa ._dgfaa .CheckBox =_dag .NewCT_FFCheckBox ();return _gefa ;};
|
|
|
|
// Text returns the underlying text in the run.
|
|
func (_bddg Run )Text ()string {if len (_bddg ._ccad .EG_RunInnerContent )==0{return "";};_adccc :=_ag .Buffer {};for _ ,_fbbdg :=range _bddg ._ccad .EG_RunInnerContent {if _fbbdg .T !=nil {_adccc .WriteString (_fbbdg .T .Content );};if _fbbdg .Tab !=nil {_adccc .WriteByte ('\t');};};return _adccc .String ();};
|
|
|
|
// NumId return numbering numId that being use by style properties.
|
|
func (_babe ParagraphStyleProperties )NumId ()int64 {if _babe ._ffgg .NumPr !=nil {if _babe ._ffgg .NumPr .NumId !=nil {return _babe ._ffgg .NumPr .NumId .ValAttr ;};};return -1;};
|
|
|
|
// SetSpacing sets the spacing that comes before and after the paragraph.
|
|
// Deprecated: See Spacing() instead which allows finer control.
|
|
func (_cada ParagraphProperties )SetSpacing (before ,after _dd .Distance ){if _cada ._gfeb .Spacing ==nil {_cada ._gfeb .Spacing =_dag .NewCT_Spacing ();};_cada ._gfeb .Spacing .BeforeAttr =&_ge .ST_TwipsMeasure {};_cada ._gfeb .Spacing .BeforeAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (before /_dd .Twips ));_cada ._gfeb .Spacing .AfterAttr =&_ge .ST_TwipsMeasure {};_cada ._gfeb .Spacing .AfterAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (after /_dd .Twips ));};
|
|
|
|
// Borders allows manipulation of the table borders.
|
|
func (_bccf TableProperties )Borders ()TableBorders {if _bccf ._befe .TblBorders ==nil {_bccf ._befe .TblBorders =_dag .NewCT_TblBorders ();};return TableBorders {_bccf ._befe .TblBorders };};
|
|
|
|
// ParagraphStyles returns only the paragraph styles.
|
|
func (_aafca Styles )ParagraphStyles ()[]Style {_geecc :=[]Style {};for _ ,_defc :=range _aafca ._bdad .Style {if _defc .TypeAttr !=_dag .ST_StyleTypeParagraph {continue ;};_geecc =append (_geecc ,Style {_defc });};return _geecc ;};
|
|
|
|
// SetBottom sets the bottom border to a specified type, color and thickness.
|
|
func (_gbdg ParagraphBorders )SetBottom (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_gbdg ._gfae .Bottom =_dag .NewCT_Border ();_bgcge (_gbdg ._gfae .Bottom ,t ,c ,thickness );};
|
|
|
|
// SetRight sets the cell right margin
|
|
func (_ee CellMargins )SetRight (d _dd .Distance ){_ee ._cc .Right =_dag .NewCT_TblWidth ();_dbdg (_ee ._cc .Right ,d );};
|
|
|
|
// 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{_cd .DocBase ;_ceeb *_dag .Document ;Settings Settings ;Numbering Numbering ;Styles Styles ;_abcg []*_dag .Hdr ;_baf []_cd .Relationships ;_geb []*_dag .Ftr ;_gfef []_cd .Relationships ;_dbce _cd .Relationships ;_gdfa []*_cgb .Theme ;_dfd *_dag .WebSettings ;_dbac *_dag .Fonts ;_acc *_dag .Endnotes ;_dde *_dag .Footnotes ;_add []*_gb .Control ;_fgcg []*chart ;_fgcbc string ;};
|
|
|
|
// Color controls the run or styles color.
|
|
type Color struct{_dcb *_dag .CT_Color };var _ccab =[...]uint8 {0,20,37,58,79};
|
|
|
|
// AddField adds a field (automatically computed text) to the document.
|
|
func (_abbf Run )AddField (code string ){_abbf .AddFieldWithFormatting (code ,"",true )};func _bafe (_efab *Document ,_cefg Paragraph )listItemInfo {if _efab .Numbering .X ()==nil {return listItemInfo {};};if len (_efab .Numbering .Definitions ())< 1{return listItemInfo {};};_ceebe :=_affc (_cefg );if _ceebe ==nil {return listItemInfo {};};_gcad :=_efab .GetNumberingLevelByIds (_ceebe .NumId .ValAttr ,_ceebe .Ilvl .ValAttr );if _fcegd :=_gcad .X ();_fcegd ==nil {return listItemInfo {};};_gefc :=int64 (0);for _ ,_acfe :=range _efab .Numbering ._bagd .Num {if _acfe !=nil &&_acfe .NumIdAttr ==_ceebe .NumId .ValAttr {_gefc =_acfe .AbstractNumId .ValAttr ;};};return listItemInfo {FromParagraph :&_cefg ,AbstractNumId :&_gefc ,NumberingLevel :&_gcad };};func (_ceeeca Paragraph )addStartBookmark (_eebaa int64 ,_edgfb string )*_dag .CT_Bookmark {_bege :=_dag .NewEG_PContent ();_ceeeca ._gbfgc .EG_PContent =append (_ceeeca ._gbfgc .EG_PContent ,_bege );_gggf :=_dag .NewEG_ContentRunContent ();_bceb :=_dag .NewEG_RunLevelElts ();_adcb :=_dag .NewEG_RangeMarkupElements ();_ecgb :=_dag .NewCT_Bookmark ();_ecgb .NameAttr =_edgfb ;_ecgb .IdAttr =_eebaa ;_adcb .BookmarkStart =_ecgb ;_bege .EG_ContentRunContent =append (_bege .EG_ContentRunContent ,_gggf );_gggf .EG_RunLevelElts =append (_gggf .EG_RunLevelElts ,_bceb );_bceb .EG_RangeMarkupElements =append (_bceb .EG_RangeMarkupElements ,_adcb );return _ecgb ;};
|
|
|
|
// TableBorders allows manipulation of borders on a table.
|
|
type TableBorders struct{_dfeff *_dag .CT_TblBorders };
|
|
|
|
// SetFirstLineIndent controls the indentation of the first line in a paragraph.
|
|
func (_bgfde ParagraphProperties )SetFirstLineIndent (m _dd .Distance ){if _bgfde ._gfeb .Ind ==nil {_bgfde ._gfeb .Ind =_dag .NewCT_Ind ();};if m ==_dd .Zero {_bgfde ._gfeb .Ind .FirstLineAttr =nil ;}else {_bgfde ._gfeb .Ind .FirstLineAttr =&_ge .ST_TwipsMeasure {};_bgfde ._gfeb .Ind .FirstLineAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (m /_dd .Twips ));};};
|
|
|
|
// SetWrapPathLineTo sets wrapPath lineTo value.
|
|
func (_abe AnchorDrawWrapOptions )SetWrapPathLineTo (coordinates []*_cgb .CT_Point2D ){_abe ._bf =coordinates ;};
|
|
|
|
// SetRowBandSize sets the number of Rows in the row band
|
|
func (_ffefd TableStyleProperties )SetRowBandSize (rows int64 ){_ffefd ._afeg .TblStyleRowBandSize =_dag .NewCT_DecimalNumber ();_ffefd ._afeg .TblStyleRowBandSize .ValAttr =rows ;};
|
|
|
|
// ReplaceText replace the text inside node.
|
|
func (_ccfac *Node )ReplaceText (oldText ,newText string ){switch _adgc :=_ccfac .X ().(type ){case *Paragraph :for _ ,_eaefc :=range _adgc .Runs (){for _ ,_ecfb :=range _eaefc ._ccad .EG_RunInnerContent {if _ecfb .T !=nil {_faecf :=_ecfb .T .Content ;_faecf =_fgc .ReplaceAll (_faecf ,oldText ,newText );_ecfb .T .Content =_faecf ;};};};};for _ ,_faeb :=range _ccfac .Children {_faeb .ReplaceText (oldText ,newText );};};
|
|
|
|
// SetFooter sets a section footer.
|
|
func (_fgee Section )SetFooter (f Footer ,t _dag .ST_HdrFtr ){_ecgab :=_dag .NewEG_HdrFtrReferences ();_fgee ._gbfbf .EG_HdrFtrReferences =append (_fgee ._gbfbf .EG_HdrFtrReferences ,_ecgab );_ecgab .FooterReference =_dag .NewCT_HdrFtrRef ();_ecgab .FooterReference .TypeAttr =t ;_bbad :=_fgee ._cdgeb ._dbce .FindRIDForN (f .Index (),_g .FooterType );if _bbad ==""{_bc .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");};_ecgab .FooterReference .IdAttr =_bbad ;};
|
|
|
|
// RemoveEndnote removes a endnote from both the paragraph and the document
|
|
// the requested endnote must be anchored on the paragraph being referenced.
|
|
func (_ecaf Paragraph )RemoveEndnote (id int64 ){_ccbd :=_ecaf ._ebddd ._acc ;var _ggeb int ;for _eedcd ,_bbcd :=range _ccbd .CT_Endnotes .Endnote {if _bbcd .IdAttr ==id {_ggeb =_eedcd ;};};_ggeb =0;_ccbd .CT_Endnotes .Endnote [_ggeb ]=nil ;_ccbd .CT_Endnotes .Endnote [_ggeb ]=_ccbd .CT_Endnotes .Endnote [len (_ccbd .CT_Endnotes .Endnote )-1];_ccbd .CT_Endnotes .Endnote =_ccbd .CT_Endnotes .Endnote [:len (_ccbd .CT_Endnotes .Endnote )-1];var _baae Run ;for _ ,_faff :=range _ecaf .Runs (){if _aagc ,_cgdff :=_faff .IsEndnote ();_aagc {if _cgdff ==id {_baae =_faff ;};};};_ecaf .RemoveRun (_baae );};
|
|
|
|
// SetKeepWithNext controls if this paragraph should be kept with the next.
|
|
func (_edda ParagraphProperties )SetKeepWithNext (b bool ){if !b {_edda ._gfeb .KeepNext =nil ;}else {_edda ._gfeb .KeepNext =_dag .NewCT_OnOff ();};};
|
|
|
|
// SearchStylesById returns style by its id.
|
|
func (_cbbd Styles )SearchStyleById (id string )(Style ,bool ){for _ ,_dgbc :=range _cbbd ._bdad .Style {if _dgbc .StyleIdAttr !=nil {if *_dgbc .StyleIdAttr ==id {return Style {_dgbc },true ;};};};return Style {},false ;};
|
|
|
|
// ComplexSizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.
|
|
func (_bccb RunProperties )ComplexSizeMeasure ()string {if _cgdfg :=_bccb ._becb .SzCs ;_cgdfg !=nil {_febd :=_cgdfg .ValAttr ;if _febd .ST_PositiveUniversalMeasure !=nil {return *_febd .ST_PositiveUniversalMeasure ;};};return "";};
|
|
|
|
// RemoveMailMerge removes any mail merge settings
|
|
func (_gdfe Settings )RemoveMailMerge (){_gdfe ._beag .MailMerge =nil };
|
|
|
|
// SetKeepNext controls if the paragraph is kept with the next paragraph.
|
|
func (_bebad ParagraphStyleProperties )SetKeepNext (b bool ){if !b {_bebad ._ffgg .KeepNext =nil ;}else {_bebad ._ffgg .KeepNext =_dag .NewCT_OnOff ();};};
|
|
|
|
// MultiLevelType returns the multilevel type, or ST_MultiLevelTypeUnset if not set.
|
|
func (_ggge NumberingDefinition )MultiLevelType ()_dag .ST_MultiLevelType {if _ggge ._edef .MultiLevelType !=nil {return _ggge ._edef .MultiLevelType .ValAttr ;}else {return _dag .ST_MultiLevelTypeUnset ;};};
|
|
|
|
// AddParagraph adds a paragraph to the footnote.
|
|
func (_afed Footnote )AddParagraph ()Paragraph {_ccdd :=_dag .NewEG_ContentBlockContent ();_bfbe :=len (_afed ._eefc .EG_BlockLevelElts [0].EG_ContentBlockContent );_afed ._eefc .EG_BlockLevelElts [0].EG_ContentBlockContent =append (_afed ._eefc .EG_BlockLevelElts [0].EG_ContentBlockContent ,_ccdd );_bgced :=_dag .NewCT_P ();var _fbee *_dag .CT_String ;if _bfbe !=0{_edebf :=len (_afed ._eefc .EG_BlockLevelElts [0].EG_ContentBlockContent [_bfbe -1].P );_fbee =_afed ._eefc .EG_BlockLevelElts [0].EG_ContentBlockContent [_bfbe -1].P [_edebf -1].PPr .PStyle ;}else {_fbee =_dag .NewCT_String ();_fbee .ValAttr ="\u0046\u006f\u006f\u0074\u006e\u006f\u0074\u0065";};_ccdd .P =append (_ccdd .P ,_bgced );_fdab :=Paragraph {_afed ._cbffe ,_bgced };_fdab ._gbfgc .PPr =_dag .NewCT_PPr ();_fdab ._gbfgc .PPr .PStyle =_fbee ;_fdab ._gbfgc .PPr .RPr =_dag .NewCT_ParaRPr ();return _fdab ;};
|
|
|
|
// RightToLeft returns true if paragraph text goes from right to left.
|
|
func (_gbfgg ParagraphProperties )RightToLeft ()bool {return _dcda (_gbfgg ._gfeb .RPr .Rtl )};
|
|
|
|
// 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 (_cebb *Document )BodySection ()Section {if _cebb ._ceeb .Body .SectPr ==nil {_cebb ._ceeb .Body .SectPr =_dag .NewCT_SectPr ();};return Section {_cebb ,_cebb ._ceeb .Body .SectPr };};
|
|
|
|
// SetName sets the name of the image, visible in the properties of the image
|
|
// within Word.
|
|
func (_bb AnchoredDrawing )SetName (name string ){_bb ._af .DocPr .NameAttr =name ;for _ ,_gd :=range _bb ._af .Graphic .GraphicData .Any {if _ce ,_gf :=_gd .(*_ggb .Pic );_gf {_ce .NvPicPr .CNvPr .DescrAttr =_g .String (name );};};};
|
|
|
|
// Name returns the name of the field.
|
|
func (_gfcc FormField )Name ()string {return *_gfcc ._dgfaa .Name [0].ValAttr };
|
|
|
|
// GetImageByRelID returns an ImageRef with the associated relation ID in the
|
|
// document.
|
|
func (_defb *Document )GetImageByRelID (relID string )(_cd .ImageRef ,bool ){_fbe :=_defb ._dbce .GetTargetByRelId (relID );_dggcg :="";for _ ,_cfbd :=range _defb ._baf {if _dggcg !=""{break ;};_dggcg =_cfbd .GetTargetByRelId (relID );};for _ ,_addg :=range _defb .Images {if _addg .RelID ()==relID {return _addg ,true ;};if _fbe !=""{_bdgg :=_fgc .Replace (_addg .Target (),"\u0077\u006f\u0072d\u002f","",1);if _bdgg ==_fbe {if _addg .RelID ()==""{_addg .SetRelID (relID );};return _addg ,true ;};};if _dggcg !=""{_age :=_fgc .Replace (_addg .Target (),"\u0077\u006f\u0072d\u002f","",1);if _age ==_dggcg {if _addg .RelID ()==""{_addg .SetRelID (relID );};return _addg ,true ;};};};return _cd .ImageRef {},false ;};
|
|
|
|
// SetVAlignment sets the vertical alignment for an anchored image.
|
|
func (_ecad AnchoredDrawing )SetVAlignment (v _dag .WdST_AlignV ){_ecad ._af .PositionV .Choice =&_dag .WdCT_PosVChoice {};_ecad ._af .PositionV .Choice .Align =v ;};
|
|
|
|
// ReplaceTextByRegexp replace the text within node using regexp expression.
|
|
func (_fgec *Node )ReplaceTextByRegexp (rgx *_d .Regexp ,newText string ){switch _dcgeg :=_fgec .X ().(type ){case *Paragraph :for _ ,_cdfac :=range _dcgeg .Runs (){for _ ,_ebfb :=range _cdfac ._ccad .EG_RunInnerContent {if _ebfb .T !=nil {_feeef :=_ebfb .T .Content ;_feeef =rgx .ReplaceAllString (_feeef ,newText );_ebfb .T .Content =_feeef ;};};};};for _ ,_ffcf :=range _fgec .Children {_ffcf .ReplaceTextByRegexp (rgx ,newText );};};
|
|
|
|
// Close closes the document, removing any temporary files that might have been
|
|
// created when opening a document.
|
|
func (_aaaad *Document )Close ()error {if _aaaad .TmpPath !=""{return _bg .RemoveAll (_aaaad .TmpPath );};return nil ;};func _dcfg ()*_ec .Path {_feab :=_ec .NewPath ();_feab .ExtrusionokAttr =_ge .ST_TrueFalseTrue ;_feab .GradientshapeokAttr =_ge .ST_TrueFalseTrue ;_feab .ConnecttypeAttr =_ec .OfcST_ConnectTypeRect ;return _feab ;};
|
|
|
|
// ClearContent clears any content in the run (text, tabs, breaks, etc.)
|
|
func (_gbaga Run )ClearContent (){_gbaga ._ccad .EG_RunInnerContent =nil };
|
|
|
|
// InsertParagraphBefore adds a new empty paragraph before the relativeTo
|
|
// paragraph.
|
|
func (_gfgg *Document )InsertParagraphBefore (relativeTo Paragraph )Paragraph {return _gfgg .insertParagraph (relativeTo ,true );};
|
|
|
|
// 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 (_daabf Run )IsFootnote ()(bool ,int64 ){if _daabf ._ccad .EG_RunInnerContent !=nil {if _daabf ._ccad .EG_RunInnerContent [0].FootnoteReference !=nil {return true ,_daabf ._ccad .EG_RunInnerContent [0].FootnoteReference .IdAttr ;};};return false ,0;};
|
|
|
|
// SetAlignment controls the paragraph alignment
|
|
func (_fcba ParagraphStyleProperties )SetAlignment (align _dag .ST_Jc ){if align ==_dag .ST_JcUnset {_fcba ._ffgg .Jc =nil ;}else {_fcba ._ffgg .Jc =_dag .NewCT_Jc ();_fcba ._ffgg .Jc .ValAttr =align ;};};
|
|
|
|
// InsertRunAfter inserts a run in the paragraph after the relative run.
|
|
func (_eagd Paragraph )InsertRunAfter (relativeTo Run )Run {return _eagd .insertRun (relativeTo ,false )};func _fgdaa (_dcgf []*_dag .EG_ContentBlockContent ,_cadc *TableInfo )[]TextItem {_ddea :=[]TextItem {};for _ ,_ecgc :=range _dcgf {if _gbgb :=_ecgc .Sdt ;_gbgb !=nil {if _eegc :=_gbgb .SdtContent ;_eegc !=nil {_ddea =append (_ddea ,_ffaa (_eegc .P ,_cadc ,nil )...);};};_ddea =append (_ddea ,_ffaa (_ecgc .P ,_cadc ,nil )...);for _ ,_gdac :=range _ecgc .Tbl {for _dceb ,_geec :=range _gdac .EG_ContentRowContent {for _ ,_dffa :=range _geec .Tr {for _feeab ,_ccda :=range _dffa .EG_ContentCellContent {for _ ,_ggdc :=range _ccda .Tc {_ffed :=&TableInfo {Table :_gdac ,Row :_dffa ,Cell :_ggdc ,RowIndex :_dceb ,ColIndex :_feeab };for _ ,_dad :=range _ggdc .EG_BlockLevelElts {_ddea =append (_ddea ,_fgdaa (_dad .EG_ContentBlockContent ,_ffed )...);};};};};};};};return _ddea ;};
|
|
|
|
// Section return paragraph properties section value.
|
|
func (_defbg ParagraphProperties )Section ()(Section ,bool ){if _defbg ._gfeb .SectPr !=nil {return Section {_defbg ._fbcc ,_defbg ._gfeb .SectPr },true ;};return Section {},false ;};
|
|
|
|
// SetAlignment set alignment of paragraph.
|
|
func (_aedaf Paragraph )SetAlignment (alignment _dag .ST_Jc ){_aedaf .ensurePPr ();if _aedaf ._gbfgc .PPr .Jc ==nil {_aedaf ._gbfgc .PPr .Jc =_dag .NewCT_Jc ();};_aedaf ._gbfgc .PPr .Jc .ValAttr =alignment ;};type listItemInfo struct{FromStyle *Style ;FromParagraph *Paragraph ;AbstractNumId *int64 ;NumberingLevel *NumberingLevel ;};func (_fccee Endnote )id ()int64 {return _fccee ._fcfd .IdAttr };
|
|
|
|
// SetStartIndent controls the start indentation.
|
|
func (_cadaf ParagraphProperties )SetStartIndent (m _dd .Distance ){if _cadaf ._gfeb .Ind ==nil {_cadaf ._gfeb .Ind =_dag .NewCT_Ind ();};if m ==_dd .Zero {_cadaf ._gfeb .Ind .StartAttr =nil ;}else {_cadaf ._gfeb .Ind .StartAttr =&_dag .ST_SignedTwipsMeasure {};_cadaf ._gfeb .Ind .StartAttr .Int64 =_g .Int64 (int64 (m /_dd .Twips ));};};
|
|
|
|
// RightToLeft returns true if run text goes from right to left.
|
|
func (_gcfed RunProperties )RightToLeft ()bool {return _dcda (_gcfed ._becb .Rtl )};
|
|
|
|
// SizeValue returns the value of run font size in points.
|
|
func (_egfcb RunProperties )SizeValue ()float64 {if _bedg :=_egfcb ._becb .Sz ;_bedg !=nil {_ccdff :=_bedg .ValAttr ;if _ccdff .ST_UnsignedDecimalNumber !=nil {return float64 (*_ccdff .ST_UnsignedDecimalNumber )/2;};};return 0.0;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_agdbd Numbering )X ()*_dag .Numbering {return _agdbd ._bagd };
|
|
|
|
// SetLastRow controls the conditional formatting for the last row in a table.
|
|
// This is called the 'Total' row within Word.
|
|
func (_dcfee TableLook )SetLastRow (on bool ){if !on {_dcfee ._bfbbe .LastRowAttr =&_ge .ST_OnOff {};_dcfee ._bfbbe .LastRowAttr .ST_OnOff1 =_ge .ST_OnOff1Off ;}else {_dcfee ._bfbbe .LastRowAttr =&_ge .ST_OnOff {};_dcfee ._bfbbe .LastRowAttr .ST_OnOff1 =_ge .ST_OnOff1On ;};};
|
|
|
|
// Node is document element node,
|
|
// contains Paragraph or Table element.
|
|
type Node struct{_efgg *Document ;_dgag interface{};Style Style ;AnchoredDrawings []AnchoredDrawing ;InlineDrawings []InlineDrawing ;Children []Node ;};
|
|
|
|
// Clear content of node element.
|
|
func (_aggg *Node )Clear (){_aggg ._dgag =nil };
|
|
|
|
// SetMultiLevelType sets the multilevel type.
|
|
func (_agce NumberingDefinition )SetMultiLevelType (t _dag .ST_MultiLevelType ){if t ==_dag .ST_MultiLevelTypeUnset {_agce ._edef .MultiLevelType =nil ;}else {_agce ._edef .MultiLevelType =_dag .NewCT_MultiLevelType ();_agce ._edef .MultiLevelType .ValAttr =t ;};};
|
|
|
|
// Tables returns the tables defined in the document.
|
|
func (_ecc *Document )Tables ()[]Table {_begf :=[]Table {};if _ecc ._ceeb .Body ==nil {return nil ;};for _ ,_dae :=range _ecc ._ceeb .Body .EG_BlockLevelElts {for _ ,_adef :=range _dae .EG_ContentBlockContent {for _ ,_ggg :=range _ecc .tables (_adef ){_begf =append (_begf ,_ggg );};};};return _begf ;};func _deggg ()*_ec .OfcLock {_bffbe :=_ec .NewOfcLock ();_bffbe .ExtAttr =_ec .ST_ExtEdit ;_bffbe .TextAttr =_ge .ST_TrueFalseTrue ;_bffbe .ShapetypeAttr =_ge .ST_TrueFalseTrue ;return _bffbe ;};
|
|
|
|
// SetBeforeSpacing sets spacing above paragraph.
|
|
func (_ebcag Paragraph )SetBeforeSpacing (d _dd .Distance ){_ebcag .ensurePPr ();if _ebcag ._gbfgc .PPr .Spacing ==nil {_ebcag ._gbfgc .PPr .Spacing =_dag .NewCT_Spacing ();};_gbag :=_ebcag ._gbfgc .PPr .Spacing ;_gbag .BeforeAttr =&_ge .ST_TwipsMeasure {};_gbag .BeforeAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (d /_dd .Twips ));};
|
|
|
|
// UnderlineColor returns the hex color value of run underline.
|
|
func (_ffeae RunProperties )UnderlineColor ()string {if _ggeca :=_ffeae ._becb .U ;_ggeca !=nil {_gaed :=_ggeca .ColorAttr ;if _gaed !=nil &&_gaed .ST_HexColorRGB !=nil {return *_gaed .ST_HexColorRGB ;};};return "";};
|
|
|
|
// RunProperties returns the RunProperties controlling numbering level font, etc.
|
|
func (_aedf NumberingLevel )RunProperties ()RunProperties {if _aedf ._fbaa .RPr ==nil {_aedf ._fbaa .RPr =_dag .NewCT_RPr ();};return RunProperties {_aedf ._fbaa .RPr };};
|
|
|
|
// TableLook is the conditional formatting associated with a table style that
|
|
// has been assigned to a table.
|
|
type TableLook struct{_bfbbe *_dag .CT_TblLook };
|
|
|
|
// SetStartIndent controls the start indent of the paragraph.
|
|
func (_bebadb ParagraphStyleProperties )SetStartIndent (m _dd .Distance ){if _bebadb ._ffgg .Ind ==nil {_bebadb ._ffgg .Ind =_dag .NewCT_Ind ();};if m ==_dd .Zero {_bebadb ._ffgg .Ind .StartAttr =nil ;}else {_bebadb ._ffgg .Ind .StartAttr =&_dag .ST_SignedTwipsMeasure {};_bebadb ._ffgg .Ind .StartAttr .Int64 =_g .Int64 (int64 (m /_dd .Twips ));};};
|
|
|
|
// SetWidth sets the cell width to a specified width.
|
|
func (_dcf CellProperties )SetWidth (d _dd .Distance ){_dcf ._bce .TcW =_dag .NewCT_TblWidth ();_dcf ._bce .TcW .TypeAttr =_dag .ST_TblWidthDxa ;_dcf ._bce .TcW .WAttr =&_dag .ST_MeasurementOrPercent {};_dcf ._bce .TcW .WAttr .ST_DecimalNumberOrPercent =&_dag .ST_DecimalNumberOrPercent {};_dcf ._bce .TcW .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_g .Int64 (int64 (d /_dd .Twips ));};
|
|
|
|
// Style returns the style for a paragraph, or an empty string if it is unset.
|
|
func (_fabea Paragraph )Style ()string {if _fabea ._gbfgc .PPr !=nil &&_fabea ._gbfgc .PPr .PStyle !=nil {return _fabea ._gbfgc .PPr .PStyle .ValAttr ;};return "";};
|
|
|
|
// Borders allows manipulation of the table borders.
|
|
func (_ggdd TableStyleProperties )Borders ()TableBorders {if _ggdd ._afeg .TblBorders ==nil {_ggdd ._afeg .TblBorders =_dag .NewCT_TblBorders ();};return TableBorders {_ggdd ._afeg .TblBorders };};
|
|
|
|
// 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 (_gaagb TableProperties )SetLayout (l _dag .ST_TblLayoutType ){if l ==_dag .ST_TblLayoutTypeUnset ||l ==_dag .ST_TblLayoutTypeAutofit {_gaagb ._befe .TblLayout =nil ;}else {_gaagb ._befe .TblLayout =_dag .NewCT_TblLayoutType ();_gaagb ._befe .TblLayout .TypeAttr =l ;};};
|
|
|
|
// SetShapeStyle sets style to the element v:shape in watermark.
|
|
func (_edca *WatermarkPicture )SetShapeStyle (shapeStyle _fgcb .ShapeStyle ){if _edca ._cebdc !=nil {_bcfg :=shapeStyle .String ();_edca ._cebdc .StyleAttr =&_bcfg ;};};
|
|
|
|
// NewNumbering constructs a new numbering.
|
|
func NewNumbering ()Numbering {_gaef :=_dag .NewNumbering ();return Numbering {_gaef }};
|
|
|
|
// SetNumberingLevel sets the numbering level of a paragraph. If used, then the
|
|
// NumberingDefinition must also be set via SetNumberingDefinition or
|
|
// SetNumberingDefinitionByID.
|
|
func (_ecdge Paragraph )SetNumberingLevel (listLevel int ){_ecdge .ensurePPr ();if _ecdge ._gbfgc .PPr .NumPr ==nil {_ecdge ._gbfgc .PPr .NumPr =_dag .NewCT_NumPr ();};_aefc :=_dag .NewCT_DecimalNumber ();_aefc .ValAttr =int64 (listLevel );_ecdge ._gbfgc .PPr .NumPr .Ilvl =_aefc ;};
|
|
|
|
// SizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.
|
|
func (_egee ParagraphProperties )SizeMeasure ()string {if _cacf :=_egee ._gfeb .RPr .Sz ;_cacf !=nil {_eeed :=_cacf .ValAttr ;if _eeed .ST_PositiveUniversalMeasure !=nil {return *_eeed .ST_PositiveUniversalMeasure ;};};return "";};
|
|
|
|
// SetWrapPathStart sets wrapPath start value.
|
|
func (_dbg AnchorDrawWrapOptions )SetWrapPathStart (coordinate *_cgb .CT_Point2D ){_dbg ._df =coordinate ;};
|
|
|
|
// Numbering return numbering that being use by paragraph.
|
|
func (_ebdf Paragraph )Numbering ()Numbering {_ebdf .ensurePPr ();_dgfgb :=NewNumbering ();if _ebdf ._gbfgc .PPr .NumPr !=nil {_feed :=int64 (-1);_fdeed :=int64 (-1);if _ebdf ._gbfgc .PPr .NumPr .NumId !=nil {_feed =_ebdf ._gbfgc .PPr .NumPr .NumId .ValAttr ;};for _ ,_ecfe :=range _ebdf ._ebddd .Numbering ._bagd .Num {if _feed < 0{break ;};if _ecfe .NumIdAttr ==_feed {if _ecfe .AbstractNumId !=nil {_fdeed =_ecfe .AbstractNumId .ValAttr ;_dgfgb ._bagd .Num =append (_dgfgb ._bagd .Num ,_ecfe );break ;};};};for _ ,_gdafa :=range _ebdf ._ebddd .Numbering ._bagd .AbstractNum {if _fdeed < 0{break ;};if _gdafa .AbstractNumIdAttr ==_fdeed {_dgfgb ._bagd .AbstractNum =append (_dgfgb ._bagd .AbstractNum ,_gdafa );break ;};};};return _dgfgb ;};
|
|
|
|
// SetEastAsiaTheme sets the font East Asia Theme.
|
|
func (_cgge Fonts )SetEastAsiaTheme (t _dag .ST_Theme ){_cgge ._gacg .EastAsiaThemeAttr =t };type mergeFieldInfo struct{_afac string ;_fbac string ;_bgcd string ;_fbdg bool ;_ffab bool ;_ggag bool ;_acded bool ;_cddd Paragraph ;_efabc ,_bfbf ,_fbfe int ;_gedd *_dag .EG_PContent ;_gacee bool ;};func (_abdag Paragraph )ensurePPr (){if _abdag ._gbfgc .PPr ==nil {_abdag ._gbfgc .PPr =_dag .NewCT_PPr ();};};
|
|
|
|
// SetThemeShade sets the shade based off the theme color.
|
|
func (_gcg Color )SetThemeShade (s uint8 ){_be :=_ga .Sprintf ("\u0025\u0030\u0032\u0078",s );_gcg ._dcb .ThemeShadeAttr =&_be ;};
|
|
|
|
// SetToolTip sets the tooltip text for a hyperlink.
|
|
func (_debf HyperLink )SetToolTip (text string ){if text ==""{_debf ._abfc .TooltipAttr =nil ;}else {_debf ._abfc .TooltipAttr =_g .String (text );};};
|
|
|
|
// SetFontFamily sets the Ascii & HAnsi fonly family for a run.
|
|
func (_fabd RunProperties )SetFontFamily (family string ){if _fabd ._becb .RFonts ==nil {_fabd ._becb .RFonts =_dag .NewCT_Fonts ();};_fabd ._becb .RFonts .AsciiAttr =_g .String (family );_fabd ._becb .RFonts .HAnsiAttr =_g .String (family );_fabd ._becb .RFonts .EastAsiaAttr =_g .String (family );};func _bfdee (_bcg *_dag .CT_P ,_efdb ,_cfdfb map[int64 ]int64 ){for _ ,_gbgd :=range _bcg .EG_PContent {for _ ,_aad :=range _gbgd .EG_ContentRunContent {if _aad .R !=nil {for _ ,_gdec :=range _aad .R .EG_RunInnerContent {_ada :=_gdec .EndnoteReference ;if _ada !=nil &&_ada .IdAttr > 0{if _ggcg ,_ffgc :=_cfdfb [_ada .IdAttr ];_ffgc {_ada .IdAttr =_ggcg ;};};_dgff :=_gdec .FootnoteReference ;if _dgff !=nil &&_dgff .IdAttr > 0{if _gggga ,_cefb :=_efdb [_dgff .IdAttr ];_cefb {_dgff .IdAttr =_gggga ;};};};};};};};
|
|
|
|
// 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 ){_edbaa ,_ccae :=Open (filename );if _ccae !=nil {return nil ,_ccae ;};_edbaa ._ceeb .Body =_dag .NewCT_Body ();return _edbaa ,nil ;};
|
|
|
|
// SetBold sets the run to bold.
|
|
func (_ffbe RunProperties )SetBold (b bool ){if !b {_ffbe ._becb .B =nil ;_ffbe ._becb .BCs =nil ;}else {_ffbe ._becb .B =_dag .NewCT_OnOff ();_ffbe ._becb .BCs =_dag .NewCT_OnOff ();};};func (_ebcgc *Document )putNode (_ggfeb ,_beae Node ,_dddf bool )bool {_ebcgc .insertImageFromNode (_beae );_ebcgc .insertStyleFromNode (_beae );switch _gbda :=_beae ._dgag .(type ){case *Paragraph :if _cccf ,_ggacd :=_ggfeb .X ().(*Paragraph );_ggacd {_ebcgc .appendParagraph (_cccf ,*_gbda ,_dddf );return true ;}else {for _ ,_gbbc :=range _ggfeb .Children {if _dfcf :=_ebcgc .putNode (_gbbc ,_beae ,_dddf );_dfcf {break ;};};};case *Table :if _dcag ,_ebag :=_ggfeb .X ().(*Paragraph );_ebag {_bgcfc :=_ebcgc .appendTable (_dcag ,*_gbda ,_dddf );_bgcfc ._acbcf =_gbda ._acbcf ;return true ;}else {for _ ,_cegg :=range _ggfeb .Children {if _cgbeb :=_ebcgc .putNode (_cegg ,_beae ,_dddf );_cgbeb {break ;};};};};return false ;};
|
|
|
|
// ReplaceTextByRegexp replace text inside node using regexp.
|
|
func (_efgad *Nodes )ReplaceTextByRegexp (expr *_d .Regexp ,newText string ){for _ ,_cffd :=range _efgad ._cace {_cffd .ReplaceTextByRegexp (expr ,newText );};};
|
|
|
|
// 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 (_cbge Document )SetStrict (strict bool ){if strict {_cbge ._ceeb .ConformanceAttr =_ge .ST_ConformanceClassStrict ;}else {_cbge ._ceeb .ConformanceAttr =_ge .ST_ConformanceClassTransitional ;};};
|
|
|
|
// NewTableWidth returns a newly intialized TableWidth
|
|
func NewTableWidth ()TableWidth {return TableWidth {_dag .NewCT_TblWidth ()}};
|
|
|
|
// StructuredDocumentTags returns the structured document tags in the document
|
|
// which are commonly used in document templates.
|
|
func (_cegb *Document )StructuredDocumentTags ()[]StructuredDocumentTag {_dagac :=[]StructuredDocumentTag {};for _ ,_dfgb :=range _cegb ._ceeb .Body .EG_BlockLevelElts {for _ ,_eaa :=range _dfgb .EG_ContentBlockContent {if _eaa .Sdt !=nil {_dagac =append (_dagac ,StructuredDocumentTag {_cegb ,_eaa .Sdt });};};};return _dagac ;};func _bgff ()*_ec .Textpath {_dfabf :=_ec .NewTextpath ();_feggd :="\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";_dfabf .StyleAttr =&_feggd ;_bafc :="\u0041\u0053\u0041\u0050";_dfabf .StringAttr =&_bafc ;return _dfabf ;};
|
|
|
|
// SetVerticalAlignment controls the vertical alignment of the run, this is used
|
|
// to control if text is superscript/subscript.
|
|
func (_bfgg RunProperties )SetVerticalAlignment (v _ge .ST_VerticalAlignRun ){if v ==_ge .ST_VerticalAlignRunUnset {_bfgg ._becb .VertAlign =nil ;}else {_bfgg ._becb .VertAlign =_dag .NewCT_VerticalAlignRun ();_bfgg ._becb .VertAlign .ValAttr =v ;};};
|
|
|
|
// AnchorDrawWrapOptions is options to set
|
|
// wrapPolygon for wrap text through and tight.
|
|
type AnchorDrawWrapOptions struct{_ded bool ;_df *_cgb .CT_Point2D ;_bf []*_cgb .CT_Point2D ;};
|
|
|
|
// SetLineSpacing sets the spacing between lines in a paragraph.
|
|
func (_ggcef Paragraph )SetLineSpacing (d _dd .Distance ,rule _dag .ST_LineSpacingRule ){_ggcef .ensurePPr ();if _ggcef ._gbfgc .PPr .Spacing ==nil {_ggcef ._gbfgc .PPr .Spacing =_dag .NewCT_Spacing ();};_cecfb :=_ggcef ._gbfgc .PPr .Spacing ;if rule ==_dag .ST_LineSpacingRuleUnset {_cecfb .LineRuleAttr =_dag .ST_LineSpacingRuleUnset ;_cecfb .LineAttr =nil ;}else {_cecfb .LineRuleAttr =rule ;_cecfb .LineAttr =&_dag .ST_SignedTwipsMeasure {};_cecfb .LineAttr .Int64 =_g .Int64 (int64 (d /_dd .Twips ));};};
|
|
|
|
// SetVerticalBanding controls the conditional formatting for vertical banding.
|
|
func (_dfegg TableLook )SetVerticalBanding (on bool ){if !on {_dfegg ._bfbbe .NoVBandAttr =&_ge .ST_OnOff {};_dfegg ._bfbbe .NoVBandAttr .ST_OnOff1 =_ge .ST_OnOff1On ;}else {_dfegg ._bfbbe .NoVBandAttr =&_ge .ST_OnOff {};_dfegg ._bfbbe .NoVBandAttr .ST_OnOff1 =_ge .ST_OnOff1Off ;};};func (_bdedg *WatermarkPicture )findNode (_bbfgd *_g .XSDAny ,_dbeg string )*_g .XSDAny {for _ ,_fedgf :=range _bbfgd .Nodes {if _fedgf .XMLName .Local ==_dbeg {return _fedgf ;};};return nil ;};
|
|
|
|
// AddParagraph adds a paragraph to the footer.
|
|
func (_gced Footer )AddParagraph ()Paragraph {_decc :=_dag .NewEG_ContentBlockContent ();_gced ._gbdc .EG_ContentBlockContent =append (_gced ._gbdc .EG_ContentBlockContent ,_decc );_afcf :=_dag .NewCT_P ();_decc .P =append (_decc .P ,_afcf );return Paragraph {_gced ._cdfa ,_afcf };};
|
|
|
|
// Headers returns the headers defined in the document.
|
|
func (_cfe *Document )Headers ()[]Header {_dfe :=[]Header {};for _ ,_gcc :=range _cfe ._abcg {_dfe =append (_dfe ,Header {_cfe ,_gcc });};return _dfe ;};
|
|
|
|
// Underline returns the type of paragraph underline.
|
|
func (_cbgc ParagraphProperties )Underline ()_dag .ST_Underline {if _dffdb :=_cbgc ._gfeb .RPr .U ;_dffdb !=nil {return _dffdb .ValAttr ;};return 0;};
|
|
|
|
// SetWindowControl controls if the first or last line of the paragraph is
|
|
// allowed to display on a separate page.
|
|
func (_ededa ParagraphProperties )SetWindowControl (b bool ){if !b {_ededa ._gfeb .WidowControl =nil ;}else {_ededa ._gfeb .WidowControl =_dag .NewCT_OnOff ();};};
|
|
|
|
// SetAlignment positions an anchored image via alignment. Offset is
|
|
// incompatible with SetOffset, whichever is called last is applied.
|
|
func (_ba AnchoredDrawing )SetAlignment (h _dag .WdST_AlignH ,v _dag .WdST_AlignV ){_ba .SetHAlignment (h );_ba .SetVAlignment (v );};func _affc (_cgga Paragraph )*_dag .CT_NumPr {_cgga .ensurePPr ();if _cgga ._gbfgc .PPr .NumPr ==nil {return nil ;};return _cgga ._gbfgc .PPr .NumPr ;};
|
|
|
|
// GetFooter gets a section Footer for given type
|
|
func (_fgbd Section )GetFooter (t _dag .ST_HdrFtr )(Footer ,bool ){for _ ,_ceffa :=range _fgbd ._gbfbf .EG_HdrFtrReferences {if _ceffa .FooterReference .TypeAttr ==t {for _ ,_agda :=range _fgbd ._cdgeb .Footers (){_cdgdc :=_fgbd ._cdgeb ._dbce .FindRIDForN (_agda .Index (),_g .FooterType );if _cdgdc ==_ceffa .FooterReference .IdAttr {return _agda ,true ;};};};};return Footer {},false ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_abfd TableProperties )X ()*_dag .CT_TblPr {return _abfd ._befe };
|
|
|
|
// Tables returns the tables defined in the footer.
|
|
func (_fcea Footer )Tables ()[]Table {_ffgbc :=[]Table {};if _fcea ._gbdc ==nil {return nil ;};for _ ,_gefe :=range _fcea ._gbdc .EG_ContentBlockContent {for _ ,_fggb :=range _fcea ._cdfa .tables (_gefe ){_ffgbc =append (_ffgbc ,_fggb );};};return _ffgbc ;};
|
|
|
|
// SetHorizontalBanding controls the conditional formatting for horizontal banding.
|
|
func (_egeae TableLook )SetHorizontalBanding (on bool ){if !on {_egeae ._bfbbe .NoHBandAttr =&_ge .ST_OnOff {};_egeae ._bfbbe .NoHBandAttr .ST_OnOff1 =_ge .ST_OnOff1On ;}else {_egeae ._bfbbe .NoHBandAttr =&_ge .ST_OnOff {};_egeae ._bfbbe .NoHBandAttr .ST_OnOff1 =_ge .ST_OnOff1Off ;};};
|
|
|
|
// Runs returns all of the runs in a paragraph.
|
|
func (_ceca Paragraph )Runs ()[]Run {_bbec :=[]Run {};for _ ,_dfgbg :=range _ceca ._gbfgc .EG_PContent {if _dfgbg .Hyperlink !=nil &&_dfgbg .Hyperlink .EG_ContentRunContent !=nil {for _ ,_edgea :=range _dfgbg .Hyperlink .EG_ContentRunContent {if _edgea .R !=nil {_bbec =append (_bbec ,Run {_ceca ._ebddd ,_edgea .R });};};};for _ ,_agfb :=range _dfgbg .EG_ContentRunContent {if _agfb .R !=nil {_bbec =append (_bbec ,Run {_ceca ._ebddd ,_agfb .R });};if _agfb .Sdt !=nil &&_agfb .Sdt .SdtContent !=nil {for _ ,_gfca :=range _agfb .Sdt .SdtContent .EG_ContentRunContent {if _gfca .R !=nil {_bbec =append (_bbec ,Run {_ceca ._ebddd ,_gfca .R });};};};};};return _bbec ;};
|
|
|
|
// X return element of Node as interface, can be either *Paragraph, *Table and Run.
|
|
func (_edecd *Node )X ()interface{}{return _edecd ._dgag };
|
|
|
|
// SetNumberingDefinition sets the numbering definition ID via a NumberingDefinition
|
|
// defined in numbering.xml
|
|
func (_bdeaf Paragraph )SetNumberingDefinition (nd NumberingDefinition ){_bdeaf .ensurePPr ();if _bdeaf ._gbfgc .PPr .NumPr ==nil {_bdeaf ._gbfgc .PPr .NumPr =_dag .NewCT_NumPr ();};_degba :=_dag .NewCT_DecimalNumber ();_ceff :=int64 (-1);for _ ,_fcdd :=range _bdeaf ._ebddd .Numbering ._bagd .Num {if _fcdd .AbstractNumId !=nil &&_fcdd .AbstractNumId .ValAttr ==nd .AbstractNumberID (){_ceff =_fcdd .NumIdAttr ;};};if _ceff ==-1{_cddb :=_dag .NewCT_Num ();_bdeaf ._ebddd .Numbering ._bagd .Num =append (_bdeaf ._ebddd .Numbering ._bagd .Num ,_cddb );_cddb .NumIdAttr =int64 (len (_bdeaf ._ebddd .Numbering ._bagd .Num ));_cddb .AbstractNumId =_dag .NewCT_DecimalNumber ();_cddb .AbstractNumId .ValAttr =nd .AbstractNumberID ();};_degba .ValAttr =_ceff ;_bdeaf ._gbfgc .PPr .NumPr .NumId =_degba ;};
|
|
|
|
// SetNumberingDefinitionByID sets the numbering definition ID directly, which must
|
|
// match an ID defined in numbering.xml
|
|
func (_cdgc Paragraph )SetNumberingDefinitionByID (abstractNumberID int64 ){_cdgc .ensurePPr ();if _cdgc ._gbfgc .PPr .NumPr ==nil {_cdgc ._gbfgc .PPr .NumPr =_dag .NewCT_NumPr ();};_gccgee :=_dag .NewCT_DecimalNumber ();_gccgee .ValAttr =int64 (abstractNumberID );_cdgc ._gbfgc .PPr .NumPr .NumId =_gccgee ;};
|
|
|
|
// InitializeDefault constructs a default numbering.
|
|
func (_aega Numbering )InitializeDefault (){_ccff :=_dag .NewCT_AbstractNum ();_ccff .MultiLevelType =_dag .NewCT_MultiLevelType ();_ccff .MultiLevelType .ValAttr =_dag .ST_MultiLevelTypeHybridMultilevel ;_aega ._bagd .AbstractNum =append (_aega ._bagd .AbstractNum ,_ccff );_ccff .AbstractNumIdAttr =1;const _eedf =720;const _afge =720;const _ccdf =360;for _fgfcc :=0;_fgfcc < 9;_fgfcc ++{_fbgaa :=_dag .NewCT_Lvl ();_fbgaa .IlvlAttr =int64 (_fgfcc );_fbgaa .Start =_dag .NewCT_DecimalNumber ();_fbgaa .Start .ValAttr =1;_fbgaa .NumFmt =_dag .NewCT_NumFmt ();_fbgaa .NumFmt .ValAttr =_dag .ST_NumberFormatBullet ;_fbgaa .Suff =_dag .NewCT_LevelSuffix ();_fbgaa .Suff .ValAttr =_dag .ST_LevelSuffixNothing ;_fbgaa .LvlText =_dag .NewCT_LevelText ();_fbgaa .LvlText .ValAttr =_g .String ("\uf0b7");_fbgaa .LvlJc =_dag .NewCT_Jc ();_fbgaa .LvlJc .ValAttr =_dag .ST_JcLeft ;_fbgaa .RPr =_dag .NewCT_RPr ();_fbgaa .RPr .RFonts =_dag .NewCT_Fonts ();_fbgaa .RPr .RFonts .AsciiAttr =_g .String ("\u0053\u0079\u006d\u0062\u006f\u006c");_fbgaa .RPr .RFonts .HAnsiAttr =_g .String ("\u0053\u0079\u006d\u0062\u006f\u006c");_fbgaa .RPr .RFonts .HintAttr =_dag .ST_HintDefault ;_fbgaa .PPr =_dag .NewCT_PPrGeneral ();_cfdb :=int64 (_fgfcc *_afge +_eedf );_fbgaa .PPr .Ind =_dag .NewCT_Ind ();_fbgaa .PPr .Ind .LeftAttr =&_dag .ST_SignedTwipsMeasure {};_fbgaa .PPr .Ind .LeftAttr .Int64 =_g .Int64 (_cfdb );_fbgaa .PPr .Ind .HangingAttr =&_ge .ST_TwipsMeasure {};_fbgaa .PPr .Ind .HangingAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (_ccdf ));_ccff .Lvl =append (_ccff .Lvl ,_fbgaa );};_bbcg :=_dag .NewCT_Num ();_bbcg .NumIdAttr =1;_bbcg .AbstractNumId =_dag .NewCT_DecimalNumber ();_bbcg .AbstractNumId .ValAttr =1;_aega ._bagd .Num =append (_aega ._bagd .Num ,_bbcg );};
|
|
|
|
// FindNodeByText return node based on matched text and return a slice of node.
|
|
func (_ccaa *Nodes )FindNodeByText (text string )[]Node {_befd :=[]Node {};for _ ,_cgfg :=range _ccaa ._cace {if _fgc .TrimSpace (_cgfg .Text ())==text {_befd =append (_befd ,_cgfg );};_fedg :=Nodes {_cace :_cgfg .Children };_befd =append (_befd ,_fedg .FindNodeByText (text )...);};return _befd ;};
|
|
|
|
// Run is a run of text within a paragraph that shares the same formatting.
|
|
type Run struct{_gcba *Document ;_ccad *_dag .CT_R ;};type chart struct{_gfea *_cg .ChartSpace ;_abg string ;_fee string ;};
|
|
|
|
// SetStrikeThrough sets the run to strike-through.
|
|
func (_baag RunProperties )SetStrikeThrough (b bool ){if !b {_baag ._becb .Strike =nil ;}else {_baag ._becb .Strike =_dag .NewCT_OnOff ();};};
|
|
|
|
// GetShapeStyle returns string style of the shape in watermark and format it to ShapeStyle.
|
|
func (_agaad *WatermarkPicture )GetShapeStyle ()_fgcb .ShapeStyle {if _agaad ._cebdc !=nil &&_agaad ._cebdc .StyleAttr !=nil {return _fgcb .NewShapeStyle (*_agaad ._cebdc .StyleAttr );};return _fgcb .NewShapeStyle ("");};func _cadd (_fcd _da .ReaderAt ,_gecg int64 ,_cfa string )(*Document ,error ){const _bbab ="\u0064\u006f\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0052\u0065\u0061\u0064";if !_dc .GetLicenseKey ().IsLicensed ()&&!_ebe {_ga .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");_ga .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 ,_de .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");};_bagc :=New ();_bagc .Numbering ._bagd =nil ;if len (_cfa )> 0{_bagc ._fgcbc =_cfa ;}else {_gbaa ,_ebec :=_dc .GenRefId ("\u0064\u0072");if _ebec !=nil {_bc .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_ebec );return nil ,_ebec ;};_bagc ._fgcbc =_gbaa ;};if _cdb :=_dc .Track (_bagc ._fgcbc ,_bbab );_cdb !=nil {_bc .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_cdb );return nil ,_cdb ;};_eced ,_gbff :=_bg .TempDir ("\u0075\u006e\u0069\u006f\u0066\u0066\u0069\u0063\u0065-\u0064\u006f\u0063\u0078");if _gbff !=nil {return nil ,_gbff ;};_bagc .TmpPath =_eced ;_bbbg ,_gbff :=_dbd .NewReader (_fcd ,_gecg );if _gbff !=nil {return nil ,_ga .Errorf ("\u0070a\u0072s\u0069\u006e\u0067\u0020\u007a\u0069\u0070\u003a\u0020\u0025\u0073",_gbff );};_efd :=[]*_dbd .File {};_efd =append (_efd ,_bbbg .File ...);_cae :=false ;for _ ,_geac :=range _efd {if _geac .FileHeader .Name =="\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c"{_cae =true ;break ;};};if _cae {_bagc .CreateCustomProperties ();};_cbab :=_bagc ._ceeb .ConformanceAttr ;_dcbd :=_b .DecodeMap {};_dcbd .SetOnNewRelationshipFunc (_bagc .onNewRelationship );_dcbd .AddTarget (_g .ContentTypesFilename ,_bagc .ContentTypes .X (),"",0);_dcbd .AddTarget (_g .BaseRelsFilename ,_bagc .Rels .X (),"",0);if _cbdb :=_dcbd .Decode (_efd );_cbdb !=nil {return nil ,_cbdb ;};_bagc ._ceeb .ConformanceAttr =_cbab ;for _ ,_abdd :=range _efd {if _abdd ==nil {continue ;};if _cffc :=_bagc .AddExtraFileFromZip (_abdd );_cffc !=nil {return nil ,_cffc ;};};if _cae {_gbba :=false ;for _ ,_caeb :=range _bagc .Rels .X ().Relationship {if _caeb .TargetAttr =="\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c"{_gbba =true ;break ;};};if !_gbba {_bagc .AddCustomRelationships ();};};return _bagc ,nil ;};func _ffcd (_cggaa *Document ,_aaffg []*_dag .CT_P ,_cfea *TableInfo ,_abaf *DrawingInfo )[]Node {_ebee :=[]Node {};for _ ,_abgb :=range _aaffg {_eafae :=Paragraph {_cggaa ,_abgb };_dfac :=Node {_efgg :_cggaa ,_dgag :&_eafae };if _befdf ,_cabee :=_cggaa .Styles .SearchStyleById (_eafae .Style ());_cabee {_dfac .Style =_befdf ;};for _ ,_gfbgb :=range _eafae .Runs (){_dfac .Children =append (_dfac .Children ,Node {_efgg :_cggaa ,_dgag :_gfbgb ,AnchoredDrawings :_gfbgb .DrawingAnchored (),InlineDrawings :_gfbgb .DrawingInline ()});};_ebee =append (_ebee ,_dfac );};return _ebee ;};
|
|
|
|
// GetRightToLeft returns true if the run text is displayed from right to left.
|
|
func (_gefeb RunProperties )GetRightToLeft ()bool {return _dcda (_gefeb ._becb .Rtl )};
|
|
|
|
// AddTabStop adds a tab stop to the paragraph.
|
|
func (_bcgef ParagraphStyleProperties )AddTabStop (position _dd .Distance ,justificaton _dag .ST_TabJc ,leader _dag .ST_TabTlc ){if _bcgef ._ffgg .Tabs ==nil {_bcgef ._ffgg .Tabs =_dag .NewCT_Tabs ();};_aabf :=_dag .NewCT_TabStop ();_aabf .LeaderAttr =leader ;_aabf .ValAttr =justificaton ;_aabf .PosAttr .Int64 =_g .Int64 (int64 (position /_dd .Twips ));_bcgef ._ffgg .Tabs .Tab =append (_bcgef ._ffgg .Tabs .Tab ,_aabf );};
|
|
|
|
// AddHyperLink adds a new hyperlink to a parapgraph.
|
|
func (_fabg Paragraph )AddHyperLink ()HyperLink {_cece :=_dag .NewEG_PContent ();_fabg ._gbfgc .EG_PContent =append (_fabg ._gbfgc .EG_PContent ,_cece );_cece .Hyperlink =_dag .NewCT_Hyperlink ();return HyperLink {_fabg ._ebddd ,_cece .Hyperlink };};
|
|
|
|
// SetColumnSpan sets the number of Grid Columns Spanned by the Cell. This is used
|
|
// to give the appearance of merged cells.
|
|
func (_bab CellProperties )SetColumnSpan (cols int ){if cols ==0{_bab ._bce .GridSpan =nil ;}else {_bab ._bce .GridSpan =_dag .NewCT_DecimalNumber ();_bab ._bce .GridSpan .ValAttr =int64 (cols );};};
|
|
|
|
// SetSmallCaps sets the run to small caps.
|
|
func (_ggaa RunProperties )SetSmallCaps (b bool ){if !b {_ggaa ._becb .SmallCaps =nil ;}else {_ggaa ._becb .SmallCaps =_dag .NewCT_OnOff ();};};
|
|
|
|
// SetFollowImageShape sets wrapPath to follow image shape,
|
|
// if nil return wrapPath that follow image size.
|
|
func (_gc AnchorDrawWrapOptions )SetFollowImageShape (val bool ){_gc ._ded =val ;if !val {_gde ,_ff :=_dbc ();_gc ._df =_gde ;_gc ._bf =_ff ;};};
|
|
|
|
// SetAfterAuto controls if spacing after a paragraph is automatically determined.
|
|
func (_bcf ParagraphSpacing )SetAfterAuto (b bool ){if b {_bcf ._bced .AfterAutospacingAttr =&_ge .ST_OnOff {};_bcf ._bced .AfterAutospacingAttr .Bool =_g .Bool (true );}else {_bcf ._bced .AfterAutospacingAttr =nil ;};};
|
|
|
|
// SetName sets the name of the style.
|
|
func (_ddfed Style )SetName (name string ){_ddfed ._ffabb .Name =_dag .NewCT_String ();_ddfed ._ffabb .Name .ValAttr =name ;};
|
|
|
|
// GetStyle returns string style of the text in watermark and format it to TextpathStyle.
|
|
func (_bbgg *WatermarkText )GetStyle ()_fgcb .TextpathStyle {_bacf :=_bbgg .getShape ();if _bbgg ._efac !=nil {_cbfcb :=_bbgg ._efac .EG_ShapeElements ;if len (_cbfcb )> 0&&_cbfcb [0].Textpath !=nil {return _fgcb .NewTextpathStyle (*_cbfcb [0].Textpath .StyleAttr );};}else {_ebfba :=_bbgg .findNode (_bacf ,"\u0074\u0065\u0078\u0074\u0070\u0061\u0074\u0068");for _ ,_aedgd :=range _ebfba .Attrs {if _aedgd .Name .Local =="\u0073\u0074\u0079l\u0065"{return _fgcb .NewTextpathStyle (_aedgd .Value );};};};return _fgcb .NewTextpathStyle ("");};
|
|
|
|
// Footer is a footer for a document section.
|
|
type Footer struct{_cdfa *Document ;_gbdc *_dag .Ftr ;};
|
|
|
|
// SetCantSplit set row properties for Can't Split value.
|
|
func (_gdfb RowProperties )SetCantSplit (val bool ){if !val {_gdfb ._dbaab .CantSplit =nil ;}else {_ddae :=_dag .NewCT_OnOff ();_gdfb ._dbaab .CantSplit =[]*_dag .CT_OnOff {_ddae };};};
|
|
|
|
// SetAll sets all of the borders to a given value.
|
|
func (_aggbb ParagraphBorders )SetAll (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_aggbb .SetBottom (t ,c ,thickness );_aggbb .SetLeft (t ,c ,thickness );_aggbb .SetRight (t ,c ,thickness );_aggbb .SetTop (t ,c ,thickness );};
|
|
|
|
// SetInsideVertical sets the interior vertical borders to a specified type, color and thickness.
|
|
func (_ffec TableBorders )SetInsideVertical (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_ffec ._dfeff .InsideV =_dag .NewCT_Border ();_fbgeg (_ffec ._dfeff .InsideV ,t ,c ,thickness );};
|
|
|
|
// SetAlignment sets the paragraph alignment
|
|
func (_begg NumberingLevel )SetAlignment (j _dag .ST_Jc ){if j ==_dag .ST_JcUnset {_begg ._fbaa .LvlJc =nil ;}else {_begg ._fbaa .LvlJc =_dag .NewCT_Jc ();_begg ._fbaa .LvlJc .ValAttr =j ;};};
|
|
|
|
// GetImage returns the ImageRef associated with an AnchoredDrawing.
|
|
func (_bgf AnchoredDrawing )GetImage ()(_cd .ImageRef ,bool ){_ggd :=_bgf ._af .Graphic .GraphicData .Any ;if len (_ggd )> 0{_cf ,_ddf :=_ggd [0].(*_ggb .Pic );if _ddf {if _cf .BlipFill !=nil &&_cf .BlipFill .Blip !=nil &&_cf .BlipFill .Blip .EmbedAttr !=nil {return _bgf ._fc .GetImageByRelID (*_cf .BlipFill .Blip .EmbedAttr );};};};return _cd .ImageRef {},false ;};
|
|
|
|
// AddHeader creates a header associated with the document, but doesn't add it
|
|
// to the document for display.
|
|
func (_dfgd *Document )AddHeader ()Header {_abgc :=_dag .NewHdr ();_dfgd ._abcg =append (_dfgd ._abcg ,_abgc );_bde :=_ga .Sprintf ("\u0068\u0065\u0061d\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c",len (_dfgd ._abcg ));_dfgd ._dbce .AddRelationship (_bde ,_g .HeaderType );_dfgd .ContentTypes .AddOverride ("\u002f\u0077\u006f\u0072\u0064\u002f"+_bde ,"\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");_dfgd ._baf =append (_dfgd ._baf ,_cd .NewRelationships ());return Header {_dfgd ,_abgc };};
|
|
|
|
// IsChecked returns true if a FormFieldTypeCheckBox is checked.
|
|
func (_efbee FormField )IsChecked ()bool {if _efbee ._dgfaa .CheckBox ==nil {return false ;};if _efbee ._dgfaa .CheckBox .Checked !=nil {return true ;};return false ;};
|
|
|
|
// Paragraphs returns the paragraphs defined in a header.
|
|
func (_cbfc Header )Paragraphs ()[]Paragraph {_defdf :=[]Paragraph {};for _ ,_ggfd :=range _cbfc ._ddaf .EG_ContentBlockContent {for _ ,_gabe :=range _ggfd .P {_defdf =append (_defdf ,Paragraph {_cbfc ._gcaa ,_gabe });};};for _ ,_ddgce :=range _cbfc .Tables (){for _ ,_ffdde :=range _ddgce .Rows (){for _ ,_dbgg :=range _ffdde .Cells (){_defdf =append (_defdf ,_dbgg .Paragraphs ()...);};};};return _defdf ;};func (_gab *Document )onNewRelationship (_deaf *_b .DecodeMap ,_ffbd ,_fdcf string ,_gbac []*_dbd .File ,_fgca *_bgc .Relationship ,_dbef _b .Target )error {_aggba :=_g .DocTypeDocument ;switch _fdcf {case _g .OfficeDocumentType ,_g .OfficeDocumentTypeStrict :_gab ._ceeb =_dag .NewDocument ();_deaf .AddTarget (_ffbd ,_gab ._ceeb ,_fdcf ,0);_deaf .AddTarget (_b .RelationsPathFor (_ffbd ),_gab ._dbce .X (),_fdcf ,0);_fgca .TargetAttr =_g .RelativeFilename (_aggba ,_dbef .Typ ,_fdcf ,0);case _g .CorePropertiesType :_deaf .AddTarget (_ffbd ,_gab .CoreProperties .X (),_fdcf ,0);_fgca .TargetAttr =_g .RelativeFilename (_aggba ,_dbef .Typ ,_fdcf ,0);case _g .CustomPropertiesType :_deaf .AddTarget (_ffbd ,_gab .CustomProperties .X (),_fdcf ,0);_fgca .TargetAttr =_g .RelativeFilename (_aggba ,_dbef .Typ ,_fdcf ,0);case _g .ExtendedPropertiesType ,_g .ExtendedPropertiesTypeStrict :_deaf .AddTarget (_ffbd ,_gab .AppProperties .X (),_fdcf ,0);_fgca .TargetAttr =_g .RelativeFilename (_aggba ,_dbef .Typ ,_fdcf ,0);case _g .ThumbnailType ,_g .ThumbnailTypeStrict :for _dcgc ,_agfc :=range _gbac {if _agfc ==nil {continue ;};if _agfc .Name ==_ffbd {_fcaf ,_fbgg :=_agfc .Open ();if _fbgg !=nil {return _ga .Errorf ("e\u0072\u0072\u006f\u0072\u0020\u0072e\u0061\u0064\u0069\u006e\u0067\u0020\u0074\u0068\u0075m\u0062\u006e\u0061i\u006c:\u0020\u0025\u0073",_fbgg );};_gab .Thumbnail ,_ ,_fbgg =_e .Decode (_fcaf );_fcaf .Close ();if _fbgg !=nil {return _ga .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",_fbgg );};_gbac [_dcgc ]=nil ;};};case _g .SettingsType ,_g .SettingsTypeStrict :_deaf .AddTarget (_ffbd ,_gab .Settings .X (),_fdcf ,0);_fgca .TargetAttr =_g .RelativeFilename (_aggba ,_dbef .Typ ,_fdcf ,0);case _g .NumberingType ,_g .NumberingTypeStrict :_gab .Numbering =NewNumbering ();_deaf .AddTarget (_ffbd ,_gab .Numbering .X (),_fdcf ,0);_fgca .TargetAttr =_g .RelativeFilename (_aggba ,_dbef .Typ ,_fdcf ,0);case _g .StylesType ,_g .StylesTypeStrict :_gab .Styles .Clear ();_deaf .AddTarget (_ffbd ,_gab .Styles .X (),_fdcf ,0);_fgca .TargetAttr =_g .RelativeFilename (_aggba ,_dbef .Typ ,_fdcf ,0);case _g .HeaderType ,_g .HeaderTypeStrict :_gbae :=_dag .NewHdr ();_deaf .AddTarget (_ffbd ,_gbae ,_fdcf ,uint32 (len (_gab ._abcg )));_gab ._abcg =append (_gab ._abcg ,_gbae );_fgca .TargetAttr =_g .RelativeFilename (_aggba ,_dbef .Typ ,_fdcf ,len (_gab ._abcg ));_dgga :=_cd .NewRelationships ();_deaf .AddTarget (_b .RelationsPathFor (_ffbd ),_dgga .X (),_fdcf ,0);_gab ._baf =append (_gab ._baf ,_dgga );case _g .FooterType ,_g .FooterTypeStrict :_gdef :=_dag .NewFtr ();_deaf .AddTarget (_ffbd ,_gdef ,_fdcf ,uint32 (len (_gab ._geb )));_gab ._geb =append (_gab ._geb ,_gdef );_fgca .TargetAttr =_g .RelativeFilename (_aggba ,_dbef .Typ ,_fdcf ,len (_gab ._geb ));_gee :=_cd .NewRelationships ();_deaf .AddTarget (_b .RelationsPathFor (_ffbd ),_gee .X (),_fdcf ,0);_gab ._gfef =append (_gab ._gfef ,_gee );case _g .ThemeType ,_g .ThemeTypeStrict :_faec :=_cgb .NewTheme ();_deaf .AddTarget (_ffbd ,_faec ,_fdcf ,uint32 (len (_gab ._gdfa )));_gab ._gdfa =append (_gab ._gdfa ,_faec );_fgca .TargetAttr =_g .RelativeFilename (_aggba ,_dbef .Typ ,_fdcf ,len (_gab ._gdfa ));case _g .WebSettingsType ,_g .WebSettingsTypeStrict :_gab ._dfd =_dag .NewWebSettings ();_deaf .AddTarget (_ffbd ,_gab ._dfd ,_fdcf ,0);_fgca .TargetAttr =_g .RelativeFilename (_aggba ,_dbef .Typ ,_fdcf ,0);case _g .FontTableType ,_g .FontTableTypeStrict :_gab ._dbac =_dag .NewFonts ();_deaf .AddTarget (_ffbd ,_gab ._dbac ,_fdcf ,0);_fgca .TargetAttr =_g .RelativeFilename (_aggba ,_dbef .Typ ,_fdcf ,0);case _g .EndNotesType ,_g .EndNotesTypeStrict :_gab ._acc =_dag .NewEndnotes ();_deaf .AddTarget (_ffbd ,_gab ._acc ,_fdcf ,0);_fgca .TargetAttr =_g .RelativeFilename (_aggba ,_dbef .Typ ,_fdcf ,0);case _g .FootNotesType ,_g .FootNotesTypeStrict :_gab ._dde =_dag .NewFootnotes ();_deaf .AddTarget (_ffbd ,_gab ._dde ,_fdcf ,0);_fgca .TargetAttr =_g .RelativeFilename (_aggba ,_dbef .Typ ,_fdcf ,0);case _g .ImageType ,_g .ImageTypeStrict :var _cedg _cd .ImageRef ;for _eaegg ,_bbba :=range _gbac {if _bbba ==nil {continue ;};if _bbba .Name ==_ffbd {_gbgg ,_gbfe :=_b .ExtractToDiskTmp (_bbba ,_gab .TmpPath );if _gbfe !=nil {return _gbfe ;};_cdbc ,_gbfe :=_cd .ImageFromStorage (_gbgg );if _gbfe !=nil {return _gbfe ;};_cedg =_cd .MakeImageRef (_cdbc ,&_gab .DocBase ,_gab ._dbce );_gbac [_eaegg ]=nil ;};};if _cedg .Format ()!=""{_bebef :="\u002e"+_fgc .ToLower (_cedg .Format ());_fgca .TargetAttr =_g .RelativeFilename (_aggba ,_dbef .Typ ,_fdcf ,len (_gab .Images )+1);if _ebcg :=_a .Ext (_fgca .TargetAttr );_ebcg !=_bebef {_fgca .TargetAttr =_fgca .TargetAttr [0:len (_fgca .TargetAttr )-len (_ebcg )]+_bebef ;};_cedg .SetTarget ("\u0077\u006f\u0072d\u002f"+_fgca .TargetAttr );_gab .Images =append (_gab .Images ,_cedg );};case _g .ControlType ,_g .ControlTypeStrict :_bfde :=_daf .NewOcx ();_efeg :=_g .RelativeFilename (_aggba ,_dbef .Typ ,_fdcf ,len (_gab ._add )+1);_ceac :="\u0077\u006f\u0072d\u002f"+_efeg [:len (_efeg )-4]+"\u002e\u0062\u0069\u006e";for _aebad ,_ggec :=range _gbac {if _ggec ==nil {continue ;};if _ggec .Name ==_ceac {_cgad ,_eeg :=_b .ExtractToDiskTmp (_ggec ,_gab .TmpPath );if _eeg !=nil {return _eeg ;};_fbff ,_eeg :=_gb .ImportFromFile (_cgad );if _eeg ==nil {_fbff .TargetAttr =_efeg ;_fbff .Ocx =_bfde ;_gab ._add =append (_gab ._add ,_fbff );_deaf .AddTarget (_ffbd ,_bfde ,_fdcf ,uint32 (len (_gab ._add )));_fgca .TargetAttr =_efeg ;_gbac [_aebad ]=nil ;}else {_bc .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",_ceac ,_eeg .Error ());};break ;};};case _g .ChartType :_eacd :=chart {_gfea :_cg .NewChartSpace ()};_dfeb :=uint32 (len (_gab ._fgcg ));_deaf .AddTarget (_ffbd ,_eacd ._gfea ,_fdcf ,_dfeb );_gab ._fgcg =append (_gab ._fgcg ,&_eacd );_fgca .TargetAttr =_g .RelativeFilename (_aggba ,_dbef .Typ ,_fdcf ,len (_gab ._fgcg ));_eacd ._fee =_fgca .TargetAttr ;default:_bc .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",_fdcf ,_ffbd );};return nil ;};func (_agcb *Document )insertNumberingFromStyleProperties (_dacc Numbering ,_bcb ParagraphStyleProperties ){_cebe :=_bcb .NumId ();_acbcd :=int64 (-1);if _cebe > -1{for _ ,_acaa :=range _dacc ._bagd .Num {if _acaa .NumIdAttr ==_cebe {if _acaa .AbstractNumId !=nil {_acbcd =_acaa .AbstractNumId .ValAttr ;_cccfe :=false ;for _ ,_gagb :=range _agcb .Numbering ._bagd .Num {if _gagb .NumIdAttr ==_cebe {_cccfe =true ;break ;};};if !_cccfe {_agcb .Numbering ._bagd .Num =append (_agcb .Numbering ._bagd .Num ,_acaa );};break ;};};};for _ ,_gdfd :=range _dacc ._bagd .AbstractNum {if _gdfd .AbstractNumIdAttr ==_acbcd {_dgfb :=false ;for _ ,_agbdb :=range _agcb .Numbering ._bagd .AbstractNum {if _agbdb .AbstractNumIdAttr ==_acbcd {_dgfb =true ;break ;};};if !_dgfb {_agcb .Numbering ._bagd .AbstractNum =append (_agcb .Numbering ._bagd .AbstractNum ,_gdfd );};break ;};};};};
|
|
|
|
// SetEmboss sets the run to embossed text.
|
|
func (_dddac RunProperties )SetEmboss (b bool ){if !b {_dddac ._becb .Emboss =nil ;}else {_dddac ._becb .Emboss =_dag .NewCT_OnOff ();};};
|
|
|
|
// Style returns the style for a paragraph, or an empty string if it is unset.
|
|
func (_ddgdd ParagraphProperties )Style ()string {if _ddgdd ._gfeb .PStyle !=nil {return _ddgdd ._gfeb .PStyle .ValAttr ;};return "";};
|
|
|
|
// AddParagraph adds a paragraph to the header.
|
|
func (_bged Header )AddParagraph ()Paragraph {_abcd :=_dag .NewEG_ContentBlockContent ();_bged ._ddaf .EG_ContentBlockContent =append (_bged ._ddaf .EG_ContentBlockContent ,_abcd );_dgda :=_dag .NewCT_P ();_abcd .P =append (_abcd .P ,_dgda );return Paragraph {_bged ._gcaa ,_dgda };};
|
|
|
|
// AddTextInput adds text input form field to the paragraph and returns it.
|
|
func (_gfdge Paragraph )AddTextInput (name string )FormField {_deeff :=_gfdge .addFldCharsForField (name ,"\u0046\u004f\u0052\u004d\u0054\u0045\u0058\u0054");_deeff ._dgfaa .TextInput =_dag .NewCT_FFTextInput ();return _deeff ;};
|
|
|
|
// SetColor sets a specific color or auto.
|
|
func (_ebfg Color )SetColor (v _ca .Color ){if v .IsAuto (){_ebfg ._dcb .ValAttr .ST_HexColorAuto =_dag .ST_HexColorAutoAuto ;_ebfg ._dcb .ValAttr .ST_HexColorRGB =nil ;}else {_ebfg ._dcb .ValAttr .ST_HexColorAuto =_dag .ST_HexColorAutoUnset ;_ebfg ._dcb .ValAttr .ST_HexColorRGB =v .AsRGBString ();};};
|
|
|
|
// WatermarkPicture is watermark picture within document.
|
|
type WatermarkPicture struct{_ecfd *_dag .CT_Picture ;_fdfa *_fgcb .ShapeStyle ;_cebdc *_ec .Shape ;_ebfcd *_ec .Shapetype ;};
|
|
|
|
// AddWatermarkPicture adds new watermark picture to document.
|
|
func (_dbfe *Document )AddWatermarkPicture (imageRef _cd .ImageRef )WatermarkPicture {var _cdf []Header ;if _eagc ,_eedg :=_dbfe .BodySection ().GetHeader (_dag .ST_HdrFtrDefault );_eedg {_cdf =append (_cdf ,_eagc );};if _dfb ,_fdeac :=_dbfe .BodySection ().GetHeader (_dag .ST_HdrFtrEven );_fdeac {_cdf =append (_cdf ,_dfb );};if _eacb ,_aege :=_dbfe .BodySection ().GetHeader (_dag .ST_HdrFtrFirst );_aege {_cdf =append (_cdf ,_eacb );};if len (_cdf )< 1{_fgg :=_dbfe .AddHeader ();_dbfe .BodySection ().SetHeader (_fgg ,_dag .ST_HdrFtrDefault );_cdf =append (_cdf ,_fgg );};var _ebfe error ;_daab :=NewWatermarkPicture ();for _ ,_deaa :=range _cdf {imageRef ,_ebfe =_deaa .AddImageRef (imageRef );if _ebfe !=nil {return WatermarkPicture {};};_eebd :=_deaa .Paragraphs ();if len (_eebd )< 1{_gdfff :=_deaa .AddParagraph ();_gdfff .AddRun ().AddText ("");};for _ ,_aebb :=range _deaa .X ().EG_ContentBlockContent {for _ ,_agab :=range _aebb .P {for _ ,_decd :=range _agab .EG_PContent {for _ ,_beda :=range _decd .EG_ContentRunContent {if _beda .R ==nil {continue ;};for _ ,_eec :=range _beda .R .EG_RunInnerContent {_eec .Pict =_daab ._ecfd ;break ;};};};};};};_daab .SetPicture (imageRef );return _daab ;};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";);
|
|
|
|
// IsItalic returns true if the run has been set to italics.
|
|
func (_edbd RunProperties )IsItalic ()bool {return _edbd .ItalicValue ()==OnOffValueOn };
|
|
|
|
// SetTextWrapThrough sets the text wrap to through with a give wrap type.
|
|
func (_gff AnchoredDrawing )SetTextWrapThrough (option *AnchorDrawWrapOptions ){_gff ._af .Choice =&_dag .WdEG_WrapTypeChoice {};_gff ._af .Choice .WrapThrough =_dag .NewWdCT_WrapThrough ();_gff ._af .Choice .WrapThrough .WrapTextAttr =_dag .WdST_WrapTextBothSides ;_fde :=false ;_gff ._af .Choice .WrapThrough .WrapPolygon .EditedAttr =&_fde ;if option ==nil {option =NewAnchorDrawWrapOptions ();};_gff ._af .Choice .WrapThrough .WrapPolygon .Start =option .GetWrapPathStart ();_gff ._af .Choice .WrapThrough .WrapPolygon .LineTo =option .GetWrapPathLineTo ();_gff ._af .LayoutInCellAttr =true ;_gff ._af .AllowOverlapAttr =true ;};
|
|
|
|
// SetHAlignment sets the horizontal alignment for an anchored image.
|
|
func (_fd AnchoredDrawing )SetHAlignment (h _dag .WdST_AlignH ){_fd ._af .PositionH .Choice =&_dag .WdCT_PosHChoice {};_fd ._af .PositionH .Choice .Align =h ;};
|
|
|
|
// ParagraphSpacing controls the spacing for a paragraph and its lines.
|
|
type ParagraphSpacing struct{_bced *_dag .CT_Spacing };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_abdbf Table )X ()*_dag .CT_Tbl {return _abdbf ._acbcf };
|
|
|
|
// Definitions returns the defined numbering definitions.
|
|
func (_ffdb Numbering )Definitions ()[]NumberingDefinition {_aefa :=[]NumberingDefinition {};if _ffdb ._bagd !=nil {for _ ,_ccce :=range _ffdb ._bagd .AbstractNum {_aefa =append (_aefa ,NumberingDefinition {_ccce });};};return _aefa ;};
|
|
|
|
// TableProperties are the properties for a table within a document
|
|
type TableProperties struct{_befe *_dag .CT_TblPr };
|
|
|
|
// // SetBeforeLineSpacing sets spacing above paragraph in line units.
|
|
func (_gbdaf Paragraph )SetBeforeLineSpacing (d _dd .Distance ){_gbdaf .ensurePPr ();if _gbdaf ._gbfgc .PPr .Spacing ==nil {_gbdaf ._gbfgc .PPr .Spacing =_dag .NewCT_Spacing ();};_efdef :=_gbdaf ._gbfgc .PPr .Spacing ;_efdef .BeforeLinesAttr =_g .Int64 (int64 (d /_dd .Twips ));};
|
|
|
|
// SetTextWrapInFrontOfText sets the text wrap to in front of text.
|
|
func (_gfb AnchoredDrawing )SetTextWrapInFrontOfText (){_gfb ._af .Choice =&_dag .WdEG_WrapTypeChoice {};_gfb ._af .Choice .WrapNone =_dag .NewWdCT_WrapNone ();_gfb ._af .BehindDocAttr =false ;_gfb ._af .LayoutInCellAttr =true ;_gfb ._af .AllowOverlapAttr =true ;};
|
|
|
|
// EastAsiaFont returns the name of run font family for East Asia.
|
|
func (_bdee RunProperties )EastAsiaFont ()string {if _cebdf :=_bdee ._becb .RFonts ;_cebdf !=nil {if _cebdf .EastAsiaAttr !=nil {return *_cebdf .EastAsiaAttr ;};};return "";};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_dfgc RunProperties )X ()*_dag .CT_RPr {return _dfgc ._becb };
|
|
|
|
// Clear clears the styes.
|
|
func (_bade Styles )Clear (){_bade ._bdad .DocDefaults =nil ;_bade ._bdad .LatentStyles =nil ;_bade ._bdad .Style =nil ;};
|
|
|
|
// SetValue sets the value of a FormFieldTypeText or FormFieldTypeDropDown. For
|
|
// FormFieldTypeDropDown, the value must be one of the fields possible values.
|
|
func (_cbdgd FormField )SetValue (v string ){if _cbdgd ._dgfaa .DdList !=nil {for _gccdd ,_gceg :=range _cbdgd .PossibleValues (){if _gceg ==v {_cbdgd ._dgfaa .DdList .Result =_dag .NewCT_DecimalNumber ();_cbdgd ._dgfaa .DdList .Result .ValAttr =int64 (_gccdd );break ;};};}else if _cbdgd ._dgfaa .TextInput !=nil {_cbdgd ._cceb .T =_dag .NewCT_Text ();_cbdgd ._cceb .T .Content =v ;};};func _dbdg (_ccd *_dag .CT_TblWidth ,_dafe _dd .Distance ){_ccd .TypeAttr =_dag .ST_TblWidthDxa ;_ccd .WAttr =&_dag .ST_MeasurementOrPercent {};_ccd .WAttr .ST_DecimalNumberOrPercent =&_dag .ST_DecimalNumberOrPercent {};_ccd .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_g .Int64 (int64 (_dafe /_dd .Dxa ));};
|
|
|
|
// SetOrigin sets the origin of the image. It defaults to ST_RelFromHPage and
|
|
// ST_RelFromVPage
|
|
func (_cb AnchoredDrawing )SetOrigin (h _dag .WdST_RelFromH ,v _dag .WdST_RelFromV ){_cb ._af .PositionH .RelativeFromAttr =h ;_cb ._af .PositionV .RelativeFromAttr =v ;};
|
|
|
|
// SetImprint sets the run to imprinted text.
|
|
func (_cdaab RunProperties )SetImprint (b bool ){if !b {_cdaab ._becb .Imprint =nil ;}else {_cdaab ._becb .Imprint =_dag .NewCT_OnOff ();};};
|
|
|
|
// NumberingLevel is the definition for numbering for a particular level within
|
|
// a NumberingDefinition.
|
|
type NumberingLevel struct{_fbaa *_dag .CT_Lvl };
|
|
|
|
// SetPossibleValues sets possible values for a FormFieldTypeDropDown.
|
|
func (_cfddg FormField )SetPossibleValues (values []string ){if _cfddg ._dgfaa .DdList !=nil {for _ ,_fcdg :=range values {_faaed :=_dag .NewCT_String ();_faaed .ValAttr =_fcdg ;_cfddg ._dgfaa .DdList .ListEntry =append (_cfddg ._dgfaa .DdList .ListEntry ,_faaed );};};};
|
|
|
|
// DoubleStrike returns true if paragraph is double striked.
|
|
func (_bbef ParagraphProperties )DoubleStrike ()bool {return _dcda (_bbef ._gfeb .RPr .Dstrike )};func _efe (_ggc *_dag .CT_TblWidth ,_ebc float64 ){_ggc .TypeAttr =_dag .ST_TblWidthPct ;_ggc .WAttr =&_dag .ST_MeasurementOrPercent {};_ggc .WAttr .ST_DecimalNumberOrPercent =&_dag .ST_DecimalNumberOrPercent {};_ggc .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_g .Int64 (int64 (_ebc *50));};
|
|
|
|
// 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 (_dece Settings )SetUpdateFieldsOnOpen (b bool ){if !b {_dece ._beag .UpdateFields =nil ;}else {_dece ._beag .UpdateFields =_dag .NewCT_OnOff ();};};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_cfab Endnote )X ()*_dag .CT_FtnEdn {return _cfab ._fcfd };
|
|
|
|
// Endnote returns the endnote based on the ID; this can be used nicely with
|
|
// the run.IsEndnote() functionality.
|
|
func (_febf *Document )Endnote (id int64 )Endnote {for _ ,_cda :=range _febf .Endnotes (){if _cda .id ()==id {return _cda ;};};return Endnote {};};
|
|
|
|
// SetTargetByRef sets the URL target of the hyperlink and is more efficient if a link
|
|
// destination will be used many times.
|
|
func (_gbee HyperLink )SetTargetByRef (link _cd .Hyperlink ){_gbee ._abfc .IdAttr =_g .String (_cd .Relationship (link ).ID ());_gbee ._abfc .AnchorAttr =nil ;};
|
|
|
|
// SetLeft sets the cell left margin
|
|
func (_aece CellMargins )SetLeft (d _dd .Distance ){_aece ._cc .Left =_dag .NewCT_TblWidth ();_dbdg (_aece ._cc .Left ,d );};func (_aafde Styles )initializeDocDefaults (){_aafde ._bdad .DocDefaults =_dag .NewCT_DocDefaults ();_aafde ._bdad .DocDefaults .RPrDefault =_dag .NewCT_RPrDefault ();_aafde ._bdad .DocDefaults .RPrDefault .RPr =_dag .NewCT_RPr ();_gecea :=RunProperties {_aafde ._bdad .DocDefaults .RPrDefault .RPr };_gecea .SetSize (12*_dd .Point );_gecea .Fonts ().SetASCIITheme (_dag .ST_ThemeMajorAscii );_gecea .Fonts ().SetEastAsiaTheme (_dag .ST_ThemeMajorEastAsia );_gecea .Fonts ().SetHANSITheme (_dag .ST_ThemeMajorHAnsi );_gecea .Fonts ().SetCSTheme (_dag .ST_ThemeMajorBidi );_gecea .X ().Lang =_dag .NewCT_Language ();_gecea .X ().Lang .ValAttr =_g .String ("\u0065\u006e\u002dU\u0053");_gecea .X ().Lang .EastAsiaAttr =_g .String ("\u0065\u006e\u002dU\u0053");_gecea .X ().Lang .BidiAttr =_g .String ("\u0061\u0072\u002dS\u0041");_aafde ._bdad .DocDefaults .PPrDefault =_dag .NewCT_PPrDefault ();};
|
|
|
|
// DrawingInfo is used for keep information about a drawing wrapping a textbox where the text is located.
|
|
type DrawingInfo struct{Drawing *_dag .CT_Drawing ;Width int64 ;Height int64 ;};
|
|
|
|
// 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 ;};
|
|
|
|
// Strike returns true if run is striked.
|
|
func (_ffgf RunProperties )Strike ()bool {return _dcda (_ffgf ._becb .Strike )};
|
|
|
|
// SetTop sets the top border to a specified type, color and thickness.
|
|
func (_gdb CellBorders )SetTop (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_gdb ._gbe .Top =_dag .NewCT_Border ();_fbgeg (_gdb ._gbe .Top ,t ,c ,thickness );};func _defg (_gdbf *_dag .CT_P ,_cebaf *_dag .CT_Hyperlink ,_gebcd *TableInfo ,_afde *DrawingInfo ,_cfdee []*_dag .EG_PContent )[]TextItem {if len (_cfdee )==0{return []TextItem {TextItem {Text :"",DrawingInfo :_afde ,Paragraph :_gdbf ,Hyperlink :_cebaf ,Run :nil ,TableInfo :_gebcd }};};_abed :=[]TextItem {};for _ ,_dgbfd :=range _cfdee {for _ ,_edge :=range _dgbfd .FldSimple {if _edge !=nil {_abed =append (_abed ,_defg (_gdbf ,_cebaf ,_gebcd ,_afde ,_edge .EG_PContent )...);};};if _cgdfb :=_dgbfd .Hyperlink ;_cgdfb !=nil {_abed =append (_abed ,_ebfd (_gdbf ,_cgdfb ,_gebcd ,_afde ,_cgdfb .EG_ContentRunContent )...);};_abed =append (_abed ,_ebfd (_gdbf ,nil ,_gebcd ,_afde ,_dgbfd .EG_ContentRunContent )...);};return _abed ;};
|
|
|
|
// Section is the beginning of a new section.
|
|
type Section struct{_cdgeb *Document ;_gbfbf *_dag .CT_SectPr ;};
|
|
|
|
// ExtractText returns text from the document as a DocText object.
|
|
func (_cbabg *Document )ExtractText ()*DocText {_cfg :=[]TextItem {};for _ ,_ceeec :=range _cbabg ._ceeb .Body .EG_BlockLevelElts {_cfg =append (_cfg ,_fgdaa (_ceeec .EG_ContentBlockContent ,nil )...);};var _bdcf []listItemInfo ;_beba :=_cbabg .Paragraphs ();for _ ,_adcc :=range _beba {_badg :=_bafe (_cbabg ,_adcc );_bdcf =append (_bdcf ,_badg );};_cfdd :=_eagf (_cbabg );return &DocText {Items :_cfg ,_acabb :_bdcf ,_dbcb :_cfdd };};func (_gbed *Document )appendParagraph (_fafd *Paragraph ,_begc Paragraph ,_ddfd bool )Paragraph {_eace :=_dag .NewEG_BlockLevelElts ();_gbed ._ceeb .Body .EG_BlockLevelElts =append (_gbed ._ceeb .Body .EG_BlockLevelElts ,_eace );_edg :=_dag .NewEG_ContentBlockContent ();_eace .EG_ContentBlockContent =append (_eace .EG_ContentBlockContent ,_edg );if _fafd !=nil {_bbf :=_fafd .X ();for _ ,_gba :=range _gbed ._ceeb .Body .EG_BlockLevelElts {for _ ,_gfg :=range _gba .EG_ContentBlockContent {for _gece ,_agbb :=range _gfg .P {if _agbb ==_bbf {_gaag :=_begc .X ();_gfg .P =append (_gfg .P ,nil );if _ddfd {copy (_gfg .P [_gece +1:],_gfg .P [_gece :]);_gfg .P [_gece ]=_gaag ;}else {copy (_gfg .P [_gece +2:],_gfg .P [_gece +1:]);_gfg .P [_gece +1]=_gaag ;};break ;};};for _ ,_bebd :=range _gfg .Tbl {for _ ,_bcdf :=range _bebd .EG_ContentRowContent {for _ ,_bdf :=range _bcdf .Tr {for _ ,_bgcf :=range _bdf .EG_ContentCellContent {for _ ,_dab :=range _bgcf .Tc {for _ ,_cgd :=range _dab .EG_BlockLevelElts {for _ ,_gbbe :=range _cgd .EG_ContentBlockContent {for _cbfe ,_dbdc :=range _gbbe .P {if _dbdc ==_bbf {_ggfe :=_begc .X ();_gbbe .P =append (_gbbe .P ,nil );if _ddfd {copy (_gbbe .P [_cbfe +1:],_gbbe .P [_cbfe :]);_gbbe .P [_cbfe ]=_ggfe ;}else {copy (_gbbe .P [_cbfe +2:],_gbbe .P [_cbfe +1:]);_gbbe .P [_cbfe +1]=_ggfe ;};break ;};};};};};};};};};if _gfg .Sdt !=nil &&_gfg .Sdt .SdtContent !=nil &&_gfg .Sdt .SdtContent .P !=nil {for _gdff ,_gfgf :=range _gfg .Sdt .SdtContent .P {if _gfgf ==_bbf {_cbd :=_begc .X ();_gfg .Sdt .SdtContent .P =append (_gfg .Sdt .SdtContent .P ,nil );if _ddfd {copy (_gfg .Sdt .SdtContent .P [_gdff +1:],_gfg .Sdt .SdtContent .P [_gdff :]);_gfg .Sdt .SdtContent .P [_gdff ]=_cbd ;}else {copy (_gfg .Sdt .SdtContent .P [_gdff +2:],_gfg .Sdt .SdtContent .P [_gdff +1:]);_gfg .Sdt .SdtContent .P [_gdff +1]=_cbd ;};break ;};};};};};}else {_edg .P =append (_edg .P ,_begc .X ());};_gafa :=_begc .Properties ();if _gceb ,_acf :=_gafa .Section ();_acf {var (_agdce map[string ]string ;_bffe map[string ]string ;);_aebd :=_gceb .X ().EG_HdrFtrReferences ;for _ ,_efaf :=range _aebd {if _efaf .HeaderReference !=nil {_agdce =map[string ]string {_efaf .HeaderReference .IdAttr :_gceb ._cdgeb ._dbce .GetTargetByRelId (_efaf .HeaderReference .IdAttr )};};if _efaf .FooterReference !=nil {_bffe =map[string ]string {_efaf .FooterReference .IdAttr :_gceb ._cdgeb ._dbce .GetTargetByRelId (_efaf .FooterReference .IdAttr )};};};var _dbfb map[int ]_cd .ImageRef ;for _ ,_fdfg :=range _gceb ._cdgeb .Headers (){for _beeb ,_aca :=range _agdce {_dcd :=_ga .Sprintf ("\u0068\u0065\u0061d\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c",(_fdfg .Index ()+1));if _dcd ==_aca {_dbdef :=_ga .Sprintf ("\u0068\u0065\u0061d\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c",_fdfg .Index ());_gbed ._abcg =append (_gbed ._abcg ,_fdfg .X ());_efce :=_gbed ._dbce .AddRelationship (_dbdef ,_g .HeaderType );_efce .SetID (_beeb );_gbed .ContentTypes .AddOverride ("\u002f\u0077\u006f\u0072\u0064\u002f"+_dbdef ,"\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");_gbed ._baf =append (_gbed ._baf ,_cd .NewRelationships ());_cdda :=_fdfg .Paragraphs ();for _ ,_edbg :=range _cdda {for _ ,_feag :=range _edbg .Runs (){_bbbe :=_feag .DrawingAnchored ();for _ ,_gbf :=range _bbbe {if _eeba ,_cag :=_gbf .GetImage ();_cag {_dbfb =map[int ]_cd .ImageRef {_fdfg .Index ():_eeba };};};_fcc :=_feag .DrawingInline ();for _ ,_gbec :=range _fcc {if _efag ,_bgcg :=_gbec .GetImage ();_bgcg {_dbfb =map[int ]_cd .ImageRef {_fdfg .Index ():_efag };};};};};};};};for _edeg ,_gdcd :=range _dbfb {for _ ,_fcbf :=range _gbed .Headers (){if (_fcbf .Index ()+1)==_edeg {_dcac ,_dce :=_cd .ImageFromFile (_gdcd .Path ());if _dce !=nil {_bc .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",_dce );};if _ ,_dce =_fcbf .AddImage (_dcac );_dce !=nil {_bc .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",_dce );};};for _ ,_ggdb :=range _fcbf .Paragraphs (){if _beab ,_cbgaf :=_gceb ._cdgeb .Styles .SearchStyleById (_ggdb .Style ());_cbgaf {if _ ,_egge :=_gbed .Styles .SearchStyleById (_ggdb .Style ());!_egge {_gbed .Styles .InsertStyle (_beab );};};};};};var _geaa map[int ]_cd .ImageRef ;for _ ,_cca :=range _gceb ._cdgeb .Footers (){for _dcbg ,_fdcc :=range _bffe {_gfda :=_ga .Sprintf ("\u0066\u006f\u006ft\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c",(_cca .Index ()+1));if _gfda ==_fdcc {_adc :=_ga .Sprintf ("\u0066\u006f\u006ft\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c",_cca .Index ());_gbed ._geb =append (_gbed ._geb ,_cca .X ());_abf :=_gbed ._dbce .AddRelationship (_adc ,_g .FooterType );_abf .SetID (_dcbg );_gbed .ContentTypes .AddOverride ("\u002f\u0077\u006f\u0072\u0064\u002f"+_adc ,"\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");_gbed ._gfef =append (_gbed ._gfef ,_cd .NewRelationships ());_fddcg :=_cca .Paragraphs ();for _ ,_egea :=range _fddcg {for _ ,_addb :=range _egea .Runs (){_dgba :=_addb .DrawingAnchored ();for _ ,_efagd :=range _dgba {if _bfe ,_degg :=_efagd .GetImage ();_degg {_geaa =map[int ]_cd .ImageRef {_cca .Index ():_bfe };};};_caag :=_addb .DrawingInline ();for _ ,_ccdc :=range _caag {if _gbbd ,_gdg :=_ccdc .GetImage ();_gdg {_geaa =map[int ]_cd .ImageRef {_cca .Index ():_gbbd };};};};};};};};for _agbe ,_afe :=range _geaa {for _ ,_ebb :=range _gbed .Footers (){if (_ebb .Index ()+1)==_agbe {_agcdc ,_ebd :=_cd .ImageFromFile (_afe .Path ());if _ebd !=nil {_bc .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",_ebd );};if _ ,_ebd =_ebb .AddImage (_agcdc );_ebd !=nil {_bc .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",_ebd );};};for _ ,_eceg :=range _ebb .Paragraphs (){if _ffa ,_dcdf :=_gceb ._cdgeb .Styles .SearchStyleById (_eceg .Style ());_dcdf {if _ ,_ecea :=_gbed .Styles .SearchStyleById (_eceg .Style ());!_ecea {_gbed .Styles .InsertStyle (_ffa );};};};};};};_bac :=_begc .Numbering ();_gbed .Numbering ._bagd .AbstractNum =append (_gbed .Numbering ._bagd .AbstractNum ,_bac ._bagd .AbstractNum ...);_gbed .Numbering ._bagd .Num =append (_gbed .Numbering ._bagd .Num ,_bac ._bagd .Num ...);return Paragraph {_gbed ,_begc .X ()};};
|
|
|
|
// 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 (_adca Footer )AddImage (i _cd .Image )(_cd .ImageRef ,error ){var _fdacd _cd .Relationships ;for _degd ,_gcab :=range _adca ._cdfa ._geb {if _gcab ==_adca ._gbdc {_fdacd =_adca ._cdfa ._gfef [_degd ];};};_decgaa :=_cd .MakeImageRef (i ,&_adca ._cdfa .DocBase ,_fdacd );if i .Data ==nil &&i .Path ==""{return _decgaa ,_de .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 _decgaa ,_de .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 _decgaa ,_de .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");};_adca ._cdfa .Images =append (_adca ._cdfa .Images ,_decgaa );_ffcc :=_ga .Sprintf ("\u006d\u0065d\u0069\u0061\u002fi\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073",len (_adca ._cdfa .Images ),i .Format );_badf :=_fdacd .AddRelationship (_ffcc ,_g .ImageType );_decgaa .SetRelID (_badf .X ().IdAttr );return _decgaa ,nil ;};
|
|
|
|
// SetTextStyleBold set text style of watermark to bold.
|
|
func (_cdce *WatermarkText )SetTextStyleBold (value bool ){if _cdce ._efac !=nil {_efea :=_cdce .GetStyle ();_efea .SetBold (value );_cdce .SetStyle (_efea );};};
|
|
|
|
// VerticalAlign returns the value of run vertical align.
|
|
func (_ccef RunProperties )VerticalAlignment ()_ge .ST_VerticalAlignRun {if _dggaf :=_ccef ._becb .VertAlign ;_dggaf !=nil {return _dggaf .ValAttr ;};return 0;};
|
|
|
|
// SetCharacterSpacing sets the run's Character Spacing Adjustment.
|
|
func (_egda RunProperties )SetCharacterSpacing (size _dd .Distance ){_egda ._becb .Spacing =_dag .NewCT_SignedTwipsMeasure ();_egda ._becb .Spacing .ValAttr .Int64 =_g .Int64 (int64 (size /_dd .Twips ));};
|
|
|
|
// SetLastColumn controls the conditional formatting for the last column in a table.
|
|
func (_gdfc TableLook )SetLastColumn (on bool ){if !on {_gdfc ._bfbbe .LastColumnAttr =&_ge .ST_OnOff {};_gdfc ._bfbbe .LastColumnAttr .ST_OnOff1 =_ge .ST_OnOff1Off ;}else {_gdfc ._bfbbe .LastColumnAttr =&_ge .ST_OnOff {};_gdfc ._bfbbe .LastColumnAttr .ST_OnOff1 =_ge .ST_OnOff1On ;};};func _dcda (_eabd *_dag .CT_OnOff )bool {return _eabd !=nil };func (_ede *Document )InsertTableBefore (relativeTo Paragraph )Table {return _ede .insertTable (relativeTo ,true );};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_bbfaf TableWidth )X ()*_dag .CT_TblWidth {return _bbfaf ._beeag };
|
|
|
|
// AddDrawingInline adds an inline drawing from an ImageRef.
|
|
func (_bdddd Run )AddDrawingInline (img _cd .ImageRef )(InlineDrawing ,error ){_cgaf :=_bdddd .newIC ();_cgaf .Drawing =_dag .NewCT_Drawing ();_bbbb :=_dag .NewWdInline ();_gggge :=InlineDrawing {_bdddd ._gcba ,_bbbb };_bbbb .CNvGraphicFramePr =_cgb .NewCT_NonVisualGraphicFrameProperties ();_cgaf .Drawing .Inline =append (_cgaf .Drawing .Inline ,_bbbb );_bbbb .Graphic =_cgb .NewGraphic ();_bbbb .Graphic .GraphicData =_cgb .NewCT_GraphicalObjectData ();_bbbb .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";_bbbb .DistTAttr =_g .Uint32 (0);_bbbb .DistLAttr =_g .Uint32 (0);_bbbb .DistBAttr =_g .Uint32 (0);_bbbb .DistRAttr =_g .Uint32 (0);_bbbb .Extent .CxAttr =int64 (float64 (img .Size ().X *_dd .Pixel72 )/_dd .EMU );_bbbb .Extent .CyAttr =int64 (float64 (img .Size ().Y *_dd .Pixel72 )/_dd .EMU );_gffa :=0x7FFFFFFF&_fg .Uint32 ();_bbbb .DocPr .IdAttr =_gffa ;_fggcc :=_ggb .NewPic ();_fggcc .NvPicPr .CNvPr .IdAttr =_gffa ;_afggb :=img .RelID ();if _afggb ==""{return _gggge ,_de .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");};_bbbb .Graphic .GraphicData .Any =append (_bbbb .Graphic .GraphicData .Any ,_fggcc );_fggcc .BlipFill =_cgb .NewCT_BlipFillProperties ();_fggcc .BlipFill .Blip =_cgb .NewCT_Blip ();_fggcc .BlipFill .Blip .EmbedAttr =&_afggb ;_fggcc .BlipFill .Stretch =_cgb .NewCT_StretchInfoProperties ();_fggcc .BlipFill .Stretch .FillRect =_cgb .NewCT_RelativeRect ();_fggcc .SpPr =_cgb .NewCT_ShapeProperties ();_fggcc .SpPr .Xfrm =_cgb .NewCT_Transform2D ();_fggcc .SpPr .Xfrm .Off =_cgb .NewCT_Point2D ();_fggcc .SpPr .Xfrm .Off .XAttr .ST_CoordinateUnqualified =_g .Int64 (0);_fggcc .SpPr .Xfrm .Off .YAttr .ST_CoordinateUnqualified =_g .Int64 (0);_fggcc .SpPr .Xfrm .Ext =_cgb .NewCT_PositiveSize2D ();_fggcc .SpPr .Xfrm .Ext .CxAttr =int64 (img .Size ().X *_dd .Point );_fggcc .SpPr .Xfrm .Ext .CyAttr =int64 (img .Size ().Y *_dd .Point );_fggcc .SpPr .PrstGeom =_cgb .NewCT_PresetGeometry2D ();_fggcc .SpPr .PrstGeom .PrstAttr =_cgb .ST_ShapeTypeRect ;return _gggge ,nil ;};
|
|
|
|
// Cells returns the cells defined in the table.
|
|
func (_ebbdb Row )Cells ()[]Cell {_abcbd :=[]Cell {};for _ ,_dbada :=range _ebbdb ._gcce .EG_ContentCellContent {for _ ,_gffcd :=range _dbada .Tc {_abcbd =append (_abcbd ,Cell {_ebbdb ._fegg ,_gffcd });};if _dbada .Sdt !=nil &&_dbada .Sdt .SdtContent !=nil {for _ ,_cacef :=range _dbada .Sdt .SdtContent .Tc {_abcbd =append (_abcbd ,Cell {_ebbdb ._fegg ,_cacef });};};};return _abcbd ;};
|
|
|
|
// SetRight sets the right border to a specified type, color and thickness.
|
|
func (_cgce TableBorders )SetRight (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_cgce ._dfeff .Right =_dag .NewCT_Border ();_fbgeg (_cgce ._dfeff .Right ,t ,c ,thickness );};
|
|
|
|
// SetHangingIndent controls the hanging indent of the paragraph.
|
|
func (_ggcd ParagraphStyleProperties )SetHangingIndent (m _dd .Distance ){if _ggcd ._ffgg .Ind ==nil {_ggcd ._ffgg .Ind =_dag .NewCT_Ind ();};if m ==_dd .Zero {_ggcd ._ffgg .Ind .HangingAttr =nil ;}else {_ggcd ._ffgg .Ind .HangingAttr =&_ge .ST_TwipsMeasure {};_ggcd ._ffgg .Ind .HangingAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (m /_dd .Twips ));};};
|
|
|
|
// ComplexSizeValue returns the value of run font size for complex fonts in points.
|
|
func (_cbaa RunProperties )ComplexSizeValue ()float64 {if _ggacb :=_cbaa ._becb .SzCs ;_ggacb !=nil {_efgaec :=_ggacb .ValAttr ;if _efgaec .ST_UnsignedDecimalNumber !=nil {return float64 (*_efgaec .ST_UnsignedDecimalNumber )/2;};};return 0.0;};
|
|
|
|
// SetRightPct sets the cell right margin
|
|
func (_fed CellMargins )SetRightPct (pct float64 ){_fed ._cc .Right =_dag .NewCT_TblWidth ();_efe (_fed ._cc .Right ,pct );};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_fe Bookmark )X ()*_dag .CT_Bookmark {return _fe ._dcc };
|
|
|
|
// DrawingAnchored returns a slice of AnchoredDrawings.
|
|
func (_gbeaa Run )DrawingAnchored ()[]AnchoredDrawing {_faebd :=[]AnchoredDrawing {};for _ ,_efegb :=range _gbeaa ._ccad .EG_RunInnerContent {if _efegb .Drawing ==nil {continue ;};for _ ,_ececc :=range _efegb .Drawing .Anchor {_faebd =append (_faebd ,AnchoredDrawing {_gbeaa ._gcba ,_ececc });};};return _faebd ;};
|
|
|
|
// SetHeader sets a section header.
|
|
func (_ffcfe Section )SetHeader (h Header ,t _dag .ST_HdrFtr ){_cgff :=_dag .NewEG_HdrFtrReferences ();_ffcfe ._gbfbf .EG_HdrFtrReferences =append (_ffcfe ._gbfbf .EG_HdrFtrReferences ,_cgff );_cgff .HeaderReference =_dag .NewCT_HdrFtrRef ();_cgff .HeaderReference .TypeAttr =t ;_fdaee :=_ffcfe ._cdgeb ._dbce .FindRIDForN (h .Index (),_g .HeaderType );if _fdaee ==""{_bc .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");};_cgff .HeaderReference .IdAttr =_fdaee ;};
|
|
|
|
// EastAsiaFont returns the name of paragraph font family for East Asia.
|
|
func (_cebd ParagraphProperties )EastAsiaFont ()string {if _dcef :=_cebd ._gfeb .RPr .RFonts ;_dcef !=nil {if _dcef .EastAsiaAttr !=nil {return *_dcef .EastAsiaAttr ;};};return "";};
|
|
|
|
// Imprint returns true if run imprint is on.
|
|
func (_dffdf RunProperties )Imprint ()bool {return _dcda (_dffdf ._becb .Imprint )};
|
|
|
|
// GetColor returns the color.Color object representing the run color.
|
|
func (_baaef ParagraphProperties )GetColor ()_ca .Color {if _eefdd :=_baaef ._gfeb .RPr .Color ;_eefdd !=nil {_dagdf :=_eefdd .ValAttr ;if _dagdf .ST_HexColorRGB !=nil {return _ca .FromHex (*_dagdf .ST_HexColorRGB );};};return _ca .Color {};};
|
|
|
|
// SetHangingIndent controls the indentation of the non-first lines in a paragraph.
|
|
func (_fddf ParagraphProperties )SetHangingIndent (m _dd .Distance ){if _fddf ._gfeb .Ind ==nil {_fddf ._gfeb .Ind =_dag .NewCT_Ind ();};if m ==_dd .Zero {_fddf ._gfeb .Ind .HangingAttr =nil ;}else {_fddf ._gfeb .Ind .HangingAttr =&_ge .ST_TwipsMeasure {};_fddf ._gfeb .Ind .HangingAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (m /_dd .Twips ));};};
|
|
|
|
// RemoveParagraph removes a paragraph from the footnote.
|
|
func (_aeaff Footnote )RemoveParagraph (p Paragraph ){for _ ,_bgde :=range _aeaff .content (){for _gdaaf ,_abdda :=range _bgde .P {if _abdda ==p ._gbfgc {copy (_bgde .P [_gdaaf :],_bgde .P [_gdaaf +1:]);_bgde .P =_bgde .P [0:len (_bgde .P )-1];return ;};};};};
|
|
|
|
// SetUnhideWhenUsed controls if a semi hidden style becomes visible when used.
|
|
func (_dadf Style )SetUnhideWhenUsed (b bool ){if b {_dadf ._ffabb .UnhideWhenUsed =_dag .NewCT_OnOff ();}else {_dadf ._ffabb .UnhideWhenUsed =nil ;};};
|
|
|
|
// SetBottomPct sets the cell bottom margin
|
|
func (_ddb CellMargins )SetBottomPct (pct float64 ){_ddb ._cc .Bottom =_dag .NewCT_TblWidth ();_efe (_ddb ._cc .Bottom ,pct );};
|
|
|
|
// Settings controls the document settings.
|
|
type Settings struct{_beag *_dag .Settings };
|
|
|
|
// DocText is an array of extracted text items which has some methods for representing extracted text.
|
|
type DocText struct{Items []TextItem ;_acabb []listItemInfo ;_dbcb map[int64 ]map[int64 ]int64 ;};func (_cdbf *WatermarkPicture )getShapeType ()*_g .XSDAny {return _cdbf .getInnerElement ("\u0073h\u0061\u0070\u0065\u0074\u0079\u0070e");};
|
|
|
|
// IgnoreSpaceBetweenParagraphOfSameStyle sets contextual spacing.
|
|
func (_fbdef Paragraph )IgnoreSpaceBetweenParagraphOfSameStyle (){_fbdef .ensurePPr ();if _fbdef ._gbfgc .PPr .ContextualSpacing ==nil {_fbdef ._gbfgc .PPr .ContextualSpacing =_dag .NewCT_OnOff ();};_fbdef ._gbfgc .PPr .ContextualSpacing .ValAttr =&_ge .ST_OnOff {ST_OnOff1 :_ge .ST_OnOff1On };};
|
|
|
|
// SetAfter sets the spacing that comes after the paragraph.
|
|
func (_fgce ParagraphSpacing )SetAfter (after _dd .Distance ){_fgce ._bced .AfterAttr =&_ge .ST_TwipsMeasure {};_fgce ._bced .AfterAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (after /_dd .Twips ));};
|
|
|
|
// Paragraphs returns all of the paragraphs in the document body including tables.
|
|
func (_cggf *Document )Paragraphs ()[]Paragraph {_ccf :=[]Paragraph {};if _cggf ._ceeb .Body ==nil {return nil ;};for _ ,_ebab :=range _cggf ._ceeb .Body .EG_BlockLevelElts {for _ ,_fdde :=range _ebab .EG_ContentBlockContent {for _ ,_egg :=range _fdde .P {_ccf =append (_ccf ,Paragraph {_cggf ,_egg });};};};for _ ,_ece :=range _cggf .Tables (){for _ ,_bgdb :=range _ece .Rows (){for _ ,_eeef :=range _bgdb .Cells (){_ccf =append (_ccf ,_eeef .Paragraphs ()...);};};};return _ccf ;};
|
|
|
|
// Italic returns true if run font is italic.
|
|
func (_edbb RunProperties )Italic ()bool {_gbgf :=_edbb ._becb ;return _dcda (_gbgf .I )||_dcda (_gbgf .ICs );};
|
|
|
|
// 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 (_acbcg *Document )Copy ()(*Document ,error ){_dcffb :=_ag .NewBuffer ([]byte {});_cbbg :=_acbcg .save (_dcffb ,_acbcg ._fgcbc );if _cbbg !=nil {return nil ,_cbbg ;};_fgb :=_dcffb .Bytes ();_bge :=_ag .NewReader (_fgb );return _cadd (_bge ,int64 (_bge .Len ()),_acbcg ._fgcbc );};
|
|
|
|
// 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 (_egac *Document )MailMerge (mergeContent map[string ]string ){_bdda :=_egac .mergeFields ();_dcgfg :=map[Paragraph ][]Run {};for _ ,_daag :=range _bdda {_bbcef ,_degf :=mergeContent [_daag ._afac ];if _degf {if _daag ._fbdg {_bbcef =_fgc .ToUpper (_bbcef );}else if _daag ._ffab {_bbcef =_fgc .ToLower (_bbcef );}else if _daag ._acded {_bbcef =_fgc .Title (_bbcef );}else if _daag ._ggag {_facdg :=_ag .Buffer {};for _daebg ,_gfa :=range _bbcef {if _daebg ==0{_facdg .WriteRune (_db .ToUpper (_gfa ));}else {_facdg .WriteRune (_gfa );};};_bbcef =_facdg .String ();};if _bbcef !=""&&_daag ._bgcd !=""{_bbcef =_daag ._bgcd +_bbcef ;};if _bbcef !=""&&_daag ._fbac !=""{_bbcef =_bbcef +_daag ._fbac ;};};if _daag ._gacee {if len (_daag ._gedd .FldSimple )==1&&len (_daag ._gedd .FldSimple [0].EG_PContent )==1&&len (_daag ._gedd .FldSimple [0].EG_PContent [0].EG_ContentRunContent )==1{_ebagf :=&_dag .EG_ContentRunContent {};_ebagf .R =_daag ._gedd .FldSimple [0].EG_PContent [0].EG_ContentRunContent [0].R ;_daag ._gedd .FldSimple =nil ;_efcdb :=Run {_egac ,_ebagf .R };_efcdb .ClearContent ();_efcdb .AddText (_bbcef );_daag ._gedd .EG_ContentRunContent =append (_daag ._gedd .EG_ContentRunContent ,_ebagf );};}else {_fada :=_daag ._cddd .Runs ();for _edbf :=_daag ._efabc ;_edbf <=_daag ._fbfe ;_edbf ++{if _edbf ==_daag ._bfbf +1{_fada [_edbf ].ClearContent ();_fada [_edbf ].AddText (_bbcef );}else {_dcgfg [_daag ._cddd ]=append (_dcgfg [_daag ._cddd ],_fada [_edbf ]);};};};};for _ecge ,_cdgfc :=range _dcgfg {for _ ,_bbd :=range _cdgfc {_ecge .RemoveRun (_bbd );};};_egac .Settings .RemoveMailMerge ();};
|
|
|
|
// Outline returns true if paragraph outline is on.
|
|
func (_dadd ParagraphProperties )Outline ()bool {return _dcda (_dadd ._gfeb .RPr .Outline )};
|
|
|
|
// Table is a table within a document.
|
|
type Table struct{_fabdg *Document ;_acbcf *_dag .CT_Tbl ;};
|
|
|
|
// Style is a style within the styles.xml file.
|
|
type Style struct{_ffabb *_dag .CT_Style };
|
|
|
|
// SetLinkedStyle sets the style that this style is linked to.
|
|
func (_bcadd Style )SetLinkedStyle (name string ){if name ==""{_bcadd ._ffabb .Link =nil ;}else {_bcadd ._ffabb .Link =_dag .NewCT_String ();_bcadd ._ffabb .Link .ValAttr =name ;};};
|
|
|
|
// AddRow adds a row to a table.
|
|
func (_fgcac Table )AddRow ()Row {_gbfed :=_dag .NewEG_ContentRowContent ();_fgcac ._acbcf .EG_ContentRowContent =append (_fgcac ._acbcf .EG_ContentRowContent ,_gbfed );_aabfg :=_dag .NewCT_Row ();_gbfed .Tr =append (_gbfed .Tr ,_aabfg );return Row {_fgcac ._fabdg ,_aabfg };};
|
|
|
|
// CharacterSpacingMeasure returns paragraph characters spacing with its measure which can be mm, cm, in, pt, pc or pi.
|
|
func (_afbd RunProperties )CharacterSpacingMeasure ()string {if _eeff :=_afbd ._becb .Spacing ;_eeff !=nil {_abfe :=_eeff .ValAttr ;if _abfe .ST_UniversalMeasure !=nil {return *_abfe .ST_UniversalMeasure ;};};return "";};
|
|
|
|
// TableStyleProperties are table properties as defined in a style.
|
|
type TableStyleProperties struct{_afeg *_dag .CT_TblPrBase };
|
|
|
|
// RStyle returns the name of character style.
|
|
// It is defined here http://officeopenxml.com/WPstyleCharStyles.php
|
|
func (_eecf RunProperties )RStyle ()string {if _eecf ._becb .RStyle !=nil {return _eecf ._becb .RStyle .ValAttr ;};return "";};
|
|
|
|
// SetCellSpacingAuto sets the cell spacing within a table to automatic.
|
|
func (_dbagg TableStyleProperties )SetCellSpacingAuto (){_dbagg ._afeg .TblCellSpacing =_dag .NewCT_TblWidth ();_dbagg ._afeg .TblCellSpacing .TypeAttr =_dag .ST_TblWidthAuto ;};
|
|
|
|
// 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 (_aebaa Paragraph )AddEndnote (text string )Endnote {var _ggcgb int64 ;if _aebaa ._ebddd .HasEndnotes (){for _ ,_gabea :=range _aebaa ._ebddd .Endnotes (){if _gabea .id ()> _ggcgb {_ggcgb =_gabea .id ();};};_ggcgb ++;}else {_ggcgb =0;_aebaa ._ebddd ._acc =&_dag .Endnotes {};};_bdgbg :=_dag .NewCT_FtnEdn ();_gbfc :=_dag .NewCT_FtnEdnRef ();_gbfc .IdAttr =_ggcgb ;_aebaa ._ebddd ._acc .CT_Endnotes .Endnote =append (_aebaa ._ebddd ._acc .CT_Endnotes .Endnote ,_bdgbg );_afbb :=_aebaa .AddRun ();_begbd :=_afbb .Properties ();_begbd .SetStyle ("\u0045\u006e\u0064\u006e\u006f\u0074\u0065\u0041\u006e\u0063\u0068\u006f\u0072");_afbb ._ccad .EG_RunInnerContent =[]*_dag .EG_RunInnerContent {_dag .NewEG_RunInnerContent ()};_afbb ._ccad .EG_RunInnerContent [0].EndnoteReference =_gbfc ;_fecaf :=Endnote {_aebaa ._ebddd ,_bdgbg };_fecaf ._fcfd .IdAttr =_ggcgb ;_fecaf ._fcfd .EG_BlockLevelElts =[]*_dag .EG_BlockLevelElts {_dag .NewEG_BlockLevelElts ()};_efdg :=_fecaf .AddParagraph ();_efdg .Properties ().SetStyle ("\u0045n\u0064\u006e\u006f\u0074\u0065");_efdg ._gbfgc .PPr .RPr =_dag .NewCT_ParaRPr ();_gfdg :=_efdg .AddRun ();_gfdg .AddTab ();_gfdg .AddText (text );return _fecaf ;};
|
|
|
|
// SetLineSpacing sets the spacing between lines in a paragraph.
|
|
func (_egbd ParagraphSpacing )SetLineSpacing (d _dd .Distance ,rule _dag .ST_LineSpacingRule ){if rule ==_dag .ST_LineSpacingRuleUnset {_egbd ._bced .LineRuleAttr =_dag .ST_LineSpacingRuleUnset ;_egbd ._bced .LineAttr =nil ;}else {_egbd ._bced .LineRuleAttr =rule ;_egbd ._bced .LineAttr =&_dag .ST_SignedTwipsMeasure {};_egbd ._bced .LineAttr .Int64 =_g .Int64 (int64 (d /_dd .Twips ));};};
|
|
|
|
// SetSize sets the font size for a run.
|
|
func (_baab RunProperties )SetSize (size _dd .Distance ){_baab ._becb .Sz =_dag .NewCT_HpsMeasure ();_baab ._becb .Sz .ValAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (size /_dd .HalfPoint ));_baab ._becb .SzCs =_dag .NewCT_HpsMeasure ();_baab ._becb .SzCs .ValAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (size /_dd .HalfPoint ));};
|
|
|
|
// Outline returns true if run outline is on.
|
|
func (_fafg RunProperties )Outline ()bool {return _dcda (_fafg ._becb .Outline )};func _bagcb (_ddfbg *_dag .CT_P ,_gaac map[string ]string ){for _ ,_ffca :=range _ddfbg .EG_PContent {if _ffca .Hyperlink !=nil &&_ffca .Hyperlink .IdAttr !=nil {if _dgace ,_eccd :=_gaac [*_ffca .Hyperlink .IdAttr ];_eccd {*_ffca .Hyperlink .IdAttr =_dgace ;};};};};
|
|
|
|
// SetStyle sets the table style name.
|
|
func (_ccdad TableProperties )SetStyle (name string ){if name ==""{_ccdad ._befe .TblStyle =nil ;}else {_ccdad ._befe .TblStyle =_dag .NewCT_String ();_ccdad ._befe .TblStyle .ValAttr =name ;};};
|
|
|
|
// Font returns the name of run font family.
|
|
func (_gfcd RunProperties )Font ()string {if _aeaca :=_gfcd ._becb .RFonts ;_aeaca !=nil {if _aeaca .AsciiAttr !=nil {return *_aeaca .AsciiAttr ;}else if _aeaca .HAnsiAttr !=nil {return *_aeaca .HAnsiAttr ;}else if _aeaca .CsAttr !=nil {return *_aeaca .CsAttr ;};};return "";};
|
|
|
|
// NewAnchorDrawWrapOptions return anchor drawing options property.
|
|
func NewAnchorDrawWrapOptions ()*AnchorDrawWrapOptions {_ddd :=&AnchorDrawWrapOptions {};if !_ddd ._ded {_ceg ,_aff :=_dbc ();_ddd ._df =_ceg ;_ddd ._bf =_aff ;};return _ddd ;};
|
|
|
|
// SetBasedOn sets the style that this style is based on.
|
|
func (_agfa Style )SetBasedOn (name string ){if name ==""{_agfa ._ffabb .BasedOn =nil ;}else {_agfa ._ffabb .BasedOn =_dag .NewCT_String ();_agfa ._ffabb .BasedOn .ValAttr =name ;};};
|
|
|
|
// 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 ._dcc .NameAttr =name };
|
|
|
|
// SetASCIITheme sets the font ASCII Theme.
|
|
func (_cfbc Fonts )SetASCIITheme (t _dag .ST_Theme ){_cfbc ._gacg .AsciiThemeAttr =t };
|
|
|
|
// SetHANSITheme sets the font H ANSI Theme.
|
|
func (_edgf Fonts )SetHANSITheme (t _dag .ST_Theme ){_edgf ._gacg .HAnsiThemeAttr =t };
|
|
|
|
// SetBehindDoc sets the behindDoc attribute of anchor.
|
|
func (_eb AnchoredDrawing )SetBehindDoc (val bool ){_eb ._af .BehindDocAttr =val };
|
|
|
|
// GetNumberingLevelByIds returns a NumberingLevel by its NumId and LevelId attributes
|
|
// or an empty one if not found.
|
|
func (_caaed *Document )GetNumberingLevelByIds (numId ,levelId int64 )NumberingLevel {for _ ,_cdea :=range _caaed .Numbering ._bagd .Num {if _cdea !=nil &&_cdea .NumIdAttr ==numId {_cdgf :=_cdea .AbstractNumId .ValAttr ;for _ ,_bdfa :=range _caaed .Numbering ._bagd .AbstractNum {if _bdfa .AbstractNumIdAttr ==_cdgf {if _bdfa .NumStyleLink !=nil &&len (_bdfa .Lvl )==0{if _gcbg ,_abad :=_caaed .Styles .SearchStyleById (_bdfa .NumStyleLink .ValAttr );_abad {if _gcbg .ParagraphProperties ().NumId ()> -1{return _caaed .GetNumberingLevelByIds (_gcbg .ParagraphProperties ().NumId (),levelId );};};};for _ ,_dfge :=range _bdfa .Lvl {if _dfge .IlvlAttr ==levelId {return NumberingLevel {_dfge };};};};};};};return NumberingLevel {};};
|
|
|
|
// SetContextualSpacing controls whether to Ignore Spacing Above and Below When
|
|
// Using Identical Styles
|
|
func (_gdfabg ParagraphStyleProperties )SetContextualSpacing (b bool ){if !b {_gdfabg ._ffgg .ContextualSpacing =nil ;}else {_gdfabg ._ffgg .ContextualSpacing =_dag .NewCT_OnOff ();};};
|
|
|
|
// GetColor returns the color.Color object representing the run color.
|
|
func (_gegg RunProperties )GetColor ()_ca .Color {if _ggbb :=_gegg ._becb .Color ;_ggbb !=nil {_dfab :=_ggbb .ValAttr ;if _dfab .ST_HexColorRGB !=nil {return _ca .FromHex (*_dfab .ST_HexColorRGB );};};return _ca .Color {};};
|
|
|
|
// 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 (_cabd ParagraphProperties )SetHeadingLevel (idx int ){_cabd .SetStyle (_ga .Sprintf ("\u0048e\u0061\u0064\u0069\u006e\u0067\u0025d",idx ));if _cabd ._gfeb .NumPr ==nil {_cabd ._gfeb .NumPr =_dag .NewCT_NumPr ();};_cabd ._gfeb .NumPr .Ilvl =_dag .NewCT_DecimalNumber ();_cabd ._gfeb .NumPr .Ilvl .ValAttr =int64 (idx );};
|
|
|
|
// SetPrimaryStyle marks the style as a primary style.
|
|
func (_efced Style )SetPrimaryStyle (b bool ){if b {_efced ._ffabb .QFormat =_dag .NewCT_OnOff ();}else {_efced ._ffabb .QFormat =nil ;};};
|
|
|
|
// SetCellSpacingPercent sets the cell spacing within a table to a percent width.
|
|
func (_ffedb TableStyleProperties )SetCellSpacingPercent (pct float64 ){_ffedb ._afeg .TblCellSpacing =_dag .NewCT_TblWidth ();_ffedb ._afeg .TblCellSpacing .TypeAttr =_dag .ST_TblWidthPct ;_ffedb ._afeg .TblCellSpacing .WAttr =&_dag .ST_MeasurementOrPercent {};_ffedb ._afeg .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent =&_dag .ST_DecimalNumberOrPercent {};_ffedb ._afeg .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_g .Int64 (int64 (pct *50));};
|
|
|
|
// ReplaceText replace text inside node.
|
|
func (_gbfb *Nodes )ReplaceText (oldText ,newText string ){for _ ,_bcbc :=range _gbfb ._cace {_bcbc .ReplaceText (oldText ,newText );};};func (_ffea Paragraph )addFldChar ()*_dag .CT_FldChar {_eecee :=_ffea .AddRun ();_baffa :=_eecee .X ();_bbga :=_dag .NewEG_RunInnerContent ();_fbgbg :=_dag .NewCT_FldChar ();_bbga .FldChar =_fbgbg ;_baffa .EG_RunInnerContent =append (_baffa .EG_RunInnerContent ,_bbga );return _fbgbg ;};
|
|
|
|
// SetThemeColor sets the color from the theme.
|
|
func (_cabf Color )SetThemeColor (t _dag .ST_ThemeColor ){_cabf ._dcb .ThemeColorAttr =t };
|
|
|
|
// Numbering is the document wide numbering styles contained in numbering.xml.
|
|
type Numbering struct{_bagd *_dag .Numbering };
|
|
|
|
// Style return the table style.
|
|
func (_gbdf Table )Style ()string {if _gbdf ._acbcf .TblPr !=nil &&_gbdf ._acbcf .TblPr .TblStyle !=nil {return _gbdf ._acbcf .TblPr .TblStyle .ValAttr ;};return "";};
|
|
|
|
// SetAllowOverlapAttr sets the allowOverlap attribute of anchor.
|
|
func (_ad AnchoredDrawing )SetAllowOverlapAttr (val bool ){_ad ._af .AllowOverlapAttr =val };
|
|
|
|
// SetHighlight highlights text in a specified color.
|
|
func (_bcfe RunProperties )SetHighlight (c _dag .ST_HighlightColor ){_bcfe ._becb .Highlight =_dag .NewCT_Highlight ();_bcfe ._becb .Highlight .ValAttr =c ;};func _ebfd (_fdae *_dag .CT_P ,_ffedf *_dag .CT_Hyperlink ,_bgdd *TableInfo ,_adfc *DrawingInfo ,_eeab []*_dag .EG_ContentRunContent )[]TextItem {_gecf :=[]TextItem {};for _ ,_cefe :=range _eeab {if _dffd :=_cefe .Sdt ;_dffd !=nil {if _faae :=_dffd .SdtContent ;_faae !=nil {_gecf =append (_gecf ,_ebfd (_fdae ,_ffedf ,_bgdd ,_adfc ,_faae .EG_ContentRunContent )...);};};if _dcfaf :=_cefe .R ;_dcfaf !=nil {_cebad :=_ag .NewBuffer ([]byte {});for _ ,_ffdaa :=range _dcfaf .EG_RunInnerContent {if _ffdaa .Br !=nil {_cebad .WriteString ("\u000a");};if _ffdaa .Tab !=nil {_cebad .WriteString ("\u0009");};if _ffdaa .T !=nil &&_ffdaa .T .Content !=""{_cebad .WriteString (_ffdaa .T .Content );};if _ffdaa .Pict !=nil &&len (_ffdaa .Pict .Any )> 0{for _ ,_dgfab :=range _ffdaa .Pict .Any {if _ffcab ,_acce :=_dgfab .(*_ec .Shape );_acce {for _ ,_fbbc :=range _ffcab .EG_ShapeElements {if _acfd :=_fbbc .Textbox ;_acfd !=nil {if _acfd .TxbxContent !=nil {_gecf =append (_gecf ,_fgdaa (_acfd .TxbxContent .EG_ContentBlockContent ,nil )...);};};};};};};};_gecf =append (_gecf ,TextItem {Text :_cebad .String (),DrawingInfo :_adfc ,Paragraph :_fdae ,Hyperlink :_ffedf ,Run :_dcfaf ,TableInfo :_bgdd });for _ ,_bbfe :=range _dcfaf .Extra {if _becg ,_efde :=_bbfe .(*_dag .AlternateContentRun );_efde {_fdac :=&DrawingInfo {Drawing :_becg .Choice .Drawing };for _ ,_dbdb :=range _fdac .Drawing .Anchor {for _ ,_daeb :=range _dbdb .Graphic .GraphicData .Any {if _acea ,_dbec :=_daeb .(*_dag .WdWsp );_dbec {if _acea .WChoice !=nil {if _ddag :=_acea .SpPr ;_ddag !=nil {if _ebga :=_ddag .Xfrm ;_ebga !=nil {if _eggf :=_ebga .Ext ;_eggf !=nil {_fdac .Width =_eggf .CxAttr ;_fdac .Height =_eggf .CyAttr ;};};};for _ ,_dbbaf :=range _acea .WChoice .Txbx .TxbxContent .EG_ContentBlockContent {_gecf =append (_gecf ,_ffaa (_dbbaf .P ,_bgdd ,_fdac )...);};};};};};};};};};return _gecf ;};
|
|
|
|
// SetTextStyleItalic set text style of watermark to italic.
|
|
func (_afce *WatermarkText )SetTextStyleItalic (value bool ){if _afce ._efac !=nil {_gfab :=_afce .GetStyle ();_gfab .SetItalic (value );_afce .SetStyle (_gfab );};};
|
|
|
|
// Properties returns the run properties.
|
|
func (_baace Run )Properties ()RunProperties {if _baace ._ccad .RPr ==nil {_baace ._ccad .RPr =_dag .NewCT_RPr ();};return RunProperties {_baace ._ccad .RPr };};
|
|
|
|
// CellProperties are a table cells properties within a document.
|
|
type CellProperties struct{_bce *_dag .CT_TcPr };
|
|
|
|
// SetShadow sets the run to shadowed text.
|
|
func (_adbfa RunProperties )SetShadow (b bool ){if !b {_adbfa ._becb .Shadow =nil ;}else {_adbfa ._becb .Shadow =_dag .NewCT_OnOff ();};};
|
|
|
|
// 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 (_fadb *Document )AddImage (i _cd .Image )(_cd .ImageRef ,error ){_adf :=_cd .MakeImageRef (i ,&_fadb .DocBase ,_fadb ._dbce );if i .Data ==nil &&i .Path ==""{return _adf ,_de .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 _adf ,_de .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 _adf ,_de .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 !=""{_gfcb :=_bg .Add (i .Path );if _gfcb !=nil {return _adf ,_gfcb ;};};_fadb .Images =append (_fadb .Images ,_adf );_dbe :=_ga .Sprintf ("\u006d\u0065d\u0069\u0061\u002fi\u006d\u0061\u0067\u0065\u0025\u0064\u002e\u0025\u0073",len (_fadb .Images ),i .Format );_ddedd :=_fadb ._dbce .AddRelationship (_dbe ,_g .ImageType );_fadb .ContentTypes .EnsureDefault ("\u0070\u006e\u0067","\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg");_fadb .ContentTypes .EnsureDefault ("\u006a\u0070\u0065\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_fadb .ContentTypes .EnsureDefault ("\u006a\u0070\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_fadb .ContentTypes .EnsureDefault ("\u0077\u006d\u0066","i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066");_fadb .ContentTypes .EnsureDefault (i .Format ,"\u0069\u006d\u0061\u0067\u0065\u002f"+i .Format );_adf .SetRelID (_ddedd .X ().IdAttr );_adf .SetTarget (_dbe );return _adf ,nil ;};func _fffea (_dcdae *Document ,_fcfge []*_dag .EG_ContentBlockContent ,_aeda *TableInfo )[]Node {_bfee :=[]Node {};for _ ,_bdaf :=range _fcfge {if _feff :=_bdaf .Sdt ;_feff !=nil {if _adeed :=_feff .SdtContent ;_adeed !=nil {_bfee =append (_bfee ,_ffcd (_dcdae ,_adeed .P ,_aeda ,nil )...);};};_bfee =append (_bfee ,_ffcd (_dcdae ,_bdaf .P ,_aeda ,nil )...);for _ ,_gfbg :=range _bdaf .Tbl {_aaac :=Table {_dcdae ,_gfbg };_aecg ,_ :=_dcdae .Styles .SearchStyleById (_aaac .Style ());_ggecd :=[]Node {};for _cafd ,_aab :=range _gfbg .EG_ContentRowContent {for _ ,_bdfcg :=range _aab .Tr {for _gded ,_gbged :=range _bdfcg .EG_ContentCellContent {for _ ,_bfffa :=range _gbged .Tc {_caaf :=&TableInfo {Table :_gfbg ,Row :_bdfcg ,Cell :_bfffa ,RowIndex :_cafd ,ColIndex :_gded };for _ ,_dagc :=range _bfffa .EG_BlockLevelElts {_ggecd =append (_ggecd ,_fffea (_dcdae ,_dagc .EG_ContentBlockContent ,_caaf )...);};};};};};_bfee =append (_bfee ,Node {_efgg :_dcdae ,_dgag :&_aaac ,Style :_aecg ,Children :_ggecd });};};return _bfee ;};
|
|
|
|
// SetUISortOrder controls the order the style is displayed in the UI.
|
|
func (_cfega Style )SetUISortOrder (order int ){_cfega ._ffabb .UiPriority =_dag .NewCT_DecimalNumber ();_cfega ._ffabb .UiPriority .ValAttr =int64 (order );};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_bgecb Style )X ()*_dag .CT_Style {return _bgecb ._ffabb };func (_eggaf Paragraph )addEndBookmark (_bbed int64 )*_dag .CT_MarkupRange {_bdcgg :=_dag .NewEG_PContent ();_eggaf ._gbfgc .EG_PContent =append (_eggaf ._gbfgc .EG_PContent ,_bdcgg );_cddg :=_dag .NewEG_ContentRunContent ();_ffceg :=_dag .NewEG_RunLevelElts ();_dfeg :=_dag .NewEG_RangeMarkupElements ();_edea :=_dag .NewCT_MarkupRange ();_edea .IdAttr =_bbed ;_dfeg .BookmarkEnd =_edea ;_bdcgg .EG_ContentRunContent =append (_bdcgg .EG_ContentRunContent ,_cddg );_cddg .EG_RunLevelElts =append (_cddg .EG_RunLevelElts ,_ffceg );_ffceg .EG_RangeMarkupElements =append (_ffceg .EG_RangeMarkupElements ,_dfeg );return _edea ;};
|
|
|
|
// FindNodeByStyleId return slice of node base on style id.
|
|
func (_bbbd *Nodes )FindNodeByStyleId (styleId string )[]Node {_agad :=[]Node {};for _ ,_dfgfg :=range _bbbd ._cace {switch _cccg :=_dfgfg ._dgag .(type ){case *Paragraph :if _cccg !=nil &&_cccg .Style ()==styleId {_agad =append (_agad ,_dfgfg );};case *Table :if _cccg !=nil &&_cccg .Style ()==styleId {_agad =append (_agad ,_dfgfg );};};_degfb :=Nodes {_cace :_dfgfg .Children };_agad =append (_agad ,_degfb .FindNodeByStyleId (styleId )...);};return _agad ;};
|
|
|
|
// SetStart sets the cell start margin
|
|
func (_eae CellMargins )SetStart (d _dd .Distance ){_eae ._cc .Start =_dag .NewCT_TblWidth ();_dbdg (_eae ._cc .Start ,d );};
|
|
|
|
// SetCellSpacing sets the cell spacing within a table.
|
|
func (_cfgc TableProperties )SetCellSpacing (m _dd .Distance ){_cfgc ._befe .TblCellSpacing =_dag .NewCT_TblWidth ();_cfgc ._befe .TblCellSpacing .TypeAttr =_dag .ST_TblWidthDxa ;_cfgc ._befe .TblCellSpacing .WAttr =&_dag .ST_MeasurementOrPercent {};_cfgc ._befe .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent =&_dag .ST_DecimalNumberOrPercent {};_cfgc ._befe .TblCellSpacing .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_g .Int64 (int64 (m /_dd .Dxa ));};
|
|
|
|
// X returns the inner wml.CT_PBdr
|
|
func (_gbcf ParagraphBorders )X ()*_dag .CT_PBdr {return _gbcf ._gfae };
|
|
|
|
// Levels returns all of the numbering levels defined in the definition.
|
|
func (_bcge NumberingDefinition )Levels ()[]NumberingLevel {_fdgc :=[]NumberingLevel {};for _ ,_bebaa :=range _bcge ._edef .Lvl {_fdgc =append (_fdgc ,NumberingLevel {_bebaa });};return _fdgc ;};
|
|
|
|
// VerticalAlign returns the value of paragraph vertical align.
|
|
func (_aged ParagraphProperties )VerticalAlignment ()_ge .ST_VerticalAlignRun {if _bbefg :=_aged ._gfeb .RPr .VertAlign ;_bbefg !=nil {return _bbefg .ValAttr ;};return 0;};
|
|
|
|
// Properties returns the row properties.
|
|
func (_adbbg Row )Properties ()RowProperties {if _adbbg ._gcce .TrPr ==nil {_adbbg ._gcce .TrPr =_dag .NewCT_TrPr ();};return RowProperties {_adbbg ._gcce .TrPr };};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_cdeab NumberingLevel )X ()*_dag .CT_Lvl {return _cdeab ._fbaa };func (_aaeb Paragraph )addInstrText (_gbcg string )*_dag .CT_Text {_affcd :=_aaeb .AddRun ();_dfae :=_affcd .X ();_ggdfd :=_dag .NewEG_RunInnerContent ();_cdbg :=_dag .NewCT_Text ();_eecc :="\u0070\u0072\u0065\u0073\u0065\u0072\u0076\u0065";_cdbg .SpaceAttr =&_eecc ;_cdbg .Content ="\u0020"+_gbcg +"\u0020";_ggdfd .InstrText =_cdbg ;_dfae .EG_RunInnerContent =append (_dfae .EG_RunInnerContent ,_ggdfd );return _cdbg ;};
|
|
|
|
// SetTop sets the top border to a specified type, color and thickness.
|
|
func (_dfdf TableBorders )SetTop (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_dfdf ._dfeff .Top =_dag .NewCT_Border ();_fbgeg (_dfdf ._dfeff .Top ,t ,c ,thickness );};
|
|
|
|
// InsertStyle insert style to styles.
|
|
func (_afdb Styles )InsertStyle (ss Style ){_afdb ._bdad .Style =append (_afdb ._bdad .Style ,ss .X ())};func (_fcfa *Document )getWatermarkHeaderInnerContentPictures ()[]*_dag .CT_Picture {var _baac []*_dag .CT_Picture ;for _ ,_fbbfd :=range _fcfa .Headers (){for _ ,_gafc :=range _fbbfd .X ().EG_ContentBlockContent {for _ ,_gbffd :=range _gafc .P {for _ ,_abb :=range _gbffd .EG_PContent {for _ ,_dbea :=range _abb .EG_ContentRunContent {if _dbea .R ==nil {continue ;};for _ ,_ggac :=range _dbea .R .EG_RunInnerContent {if _ggac .Pict ==nil {continue ;};_fcgd :=false ;for _ ,_afc :=range _ggac .Pict .Any {_efb ,_gbbg :=_afc .(*_g .XSDAny );if _gbbg &&_efb .XMLName .Local =="\u0073\u0068\u0061p\u0065"{_fcgd =true ;};};if _fcgd {_baac =append (_baac ,_ggac .Pict );};};};};};};};return _baac ;};
|
|
|
|
// CharacterSpacingValue returns the value of run's characters spacing in twips (1/20 of point).
|
|
func (_dgfc RunProperties )CharacterSpacingValue ()int64 {if _faca :=_dgfc ._becb .Spacing ;_faca !=nil {_ffgbce :=_faca .ValAttr ;if _ffgbce .Int64 !=nil {return *_ffgbce .Int64 ;};};return int64 (0);};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_gcgf Header )X ()*_dag .Hdr {return _gcgf ._ddaf };
|
|
|
|
// SetAfterSpacing sets spacing below paragraph.
|
|
func (_cffe Paragraph )SetAfterSpacing (d _dd .Distance ){_cffe .ensurePPr ();if _cffe ._gbfgc .PPr .Spacing ==nil {_cffe ._gbfgc .PPr .Spacing =_dag .NewCT_Spacing ();};_bbdb :=_cffe ._gbfgc .PPr .Spacing ;_bbdb .AfterAttr =&_ge .ST_TwipsMeasure {};_bbdb .AfterAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (d /_dd .Twips ));};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_bebg TableLook )X ()*_dag .CT_TblLook {return _bebg ._bfbbe };
|
|
|
|
// SetStartPct sets the cell start margin
|
|
func (_eef CellMargins )SetStartPct (pct float64 ){_eef ._cc .Start =_dag .NewCT_TblWidth ();_efe (_eef ._cc .Start ,pct );};
|
|
|
|
// Font returns the name of paragraph font family.
|
|
func (_ebef ParagraphProperties )Font ()string {if _acef :=_ebef ._gfeb .RPr .RFonts ;_acef !=nil {if _acef .AsciiAttr !=nil {return *_acef .AsciiAttr ;}else if _acef .HAnsiAttr !=nil {return *_acef .HAnsiAttr ;}else if _acef .CsAttr !=nil {return *_acef .CsAttr ;};};return "";};
|
|
|
|
// SetFormat sets the numbering format.
|
|
func (_cbbb NumberingLevel )SetFormat (f _dag .ST_NumberFormat ){if _cbbb ._fbaa .NumFmt ==nil {_cbbb ._fbaa .NumFmt =_dag .NewCT_NumFmt ();};_cbbb ._fbaa .NumFmt .ValAttr =f ;};
|
|
|
|
// Paragraph is a paragraph within a document.
|
|
type Paragraph struct{_ebddd *Document ;_gbfgc *_dag .CT_P ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_cdbgf ParagraphStyleProperties )X ()*_dag .CT_PPrGeneral {return _cdbgf ._ffgg };
|
|
|
|
// 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 (_caad *Document )Validate ()error {if _caad ==nil ||_caad ._ceeb ==nil {return _de .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 _ ,_agg :=range []func ()error {_caad .validateTableCells ,_caad .validateBookmarks }{if _bdfc :=_agg ();_bdfc !=nil {return _bdfc ;};};if _dcfa :=_caad ._ceeb .Validate ();_dcfa !=nil {return _dcfa ;};return nil ;};
|
|
|
|
// SetAlignment sets the alignment of a table within the page.
|
|
func (_cdfb TableProperties )SetAlignment (align _dag .ST_JcTable ){if align ==_dag .ST_JcTableUnset {_cdfb ._befe .Jc =nil ;}else {_cdfb ._befe .Jc =_dag .NewCT_JcTable ();_cdfb ._befe .Jc .ValAttr =align ;};};func (_aebc Footnote )id ()int64 {return _aebc ._eefc .IdAttr };
|
|
|
|
// SetWidth sets the table with to a specified width.
|
|
func (_bcea TableProperties )SetWidth (d _dd .Distance ){_bcea ._befe .TblW =_dag .NewCT_TblWidth ();_bcea ._befe .TblW .TypeAttr =_dag .ST_TblWidthDxa ;_bcea ._befe .TblW .WAttr =&_dag .ST_MeasurementOrPercent {};_bcea ._befe .TblW .WAttr .ST_DecimalNumberOrPercent =&_dag .ST_DecimalNumberOrPercent {};_bcea ._befe .TblW .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_g .Int64 (int64 (d /_dd .Twips ));};
|
|
|
|
// ExtractFromHeader returns text from the document header as an array of TextItems.
|
|
func ExtractFromHeader (header *_dag .Hdr )[]TextItem {return _fgdaa (header .EG_ContentBlockContent ,nil );};
|
|
|
|
// Text return node and its child text,
|
|
func (_gcag *Node )Text ()string {_afae :=_ag .NewBuffer ([]byte {});switch _efaff :=_gcag .X ().(type ){case *Paragraph :for _ ,_ccabd :=range _efaff .Runs (){if _ccabd .Text ()!=""{_afae .WriteString (_ccabd .Text ());_afae .WriteString ("\u000a");};};};for _ ,_bbcbcc :=range _gcag .Children {_afae .WriteString (_bbcbcc .Text ());};return _afae .String ();};
|
|
|
|
// ClearColor clears the text color.
|
|
func (_babb RunProperties )ClearColor (){_babb ._becb .Color =nil };
|
|
|
|
// Borders returns the ParagraphBorders for setting-up border on paragraph.
|
|
func (_bgdfd Paragraph )Borders ()ParagraphBorders {_bgdfd .ensurePPr ();if _bgdfd ._gbfgc .PPr .PBdr ==nil {_bgdfd ._gbfgc .PPr .PBdr =_dag .NewCT_PBdr ();};return ParagraphBorders {_bgdfd ._ebddd ,_bgdfd ._gbfgc .PPr .PBdr };};
|
|
|
|
// SetStyle sets style to the text in watermark.
|
|
func (_bdeac *WatermarkText )SetStyle (style _fgcb .TextpathStyle ){_cdage :=_bdeac .getShape ();if _bdeac ._efac !=nil {_fgga :=_bdeac ._efac .EG_ShapeElements ;if len (_fgga )> 0&&_fgga [0].Textpath !=nil {var _gccc =style .String ();_fgga [0].Textpath .StyleAttr =&_gccc ;};return ;};_ffaf :=_bdeac .findNode (_cdage ,"\u0074\u0065\u0078\u0074\u0070\u0061\u0074\u0068");for _adadc ,_dgaf :=range _ffaf .Attrs {if _dgaf .Name .Local =="\u0073\u0074\u0079l\u0065"{_ffaf .Attrs [_adadc ].Value =style .String ();};};};
|
|
|
|
// StructuredDocumentTag are a tagged bit of content in a document.
|
|
type StructuredDocumentTag struct{_dffad *Document ;_cdedb *_dag .CT_SdtBlock ;};
|
|
|
|
// Clear removes all of the content from within a run.
|
|
func (_bbfa Run )Clear (){_bbfa ._ccad .EG_RunInnerContent =nil };func (_feffg Run )newIC ()*_dag .EG_RunInnerContent {_ccaad :=_dag .NewEG_RunInnerContent ();_feffg ._ccad .EG_RunInnerContent =append (_feffg ._ccad .EG_RunInnerContent ,_ccaad );return _ccaad ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_dgfed HyperLink )X ()*_dag .CT_Hyperlink {return _dgfed ._abfc };
|
|
|
|
// Bookmark is a bookmarked location within a document that can be referenced
|
|
// with a hyperlink.
|
|
type Bookmark struct{_dcc *_dag .CT_Bookmark };
|
|
|
|
// ComplexSizeValue returns the value of paragraph font size for complex fonts in points.
|
|
func (_debb ParagraphProperties )ComplexSizeValue ()float64 {if _ggbc :=_debb ._gfeb .RPr .SzCs ;_ggbc !=nil {_ggfc :=_ggbc .ValAttr ;if _ggfc .ST_UnsignedDecimalNumber !=nil {return float64 (*_ggfc .ST_UnsignedDecimalNumber )/2;};};return 0.0;};
|
|
|
|
// SetSemiHidden controls if the style is hidden in the UI.
|
|
func (_dega Style )SetSemiHidden (b bool ){if b {_dega ._ffabb .SemiHidden =_dag .NewCT_OnOff ();}else {_dega ._ffabb .SemiHidden =nil ;};};func (_adbg Footnote )content ()[]*_dag .EG_ContentBlockContent {var _dedab []*_dag .EG_ContentBlockContent ;for _ ,_agag :=range _adbg ._eefc .EG_BlockLevelElts {_dedab =append (_dedab ,_agag .EG_ContentBlockContent ...);};return _dedab ;};
|
|
|
|
// AbstractNumberID returns the ID that is unique within all numbering
|
|
// definitions that is used to assign the definition to a paragraph.
|
|
func (_facdc NumberingDefinition )AbstractNumberID ()int64 {return _facdc ._edef .AbstractNumIdAttr };
|
|
|
|
// 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 (_eabe Paragraph )AddBookmark (name string )Bookmark {_gdfab :=_dag .NewEG_PContent ();_bcada :=_dag .NewEG_ContentRunContent ();_gdfab .EG_ContentRunContent =append (_gdfab .EG_ContentRunContent ,_bcada );_dbfea :=_dag .NewEG_RunLevelElts ();_bcada .EG_RunLevelElts =append (_bcada .EG_RunLevelElts ,_dbfea );_dgde :=_dag .NewEG_RangeMarkupElements ();_gccge :=_dag .NewCT_Bookmark ();_dgde .BookmarkStart =_gccge ;_dbfea .EG_RangeMarkupElements =append (_dbfea .EG_RangeMarkupElements ,_dgde );_dgde =_dag .NewEG_RangeMarkupElements ();_dgde .BookmarkEnd =_dag .NewCT_MarkupRange ();_dbfea .EG_RangeMarkupElements =append (_dbfea .EG_RangeMarkupElements ,_dgde );_eabe ._gbfgc .EG_PContent =append (_eabe ._gbfgc .EG_PContent ,_gdfab );_dfbd :=Bookmark {_gccge };_dfbd .SetName (name );return _dfbd ;};
|
|
|
|
// Text returns text from the document as one string separated with line breaks.
|
|
func (_babcg *DocText )Text ()string {_bffdae :=_ag .NewBuffer ([]byte {});for _ ,_bgfaa :=range _babcg .Items {if _bgfaa .Text !=""{_bffdae .WriteString (_bgfaa .Text );_bffdae .WriteString ("\u000a");};};return _bffdae .String ();};
|
|
|
|
// NewSettings constructs a new empty Settings
|
|
func NewSettings ()Settings {_eeabb :=_dag .NewSettings ();_eeabb .Compat =_dag .NewCT_Compat ();_bdgc :=_dag .NewCT_CompatSetting ();_bdgc .NameAttr =_g .String ("\u0063\u006f\u006d\u0070\u0061\u0074\u0069\u0062\u0069\u006c\u0069\u0074y\u004d\u006f\u0064\u0065");_bdgc .UriAttr =_g .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");_bdgc .ValAttr =_g .String ("\u0031\u0035");_eeabb .Compat .CompatSetting =append (_eeabb .Compat .CompatSetting ,_bdgc );return Settings {_eeabb };};
|
|
|
|
// CharacterSpacingMeasure returns paragraph characters spacing with its measure which can be mm, cm, in, pt, pc or pi.
|
|
func (_fcgaa ParagraphProperties )CharacterSpacingMeasure ()string {if _bagf :=_fcgaa ._gfeb .RPr .Spacing ;_bagf !=nil {_agbdd :=_bagf .ValAttr ;if _agbdd .ST_UniversalMeasure !=nil {return *_agbdd .ST_UniversalMeasure ;};};return "";};
|
|
|
|
// AppendNode append node to document element.
|
|
func (_eabc *Document )AppendNode (node Node ){_eabc .insertImageFromNode (node );_eabc .insertStyleFromNode (node );for _ ,_cdfc :=range node .Children {_eabc .insertImageFromNode (_cdfc );_eabc .insertStyleFromNode (_cdfc );};switch _bdffe :=node .X ().(type ){case *Paragraph :_eabc .appendParagraph (nil ,*_bdffe ,false );case *Table :_eabc .appendTable (nil ,*_bdffe ,false );};if node ._efgg !=nil {if node ._efgg ._gdfa !=nil {if _gbedg :=_eabc ._dbce .FindRIDForN (0,_g .ThemeType );_gbedg ==""{if _cagf :=node ._efgg ._dbce .FindRIDForN (0,_g .ThemeType );_cagf !=""{_eabc ._gdfa =append (_eabc ._gdfa ,node ._efgg ._gdfa ...);_dgfe :=node ._efgg ._dbce .GetTargetByRelId (_cagf );_eabc .ContentTypes .AddOverride ("\u002f\u0077\u006f\u0072\u0064\u002f"+_dgfe ,"\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");_eabc ._dbce .AddRelationship (_dgfe ,_g .ThemeType );};};};_acdf :=_eabc ._dbac ;_bgce :=node ._efgg ._dbac ;if _acdf !=nil {if _bgce !=nil {if _acdf .Font !=nil {if _bgce .Font !=nil {for _ ,_ffdc :=range _bgce .Font {_ggaf :=true ;for _ ,_cagb :=range _acdf .Font {if _cagb .NameAttr ==_ffdc .NameAttr {_ggaf =false ;break ;};};if _ggaf {_acdf .Font =append (_acdf .Font ,_ffdc );};};};}else {_acdf .Font =_bgce .Font ;};};}else if _bgce !=nil {_acdf =_bgce ;};_eabc ._dbac =_acdf ;if _dgbf :=_eabc ._dbce .FindRIDForN (0,_g .FontTableType );_dgbf ==""{_eabc .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");_eabc ._dbce .AddRelationship ("\u0066\u006f\u006e\u0074\u0054\u0061\u0062\u006c\u0065\u002e\u0078\u006d\u006c",_g .FontTableType );};};};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_agage TableStyleProperties )X ()*_dag .CT_TblPrBase {return _agage ._afeg };
|
|
|
|
// RemoveParagraph removes a paragraph from a footer.
|
|
func (_bcac Footer )RemoveParagraph (p Paragraph ){for _ ,_fdg :=range _bcac ._gbdc .EG_ContentBlockContent {for _adee ,_cbcdb :=range _fdg .P {if _cbcdb ==p ._gbfgc {copy (_fdg .P [_adee :],_fdg .P [_adee +1:]);_fdg .P =_fdg .P [0:len (_fdg .P )-1];return ;};};};};
|
|
|
|
// Open opens and reads a document from a file (.docx).
|
|
func Open (filename string )(*Document ,error ){_gcff ,_bggd :=_gg .Open (filename );if _bggd !=nil {return nil ,_ga .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,_bggd );};defer _gcff .Close ();_gefg ,_bggd :=_gg .Stat (filename );if _bggd !=nil {return nil ,_ga .Errorf ("e\u0072r\u006f\u0072\u0020\u006f\u0070\u0065\u006e\u0069n\u0067\u0020\u0025\u0073: \u0025\u0073",filename ,_bggd );};_ =_gefg ;return Read (_gcff ,_gefg .Size ());};
|
|
|
|
// Pict returns the pict object.
|
|
func (_fafa *WatermarkPicture )Pict ()*_dag .CT_Picture {return _fafa ._ecfd };
|
|
|
|
// ParagraphProperties are the properties for a paragraph.
|
|
type ParagraphProperties struct{_fbcc *Document ;_gfeb *_dag .CT_PPr ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_dfba Styles )X ()*_dag .Styles {return _dfba ._bdad };
|
|
|
|
// TextWithOptions extract text with options.
|
|
func (_acgca *DocText )TextWithOptions (options ExtractTextOptions )string {_efcd :=make (map[int64 ]map[int64 ]int64 ,0);_gfce :=_ag .NewBuffer ([]byte {});_beabe :=int64 (0);_feac :=int64 (0);_cdgee :=int64 (0);for _cgbb ,_dccf :=range _acgca .Items {_bcdb :=false ;if _dccf .Text !=""{if _cgbb > 0{if _dccf .Paragraph !=_acgca .Items [_cgbb -1].Paragraph {_bcdb =true ;};if !options .RunsOnNewLine &&_bcdb {_gfce .WriteString ("\u000a");}else if options .RunsOnNewLine {_gfce .WriteString ("\u000a");};}else {_bcdb =true ;};if options .WithNumbering {if _bcdb {for _ ,_edeb :=range _acgca ._acabb {if _edeb .FromParagraph ==nil {continue ;};if _edeb .FromParagraph .X ()==_dccf .Paragraph {if _fcbd :=_edeb .NumberingLevel .X ();_fcbd !=nil {if _edeb .AbstractNumId !=nil &&_acgca ._dbcb [*_edeb .AbstractNumId ][_fcbd .IlvlAttr ]> 0{if _ ,_gca :=_efcd [*_edeb .AbstractNumId ];_gca {if _ ,_fbgc :=_efcd [*_edeb .AbstractNumId ][_fcbd .IlvlAttr ];_fbgc {_efcd [*_edeb .AbstractNumId ][_fcbd .IlvlAttr ]++;}else {_efcd [*_edeb .AbstractNumId ][_fcbd .IlvlAttr ]=1;};}else {_efcd [*_edeb .AbstractNumId ]=map[int64 ]int64 {_fcbd .IlvlAttr :1};};if _beabe ==_edeb .NumberingLevel .X ().IlvlAttr &&_fcbd .IlvlAttr > 0{_feac ++;}else {_feac =_efcd [*_edeb .AbstractNumId ][_fcbd .IlvlAttr ];if _fcbd .IlvlAttr > _beabe &&_cdgee ==*_edeb .AbstractNumId {_feac =1;};};_gddb :="";if _fcbd .LvlText .ValAttr !=nil {_gddb =*_fcbd .LvlText .ValAttr ;};_caage :=_aa .FormatNumberingText (_feac ,_fcbd .IlvlAttr ,_gddb ,_fcbd .NumFmt ,_efcd [*_edeb .AbstractNumId ]);_gfce .WriteString (_caage );_acgca ._dbcb [*_edeb .AbstractNumId ][_fcbd .IlvlAttr ]--;_beabe =_fcbd .IlvlAttr ;_cdgee =*_edeb .AbstractNumId ;if options .NumberingIndent !=""{_gfce .WriteString (options .NumberingIndent );};};};break ;};};};};_gfce .WriteString (_dccf .Text );};};return _gfce .String ();};
|
|
|
|
// SetAfterLineSpacing sets spacing below paragraph in line units.
|
|
func (_dbbfb Paragraph )SetAfterLineSpacing (d _dd .Distance ){_dbbfb .ensurePPr ();if _dbbfb ._gbfgc .PPr .Spacing ==nil {_dbbfb ._gbfgc .PPr .Spacing =_dag .NewCT_Spacing ();};_fbcb :=_dbbfb ._gbfgc .PPr .Spacing ;_fbcb .AfterLinesAttr =_g .Int64 (int64 (d /_dd .Twips ));};
|
|
|
|
// SetRightIndent controls right indent of paragraph.
|
|
func (_dgeg Paragraph )SetRightIndent (m _dd .Distance ){_dgeg .ensurePPr ();_dcae :=_dgeg ._gbfgc .PPr ;if _dcae .Ind ==nil {_dcae .Ind =_dag .NewCT_Ind ();};if m ==_dd .Zero {_dcae .Ind .RightAttr =nil ;}else {_dcae .Ind .RightAttr =&_dag .ST_SignedTwipsMeasure {};_dcae .Ind .RightAttr .Int64 =_g .Int64 (int64 (m /_dd .Twips ));};};func (_dfabc *WatermarkText )getShape ()*_g .XSDAny {return _dfabc .getInnerElement ("\u0073\u0068\u0061p\u0065");};
|
|
|
|
// AddTabStop adds a tab stop to the paragraph. It controls the position of text when using Run.AddTab()
|
|
func (_egeac ParagraphProperties )AddTabStop (position _dd .Distance ,justificaton _dag .ST_TabJc ,leader _dag .ST_TabTlc ){if _egeac ._gfeb .Tabs ==nil {_egeac ._gfeb .Tabs =_dag .NewCT_Tabs ();};_dbfdc :=_dag .NewCT_TabStop ();_dbfdc .LeaderAttr =leader ;_dbfdc .ValAttr =justificaton ;_dbfdc .PosAttr .Int64 =_g .Int64 (int64 (position /_dd .Twips ));_egeac ._gfeb .Tabs .Tab =append (_egeac ._gfeb .Tabs .Tab ,_dbfdc );};func (_cecd Paragraph )addSeparateFldChar ()*_dag .CT_FldChar {_ggae :=_cecd .addFldChar ();_ggae .FldCharTypeAttr =_dag .ST_FldCharTypeSeparate ;return _ggae ;};func (_cfcf *Document )validateBookmarks ()error {_dga :=make (map[string ]struct{});for _ ,_ccc :=range _cfcf .Bookmarks (){if _ ,_eff :=_dga [_ccc .Name ()];_eff {return _ga .Errorf ("d\u0075\u0070\u006c\u0069\u0063\u0061t\u0065\u0020\u0062\u006f\u006f\u006b\u006d\u0061\u0072k\u0020\u0025\u0073 \u0066o\u0075\u006e\u0064",_ccc .Name ());};_dga [_ccc .Name ()]=struct{}{};};return nil ;};
|
|
|
|
// Borders allows controlling individual cell borders.
|
|
func (_dba CellProperties )Borders ()CellBorders {if _dba ._bce .TcBorders ==nil {_dba ._bce .TcBorders =_dag .NewCT_TcBorders ();};return CellBorders {_dba ._bce .TcBorders };};
|
|
|
|
// SetInsideVertical sets the interior vertical borders to a specified type, color and thickness.
|
|
func (_aed CellBorders )SetInsideVertical (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_aed ._gbe .InsideV =_dag .NewCT_Border ();_fbgeg (_aed ._gbe .InsideV ,t ,c ,thickness );};
|
|
|
|
// AddParagraph adds a new paragraph to the document body.
|
|
func (_caa *Document )AddParagraph ()Paragraph {_bded :=_dag .NewEG_BlockLevelElts ();_caa ._ceeb .Body .EG_BlockLevelElts =append (_caa ._ceeb .Body .EG_BlockLevelElts ,_bded );_fgf :=_dag .NewEG_ContentBlockContent ();_bded .EG_ContentBlockContent =append (_bded .EG_ContentBlockContent ,_fgf );_dfa :=_dag .NewCT_P ();_fgf .P =append (_fgf .P ,_dfa );return Paragraph {_caa ,_dfa };};
|
|
|
|
// IsBold returns true if the run has been set to bold.
|
|
func (_eeaad RunProperties )IsBold ()bool {return _eeaad .BoldValue ()==OnOffValueOn };
|
|
|
|
// SetBottom sets the bottom border to a specified type, color and thickness.
|
|
func (_gddg CellBorders )SetBottom (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_gddg ._gbe .Bottom =_dag .NewCT_Border ();_fbgeg (_gddg ._gbe .Bottom ,t ,c ,thickness );};
|
|
|
|
// Paragraphs returns the paragraphs defined in a footer.
|
|
func (_dfcef Footer )Paragraphs ()[]Paragraph {_ffef :=[]Paragraph {};for _ ,_dcgcc :=range _dfcef ._gbdc .EG_ContentBlockContent {for _ ,_cbec :=range _dcgcc .P {_ffef =append (_ffef ,Paragraph {_dfcef ._cdfa ,_cbec });};};for _ ,_aefbc :=range _dfcef .Tables (){for _ ,_feagc :=range _aefbc .Rows (){for _ ,_ddfeg :=range _feagc .Cells (){_ffef =append (_ffef ,_ddfeg .Paragraphs ()...);};};};return _ffef ;};
|
|
|
|
// SetEffect sets a text effect on the run.
|
|
func (_bbdc RunProperties )SetEffect (e _dag .ST_TextEffect ){if e ==_dag .ST_TextEffectUnset {_bbdc ._becb .Effect =nil ;}else {_bbdc ._becb .Effect =_dag .NewCT_TextEffect ();_bbdc ._becb .Effect .ValAttr =e ;};};
|
|
|
|
// SetLineSpacing controls the line spacing of the paragraph.
|
|
func (_eabb ParagraphStyleProperties )SetLineSpacing (m _dd .Distance ,rule _dag .ST_LineSpacingRule ){if _eabb ._ffgg .Spacing ==nil {_eabb ._ffgg .Spacing =_dag .NewCT_Spacing ();};if rule ==_dag .ST_LineSpacingRuleUnset {_eabb ._ffgg .Spacing .LineRuleAttr =_dag .ST_LineSpacingRuleUnset ;_eabb ._ffgg .Spacing .LineAttr =nil ;}else {_eabb ._ffgg .Spacing .LineRuleAttr =rule ;_eabb ._ffgg .Spacing .LineAttr =&_dag .ST_SignedTwipsMeasure {};_eabb ._ffgg .Spacing .LineAttr .Int64 =_g .Int64 (int64 (m /_dd .Twips ));};};
|
|
|
|
// SetCalcOnExit marks if a FormField should be CalcOnExit or not.
|
|
func (_fabb FormField )SetCalcOnExit (calcOnExit bool ){_fgea :=_dag .NewCT_OnOff ();_fgea .ValAttr =&_ge .ST_OnOff {Bool :&calcOnExit };_fabb ._dgfaa .CalcOnExit =[]*_dag .CT_OnOff {_fgea };};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_afbf InlineDrawing )X ()*_dag .WdInline {return _afbf ._cafea };
|
|
|
|
// Save writes the document to an io.Writer in the Zip package format.
|
|
func (_fae *Document )Save (w _da .Writer )error {return _fae .save (w ,_fae ._fgcbc )};
|
|
|
|
// AddRun adds a run of text to a hyperlink. This is the text that will be linked.
|
|
func (_ebgab HyperLink )AddRun ()Run {_faaa :=_dag .NewEG_ContentRunContent ();_ebgab ._abfc .EG_ContentRunContent =append (_ebgab ._abfc .EG_ContentRunContent ,_faaa );_egdd :=_dag .NewCT_R ();_faaa .R =_egdd ;return Run {_ebgab ._fceaa ,_egdd };};
|
|
|
|
// SetBeforeAuto controls if spacing before a paragraph is automatically determined.
|
|
func (_ebcge ParagraphSpacing )SetBeforeAuto (b bool ){if b {_ebcge ._bced .BeforeAutospacingAttr =&_ge .ST_OnOff {};_ebcge ._bced .BeforeAutospacingAttr .Bool =_g .Bool (true );}else {_ebcge ._bced .BeforeAutospacingAttr =nil ;};};
|
|
|
|
// AnchoredDrawing is an absolutely positioned image within a document page.
|
|
type AnchoredDrawing struct{_fc *Document ;_af *_dag .WdAnchor ;};func _bdbg ()*_ec .Formulas {_deggd :=_ec .NewFormulas ();_deggd .F =[]*_ec .CT_F {_fgcb .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"),_fgcb .CreateFormula ("\u0073\u0075\u006d\u0020\u0040\u0030\u0020\u0031\u0020\u0030"),_fgcb .CreateFormula ("\u0073\u0075\u006d\u0020\u0030\u0020\u0030\u0020\u0040\u0031"),_fgcb .CreateFormula ("p\u0072\u006f\u0064\u0020\u0040\u0032\u0020\u0031\u0020\u0032"),_fgcb .CreateFormula ("\u0070r\u006f\u0064\u0020\u0040\u0033\u0020\u0032\u0031\u0036\u0030\u0030 \u0070\u0069\u0078\u0065\u006c\u0057\u0069\u0064\u0074\u0068"),_fgcb .CreateFormula ("\u0070r\u006f\u0064\u0020\u00403\u0020\u0032\u0031\u0036\u00300\u0020p\u0069x\u0065\u006c\u0048\u0065\u0069\u0067\u0068t"),_fgcb .CreateFormula ("\u0073\u0075\u006d\u0020\u0040\u0030\u0020\u0030\u0020\u0031"),_fgcb .CreateFormula ("p\u0072\u006f\u0064\u0020\u0040\u0036\u0020\u0031\u0020\u0032"),_fgcb .CreateFormula ("\u0070r\u006f\u0064\u0020\u0040\u0037\u0020\u0032\u0031\u0036\u0030\u0030 \u0070\u0069\u0078\u0065\u006c\u0057\u0069\u0064\u0074\u0068"),_fgcb .CreateFormula ("\u0073\u0075\u006d\u0020\u0040\u0038\u0020\u0032\u00316\u0030\u0030\u0020\u0030"),_fgcb .CreateFormula ("\u0070r\u006f\u0064\u0020\u00407\u0020\u0032\u0031\u0036\u00300\u0020p\u0069x\u0065\u006c\u0048\u0065\u0069\u0067\u0068t"),_fgcb .CreateFormula ("\u0073u\u006d \u0040\u0031\u0030\u0020\u0032\u0031\u0036\u0030\u0030\u0020\u0030")};return _deggd ;};
|
|
|
|
// AddWatermarkText adds new watermark text to the document.
|
|
func (_gaegd *Document )AddWatermarkText (text string )WatermarkText {var _cgbe []Header ;if _ebae ,_cfcfb :=_gaegd .BodySection ().GetHeader (_dag .ST_HdrFtrDefault );_cfcfb {_cgbe =append (_cgbe ,_ebae );};if _edd ,_gac :=_gaegd .BodySection ().GetHeader (_dag .ST_HdrFtrEven );_gac {_cgbe =append (_cgbe ,_edd );};if _agge ,_dbdeb :=_gaegd .BodySection ().GetHeader (_dag .ST_HdrFtrFirst );_dbdeb {_cgbe =append (_cgbe ,_agge );};if len (_cgbe )< 1{_feca :=_gaegd .AddHeader ();_gaegd .BodySection ().SetHeader (_feca ,_dag .ST_HdrFtrDefault );_cgbe =append (_cgbe ,_feca );};_gdfg :=NewWatermarkText ();for _ ,_fcgb :=range _cgbe {_aef :=_fcgb .Paragraphs ();if len (_aef )< 1{_fgcc :=_fcgb .AddParagraph ();_fgcc .AddRun ().AddText ("");};for _ ,_egb :=range _fcgb .X ().EG_ContentBlockContent {for _ ,_fgfa :=range _egb .P {for _ ,_bfg :=range _fgfa .EG_PContent {for _ ,_gcb :=range _bfg .EG_ContentRunContent {if _gcb .R ==nil {continue ;};for _ ,_dabd :=range _gcb .R .EG_RunInnerContent {_dabd .Pict =_gdfg ._bgcdc ;break ;};};};};};};_gdfg .SetText (text );return _gdfg ;};
|
|
|
|
// GetHeader gets a section Header for given type t [ST_HdrFtrDefault, ST_HdrFtrEven, ST_HdrFtrFirst]
|
|
func (_cbdgdc Section )GetHeader (t _dag .ST_HdrFtr )(Header ,bool ){for _ ,_bdead :=range _cbdgdc ._gbfbf .EG_HdrFtrReferences {if _bdead .HeaderReference .TypeAttr ==t {for _ ,_egeca :=range _cbdgdc ._cdgeb .Headers (){_acgcag :=_cbdgdc ._cdgeb ._dbce .FindRIDForN (_egeca .Index (),_g .HeaderType );if _acgcag ==_bdead .HeaderReference .IdAttr {return _egeca ,true ;};};};};return Header {},false ;};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_edec Footer )X ()*_dag .Ftr {return _edec ._gbdc };
|
|
|
|
// Nodes return the document's element as nodes.
|
|
func (_agecc *Document )Nodes ()Nodes {_ddgd :=[]Node {};for _ ,_beea :=range _agecc ._ceeb .Body .EG_BlockLevelElts {_ddgd =append (_ddgd ,_fffea (_agecc ,_beea .EG_ContentBlockContent ,nil )...);};if _agecc ._ceeb .Body .SectPr !=nil {_ddgd =append (_ddgd ,Node {_dgag :_agecc ._ceeb .Body .SectPr });};_ccfc :=Nodes {_cace :_ddgd };return _ccfc ;};
|
|
|
|
// GetDocRelTargetByID returns TargetAttr of document relationship given its IdAttr.
|
|
func (_faad *Document )GetDocRelTargetByID (idAttr string )string {for _ ,_dcff :=range _faad ._dbce .X ().Relationship {if _dcff .IdAttr ==idAttr {return _dcff .TargetAttr ;};};return "";};
|
|
|
|
// CellProperties returns the cell properties.
|
|
func (_dfed TableConditionalFormatting )CellProperties ()CellProperties {if _dfed ._cfbcc .TcPr ==nil {_dfed ._cfbcc .TcPr =_dag .NewCT_TcPr ();};return CellProperties {_dfed ._cfbcc .TcPr };};
|
|
|
|
// InsertParagraphAfter adds a new empty paragraph after the relativeTo
|
|
// paragraph.
|
|
func (_cbde *Document )InsertParagraphAfter (relativeTo Paragraph )Paragraph {return _cbde .insertParagraph (relativeTo ,false );};
|
|
|
|
// SetOutline sets the run to outlined text.
|
|
func (_fcaff RunProperties )SetOutline (b bool ){if !b {_fcaff ._becb .Outline =nil ;}else {_fcaff ._becb .Outline =_dag .NewCT_OnOff ();};};
|
|
|
|
// Row is a row within a table within a document.
|
|
type Row struct{_fegg *Document ;_gcce *_dag .CT_Row ;};
|
|
|
|
// SetSize sets the size of the displayed image on the page.
|
|
func (_cbfd InlineDrawing )SetSize (w ,h _dd .Distance ){_cbfd ._cafea .Extent .CxAttr =int64 (float64 (w *_dd .Pixel72 )/_dd .EMU );_cbfd ._cafea .Extent .CyAttr =int64 (float64 (h *_dd .Pixel72 )/_dd .EMU );};
|
|
|
|
// InsertRowAfter inserts a row after another row
|
|
func (_ffcfg Table )InsertRowAfter (r Row )Row {for _dagff ,_agae :=range _ffcfg ._acbcf .EG_ContentRowContent {if len (_agae .Tr )> 0&&r .X ()==_agae .Tr [0]{_afbe :=_dag .NewEG_ContentRowContent ();if len (_ffcfg ._acbcf .EG_ContentRowContent )< _dagff +2{return _ffcfg .AddRow ();};_ffcfg ._acbcf .EG_ContentRowContent =append (_ffcfg ._acbcf .EG_ContentRowContent ,nil );copy (_ffcfg ._acbcf .EG_ContentRowContent [_dagff +2:],_ffcfg ._acbcf .EG_ContentRowContent [_dagff +1:]);_ffcfg ._acbcf .EG_ContentRowContent [_dagff +1]=_afbe ;_gcbb :=_dag .NewCT_Row ();_afbe .Tr =append (_afbe .Tr ,_gcbb );return Row {_ffcfg ._fabdg ,_gcbb };};};return _ffcfg .AddRow ();};
|
|
|
|
// AddDropdownList adds dropdown list form field to the paragraph and returns it.
|
|
func (_eded Paragraph )AddDropdownList (name string )FormField {_ddcg :=_eded .addFldCharsForField (name ,"\u0046\u004f\u0052M\u0044\u0052\u004f\u0050\u0044\u004f\u0057\u004e");_ddcg ._dgfaa .DdList =_dag .NewCT_FFDDList ();return _ddcg ;};
|
|
|
|
// GetText returns text in the watermark.
|
|
func (_cgdb *WatermarkText )GetText ()string {_bccc :=_cgdb .getShape ();if _cgdb ._efac !=nil {_acabg :=_cgdb ._efac .EG_ShapeElements ;if len (_acabg )> 0&&_acabg [0].Textpath !=nil {return *_acabg [0].Textpath .StringAttr ;};}else {_caaae :=_cgdb .findNode (_bccc ,"\u0074\u0065\u0078\u0074\u0070\u0061\u0074\u0068");for _ ,_dccgc :=range _caaae .Attrs {if _dccgc .Name .Local =="\u0073\u0074\u0072\u0069\u006e\u0067"{return _dccgc .Value ;};};};return "";};func _fefd ()*_ec .Formulas {_eeade :=_ec .NewFormulas ();_eeade .F =[]*_ec .CT_F {_fgcb .CreateFormula ("\u0073\u0075\u006d\u0020\u0023\u0030\u0020\u0030\u00201\u0030\u0038\u0030\u0030"),_fgcb .CreateFormula ("p\u0072\u006f\u0064\u0020\u0023\u0030\u0020\u0032\u0020\u0031"),_fgcb .CreateFormula ("\u0073\u0075\u006d\u0020\u0032\u0031\u0036\u0030\u0030 \u0030\u0020\u0040\u0031"),_fgcb .CreateFormula ("\u0073\u0075\u006d\u0020\u0030\u0020\u0030\u0020\u0040\u0032"),_fgcb .CreateFormula ("\u0073\u0075\u006d\u0020\u0032\u0031\u0036\u0030\u0030 \u0030\u0020\u0040\u0033"),_fgcb .CreateFormula ("\u0069\u0066\u0020\u0040\u0030\u0020\u0040\u0033\u0020\u0030"),_fgcb .CreateFormula ("\u0069\u0066\u0020\u0040\u0030\u0020\u0032\u0031\u00360\u0030\u0020\u0040\u0031"),_fgcb .CreateFormula ("\u0069\u0066\u0020\u0040\u0030\u0020\u0030\u0020\u0040\u0032"),_fgcb .CreateFormula ("\u0069\u0066\u0020\u0040\u0030\u0020\u0040\u0034\u00202\u0031\u0036\u0030\u0030"),_fgcb .CreateFormula ("\u006di\u0064\u0020\u0040\u0035\u0020\u00406"),_fgcb .CreateFormula ("\u006di\u0064\u0020\u0040\u0038\u0020\u00405"),_fgcb .CreateFormula ("\u006di\u0064\u0020\u0040\u0037\u0020\u00408"),_fgcb .CreateFormula ("\u006di\u0064\u0020\u0040\u0036\u0020\u00407"),_fgcb .CreateFormula ("s\u0075\u006d\u0020\u0040\u0036\u0020\u0030\u0020\u0040\u0035")};return _eeade ;};
|
|
|
|
// BoldValue returns the precise nature of the bold setting (unset, off or on).
|
|
func (_adbf RunProperties )BoldValue ()OnOffValue {return _gfggb (_adbf ._becb .B )};
|
|
|
|
// ParagraphBorders allows manipulation of borders on a paragraph.
|
|
type ParagraphBorders struct{_bfdc *Document ;_gfae *_dag .CT_PBdr ;};
|
|
|
|
// SetOutlineLevel sets the outline level of this style.
|
|
func (_ebbf ParagraphStyleProperties )SetOutlineLevel (lvl int ){_ebbf ._ffgg .OutlineLvl =_dag .NewCT_DecimalNumber ();_ebbf ._ffgg .OutlineLvl .ValAttr =int64 (lvl );};
|
|
|
|
// SetShading controls the cell shading.
|
|
func (_bfd CellProperties )SetShading (shd _dag .ST_Shd ,foreground ,fill _ca .Color ){if shd ==_dag .ST_ShdUnset {_bfd ._bce .Shd =nil ;}else {_bfd ._bce .Shd =_dag .NewCT_Shd ();_bfd ._bce .Shd .ValAttr =shd ;_bfd ._bce .Shd .ColorAttr =&_dag .ST_HexColor {};if foreground .IsAuto (){_bfd ._bce .Shd .ColorAttr .ST_HexColorAuto =_dag .ST_HexColorAutoAuto ;}else {_bfd ._bce .Shd .ColorAttr .ST_HexColorRGB =foreground .AsRGBString ();};_bfd ._bce .Shd .FillAttr =&_dag .ST_HexColor {};if fill .IsAuto (){_bfd ._bce .Shd .FillAttr .ST_HexColorAuto =_dag .ST_HexColorAutoAuto ;}else {_bfd ._bce .Shd .FillAttr .ST_HexColorRGB =fill .AsRGBString ();};};};
|
|
|
|
// SetInsideHorizontal sets the interior horizontal borders to a specified type, color and thickness.
|
|
func (_gccdc TableBorders )SetInsideHorizontal (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_gccdc ._dfeff .InsideH =_dag .NewCT_Border ();_fbgeg (_gccdc ._dfeff .InsideH ,t ,c ,thickness );};
|
|
|
|
// SetHeight allows controlling the height of a row within a table.
|
|
func (_aafc RowProperties )SetHeight (ht _dd .Distance ,rule _dag .ST_HeightRule ){if rule ==_dag .ST_HeightRuleUnset {_aafc ._dbaab .TrHeight =nil ;}else {_gceeb :=_dag .NewCT_Height ();_gceeb .HRuleAttr =rule ;_gceeb .ValAttr =&_ge .ST_TwipsMeasure {};_gceeb .ValAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (ht /_dd .Twips ));_aafc ._dbaab .TrHeight =[]*_dag .CT_Height {_gceeb };};};
|
|
|
|
// Rows returns the rows defined in the table.
|
|
func (_bcgde Table )Rows ()[]Row {_ebgaf :=[]Row {};for _ ,_edgd :=range _bcgde ._acbcf .EG_ContentRowContent {for _ ,_fccd :=range _edgd .Tr {_ebgaf =append (_ebgaf ,Row {_bcgde ._fabdg ,_fccd });};if _edgd .Sdt !=nil &&_edgd .Sdt .SdtContent !=nil {for _ ,_aeaffe :=range _edgd .Sdt .SdtContent .Tr {_ebgaf =append (_ebgaf ,Row {_bcgde ._fabdg ,_aeaffe });};};};return _ebgaf ;};
|
|
|
|
// FormFieldType is the type of the form field.
|
|
//go:generate stringer -type=FormFieldType
|
|
type FormFieldType byte ;
|
|
|
|
// 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{_dgfaa *_dag .CT_FFData ;_cceb *_dag .EG_RunInnerContent ;};func _dbc ()(*_cgb .CT_Point2D ,[]*_cgb .CT_Point2D ){var (_gec int64 =0;_aec int64 =21600;);_deg :=_cgb .ST_Coordinate {ST_CoordinateUnqualified :&_gec ,ST_UniversalMeasure :nil };_ea :=_cgb .ST_Coordinate {ST_CoordinateUnqualified :&_aec ,ST_UniversalMeasure :nil };_fa :=_cgb .NewCT_Point2D ();_fa .XAttr =_deg ;_fa .YAttr =_deg ;_agc :=[]*_cgb .CT_Point2D {&_cgb .CT_Point2D {XAttr :_deg ,YAttr :_ea },&_cgb .CT_Point2D {XAttr :_ea ,YAttr :_ea },&_cgb .CT_Point2D {XAttr :_ea ,YAttr :_deg },_fa };return _fa ,_agc ;};
|
|
|
|
// Cell is a table cell within a document (not a spreadsheet)
|
|
type Cell struct{_fcbc *Document ;_fb *_dag .CT_Tc ;};
|
|
|
|
// SetAllCaps sets the run to all caps.
|
|
func (_fdba RunProperties )SetAllCaps (b bool ){if !b {_fdba ._becb .Caps =nil ;}else {_fdba ._becb .Caps =_dag .NewCT_OnOff ();};};
|
|
|
|
// FindNodeByStyleName return slice of node base on style name.
|
|
func (_fdff *Nodes )FindNodeByStyleName (styleName string )[]Node {_cffa :=[]Node {};for _ ,_begcb :=range _fdff ._cace {switch _bddbf :=_begcb ._dgag .(type ){case *Paragraph :if _bddbf !=nil {if _gaca ,_deed :=_begcb ._efgg .Styles .SearchStyleByName (styleName );_deed {_ddabe :=_bddbf .Style ();if _ddabe ==_gaca .StyleID (){_cffa =append (_cffa ,_begcb );};};};case *Table :if _bddbf !=nil {if _aggc ,_befg :=_begcb ._efgg .Styles .SearchStyleByName (styleName );_befg {_gabf :=_bddbf .Style ();if _gabf ==_aggc .StyleID (){_cffa =append (_cffa ,_begcb );};};};};_ggfg :=Nodes {_cace :_begcb .Children };_cffa =append (_cffa ,_ggfg .FindNodeByStyleName (styleName )...);};return _cffa ;};
|
|
|
|
// Paragraphs returns the paragraphs within a structured document tag.
|
|
func (_bbfg StructuredDocumentTag )Paragraphs ()[]Paragraph {if _bbfg ._cdedb .SdtContent ==nil {return nil ;};_cfaa :=[]Paragraph {};for _ ,_ddaa :=range _bbfg ._cdedb .SdtContent .P {_cfaa =append (_cfaa ,Paragraph {_bbfg ._dffad ,_ddaa });};return _cfaa ;};func (_ccdge *Document )insertImageFromNode (_cafe Node ){for _ ,_bfcf :=range _cafe .AnchoredDrawings {if _dgdf ,_gcd :=_bfcf .GetImage ();_gcd {_baffb ,_fade :=_cd .ImageFromFile (_dgdf .Path ());if _fade !=nil {_bc .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",_fade );};_gcbc ,_fade :=_ccdge .AddImage (_baffb );if _fade !=nil {_bc .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",_fade );};_ffdcg :=_ccdge ._dbce .GetByRelId (_gcbc .RelID ());_ffdcg .SetID (_dgdf .RelID ());};};for _ ,_dbag :=range _cafe .InlineDrawings {if _cade ,_effg :=_dbag .GetImage ();_effg {_fcga ,_dafd :=_cd .ImageFromFile (_cade .Path ());if _dafd !=nil {_bc .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",_dafd );};_acag ,_dafd :=_ccdge .AddImage (_fcga );if _dafd !=nil {_bc .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",_dafd );};_acdff :=_ccdge ._dbce .GetByRelId (_acag .RelID ());_acdff .SetID (_cade .RelID ());};};};
|
|
|
|
// SetTopPct sets the cell top margin
|
|
func (_dgd CellMargins )SetTopPct (pct float64 ){_dgd ._cc .Top =_dag .NewCT_TblWidth ();_efe (_dgd ._cc .Top ,pct );};
|
|
|
|
// SizeValue returns the value of paragraph font size in points.
|
|
func (_aaef ParagraphProperties )SizeValue ()float64 {if _bfdb :=_aaef ._gfeb .RPr .Sz ;_bfdb !=nil {_caff :=_bfdb .ValAttr ;if _caff .ST_UnsignedDecimalNumber !=nil {return float64 (*_caff .ST_UnsignedDecimalNumber )/2;};};return 0.0;};var _ebe =false ;
|
|
|
|
// Clear clears all content within a header
|
|
func (_efcc Header )Clear (){_efcc ._ddaf .EG_ContentBlockContent =nil };
|
|
|
|
// SetPageMargins sets the page margins for a section
|
|
func (_ffcg Section )SetPageMargins (top ,right ,bottom ,left ,header ,footer ,gutter _dd .Distance ){_gbead :=_dag .NewCT_PageMar ();_gbead .TopAttr .Int64 =_g .Int64 (int64 (top /_dd .Twips ));_gbead .BottomAttr .Int64 =_g .Int64 (int64 (bottom /_dd .Twips ));_gbead .RightAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (right /_dd .Twips ));_gbead .LeftAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (left /_dd .Twips ));_gbead .HeaderAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (header /_dd .Twips ));_gbead .FooterAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (footer /_dd .Twips ));_gbead .GutterAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (gutter /_dd .Twips ));_ffcg ._gbfbf .PgMar =_gbead ;};
|
|
|
|
// NewWatermarkPicture generates new WatermarkPicture.
|
|
func NewWatermarkPicture ()WatermarkPicture {_fcfc :=_ec .NewShapetype ();_ccecf :=_ec .NewEG_ShapeElements ();_ccecf .Formulas =_bdbg ();_ccecf .Path =_dcfg ();_ccecf .Lock =_ddeb ();_fcfc .EG_ShapeElements =[]*_ec .EG_ShapeElements {_ccecf };var (_caac ="\u005f\u0078\u0030\u0030\u0030\u0030\u005f\u0074\u0037\u0035";_bgfdd ="2\u0031\u0036\u0030\u0030\u002c\u0032\u0031\u0036\u0030\u0030";_bgddb =float32 (75.0);_aaafd ="\u006d\u0040\u0034\u00405l\u0040\u0034\u0040\u0031\u0031\u0040\u0039\u0040\u0031\u0031\u0040\u0039\u0040\u0035x\u0065";);_fcfc .IdAttr =&_caac ;_fcfc .CoordsizeAttr =&_bgfdd ;_fcfc .SptAttr =&_bgddb ;_fcfc .PreferrelativeAttr =_ge .ST_TrueFalseTrue ;_fcfc .PathAttr =&_aaafd ;_fcfc .FilledAttr =_ge .ST_TrueFalseFalse ;_fcfc .StrokedAttr =_ge .ST_TrueFalseFalse ;_dgeaa :=_ec .NewShape ();_abcc :=_ec .NewEG_ShapeElements ();_abcc .Imagedata =_eeabc ();_dgeaa .EG_ShapeElements =[]*_ec .EG_ShapeElements {_abcc };var (_becd ="\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";_gabca ="\u005f\u0078\u00300\u0030\u0030\u005f\u0073\u0032\u0030\u0035\u0031";_fdda ="#\u005f\u0078\u0030\u0030\u0030\u0030\u005f\u0074\u0037\u0035";_ffaee ="";_agaf ="\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";);_dgeaa .IdAttr =&_becd ;_dgeaa .SpidAttr =&_gabca ;_dgeaa .TypeAttr =&_fdda ;_dgeaa .AltAttr =&_ffaee ;_dgeaa .StyleAttr =&_agaf ;_dgeaa .AllowincellAttr =_ge .ST_TrueFalseFalse ;_bgedd :=_dag .NewCT_Picture ();_bgedd .Any =[]_g .Any {_fcfc ,_dgeaa };return WatermarkPicture {_ecfd :_bgedd ,_cebdc :_dgeaa ,_ebfcd :_fcfc };};
|
|
|
|
// GetTargetByRelId returns a target path with the associated relation ID in the
|
|
// document.
|
|
func (_gccd *Document )GetTargetByRelId (idAttr string )string {return _gccd ._dbce .GetTargetByRelId (idAttr );};
|
|
|
|
// NewStyles constructs a new empty Styles
|
|
func NewStyles ()Styles {return Styles {_dag .NewStyles ()}};func (_ead *chart )Target ()string {return _ead ._fee };
|
|
|
|
// PossibleValues returns the possible values for a FormFieldTypeDropDown.
|
|
func (_fbeg FormField )PossibleValues ()[]string {if _fbeg ._dgfaa .DdList ==nil {return nil ;};_acbce :=[]string {};for _ ,_ddfdb :=range _fbeg ._dgfaa .DdList .ListEntry {if _ddfdb ==nil {continue ;};_acbce =append (_acbce ,_ddfdb .ValAttr );};return _acbce ;};
|
|
|
|
// FontTable returns document fontTable element.
|
|
func (_fece *Document )FontTable ()*_dag .Fonts {return _fece ._dbac };
|
|
|
|
// ItalicValue returns the precise nature of the italic setting (unset, off or on).
|
|
func (_egaa RunProperties )ItalicValue ()OnOffValue {return _gfggb (_egaa ._becb .I )};
|
|
|
|
// Properties returns the numbering level paragraph properties.
|
|
func (_cgcdc NumberingLevel )Properties ()ParagraphStyleProperties {if _cgcdc ._fbaa .PPr ==nil {_cgcdc ._fbaa .PPr =_dag .NewCT_PPrGeneral ();};return ParagraphStyleProperties {_cgcdc ._fbaa .PPr };};func (_gafe *chart )RelId ()string {return _gafe ._abg };
|
|
|
|
// SizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.
|
|
func (_fgccg RunProperties )SizeMeasure ()string {if _abeg :=_fgccg ._becb .Sz ;_abeg !=nil {_bdbf :=_abeg .ValAttr ;if _bdbf .ST_PositiveUniversalMeasure !=nil {return *_bdbf .ST_PositiveUniversalMeasure ;};};return "";};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_aecd CellProperties )X ()*_dag .CT_TcPr {return _aecd ._bce };
|
|
|
|
// SetProperties sets the `RunProperties` to the `Run` element
|
|
func (_beebg Run )SetProperties (rp RunProperties ){if rp ._becb ==nil {_beebg ._ccad .RPr =_dag .NewCT_RPr ();}else {_fdgg :=&_dag .CT_RPr {};if rp ._becb .RStyle !=nil {_fdgg .RStyle =&_dag .CT_String {ValAttr :rp ._becb .RStyle .ValAttr };};if rp ._becb .RFonts !=nil {_fdgg .RFonts =&_dag .CT_Fonts {HintAttr :rp ._becb .RFonts .HintAttr ,AsciiAttr :rp ._becb .RFonts .AsciiAttr ,HAnsiAttr :rp ._becb .RFonts .HAnsiAttr ,EastAsiaAttr :rp ._becb .RFonts .EastAsiaAttr ,CsAttr :rp ._becb .RFonts .CsAttr ,AsciiThemeAttr :rp ._becb .RFonts .AsciiThemeAttr ,HAnsiThemeAttr :rp ._becb .RFonts .HAnsiThemeAttr ,EastAsiaThemeAttr :rp ._becb .RFonts .EastAsiaThemeAttr ,CsthemeAttr :rp ._becb .RFonts .CsthemeAttr };};if rp ._becb .B !=nil {_fdgg .B =&_dag .CT_OnOff {};if rp ._becb .B .ValAttr !=nil {_fbbe :=*rp ._becb .B .ValAttr ;_fdgg .B .ValAttr =&_fbbe ;};};if rp ._becb .BCs !=nil {_fdgg .BCs =&_dag .CT_OnOff {};if rp ._becb .BCs .ValAttr !=nil {_gcaga :=*rp ._becb .BCs .ValAttr ;_fdgg .BCs .ValAttr =&_gcaga ;};};if rp ._becb .I !=nil {_fdgg .I =&_dag .CT_OnOff {};if rp ._becb .I .ValAttr !=nil {_bcdfb :=*rp ._becb .I .ValAttr ;_fdgg .I .ValAttr =&_bcdfb ;};};if rp ._becb .ICs !=nil {_fdgg .ICs =&_dag .CT_OnOff {};if rp ._becb .ICs .ValAttr !=nil {_gceda :=*rp ._becb .ICs .ValAttr ;_fdgg .ICs .ValAttr =&_gceda ;};};if rp ._becb .Caps !=nil {_fdgg .Caps =&_dag .CT_OnOff {};if rp ._becb .Caps .ValAttr !=nil {_ebfc :=*rp ._becb .Caps .ValAttr ;_fdgg .Caps .ValAttr =&_ebfc ;};};if rp ._becb .SmallCaps !=nil {_fdgg .SmallCaps =&_dag .CT_OnOff {};if rp ._becb .SmallCaps .ValAttr !=nil {_gbgc :=*rp ._becb .SmallCaps .ValAttr ;_fdgg .SmallCaps .ValAttr =&_gbgc ;};};if rp ._becb .Strike !=nil {_fdgg .Strike =&_dag .CT_OnOff {};if rp ._becb .Strike .ValAttr !=nil {_gbef :=*rp ._becb .Strike .ValAttr ;_fdgg .Strike .ValAttr =&_gbef ;};};if rp ._becb .Dstrike !=nil {_fdgg .Dstrike =&_dag .CT_OnOff {};if rp ._becb .Dstrike .ValAttr !=nil {_aafd :=*rp ._becb .Dstrike .ValAttr ;_fdgg .Dstrike .ValAttr =&_aafd ;};};if rp ._becb .Outline !=nil {_fdgg .Outline =&_dag .CT_OnOff {};if rp ._becb .Outline .ValAttr !=nil {_caga :=*rp ._becb .Outline .ValAttr ;_fdgg .Outline .ValAttr =&_caga ;};};if rp ._becb .Shadow !=nil {_fdgg .Shadow =&_dag .CT_OnOff {};if rp ._becb .Shadow .ValAttr !=nil {_eege :=*rp ._becb .Shadow .ValAttr ;_fdgg .Shadow .ValAttr =&_eege ;};};if rp ._becb .Emboss !=nil {_fdgg .Emboss =&_dag .CT_OnOff {};if rp ._becb .Emboss .ValAttr !=nil {_dgfaae :=*rp ._becb .Emboss .ValAttr ;_fdgg .Emboss .ValAttr =&_dgfaae ;};};if rp ._becb .Imprint !=nil {_fdgg .Imprint =&_dag .CT_OnOff {};if rp ._becb .Imprint .ValAttr !=nil {_egc :=*rp ._becb .Imprint .ValAttr ;_fdgg .Imprint .ValAttr =&_egc ;};};if rp ._becb .NoProof !=nil {_fdgg .NoProof =&_dag .CT_OnOff {};if rp ._becb .NoProof .ValAttr !=nil {_gbgdf :=*rp ._becb .NoProof .ValAttr ;_fdgg .NoProof .ValAttr =&_gbgdf ;};};if rp ._becb .SnapToGrid !=nil {_fdgg .SnapToGrid =&_dag .CT_OnOff {};if rp ._becb .SnapToGrid .ValAttr !=nil {_ceceb :=*rp ._becb .SnapToGrid .ValAttr ;_fdgg .SnapToGrid .ValAttr =&_ceceb ;};};if rp ._becb .Vanish !=nil {_fdgg .Vanish =&_dag .CT_OnOff {};if rp ._becb .Vanish .ValAttr !=nil {_gbdd :=*rp ._becb .Vanish .ValAttr ;_fdgg .Vanish .ValAttr =&_gbdd ;};};if rp ._becb .WebHidden !=nil {_fdgg .WebHidden =&_dag .CT_OnOff {};if rp ._becb .WebHidden .ValAttr !=nil {_ggfea :=*rp ._becb .WebHidden .ValAttr ;_fdgg .WebHidden .ValAttr =&_ggfea ;};};if rp ._becb .Color !=nil {_fdgg .Color =&_dag .CT_Color {ValAttr :rp ._becb .Color .ValAttr ,ThemeColorAttr :rp ._becb .Color .ThemeColorAttr ,ThemeTintAttr :rp ._becb .Color .ThemeTintAttr ,ThemeShadeAttr :rp ._becb .Color .ThemeShadeAttr };};if rp ._becb .Spacing !=nil {_fdgg .Spacing =&_dag .CT_SignedTwipsMeasure {ValAttr :rp ._becb .Spacing .ValAttr };};if rp ._becb .W !=nil {_fdgg .W =&_dag .CT_TextScale {ValAttr :rp ._becb .W .ValAttr };};if rp ._becb .Kern !=nil {_fdgg .Kern =&_dag .CT_HpsMeasure {ValAttr :rp ._becb .Kern .ValAttr };};if rp ._becb .Position !=nil {_fdgg .Position =&_dag .CT_SignedHpsMeasure {ValAttr :rp ._becb .Position .ValAttr };};if rp ._becb .Sz !=nil {_fdgg .Sz =&_dag .CT_HpsMeasure {ValAttr :rp ._becb .Sz .ValAttr };};if rp ._becb .SzCs !=nil {_fdgg .SzCs =&_dag .CT_HpsMeasure {ValAttr :rp ._becb .SzCs .ValAttr };};if rp ._becb .Highlight !=nil {_fdgg .Highlight =&_dag .CT_Highlight {ValAttr :rp ._becb .Highlight .ValAttr };};if rp ._becb .U !=nil {_fdgg .U =&_dag .CT_Underline {ValAttr :rp ._becb .U .ValAttr ,ColorAttr :rp ._becb .U .ColorAttr ,ThemeColorAttr :rp ._becb .U .ThemeColorAttr ,ThemeTintAttr :rp ._becb .U .ThemeTintAttr ,ThemeShadeAttr :rp ._becb .U .ThemeShadeAttr };};if rp ._becb .Effect !=nil {_fdgg .Effect =&_dag .CT_TextEffect {ValAttr :rp ._becb .Effect .ValAttr };};if rp ._becb .Bdr !=nil {_fdgg .Bdr =&_dag .CT_Border {ValAttr :rp ._becb .Bdr .ValAttr ,ColorAttr :rp ._becb .Bdr .ColorAttr ,ThemeColorAttr :rp ._becb .Bdr .ThemeColorAttr ,ThemeTintAttr :rp ._becb .Bdr .ThemeTintAttr ,ThemeShadeAttr :rp ._becb .Bdr .ThemeShadeAttr ,SzAttr :rp ._becb .Bdr .SzAttr ,SpaceAttr :rp ._becb .Bdr .SpaceAttr ,ShadowAttr :rp ._becb .Bdr .ShadowAttr ,FrameAttr :rp ._becb .Bdr .FrameAttr };};if rp ._becb .Shd !=nil {_fdgg .Shd =&_dag .CT_Shd {ValAttr :rp ._becb .Shd .ValAttr ,ColorAttr :rp ._becb .Shd .ColorAttr ,ThemeColorAttr :rp ._becb .Shd .ThemeColorAttr ,ThemeTintAttr :rp ._becb .Shd .ThemeTintAttr ,ThemeShadeAttr :rp ._becb .Shd .ThemeShadeAttr ,FillAttr :rp ._becb .Shd .FillAttr ,ThemeFillAttr :rp ._becb .Shd .ThemeFillAttr ,ThemeFillTintAttr :rp ._becb .Shd .ThemeFillTintAttr ,ThemeFillShadeAttr :rp ._becb .Shd .ThemeFillShadeAttr };};if rp ._becb .FitText !=nil {_fdgg .FitText =&_dag .CT_FitText {ValAttr :rp ._becb .FitText .ValAttr ,IdAttr :rp ._becb .FitText .IdAttr };};if rp ._becb .VertAlign !=nil {_fdgg .VertAlign =&_dag .CT_VerticalAlignRun {ValAttr :rp ._becb .VertAlign .ValAttr };};if rp ._becb .Rtl !=nil {_fdgg .Rtl =&_dag .CT_OnOff {ValAttr :rp ._becb .Rtl .ValAttr };};if rp ._becb .Cs !=nil {_fdgg .Cs =&_dag .CT_OnOff {ValAttr :rp ._becb .Cs .ValAttr };};if rp ._becb .Em !=nil {_fdgg .Em =&_dag .CT_Em {ValAttr :rp ._becb .Em .ValAttr };};if rp ._becb .Lang !=nil {_fdgg .Lang =&_dag .CT_Language {ValAttr :rp ._becb .Lang .ValAttr ,EastAsiaAttr :rp ._becb .Lang .EastAsiaAttr ,BidiAttr :rp ._becb .Lang .BidiAttr };};if rp ._becb .EastAsianLayout !=nil {_fdgg .EastAsianLayout =&_dag .CT_EastAsianLayout {IdAttr :rp ._becb .EastAsianLayout .IdAttr ,CombineAttr :rp ._becb .EastAsianLayout .CombineAttr ,CombineBracketsAttr :rp ._becb .EastAsianLayout .CombineBracketsAttr ,VertAttr :rp ._becb .EastAsianLayout .VertAttr ,VertCompressAttr :rp ._becb .EastAsianLayout .VertCompressAttr };};if rp ._becb .SpecVanish !=nil {_fdgg .SpecVanish =&_dag .CT_OnOff {ValAttr :rp ._becb .SpecVanish .ValAttr };};if rp ._becb .OMath !=nil {_fdgg .OMath =&_dag .CT_OnOff {ValAttr :rp ._becb .OMath .ValAttr };};_beebg ._ccad .RPr =_fdgg ;};};
|
|
|
|
// GetSize return the size of anchor on the page.
|
|
func (_gdd AnchoredDrawing )GetSize ()(_bag ,_ae int64 ){return _gdd ._af .Extent .CxAttr ,_gdd ._af .Extent .CyAttr ;};
|
|
|
|
// Endnote is an individual endnote reference within the document.
|
|
type Endnote struct{_gdfaf *Document ;_fcfd *_dag .CT_FtnEdn ;};func _ggfa ()*_ec .Handles {_gcfd :=_ec .NewHandles ();_ccgd :=_ec .NewCT_H ();_fdbeb :="\u0023\u0030\u002c\u0062\u006f\u0074\u0074\u006f\u006dR\u0069\u0067\u0068\u0074";_ccgd .PositionAttr =&_fdbeb ;_gacf :="\u0036\u0036\u0032\u0039\u002c\u0031\u0034\u0039\u0037\u0031";_ccgd .XrangeAttr =&_gacf ;_gcfd .H =[]*_ec .CT_H {_ccgd };return _gcfd ;};
|
|
|
|
// Emboss returns true if paragraph emboss is on.
|
|
func (_cbdd ParagraphProperties )Emboss ()bool {return _dcda (_cbdd ._gfeb .RPr .Emboss )};const _eeagd ="\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";
|
|
|
|
// Paragraphs returns the paragraphs defined in a footnote.
|
|
func (_ddbaf Footnote )Paragraphs ()[]Paragraph {_efbb :=[]Paragraph {};for _ ,_gbge :=range _ddbaf .content (){for _ ,_cdfe :=range _gbge .P {_efbb =append (_efbb ,Paragraph {_ddbaf ._cbffe ,_cdfe });};};return _efbb ;};func _fbgeg (_bcdd *_dag .CT_Border ,_bcgbe _dag .ST_Border ,_cdcg _ca .Color ,_ebfga _dd .Distance ){_bcdd .ValAttr =_bcgbe ;_bcdd .ColorAttr =&_dag .ST_HexColor {};if _cdcg .IsAuto (){_bcdd .ColorAttr .ST_HexColorAuto =_dag .ST_HexColorAutoAuto ;}else {_bcdd .ColorAttr .ST_HexColorRGB =_cdcg .AsRGBString ();};if _ebfga !=_dd .Zero {_bcdd .SzAttr =_g .Uint64 (uint64 (_ebfga /_dd .Point *8));};};
|
|
|
|
// Shadow returns true if run shadow is on.
|
|
func (_ffeed RunProperties )Shadow ()bool {return _dcda (_ffeed ._becb .Shadow )};
|
|
|
|
// SetKeepOnOnePage controls if all lines in a paragraph are kept on the same
|
|
// page.
|
|
func (_abcb ParagraphStyleProperties )SetKeepOnOnePage (b bool ){if !b {_abcb ._ffgg .KeepLines =nil ;}else {_abcb ._ffgg .KeepLines =_dag .NewCT_OnOff ();};};func (_afb *Document )tables (_bda *_dag .EG_ContentBlockContent )[]Table {_dge :=[]Table {};for _ ,_cecf :=range _bda .Tbl {_dge =append (_dge ,Table {_afb ,_cecf });for _ ,_bgd :=range _cecf .EG_ContentRowContent {for _ ,_dbde :=range _bgd .Tr {for _ ,_cba :=range _dbde .EG_ContentCellContent {for _ ,_efed :=range _cba .Tc {for _ ,_cfc :=range _efed .EG_BlockLevelElts {for _ ,_fge :=range _cfc .EG_ContentBlockContent {for _ ,_fddc :=range _afb .tables (_fge ){_dge =append (_dge ,_fddc );};};};};};};};};return _dge ;};func _eeabc ()*_ec .Imagedata {_dcdea :=_ec .NewImagedata ();_daee :="\u0072\u0049\u0064\u0031";_gebb :="\u0057A\u0054\u0045\u0052\u004d\u0041\u0052K";_dcdea .IdAttr =&_daee ;_dcdea .TitleAttr =&_gebb ;return _dcdea ;};
|
|
|
|
// ComplexSizeMeasure returns font with its measure which can be mm, cm, in, pt, pc or pi.
|
|
func (_cgfd ParagraphProperties )ComplexSizeMeasure ()string {if _bgece :=_cgfd ._gfeb .RPr .SzCs ;_bgece !=nil {_dcebb :=_bgece .ValAttr ;if _dcebb .ST_PositiveUniversalMeasure !=nil {return *_dcebb .ST_PositiveUniversalMeasure ;};};return "";};
|
|
|
|
// ExtractFromFooter returns text from the document footer as an array of TextItems.
|
|
func ExtractFromFooter (footer *_dag .Ftr )[]TextItem {return _fgdaa (footer .EG_ContentBlockContent ,nil );};
|
|
|
|
// Properties returns the table properties.
|
|
func (_gbecf Table )Properties ()TableProperties {if _gbecf ._acbcf .TblPr ==nil {_gbecf ._acbcf .TblPr =_dag .NewCT_TblPr ();};return TableProperties {_gbecf ._acbcf .TblPr };};
|
|
|
|
// RemoveRun removes a child run from a paragraph.
|
|
func (_geacf Paragraph )RemoveRun (r Run ){for _ ,_dgbae :=range _geacf ._gbfgc .EG_PContent {for _efbd ,_bdca :=range _dgbae .EG_ContentRunContent {if _bdca .R ==r ._ccad {copy (_dgbae .EG_ContentRunContent [_efbd :],_dgbae .EG_ContentRunContent [_efbd +1:]);_dgbae .EG_ContentRunContent =_dgbae .EG_ContentRunContent [0:len (_dgbae .EG_ContentRunContent )-1];};if _bdca .Sdt !=nil &&_bdca .Sdt .SdtContent !=nil {for _ccec ,_gaab :=range _bdca .Sdt .SdtContent .EG_ContentRunContent {if _gaab .R ==r ._ccad {copy (_bdca .Sdt .SdtContent .EG_ContentRunContent [_ccec :],_bdca .Sdt .SdtContent .EG_ContentRunContent [_ccec +1:]);_bdca .Sdt .SdtContent .EG_ContentRunContent =_bdca .Sdt .SdtContent .EG_ContentRunContent [0:len (_bdca .Sdt .SdtContent .EG_ContentRunContent )-1];};};};};};};func (_deeg Endnote )content ()[]*_dag .EG_ContentBlockContent {var _bfaaa []*_dag .EG_ContentBlockContent ;for _ ,_fef :=range _deeg ._fcfd .EG_BlockLevelElts {_bfaaa =append (_bfaaa ,_fef .EG_ContentBlockContent ...);};return _bfaaa ;};
|
|
|
|
// AddSection adds a new document section with an optional section break. If t
|
|
// is ST_SectionMarkUnset, then no break will be inserted.
|
|
func (_fcbce ParagraphProperties )AddSection (t _dag .ST_SectionMark )Section {_fcbce ._gfeb .SectPr =_dag .NewCT_SectPr ();if t !=_dag .ST_SectionMarkUnset {_fcbce ._gfeb .SectPr .Type =_dag .NewCT_SectType ();_fcbce ._gfeb .SectPr .Type .ValAttr =t ;};return Section {_fcbce ._fbcc ,_fcbce ._gfeb .SectPr };};
|
|
|
|
// InsertRunBefore inserts a run in the paragraph before the relative run.
|
|
func (_dcca Paragraph )InsertRunBefore (relativeTo Run )Run {return _dcca .insertRun (relativeTo ,true )};
|
|
|
|
// Properties returns the paragraph properties.
|
|
func (_dabgbf Paragraph )Properties ()ParagraphProperties {_dabgbf .ensurePPr ();return ParagraphProperties {_dabgbf ._ebddd ,_dabgbf ._gbfgc .PPr };};
|
|
|
|
// RemoveParagraph removes a paragraph from a document.
|
|
func (_dec *Document )RemoveParagraph (p Paragraph ){if _dec ._ceeb .Body ==nil {return ;};for _ ,_cbeg :=range _dec ._ceeb .Body .EG_BlockLevelElts {for _ ,_febe :=range _cbeg .EG_ContentBlockContent {for _ged ,_ccbc :=range _febe .P {if _ccbc ==p ._gbfgc {copy (_febe .P [_ged :],_febe .P [_ged +1:]);_febe .P =_febe .P [0:len (_febe .P )-1];return ;};};if _febe .Sdt !=nil &&_febe .Sdt .SdtContent !=nil &&_febe .Sdt .SdtContent .P !=nil {for _edc ,_bdd :=range _febe .Sdt .SdtContent .P {if _bdd ==p ._gbfgc {copy (_febe .P [_edc :],_febe .P [_edc +1:]);_febe .P =_febe .P [0:len (_febe .P )-1];return ;};};};};};for _ ,_cff :=range _dec .Tables (){for _ ,_dfcd :=range _cff .Rows (){for _ ,_dedb :=range _dfcd .Cells (){for _ ,_ced :=range _dedb ._fb .EG_BlockLevelElts {for _ ,_bca :=range _ced .EG_ContentBlockContent {for _gebd ,_dgdb :=range _bca .P {if _dgdb ==p ._gbfgc {copy (_bca .P [_gebd :],_bca .P [_gebd +1:]);_bca .P =_bca .P [0:len (_bca .P )-1];return ;};};};};};};};for _ ,_fda :=range _dec .Headers (){_fda .RemoveParagraph (p );};for _ ,_ggff :=range _dec .Footers (){_ggff .RemoveParagraph (p );};};
|
|
|
|
// SetTargetBookmark sets the bookmark target of the hyperlink.
|
|
func (_adde HyperLink )SetTargetBookmark (bm Bookmark ){_adde ._abfc .AnchorAttr =_g .String (bm .Name ());_adde ._abfc .IdAttr =nil ;};
|
|
|
|
// GetWrapPathStart return wrapPath start value.
|
|
func (_ed AnchorDrawWrapOptions )GetWrapPathStart ()*_cgb .CT_Point2D {return _ed ._df };
|
|
|
|
// SaveToFile writes the document out to a file.
|
|
func (_bddd *Document )SaveToFile (path string )error {_egec ,_cdgd :=_gg .Create (path );if _cdgd !=nil {return _cdgd ;};defer _egec .Close ();return _bddd .Save (_egec );};func (_fdbb Paragraph )addFldCharsForField (_fefb ,_bfed string )FormField {_dbdf :=_fdbb .addBeginFldChar (_fefb );_gdcdg :=FormField {_dgfaa :_dbdf };_gfefg :=_fdbb ._ebddd .Bookmarks ();_eefec :=int64 (len (_gfefg ));if _fefb !=""{_fdbb .addStartBookmark (_eefec ,_fefb );};_fdbb .addInstrText (_bfed );_fdbb .addSeparateFldChar ();if _bfed =="\u0046\u004f\u0052\u004d\u0054\u0045\u0058\u0054"{_adfce :=_fdbb .AddRun ();_ddfc :=_dag .NewEG_RunInnerContent ();_adfce ._ccad .EG_RunInnerContent =[]*_dag .EG_RunInnerContent {_ddfc };_gdcdg ._cceb =_ddfc ;};_fdbb .addEndFldChar ();if _fefb !=""{_fdbb .addEndBookmark (_eefec );};return _gdcdg ;};
|
|
|
|
// PutNodeBefore put node to position before relativeTo.
|
|
func (_egfg *Document )PutNodeBefore (relativeTo ,node Node ){_egfg .putNode (relativeTo ,node ,true )};
|
|
|
|
// SetHangingIndent controls special indent of paragraph.
|
|
func (_ddecd Paragraph )SetHangingIndent (m _dd .Distance ){_ddecd .ensurePPr ();_eged :=_ddecd ._gbfgc .PPr ;if _eged .Ind ==nil {_eged .Ind =_dag .NewCT_Ind ();};if m ==_dd .Zero {_eged .Ind .HangingAttr =nil ;}else {_eged .Ind .HangingAttr =&_ge .ST_TwipsMeasure {};_eged .Ind .HangingAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (m /_dd .Twips ));};};
|
|
|
|
// 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 (_aaaf Document )AddHyperlink (url string )_cd .Hyperlink {return _aaaf ._dbce .AddHyperlink (url )};
|
|
|
|
// 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 (_cee AnchoredDrawing )SetOffset (x ,y _dd .Distance ){_cee .SetXOffset (x );_cee .SetYOffset (y )};
|
|
|
|
// SetRight sets the right border to a specified type, color and thickness.
|
|
func (_feg CellBorders )SetRight (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_feg ._gbe .Right =_dag .NewCT_Border ();_fbgeg (_feg ._gbe .Right ,t ,c ,thickness );};
|
|
|
|
// SetBottom sets the cell bottom margin
|
|
func (_abea CellMargins )SetBottom (d _dd .Distance ){_abea ._cc .Bottom =_dag .NewCT_TblWidth ();_dbdg (_abea ._cc .Bottom ,d );};
|
|
|
|
// Shadow returns true if paragraph shadow is on.
|
|
func (_ebcbg ParagraphProperties )Shadow ()bool {return _dcda (_ebcbg ._gfeb .RPr .Shadow )};
|
|
|
|
// SetAll sets all of the borders to a given value.
|
|
func (_bgb CellBorders )SetAll (t _dag .ST_Border ,c _ca .Color ,thickness _dd .Distance ){_bgb .SetBottom (t ,c ,thickness );_bgb .SetLeft (t ,c ,thickness );_bgb .SetRight (t ,c ,thickness );_bgb .SetTop (t ,c ,thickness );_bgb .SetInsideHorizontal (t ,c ,thickness );_bgb .SetInsideVertical (t ,c ,thickness );};
|
|
|
|
// SetColumnBandSize sets the number of Columns in the column band
|
|
func (_cggad TableStyleProperties )SetColumnBandSize (cols int64 ){_cggad ._afeg .TblStyleColBandSize =_dag .NewCT_DecimalNumber ();_cggad ._afeg .TblStyleColBandSize .ValAttr =cols ;};
|
|
|
|
// InlineDrawing is an inlined image within a run.
|
|
type InlineDrawing struct{_cgcd *Document ;_cafea *_dag .WdInline ;};func (_aggbd *Document )insertParagraph (_fecf Paragraph ,_efdf bool )Paragraph {if _aggbd ._ceeb .Body ==nil {return _aggbd .AddParagraph ();};_baff :=_fecf .X ();for _ ,_fbd :=range _aggbd ._ceeb .Body .EG_BlockLevelElts {for _ ,_eadg :=range _fbd .EG_ContentBlockContent {for _dccd ,_fffe :=range _eadg .P {if _fffe ==_baff {_ccg :=_dag .NewCT_P ();_eadg .P =append (_eadg .P ,nil );if _efdf {copy (_eadg .P [_dccd +1:],_eadg .P [_dccd :]);_eadg .P [_dccd ]=_ccg ;}else {copy (_eadg .P [_dccd +2:],_eadg .P [_dccd +1:]);_eadg .P [_dccd +1]=_ccg ;};return Paragraph {_aggbd ,_ccg };};};for _ ,_afd :=range _eadg .Tbl {for _ ,_gbgge :=range _afd .EG_ContentRowContent {for _ ,_cedgf :=range _gbgge .Tr {for _ ,_egeb :=range _cedgf .EG_ContentCellContent {for _ ,_cbabf :=range _egeb .Tc {for _ ,_abee :=range _cbabf .EG_BlockLevelElts {for _ ,_gdbee :=range _abee .EG_ContentBlockContent {for _adba ,_deac :=range _gdbee .P {if _deac ==_baff {_bfad :=_dag .NewCT_P ();_gdbee .P =append (_gdbee .P ,nil );if _efdf {copy (_gdbee .P [_adba +1:],_gdbee .P [_adba :]);_gdbee .P [_adba ]=_bfad ;}else {copy (_gdbee .P [_adba +2:],_gdbee .P [_adba +1:]);_gdbee .P [_adba +1]=_bfad ;};return Paragraph {_aggbd ,_bfad };};};};};};};};};};if _eadg .Sdt !=nil &&_eadg .Sdt .SdtContent !=nil &&_eadg .Sdt .SdtContent .P !=nil {for _fba ,_bgfd :=range _eadg .Sdt .SdtContent .P {if _bgfd ==_baff {_edf :=_dag .NewCT_P ();_eadg .Sdt .SdtContent .P =append (_eadg .Sdt .SdtContent .P ,nil );if _efdf {copy (_eadg .Sdt .SdtContent .P [_fba +1:],_eadg .Sdt .SdtContent .P [_fba :]);_eadg .Sdt .SdtContent .P [_fba ]=_edf ;}else {copy (_eadg .Sdt .SdtContent .P [_fba +2:],_eadg .Sdt .SdtContent .P [_fba +1:]);_eadg .Sdt .SdtContent .P [_fba +1]=_edf ;};return Paragraph {_aggbd ,_edf };};};};};};return _aggbd .AddParagraph ();};
|
|
|
|
// GetHighlight returns the HighlightColor.
|
|
func (_babg RunProperties )GetHighlight ()_dag .ST_HighlightColor {if _babg ._becb .Highlight !=nil {return _babg ._becb .Highlight .ValAttr ;};return _dag .ST_HighlightColorNone ;};
|
|
|
|
// TableConditionalFormatting controls the conditional formatting within a table
|
|
// style.
|
|
type TableConditionalFormatting struct{_cfbcc *_dag .CT_TblStylePr };
|
|
|
|
// SetItalic sets the run to italic.
|
|
func (_fcgbg RunProperties )SetItalic (b bool ){if !b {_fcgbg ._becb .I =nil ;_fcgbg ._becb .ICs =nil ;}else {_fcgbg ._becb .I =_dag .NewCT_OnOff ();_fcgbg ._becb .ICs =_dag .NewCT_OnOff ();};};
|
|
|
|
// SetOutlineLvl sets outline level of paragraph.
|
|
func (_adcca Paragraph )SetOutlineLvl (lvl int64 ){_adcca .ensurePPr ();if _adcca ._gbfgc .PPr .OutlineLvl ==nil {_adcca ._gbfgc .PPr .OutlineLvl =_dag .NewCT_DecimalNumber ();};_bdede :=lvl -1;_adcca ._gbfgc .PPr .OutlineLvl .ValAttr =_bdede ;};
|
|
|
|
// ParagraphProperties returns the paragraph style properties.
|
|
func (_affd Style )ParagraphProperties ()ParagraphStyleProperties {if _affd ._ffabb .PPr ==nil {_affd ._ffabb .PPr =_dag .NewCT_PPrGeneral ();};return ParagraphStyleProperties {_affd ._ffabb .PPr };};func _ebda (_fgdbc string )mergeFieldInfo {_gcge :=[]string {};_bdcc :=_ag .Buffer {};_eefb :=-1;for _gcbe ,_adga :=range _fgdbc {switch _adga {case ' ':if _bdcc .Len ()!=0{_gcge =append (_gcge ,_bdcc .String ());};_bdcc .Reset ();case '"':if _eefb !=-1{_gcge =append (_gcge ,_fgdbc [_eefb +1:_gcbe ]);_eefb =-1;}else {_eefb =_gcbe ;};default:_bdcc .WriteRune (_adga );};};if _bdcc .Len ()!=0{_gcge =append (_gcge ,_bdcc .String ());};_bfeb :=mergeFieldInfo {};for _fcad :=0;_fcad < len (_gcge )-1;_fcad ++{_feaee :=_gcge [_fcad ];switch _feaee {case "\u004d\u0045\u0052\u0047\u0045\u0046\u0049\u0045\u004c\u0044":_bfeb ._afac =_gcge [_fcad +1];_fcad ++;case "\u005c\u0066":_bfeb ._fbac =_gcge [_fcad +1];_fcad ++;case "\u005c\u0062":_bfeb ._bgcd =_gcge [_fcad +1];_fcad ++;case "\u005c\u002a":switch _gcge [_fcad +1]{case "\u0055\u0070\u0070e\u0072":_bfeb ._fbdg =true ;case "\u004c\u006f\u0077e\u0072":_bfeb ._ffab =true ;case "\u0043\u0061\u0070\u0073":_bfeb ._acded =true ;case "\u0046\u0069\u0072\u0073\u0074\u0043\u0061\u0070":_bfeb ._ggag =true ;};_fcad ++;};};return _bfeb ;};
|
|
|
|
// AddParagraph adds a paragraph to the endnote.
|
|
func (_fgcgg Endnote )AddParagraph ()Paragraph {_bgec :=_dag .NewEG_ContentBlockContent ();_abce :=len (_fgcgg ._fcfd .EG_BlockLevelElts [0].EG_ContentBlockContent );_fgcgg ._fcfd .EG_BlockLevelElts [0].EG_ContentBlockContent =append (_fgcgg ._fcfd .EG_BlockLevelElts [0].EG_ContentBlockContent ,_bgec );_bcc :=_dag .NewCT_P ();var _cfde *_dag .CT_String ;if _abce !=0{_bef :=len (_fgcgg ._fcfd .EG_BlockLevelElts [0].EG_ContentBlockContent [_abce -1].P );_cfde =_fgcgg ._fcfd .EG_BlockLevelElts [0].EG_ContentBlockContent [_abce -1].P [_bef -1].PPr .PStyle ;}else {_cfde =_dag .NewCT_String ();_cfde .ValAttr ="\u0045n\u0064\u006e\u006f\u0074\u0065";};_bgec .P =append (_bgec .P ,_bcc );_dedac :=Paragraph {_fgcgg ._gdfaf ,_bcc };_dedac ._gbfgc .PPr =_dag .NewCT_PPr ();_dedac ._gbfgc .PPr .PStyle =_cfde ;_dedac ._gbfgc .PPr .RPr =_dag .NewCT_ParaRPr ();return _dedac ;};
|
|
|
|
// Properties returns the cell properties.
|
|
func (_aac Cell )Properties ()CellProperties {if _aac ._fb .TcPr ==nil {_aac ._fb .TcPr =_dag .NewCT_TcPr ();};return CellProperties {_aac ._fb .TcPr };};
|
|
|
|
// RStyle returns the name of character style.
|
|
// It is defined here http://officeopenxml.com/WPstyleCharStyles.php
|
|
func (_aecb ParagraphProperties )RStyle ()string {if _aecb ._gfeb .RPr .RStyle !=nil {return _aecb ._gfeb .RPr .RStyle .ValAttr ;};return "";};func _bbce (_dgad *_dag .EG_ContentBlockContent )[]Bookmark {_cbb :=[]Bookmark {};for _ ,_dfec :=range _dgad .P {for _ ,_aaaa :=range _dfec .EG_PContent {for _ ,_dcbgg :=range _aaaa .EG_ContentRunContent {for _ ,_ecaa :=range _dcbgg .EG_RunLevelElts {for _ ,_fac :=range _ecaa .EG_RangeMarkupElements {if _fac .BookmarkStart !=nil {_cbb =append (_cbb ,Bookmark {_fac .BookmarkStart });};};};};};};for _ ,_afgb :=range _dgad .EG_RunLevelElts {for _ ,_faacc :=range _afgb .EG_RangeMarkupElements {if _faacc .BookmarkStart !=nil {_cbb =append (_cbb ,Bookmark {_faacc .BookmarkStart });};};};for _ ,_ecd :=range _dgad .Tbl {for _ ,_ggbfb :=range _ecd .EG_ContentRowContent {for _ ,_dged :=range _ggbfb .Tr {for _ ,_dedd :=range _dged .EG_ContentCellContent {for _ ,_efba :=range _dedd .Tc {for _ ,_aeaf :=range _efba .EG_BlockLevelElts {for _ ,_bga :=range _aeaf .EG_ContentBlockContent {for _ ,_adg :=range _bbce (_bga ){_cbb =append (_cbb ,_adg );};};};};};};};};return _cbb ;};
|
|
|
|
// Caps returns true if paragraph font is capitalized.
|
|
func (_dagd ParagraphProperties )Caps ()bool {return _dcda (_dagd ._gfeb .RPr .Caps )};
|
|
|
|
// NewWatermarkText generates a new WatermarkText.
|
|
func NewWatermarkText ()WatermarkText {_bebeff :=_ec .NewShapetype ();_deae :=_ec .NewEG_ShapeElements ();_deae .Formulas =_fefd ();_deae .Path =_abcf ();_deae .Textpath =_agbgd ();_deae .Handles =_ggfa ();_deae .Lock =_deggg ();_bebeff .EG_ShapeElements =[]*_ec .EG_ShapeElements {_deae };var (_bcef ="_\u0078\u0030\u0030\u0030\u0030\u005f\u0074\u0031\u0033\u0036";_geeg ="2\u0031\u0036\u0030\u0030\u002c\u0032\u0031\u0036\u0030\u0030";_cgcb =float32 (136.0);_edbe ="\u0031\u0030\u00380\u0030";_gfcdf ="m\u0040\u0037\u002c\u006c\u0040\u0038,\u006d\u0040\u0035\u002c\u0032\u0031\u0036\u0030\u0030l\u0040\u0036\u002c2\u00316\u0030\u0030\u0065";);_bebeff .IdAttr =&_bcef ;_bebeff .CoordsizeAttr =&_geeg ;_bebeff .SptAttr =&_cgcb ;_bebeff .AdjAttr =&_edbe ;_bebeff .PathAttr =&_gfcdf ;_cfgce :=_ec .NewShape ();_dcabc :=_ec .NewEG_ShapeElements ();_dcabc .Textpath =_bgff ();_cfgce .EG_ShapeElements =[]*_ec .EG_ShapeElements {_dcabc };var (_bbead ="\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";_dbbfa ="\u005f\u0078\u00300\u0030\u0030\u005f\u0073\u0032\u0030\u0035\u0031";_ggga ="\u0023\u005f\u00780\u0030\u0030\u0030\u005f\u0074\u0031\u0033\u0036";_eafdg ="";_fdfcd ="\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";_gacd ="\u0073\u0069\u006c\u0076\u0065\u0072";);_cfgce .IdAttr =&_bbead ;_cfgce .SpidAttr =&_dbbfa ;_cfgce .TypeAttr =&_ggga ;_cfgce .AltAttr =&_eafdg ;_cfgce .StyleAttr =&_fdfcd ;_cfgce .AllowincellAttr =_ge .ST_TrueFalseFalse ;_cfgce .FillcolorAttr =&_gacd ;_cfgce .StrokedAttr =_ge .ST_TrueFalseFalse ;_adad :=_dag .NewCT_Picture ();_adad .Any =[]_g .Any {_bebeff ,_cfgce };return WatermarkText {_bgcdc :_adad ,_efac :_cfgce ,_deabb :_bebeff };};func (_bdec *Document )save (_bad _da .Writer ,_cac string )error {const _bfb ="\u0064o\u0063u\u006d\u0065\u006e\u0074\u003a\u0064\u002e\u0053\u0061\u0076\u0065";if _eeag :=_bdec ._ceeb .Validate ();_eeag !=nil {_bc .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",_eeag );};_gffg :=_g .DocTypeDocument ;if !_dc .GetLicenseKey ().IsLicensed ()&&!_ebe {_ga .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");_ga .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 _de .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 (_bdec ._fgcbc )==0{if len (_cac )> 0{_bdec ._fgcbc =_cac ;}else {_ceeba ,_eg :=_dc .GenRefId ("\u0064\u0077");if _eg !=nil {_bc .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_eg );return _eg ;};_bdec ._fgcbc =_ceeba ;};};if _abge :=_dc .Track (_bdec ._fgcbc ,_bfb );_abge !=nil {_bc .Log .Error ("\u0045R\u0052\u004f\u0052\u003a\u0020\u0025v",_abge );return _abge ;};_cdd :=_dbd .NewWriter (_bad );defer _cdd .Close ();if _bba :=_b .MarshalXML (_cdd ,_g .BaseRelsFilename ,_bdec .Rels .X ());_bba !=nil {return _bba ;};if _ggce :=_b .MarshalXMLByType (_cdd ,_gffg ,_g .ExtendedPropertiesType ,_bdec .AppProperties .X ());_ggce !=nil {return _ggce ;};if _bbb :=_b .MarshalXMLByType (_cdd ,_gffg ,_g .CorePropertiesType ,_bdec .CoreProperties .X ());_bbb !=nil {return _bbb ;};if _bdec .CustomProperties .X ()!=nil {if _fga :=_b .MarshalXMLByType (_cdd ,_gffg ,_g .CustomPropertiesType ,_bdec .CustomProperties .X ());_fga !=nil {return _fga ;};};if _bdec .Thumbnail !=nil {_feea ,_edb :=_cdd .Create ("\u0064\u006f\u0063Pr\u006f\u0070\u0073\u002f\u0074\u0068\u0075\u006d\u0062\u006e\u0061\u0069\u006c\u002e\u006a\u0070\u0065\u0067");if _edb !=nil {return _edb ;};if _fca :=_c .Encode (_feea ,_bdec .Thumbnail ,nil );_fca !=nil {return _fca ;};};if _cbcd :=_b .MarshalXMLByType (_cdd ,_gffg ,_g .SettingsType ,_bdec .Settings .X ());_cbcd !=nil {return _cbcd ;};_dfef :=_g .AbsoluteFilename (_gffg ,_g .OfficeDocumentType ,0);if _dfea :=_b .MarshalXML (_cdd ,_dfef ,_bdec ._ceeb );_dfea !=nil {return _dfea ;};if _cga :=_b .MarshalXML (_cdd ,_b .RelationsPathFor (_dfef ),_bdec ._dbce .X ());_cga !=nil {return _cga ;};if _bdec .Numbering .X ()!=nil {if _aeba :=_b .MarshalXMLByType (_cdd ,_gffg ,_g .NumberingType ,_bdec .Numbering .X ());_aeba !=nil {return _aeba ;};};if _aga :=_b .MarshalXMLByType (_cdd ,_gffg ,_g .StylesType ,_bdec .Styles .X ());_aga !=nil {return _aga ;};if _bdec ._dfd !=nil {if _bgg :=_b .MarshalXMLByType (_cdd ,_gffg ,_g .WebSettingsType ,_bdec ._dfd );_bgg !=nil {return _bgg ;};};if _bdec ._dbac !=nil {if _ddfe :=_b .MarshalXMLByType (_cdd ,_gffg ,_g .FontTableType ,_bdec ._dbac );_ddfe !=nil {return _ddfe ;};};if _bdec ._acc !=nil {if _ecf :=_b .MarshalXMLByType (_cdd ,_gffg ,_g .EndNotesType ,_bdec ._acc );_ecf !=nil {return _ecf ;};};if _bdec ._dde !=nil {if _deb :=_b .MarshalXMLByType (_cdd ,_gffg ,_g .FootNotesType ,_bdec ._dde );_deb !=nil {return _deb ;};};for _faef ,_bgfa :=range _bdec ._gdfa {if _feeb :=_b .MarshalXMLByTypeIndex (_cdd ,_gffg ,_g .ThemeType ,_faef +1,_bgfa );_feeb !=nil {return _feeb ;};};for _ddg ,_bfda :=range _bdec ._add {_ccb ,_degb :=_bfda .ExportToByteArray ();if _degb !=nil {return _degb ;};_bfdaf :="\u0077\u006f\u0072d\u002f"+_bfda .TargetAttr [:len (_bfda .TargetAttr )-4]+"\u002e\u0062\u0069\u006e";if _dca :=_b .AddFileFromBytes (_cdd ,_bfdaf ,_ccb );_dca !=nil {return _dca ;};if _cbcdc :=_b .MarshalXMLByTypeIndex (_cdd ,_gffg ,_g .ControlType ,_ddg +1,_bfda .Ocx );_cbcdc !=nil {return _cbcdc ;};};for _ecff ,_bfbb :=range _bdec ._abcg {_dbcc :=_g .AbsoluteFilename (_gffg ,_g .HeaderType ,_ecff +1);if _fdeg :=_b .MarshalXML (_cdd ,_dbcc ,_bfbb );_fdeg !=nil {return _fdeg ;};if !_bdec ._baf [_ecff ].IsEmpty (){_b .MarshalXML (_cdd ,_b .RelationsPathFor (_dbcc ),_bdec ._baf [_ecff ].X ());};};for _beb ,_fgda :=range _bdec ._geb {_beg :=_g .AbsoluteFilename (_gffg ,_g .FooterType ,_beb +1);if _bebf :=_b .MarshalXMLByTypeIndex (_cdd ,_gffg ,_g .FooterType ,_beb +1,_fgda );_bebf !=nil {return _bebf ;};if !_bdec ._gfef [_beb ].IsEmpty (){_b .MarshalXML (_cdd ,_b .RelationsPathFor (_beg ),_bdec ._gfef [_beb ].X ());};};for _ffb ,_fegc :=range _bdec .Images {if _cbe :=_cd .AddImageToZip (_cdd ,_fegc ,_ffb +1,_g .DocTypeDocument );_cbe !=nil {return _cbe ;};};for _fcac ,_ade :=range _bdec ._fgcg {_bbgd :=_g .AbsoluteFilename (_gffg ,_g .ChartType ,_fcac +1);_b .MarshalXML (_cdd ,_bbgd ,_ade ._gfea );};if _dbccg :=_b .MarshalXML (_cdd ,_g .ContentTypesFilename ,_bdec .ContentTypes .X ());_dbccg !=nil {return _dbccg ;};if _aaa :=_bdec .WriteExtraFiles (_cdd );_aaa !=nil {return _aaa ;};return _cdd .Close ();};
|
|
|
|
// CellMargins are the margins for an individual cell.
|
|
type CellMargins struct{_cc *_dag .CT_TcMar };
|
|
|
|
// HasFootnotes returns a bool based on the presence or abscence of footnotes within
|
|
// the document.
|
|
func (_dfcc *Document )HasFootnotes ()bool {return _dfcc ._dde !=nil };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_cab AnchoredDrawing )X ()*_dag .WdAnchor {return _cab ._af };
|
|
|
|
// SetTableIndent sets the Table Indent from the Leading Margin
|
|
func (_dgge TableStyleProperties )SetTableIndent (ind _dd .Distance ){_dgge ._afeg .TblInd =_dag .NewCT_TblWidth ();_dgge ._afeg .TblInd .TypeAttr =_dag .ST_TblWidthDxa ;_dgge ._afeg .TblInd .WAttr =&_dag .ST_MeasurementOrPercent {};_dgge ._afeg .TblInd .WAttr .ST_DecimalNumberOrPercent =&_dag .ST_DecimalNumberOrPercent {};_dgge ._afeg .TblInd .WAttr .ST_DecimalNumberOrPercent .ST_UnqualifiedPercentage =_g .Int64 (int64 (ind /_dd .Dxa ));};
|
|
|
|
// TableProperties returns the table style properties.
|
|
func (_dfbg Style )TableProperties ()TableStyleProperties {if _dfbg ._ffabb .TblPr ==nil {_dfbg ._ffabb .TblPr =_dag .NewCT_TblPrBase ();};return TableStyleProperties {_dfbg ._ffabb .TblPr };};func _cbee (_fgbe *_dag .CT_Tbl ,_fcff map[string ]string ){for _ ,_ffee :=range _fgbe .EG_ContentRowContent {for _ ,_cbeed :=range _ffee .Tr {for _ ,_abff :=range _cbeed .EG_ContentCellContent {for _ ,_cfaf :=range _abff .Tc {for _ ,_deec :=range _cfaf .EG_BlockLevelElts {for _ ,_cgc :=range _deec .EG_ContentBlockContent {for _ ,_egebe :=range _cgc .P {_ebce (_egebe ,_fcff );};for _ ,_edgb :=range _cgc .Tbl {_cbee (_edgb ,_fcff );};};};};};};};};
|
|
|
|
// 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 (_dbdee Header )Index ()int {for _gdfafc ,_cbca :=range _dbdee ._gcaa ._abcg {if _cbca ==_dbdee ._ddaf {return _gdfafc ;};};return -1;};func _bgcge (_efage *_dag .CT_Border ,_babce _dag .ST_Border ,_gdbad _ca .Color ,_bbcf _dd .Distance ){_efage .ValAttr =_babce ;_efage .ColorAttr =&_dag .ST_HexColor {};if _gdbad .IsAuto (){_efage .ColorAttr .ST_HexColorAuto =_dag .ST_HexColorAutoAuto ;}else {_efage .ColorAttr .ST_HexColorRGB =_gdbad .AsRGBString ();};if _bbcf !=_dd .Zero {_efage .SzAttr =_g .Uint64 (uint64 (_bbcf /_dd .Point *8));};};
|
|
|
|
// SetYOffset sets the Y offset for an image relative to the origin.
|
|
func (_eca AnchoredDrawing )SetYOffset (y _dd .Distance ){_eca ._af .PositionV .Choice =&_dag .WdCT_PosVChoice {};_eca ._af .PositionV .Choice .PosOffset =_g .Int32 (int32 (y /_dd .EMU ));};
|
|
|
|
// AddCell adds a cell to a row and returns it
|
|
func (_gbcc Row )AddCell ()Cell {_cfeg :=_dag .NewEG_ContentCellContent ();_gbcc ._gcce .EG_ContentCellContent =append (_gbcc ._gcce .EG_ContentCellContent ,_cfeg );_bffbf :=_dag .NewCT_Tc ();_cfeg .Tc =append (_cfeg .Tc ,_bffbf );return Cell {_gbcc ._fegg ,_bffbf };};
|
|
|
|
// Fonts returns the style's Fonts.
|
|
func (_deba RunProperties )Fonts ()Fonts {if _deba ._becb .RFonts ==nil {_deba ._becb .RFonts =_dag .NewCT_Fonts ();};return Fonts {_deba ._becb .RFonts };};
|
|
|
|
// SetNextStyle sets the style that the next paragraph will use.
|
|
func (_ffdba Style )SetNextStyle (name string ){if name ==""{_ffdba ._ffabb .Next =nil ;}else {_ffdba ._ffabb .Next =_dag .NewCT_String ();_ffdba ._ffabb .Next .ValAttr =name ;};};
|
|
|
|
// AddBreak adds a line break to a run.
|
|
func (_fbeeg Run )AddBreak (){_ffbb :=_fbeeg .newIC ();_ffbb .Br =_dag .NewCT_Br ()};
|
|
|
|
// SetRightToLeft sets the run text goes from right to left.
|
|
func (_aedg RunProperties )SetRightToLeft (b bool ){if !b {_aedg ._becb .Rtl =nil ;}else {_aedg ._becb .Rtl =_dag .NewCT_OnOff ();};};
|
|
|
|
// SetText sets the watermark text.
|
|
func (_dfabcf *WatermarkText )SetText (text string ){_aggcd :=_dfabcf .getShape ();if _dfabcf ._efac !=nil {_bbcbd :=_dfabcf ._efac .EG_ShapeElements ;if len (_bbcbd )> 0&&_bbcbd [0].Textpath !=nil {_bbcbd [0].Textpath .StringAttr =&text ;};}else {_eafb :=_dfabcf .findNode (_aggcd ,"\u0074\u0065\u0078\u0074\u0070\u0061\u0074\u0068");for _fbaf ,_ffccf :=range _eafb .Attrs {if _ffccf .Name .Local =="\u0073\u0074\u0072\u0069\u006e\u0067"{_eafb .Attrs [_fbaf ].Value =text ;};};};};
|
|
|
|
// SetPageSizeAndOrientation sets the page size and orientation for a section.
|
|
func (_dgdbd Section )SetPageSizeAndOrientation (w ,h _dd .Distance ,orientation _dag .ST_PageOrientation ){if _dgdbd ._gbfbf .PgSz ==nil {_dgdbd ._gbfbf .PgSz =_dag .NewCT_PageSz ();};_dgdbd ._gbfbf .PgSz .OrientAttr =orientation ;if orientation ==_dag .ST_PageOrientationLandscape {_dgdbd ._gbfbf .PgSz .WAttr =&_ge .ST_TwipsMeasure {};_dgdbd ._gbfbf .PgSz .WAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (h /_dd .Twips ));_dgdbd ._gbfbf .PgSz .HAttr =&_ge .ST_TwipsMeasure {};_dgdbd ._gbfbf .PgSz .HAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (w /_dd .Twips ));}else {_dgdbd ._gbfbf .PgSz .WAttr =&_ge .ST_TwipsMeasure {};_dgdbd ._gbfbf .PgSz .WAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (w /_dd .Twips ));_dgdbd ._gbfbf .PgSz .HAttr =&_ge .ST_TwipsMeasure {};_dgdbd ._gbfbf .PgSz .HAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (h /_dd .Twips ));};};
|
|
|
|
// SetName marks sets a name attribute for a FormField.
|
|
func (_dbbg FormField )SetName (name string ){_bccg :=_dag .NewCT_FFName ();_bccg .ValAttr =&name ;_dbbg ._dgfaa .Name =[]*_dag .CT_FFName {_bccg };};
|
|
|
|
// Bookmarks returns all of the bookmarks defined in the document.
|
|
func (_acfa Document )Bookmarks ()[]Bookmark {if _acfa ._ceeb .Body ==nil {return nil ;};_eeeg :=[]Bookmark {};for _ ,_bdba :=range _acfa ._ceeb .Body .EG_BlockLevelElts {for _ ,_ecgg :=range _bdba .EG_ContentBlockContent {for _ ,_bggg :=range _bbce (_ecgg ){_eeeg =append (_eeeg ,_bggg );};};};return _eeeg ;};
|
|
|
|
// Name returns the name of the bookmark whcih is the document unique ID that
|
|
// identifies the bookmark.
|
|
func (_cbc Bookmark )Name ()string {return _cbc ._dcc .NameAttr };
|
|
|
|
// SetTop sets the cell top margin
|
|
func (_aeb CellMargins )SetTop (d _dd .Distance ){_aeb ._cc .Top =_dag .NewCT_TblWidth ();_dbdg (_aeb ._cc .Top ,d );};
|
|
|
|
// AddDrawingAnchored adds an anchored (floating) drawing from an ImageRef.
|
|
func (_cbgef Run )AddDrawingAnchored (img _cd .ImageRef )(AnchoredDrawing ,error ){_fbfef :=_cbgef .newIC ();_fbfef .Drawing =_dag .NewCT_Drawing ();_fccc :=_dag .NewWdAnchor ();_bdab :=AnchoredDrawing {_cbgef ._gcba ,_fccc };_fccc .SimplePosAttr =_g .Bool (false );_fccc .AllowOverlapAttr =true ;_fccc .CNvGraphicFramePr =_cgb .NewCT_NonVisualGraphicFrameProperties ();_fbfef .Drawing .Anchor =append (_fbfef .Drawing .Anchor ,_fccc );_fccc .Graphic =_cgb .NewGraphic ();_fccc .Graphic .GraphicData =_cgb .NewCT_GraphicalObjectData ();_fccc .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";_fccc .SimplePos .XAttr .ST_CoordinateUnqualified =_g .Int64 (0);_fccc .SimplePos .YAttr .ST_CoordinateUnqualified =_g .Int64 (0);_fccc .PositionH .RelativeFromAttr =_dag .WdST_RelFromHPage ;_fccc .PositionH .Choice =&_dag .WdCT_PosHChoice {};_fccc .PositionH .Choice .PosOffset =_g .Int32 (0);_fccc .PositionV .RelativeFromAttr =_dag .WdST_RelFromVPage ;_fccc .PositionV .Choice =&_dag .WdCT_PosVChoice {};_fccc .PositionV .Choice .PosOffset =_g .Int32 (0);_fccc .Extent .CxAttr =int64 (float64 (img .Size ().X *_dd .Pixel72 )/_dd .EMU );_fccc .Extent .CyAttr =int64 (float64 (img .Size ().Y *_dd .Pixel72 )/_dd .EMU );_fccc .Choice =&_dag .WdEG_WrapTypeChoice {};_fccc .Choice .WrapSquare =_dag .NewWdCT_WrapSquare ();_fccc .Choice .WrapSquare .WrapTextAttr =_dag .WdST_WrapTextBothSides ;_ggfdd :=0x7FFFFFFF&_fg .Uint32 ();_fccc .DocPr .IdAttr =_ggfdd ;_fgfgd :=_ggb .NewPic ();_fgfgd .NvPicPr .CNvPr .IdAttr =_ggfdd ;_gfccd :=img .RelID ();if _gfccd ==""{return _bdab ,_de .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");};_fccc .Graphic .GraphicData .Any =append (_fccc .Graphic .GraphicData .Any ,_fgfgd );_fgfgd .BlipFill =_cgb .NewCT_BlipFillProperties ();_fgfgd .BlipFill .Blip =_cgb .NewCT_Blip ();_fgfgd .BlipFill .Blip .EmbedAttr =&_gfccd ;_fgfgd .BlipFill .Stretch =_cgb .NewCT_StretchInfoProperties ();_fgfgd .BlipFill .Stretch .FillRect =_cgb .NewCT_RelativeRect ();_fgfgd .SpPr =_cgb .NewCT_ShapeProperties ();_fgfgd .SpPr .Xfrm =_cgb .NewCT_Transform2D ();_fgfgd .SpPr .Xfrm .Off =_cgb .NewCT_Point2D ();_fgfgd .SpPr .Xfrm .Off .XAttr .ST_CoordinateUnqualified =_g .Int64 (0);_fgfgd .SpPr .Xfrm .Off .YAttr .ST_CoordinateUnqualified =_g .Int64 (0);_fgfgd .SpPr .Xfrm .Ext =_cgb .NewCT_PositiveSize2D ();_fgfgd .SpPr .Xfrm .Ext .CxAttr =int64 (img .Size ().X *_dd .Point );_fgfgd .SpPr .Xfrm .Ext .CyAttr =int64 (img .Size ().Y *_dd .Point );_fgfgd .SpPr .PrstGeom =_cgb .NewCT_PresetGeometry2D ();_fgfgd .SpPr .PrstGeom .PrstAttr =_cgb .ST_ShapeTypeRect ;return _bdab ,nil ;};const (FormFieldTypeUnknown FormFieldType =iota ;FormFieldTypeText ;FormFieldTypeCheckBox ;FormFieldTypeDropDown ;);
|
|
|
|
// InsertRowBefore inserts a row before another row
|
|
func (_afdeb Table )InsertRowBefore (r Row )Row {for _gdbeea ,_eeegg :=range _afdeb ._acbcf .EG_ContentRowContent {if len (_eeegg .Tr )> 0&&r .X ()==_eeegg .Tr [0]{_dedabd :=_dag .NewEG_ContentRowContent ();_afdeb ._acbcf .EG_ContentRowContent =append (_afdeb ._acbcf .EG_ContentRowContent ,nil );copy (_afdeb ._acbcf .EG_ContentRowContent [_gdbeea +1:],_afdeb ._acbcf .EG_ContentRowContent [_gdbeea :]);_afdeb ._acbcf .EG_ContentRowContent [_gdbeea ]=_dedabd ;_ggadb :=_dag .NewCT_Row ();_dedabd .Tr =append (_dedabd .Tr ,_ggadb );return Row {_afdeb ._fabdg ,_ggadb };};};return _afdeb .AddRow ();};
|
|
|
|
// SetChecked marks a FormFieldTypeCheckBox as checked or unchecked.
|
|
func (_bfff FormField )SetChecked (b bool ){if _bfff ._dgfaa .CheckBox ==nil {return ;};if !b {_bfff ._dgfaa .CheckBox .Checked =nil ;}else {_bfff ._dgfaa .CheckBox .Checked =_dag .NewCT_OnOff ();};};
|
|
|
|
// SetFirstRow controls the conditional formatting for the first row in a table.
|
|
func (_cgae TableLook )SetFirstRow (on bool ){if !on {_cgae ._bfbbe .FirstRowAttr =&_ge .ST_OnOff {};_cgae ._bfbbe .FirstRowAttr .ST_OnOff1 =_ge .ST_OnOff1Off ;}else {_cgae ._bfbbe .FirstRowAttr =&_ge .ST_OnOff {};_cgae ._bfbbe .FirstRowAttr .ST_OnOff1 =_ge .ST_OnOff1On ;};};
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_cgafa Settings )X ()*_dag .Settings {return _cgafa ._beag };
|
|
|
|
// X returns the inner wrapped XML type.
|
|
func (_ceb *Document )X ()*_dag .Document {return _ceb ._ceeb };
|
|
|
|
// AddFooter creates a Footer associated with the document, but doesn't add it
|
|
// to the document for display.
|
|
func (_aae *Document )AddFooter ()Footer {_agf :=_dag .NewFtr ();_aae ._geb =append (_aae ._geb ,_agf );_fea :=_ga .Sprintf ("\u0066\u006f\u006ft\u0065\u0072\u0025\u0064\u002e\u0078\u006d\u006c",len (_aae ._geb ));_aae ._dbce .AddRelationship (_fea ,_g .FooterType );_aae .ContentTypes .AddOverride ("\u002f\u0077\u006f\u0072\u0064\u002f"+_fea ,"\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");_aae ._gfef =append (_aae ._gfef ,_cd .NewRelationships ());return Footer {_aae ,_agf };};
|
|
|
|
// ParagraphProperties returns the paragraph properties controlling text formatting within the table.
|
|
func (_fdce TableConditionalFormatting )ParagraphProperties ()ParagraphStyleProperties {if _fdce ._cfbcc .PPr ==nil {_fdce ._cfbcc .PPr =_dag .NewCT_PPrGeneral ();};return ParagraphStyleProperties {_fdce ._cfbcc .PPr };};
|
|
|
|
// SetLeftIndent controls the left indent of the paragraph.
|
|
func (_bfce ParagraphStyleProperties )SetLeftIndent (m _dd .Distance ){if _bfce ._ffgg .Ind ==nil {_bfce ._ffgg .Ind =_dag .NewCT_Ind ();};if m ==_dd .Zero {_bfce ._ffgg .Ind .LeftAttr =nil ;}else {_bfce ._ffgg .Ind .LeftAttr =&_dag .ST_SignedTwipsMeasure {};_bfce ._ffgg .Ind .LeftAttr .Int64 =_g .Int64 (int64 (m /_dd .Twips ));};};
|
|
|
|
// AddFieldWithFormatting adds a field (automatically computed text) to the
|
|
// document with field specifc formatting.
|
|
func (_cffec Run )AddFieldWithFormatting (code string ,fmt string ,isDirty bool ){_eebe :=_cffec .newIC ();_eebe .FldChar =_dag .NewCT_FldChar ();_eebe .FldChar .FldCharTypeAttr =_dag .ST_FldCharTypeBegin ;if isDirty {_eebe .FldChar .DirtyAttr =&_ge .ST_OnOff {};_eebe .FldChar .DirtyAttr .Bool =_g .Bool (true );};_eebe =_cffec .newIC ();_eebe .InstrText =_dag .NewCT_Text ();if fmt !=""{_eebe .InstrText .Content =code +"\u0020"+fmt ;}else {_eebe .InstrText .Content =code ;};_eebe =_cffec .newIC ();_eebe .FldChar =_dag .NewCT_FldChar ();_eebe .FldChar .FldCharTypeAttr =_dag .ST_FldCharTypeEnd ;};func (_bagb *chart )X ()*_cg .ChartSpace {return _bagb ._gfea };
|
|
|
|
// X returns the inner wml.CT_TblBorders
|
|
func (_adff TableBorders )X ()*_dag .CT_TblBorders {return _adff ._dfeff };
|
|
|
|
// SetKerning sets the run's font kerning.
|
|
func (_dgeb RunProperties )SetKerning (size _dd .Distance ){_dgeb ._becb .Kern =_dag .NewCT_HpsMeasure ();_dgeb ._becb .Kern .ValAttr .ST_UnsignedDecimalNumber =_g .Uint64 (uint64 (size /_dd .HalfPoint ));};func (_bebcg *WatermarkPicture )getShape ()*_g .XSDAny {return _bebcg .getInnerElement ("\u0073\u0068\u0061p\u0065");};
|
|
|
|
// MergeFields returns the list of all mail merge fields found in the document.
|
|
func (_deef Document )MergeFields ()[]string {_bgfbg :=map[string ]struct{}{};for _ ,_bedfb :=range _deef .mergeFields (){_bgfbg [_bedfb ._afac ]=struct{}{};};_cdeda :=[]string {};for _cbce :=range _bgfbg {_cdeda =append (_cdeda ,_cbce );};return _cdeda ;};
|
|
|
|
// SetKeepOnOnePage controls if all lines in a paragraph are kept on the same
|
|
// page.
|
|
func (_gcdg ParagraphProperties )SetKeepOnOnePage (b bool ){if !b {_gcdg ._gfeb .KeepLines =nil ;}else {_gcdg ._gfeb .KeepLines =_dag .NewCT_OnOff ();};};
|
|
|
|
// SetColor sets the text color.
|
|
func (_dfff RunProperties )SetColor (c _ca .Color ){_dfff ._becb .Color =_dag .NewCT_Color ();_dfff ._becb .Color .ValAttr .ST_HexColorRGB =c .AsRGBString ();};
|
|
|
|
// AddParagraph adds a paragraph to the table cell.
|
|
func (_dgg Cell )AddParagraph ()Paragraph {_dea :=_dag .NewEG_BlockLevelElts ();_dgg ._fb .EG_BlockLevelElts =append (_dgg ._fb .EG_BlockLevelElts ,_dea );_bae :=_dag .NewEG_ContentBlockContent ();_dea .EG_ContentBlockContent =append (_dea .EG_ContentBlockContent ,_bae );_agb :=_dag .NewCT_P ();_bae .P =append (_bae .P ,_agb );return Paragraph {_dgg ._fcbc ,_agb };};
|
|
|
|
// RunProperties returns the run style properties.
|
|
func (_fggbe Style )RunProperties ()RunProperties {if _fggbe ._ffabb .RPr ==nil {_fggbe ._ffabb .RPr =_dag .NewCT_RPr ();};return RunProperties {_fggbe ._ffabb .RPr };}; |