unioffice/common/common.go
2022-02-25 19:20:45 +00:00

413 lines
48 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 common contains wrapper types and utilities common to all of the
// OOXML document formats.
//
// Package common contains common properties used by the subpackages.
package common ;import (_cb "archive/zip";_b "bytes";_gd "encoding/xml";_fa "errors";_ba "fmt";_ff "github.com/unidoc/unioffice";_eg "github.com/unidoc/unioffice/common/logger";_fgb "github.com/unidoc/unioffice/common/tempstorage";_gaf "github.com/unidoc/unioffice/common/tempstorage/diskstore";_dg "github.com/unidoc/unioffice/measurement";_ee "github.com/unidoc/unioffice/schema/soo/dml";_a "github.com/unidoc/unioffice/schema/soo/ofc/custom_properties";_da "github.com/unidoc/unioffice/schema/soo/ofc/docPropsVTypes";_cf "github.com/unidoc/unioffice/schema/soo/ofc/extended_properties";_cbf "github.com/unidoc/unioffice/schema/soo/pkg/content_types";_ac "github.com/unidoc/unioffice/schema/soo/pkg/metadata/core_properties";_faf "github.com/unidoc/unioffice/schema/soo/pkg/relationships";_gc "github.com/unidoc/unioffice/zippkg";_dc "image";_ "image/gif";_ "image/jpeg";_ "image/png";_g "os";_e "reflect";_bb "regexp";_fg "strconv";_ga "strings";_ea "time";);
// Rows returns all table rows.
func (_gce Table )Rows ()[]*TableRow {_faac :=_gce ._bcda .Tr ;_abg :=[]*TableRow {};for _ ,_bcag :=range _faac {_abg =append (_abg ,&TableRow {_facb :_bcag });};return _abg ;};const _cgbc =15;func (_eaeg CustomProperties )SetPropertyAsLpstr (name string ,lpstr string ){_cag :=_eaeg .getNewProperty (name );_cag .Lpstr =&lpstr ;_eaeg .setOrReplaceProperty (_cag );};
// CopyRelationship copies the relationship.
func (_efcf Relationships )CopyRelationship (idAttr string )(Relationship ,bool ){for _fga :=range _efcf ._fffg .Relationship {if _efcf ._fffg .Relationship [_fga ].IdAttr ==idAttr {_aba :=*_efcf ._fffg .Relationship [_fga ];_cggg :=len (_efcf ._fffg .Relationship )+1;_aaea :=map[string ]struct{}{};for _ ,_dbe :=range _efcf ._fffg .Relationship {_aaea [_dbe .IdAttr ]=struct{}{};};for _ ,_ebg :=_aaea [_ba .Sprintf ("\u0072\u0049\u0064%\u0064",_cggg )];_ebg ;_ ,_ebg =_aaea [_ba .Sprintf ("\u0072\u0049\u0064%\u0064",_cggg )]{_cggg ++;};_aba .IdAttr =_ba .Sprintf ("\u0072\u0049\u0064%\u0064",_cggg );_efcf ._fffg .Relationship =append (_efcf ._fffg .Relationship ,&_aba );return Relationship {_bcd :&_aba },true ;};};return Relationship {},false ;};
// RelativeHeight returns the relative height of an image given a fixed width.
// This is used when setting image to a fixed width to calculate the height
// required to keep the same image aspect ratio.
func (_gcd ImageRef )RelativeHeight (w _dg .Distance )_dg .Distance {_gb :=float64 (_gcd .Size ().Y )/float64 (_gcd .Size ().X );return w *_dg .Distance (_gb );};
// SetModified sets the time that the document was modified.
func (_eef CoreProperties )SetModified (t _ea .Time ){_eef ._aae .Modified =_dcb (t ,"\u0064\u0063t\u0065\u0072\u006ds\u003a\u006d\u006f\u0064\u0069\u0066\u0069\u0065\u0064");};
// Pages returns total number of pages which are saved by the text editor which produced the document.
// For unioffice created documents, it is 0.
func (_bgc AppProperties )Pages ()int32 {if _bgc ._aged .Pages !=nil {return *_bgc ._aged .Pages ;};return 0;};func (_gae CustomProperties )SetPropertyAsCy (name string ,cy string ){_aaa :=_gae .getNewProperty (name );_aaa .Cy =&cy ;_gae .setOrReplaceProperty (_aaa );};
// NewRelationshipsCopy creates a new relationships wrapper as a copy of passed in instance.
func NewRelationshipsCopy (rels Relationships )Relationships {_fbgg :=*rels ._fffg ;return Relationships {_fffg :&_fbgg };};
// AddExtraFileFromZip is used when reading an unsupported file from an OOXML
// file. This ensures that unsupported file content will at least round-trip
// correctly.
func (_dda *DocBase )AddExtraFileFromZip (f *_cb .File )error {_dbd ,_dafe :=_gc .ExtractToDiskTmp (f ,_dda .TmpPath );if _dafe !=nil {return _ba .Errorf ("\u0065\u0072r\u006f\u0072\u0020\u0065x\u0074\u0072a\u0063\u0074\u0069\u006e\u0067\u0020\u0075\u006es\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0066\u0069\u006ce\u003a\u0020\u0025\u0073",_dafe );};_dda .ExtraFiles =append (_dda .ExtraFiles ,ExtraFile {ZipPath :f .Name ,DiskPath :_dbd });return nil ;};func (_egff CustomProperties )SetPropertyAsI4 (name string ,i4 int32 ){_ffca :=_egff .getNewProperty (name );_ffca .I4 =&i4 ;_egff .setOrReplaceProperty (_ffca );};
// Hyperlink is just an appropriately configured relationship.
type Hyperlink Relationship ;func (_dfa Relationship )String ()string {return _ba .Sprintf ("\u007b\u0049\u0044\u003a \u0025\u0073\u0020\u0054\u0061\u0072\u0067\u0065\u0074\u003a \u0025s\u0020\u0054\u0079\u0070\u0065\u003a\u0020%\u0073\u007d",_dfa .ID (),_dfa .Target (),_dfa .Type ());};
// SetDescription records the description of the document.
func (_gdg CoreProperties )SetDescription (s string ){if _gdg ._aae .Description ==nil {_gdg ._aae .Description =&_ff .XSDAny {XMLName :_gd .Name {Local :"\u0064\u0063\u003a\u0064\u0065\u0073\u0063\u0072\u0069p\u0074\u0069\u006f\u006e"}};};_gdg ._aae .Description .Data =[]byte (s );};func (_fdf CustomProperties )SetPropertyAsUi4 (name string ,ui4 uint32 ){_bfde :=_fdf .getNewProperty (name );_bfde .Ui4 =&ui4 ;_fdf .setOrReplaceProperty (_bfde );};
// SetLinksUpToDate sets the links up to date flag.
func (_beb AppProperties )SetLinksUpToDate (v bool ){_beb ._aged .LinksUpToDate =_ff .Bool (v )};
// NewRelationships creates a new relationship wrapper.
func NewRelationships ()Relationships {return Relationships {_fffg :_faf .NewRelationships ()}};func (_gcfa CustomProperties )SetPropertyAsUi8 (name string ,ui8 uint64 ){_gfd :=_gcfa .getNewProperty (name );_gfd .Ui8 =&ui8 ;_gcfa .setOrReplaceProperty (_gfd );};
// SetTarget set the target (path) of a relationship.
func (_dbff Relationship )SetTarget (s string ){_dbff ._bcd .TargetAttr =s };
// NewRelationship constructs a new relationship.
func NewRelationship ()Relationship {return Relationship {_bcd :_faf .NewRelationship ()}};
// EnsureOverride ensures that an override for the given path exists, adding it if necessary
func (_ege ContentTypes )EnsureOverride (path ,contentType string ){for _ ,_caf :=range _ege ._bbb .Override {if _caf .PartNameAttr ==path {if _ga .HasPrefix (contentType ,"\u0068\u0074\u0074\u0070"){_eg .Log .Debug ("\u0063\u006f\u006e\u0074\u0065\u006et\u0020\u0074\u0079p\u0065\u0020\u0027%\u0073\u0027\u0020\u0069\u0073\u0020\u0069\u006e\u0063\u006fr\u0072\u0065\u0063\u0074\u002c m\u0075\u0073\u0074\u0020\u006e\u006f\u0074\u0020\u0073\u0074\u0061\u0072\u0074\u0020\u0077\u0069\u0074\u0068\u0020\u0068\u0074\u0074\u0070",contentType );};_caf .ContentTypeAttr =contentType ;return ;};};_ege .AddOverride (path ,contentType );};
// CoreProperties contains document specific properties.
type CoreProperties struct{_aae *_ac .CoreProperties };
// TableRow represents a row in a table.
type TableRow struct{_facb *_ee .CT_TableRow };func (_gfb CustomProperties )SetPropertyAsVector (name string ,vector *_da .Vector ){_bfd :=_gfb .getNewProperty (name );_bfd .Vector =vector ;_gfb .setOrReplaceProperty (_bfd );};
// CreateCustomProperties creates the custom properties of the document.
func (_cec *DocBase )CreateCustomProperties (){_cec .CustomProperties =NewCustomProperties ();_cec .AddCustomRelationships ();};
// RemoveOverride removes an override given a path.
func (_fgg ContentTypes )RemoveOverride (path string ){if !_ga .HasPrefix (path ,"\u002f"){path ="\u002f"+path ;};for _eca ,_ffb :=range _fgg ._bbb .Override {if _ffb .PartNameAttr ==path {copy (_fgg ._bbb .Override [_eca :],_fgg ._bbb .Override [_eca +1:]);_fgg ._bbb .Override =_fgg ._bbb .Override [0:len (_fgg ._bbb .Override )-1];};};};func (_dga CustomProperties )getNewProperty (_ed string )*_a .CT_Property {_bae :=_dga ._gge .Property ;_afff :=int32 (1);for _ ,_aege :=range _bae {if _aege .PidAttr > _afff {_afff =_aege .PidAttr ;};};_dacb :=_a .NewCT_Property ();_dacb .NameAttr =&_ed ;_dacb .PidAttr =_afff +1;_dacb .FmtidAttr ="\u007b\u0044\u0035\u0043\u0044\u0044\u0035\u0030\u0035\u002d\u0032\u0045\u0039\u0043\u002d\u0031\u0030\u0031\u0042\u002d\u0039\u0033\u0039\u0037-\u0030\u0038\u0030\u0030\u0032B\u0032\u0043F\u0039\u0041\u0045\u007d";return _dacb ;};
// AddOverride adds an override content type for a given path name.
func (_bca ContentTypes )AddOverride (path ,contentType string ){if !_ga .HasPrefix (path ,"\u002f"){path ="\u002f"+path ;};if _ga .HasPrefix (contentType ,"\u0068\u0074\u0074\u0070"){_eg .Log .Debug ("\u0063\u006f\u006e\u0074\u0065\u006et\u0020\u0074\u0079p\u0065\u0020\u0027%\u0073\u0027\u0020\u0069\u0073\u0020\u0069\u006e\u0063\u006fr\u0072\u0065\u0063\u0074\u002c m\u0075\u0073\u0074\u0020\u006e\u006f\u0074\u0020\u0073\u0074\u0061\u0072\u0074\u0020\u0077\u0069\u0074\u0068\u0020\u0068\u0074\u0074\u0070",contentType );};for _ ,_cc :=range _bca ._bbb .Override {if _cc .PartNameAttr ==path &&_cc .ContentTypeAttr ==contentType {return ;};};_ffcf :=_cbf .NewOverride ();_ffcf .PartNameAttr =path ;_ffcf .ContentTypeAttr =contentType ;_bca ._bbb .Override =append (_bca ._bbb .Override ,_ffcf );};
// Title returns the Title of the document
func (_fde CoreProperties )Title ()string {if _fde ._aae .Title !=nil {return string (_fde ._aae .Title .Data );};return "";};
// AddAutoRelationship adds a relationship with an automatically generated
// filename based off of the type. It should be preferred over AddRelationship
// to ensure consistent filenames are maintained.
func (_dde Relationships )AddAutoRelationship (dt _ff .DocType ,src string ,idx int ,ctype string )Relationship {return _dde .AddRelationship (_ff .RelativeFilename (dt ,src ,ctype ,idx ),ctype );};
// SetDocSecurity sets the document security flag.
func (_ca AppProperties )SetDocSecurity (v int32 ){_ca ._aged .DocSecurity =_ff .Int32 (v )};
// SetTarget changes the target attribute of the image reference (e.g. in the case of the creation of the reference or if the image which the reference is related to was moved from one location to another).
func (_fbf *ImageRef )SetTarget (target string ){_fbf ._adfe =target };
// Author returns the author of the document
func (_ce CoreProperties )Author ()string {if _ce ._aae .Creator !=nil {return string (_ce ._aae .Creator .Data );};return "";};
// ImageFromFile reads an image from a file on disk. It doesn't keep the image
// in memory and only reads it to determine the format and size. You can also
// construct an Image directly if the file and size are known.
// NOTE: See also ImageFromStorage.
func ImageFromFile (path string )(Image ,error ){_agdga ,_bea :=_g .Open (path );_aegf :=Image {};if _bea !=nil {return _aegf ,_ba .Errorf ("\u0065\u0072\u0072or\u0020\u0072\u0065\u0061\u0064\u0069\u006e\u0067\u0020\u0069\u006d\u0061\u0067\u0065\u003a\u0020\u0025\u0073",_bea );};defer _agdga .Close ();_cbbe ,_addg ,_bea :=_dc .Decode (_agdga );if _bea !=nil {return _aegf ,_ba .Errorf ("\u0075n\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0070\u0061r\u0073e\u0020i\u006d\u0061\u0067\u0065\u003a\u0020\u0025s",_bea );};_aegf .Path =path ;_aegf .Format =_addg ;_aegf .Size =_cbbe .Bounds ().Size ();return _aegf ,nil ;};
// SetStyle assigns TableStyle to a table.
func (_bce Table )SetStyle (style *_ee .CT_TableStyle ){if _bce ._bcda .TblPr ==nil {_bce ._bcda .TblPr =_ee .NewCT_TableProperties ();};if _bce ._bcda .TblPr .Choice ==nil {_bce ._bcda .TblPr .Choice =_ee .NewCT_TablePropertiesChoice ();};_bce ._bcda .TblPr .Choice .TableStyle =style ;};
// TableCol represents a column in a table.
type TableCol struct{_abd *_ee .CT_TableCol };
// SetOffsetY sets vertical offset of a table in distance units (see measurement package).
func (_edab Table )SetOffsetY (offY float64 ){if _edab ._cgbd .Off ==nil {_edab ._cgbd .Off =_ee .NewCT_Point2D ();_acbc :=int64 (0);_edab ._cgbd .Off .XAttr =_ee .ST_Coordinate {ST_CoordinateUnqualified :&_acbc };};_gea :=_dg .ToEMU (offY );_edab ._cgbd .Off .YAttr =_ee .ST_Coordinate {ST_CoordinateUnqualified :&_gea };};func (_bfb CustomProperties )SetPropertyAsStorage (name string ,storage string ){_cae :=_bfb .getNewProperty (name );_cae .Storage =&storage ;_bfb .setOrReplaceProperty (_cae );};func (_abf TableRow )addCell ()*_ee .CT_TableCell {_fgaa :=_ee .NewCT_TableCell ();_abf ._facb .Tc =append (_abf ._facb .Tc ,_fgaa );return _fgaa ;};func (_ged CustomProperties )SetPropertyAsBstr (name string ,bstr string ){_fbe :=_ged .getNewProperty (name );_fbe .Bstr =&bstr ;_ged .setOrReplaceProperty (_fbe );};
// Relationships represents a .rels file.
type Relationships struct{_fffg *_faf .Relationships };
// Relationship is a relationship within a .rels file.
type Relationship struct{_bcd *_faf .Relationship };
// X returns the inner wrapped XML type of CustomProperty.
func (_adf CustomProperty )X ()*_a .CT_Property {return _adf ._cca };func (_ecgb CustomProperties )setPropertyHelper (_acgb *_a .CT_Property ,_gdf bool ){_aegb :=_ecgb .GetPropertyByName (*_acgb .NameAttr );if (_aegb ==CustomProperty {}){_ecgb ._gge .Property =append (_ecgb ._gge .Property ,_acgb );}else if _gdf {_acgb .FmtidAttr =_aegb ._cca .FmtidAttr ;if _aegb ._cca .PidAttr ==0{_acgb .PidAttr =_aegb ._cca .PidAttr ;};_acgb .LinkTargetAttr =_aegb ._cca .LinkTargetAttr ;*_aegb ._cca =*_acgb ;};};
// X returns the inner wrapped XML type.
func (_bec AppProperties )X ()*_cf .Properties {return _bec ._aged };
// AddDefault registers a default content type for a given file extension.
func (_dba ContentTypes )AddDefault (fileExtension string ,contentType string ){fileExtension =_ga .ToLower (fileExtension );for _ ,_gfg :=range _dba ._bbb .Default {if _gfg .ExtensionAttr ==fileExtension &&_gfg .ContentTypeAttr ==contentType {return ;};};_fe :=_cbf .NewDefault ();_fe .ExtensionAttr =fileExtension ;_fe .ContentTypeAttr =contentType ;_dba ._bbb .Default =append (_dba ._bbb .Default ,_fe );};func (_egee CustomProperties )SetPropertyAsOstorage (name string ,ostorage string ){_ffcc :=_egee .getNewProperty (name );_ffcc .Ostorage =&ostorage ;_egee .setOrReplaceProperty (_ffcc );};var ReleasedAt =_ea .Date (_cbfa ,_bad ,_eff ,_cgbc ,_fdd ,0,0,_ea .UTC );
// PropertiesList returns the list of all custom properties of the document.
func (_dad CustomProperties )PropertiesList ()[]*_a .CT_Property {return _dad ._gge .Property };
// RelativeWidth returns the relative width of an image given a fixed height.
// This is used when setting image to a fixed height to calculate the width
// required to keep the same image aspect ratio.
func (_ddf ImageRef )RelativeWidth (h _dg .Distance )_dg .Distance {_add :=float64 (_ddf .Size ().X )/float64 (_ddf .Size ().Y );return h *_dg .Distance (_add );};
// Image is a container for image information. It's used as we need format and
// and size information to use images.
// It contains either the filesystem path to the image, or the image itself.
type Image struct{Size _dc .Point ;Format string ;Path string ;Data *[]byte ;};
// RemoveOverrideByIndex removes an override given a path and override index.
func (_cce ContentTypes )RemoveOverrideByIndex (path string ,indexToFind int )error {_gg :=path [0:len (path )-5];if !_ga .HasPrefix (_gg ,"\u002f"){_gg ="\u002f"+_gg ;};_fce ,_cfe :=_bb .Compile (_gg +"\u0028\u005b\u0030-\u0039\u005d\u002b\u0029\u002e\u0078\u006d\u006c");if _cfe !=nil {return _cfe ;};_cd :=0;_gda :=-1;for _adef ,_deb :=range _cce ._bbb .Override {if _eae :=_fce .FindStringSubmatch (_deb .PartNameAttr );len (_eae )> 1{if _cd ==indexToFind {_gda =_adef ;}else if _cd > indexToFind {_bda ,_ :=_fg .Atoi (_eae [1]);_bda --;_deb .PartNameAttr =_ba .Sprintf ("\u0025\u0073\u0025\u0064\u002e\u0078\u006d\u006c",_gg ,_bda );};_cd ++;};};if _gda > -1{copy (_cce ._bbb .Override [_gda :],_cce ._bbb .Override [_gda +1:]);_cce ._bbb .Override =_cce ._bbb .Override [0:len (_cce ._bbb .Override )-1];};return nil ;};
// SetCreated sets the time that the document was created.
func (_efc CoreProperties )SetCreated (t _ea .Time ){_efc ._aae .Created =_dcb (t ,"\u0064c\u0074e\u0072\u006d\u0073\u003a\u0063\u0072\u0065\u0061\u0074\u0065\u0064");};
// SetOffsetX sets horizontal offset of a table in distance units (see measurement package).
func (_caecf Table )SetOffsetX (offX float64 ){if _caecf ._cgbd .Off ==nil {_caecf ._cgbd .Off =_ee .NewCT_Point2D ();_afa :=int64 (0);_caecf ._cgbd .Off .YAttr =_ee .ST_Coordinate {ST_CoordinateUnqualified :&_afa };};_gff :=_dg .ToEMU (offX );_caecf ._cgbd .Off .XAttr =_ee .ST_Coordinate {ST_CoordinateUnqualified :&_gff };};
// SetApplication sets the name of the application that created the document.
func (_gaa AppProperties )SetApplication (s string ){_gaa ._aged .Application =&s };const Version ="\u0031\u002e\u0031\u0038\u002e\u0030";func (_dbc CustomProperties )SetPropertyAsLpwstr (name string ,lpwstr string ){_egdc :=_dbc .getNewProperty (name );_egdc .Lpwstr =&lpwstr ;_dbc .setOrReplaceProperty (_egdc );};
// GetImageBytesByTarget returns Image object with Data bytes read from its target.
func (_dcc *DocBase )GetImageBytesByTarget (target string )(Image ,error ){if target !=""{target ="\u0077\u006f\u0072d\u002f"+target ;for _ ,_cbfc :=range _dcc .Images {if _cbfc .Target ()==target {return ImageFromStorage (_cbfc .Path ());};};};return Image {},_daeg ;};
// Company returns the name of the company that created the document.
// For unioffice created documents, it defaults to github.com/unidoc/unioffice
func (_cbfd AppProperties )Company ()string {if _cbfd ._aged .Company !=nil {return *_cbfd ._aged .Company ;};return "";};
// ContentTypes is the top level "[Content_Types].xml" in a zip package.
type ContentTypes struct{_bbb *_cbf .Types };
// NewAppProperties constructs a new AppProperties.
func NewAppProperties ()AppProperties {_afg :=AppProperties {_aged :_cf .NewProperties ()};_afg .SetCompany ("\u0046\u006f\u0078\u0079\u0055\u0074\u0069\u006c\u0073\u0020\u0065\u0068\u0066");_afg .SetApplication ("g\u0069\u0074\u0068\u0075\u0062\u002ec\u006f\u006d\u002f\u0075\u006e\u0069\u0064\u006f\u0063/\u0075\u006e\u0069o\u0066f\u0069\u0063\u0065");_afg .SetDocSecurity (0);_afg .SetLinksUpToDate (false );var _bdg ,_cfae ,_gcf int64 ;_ba .Sscanf (Version ,"\u0025\u0064\u002e\u0025\u0064\u002e\u0025\u0064",&_bdg ,&_cfae ,&_gcf );_dcf :=float64 (_bdg )+float64 (_cfae )/10000.0;_afg .SetApplicationVersion (_ba .Sprintf ("\u0025\u0030\u0037\u002e\u0034\u0066",_dcf ));return _afg ;};
// X returns the inner wrapped XML type.
func (_eged CoreProperties )X ()*_ac .CoreProperties {return _eged ._aae };
// GetPropertyByName returns a custom property selected by it's name.
func (_cdc CustomProperties )GetPropertyByName (name string )CustomProperty {_dgb :=_cdc ._gge .Property ;for _ ,_dcfe :=range _dgb {if *_dcfe .NameAttr ==name {return CustomProperty {_cca :_dcfe };};};return CustomProperty {};};func (_ccda CustomProperties )SetPropertyAsArray (name string ,array *_da .Array ){_cfgg :=_ccda .getNewProperty (name );_cfgg .Array =array ;_ccda .setOrReplaceProperty (_cfgg );};const _cbfa =2022;func (_egfg CustomProperties )SetPropertyAsI8 (name string ,i8 int64 ){_bgg :=_egfg .getNewProperty (name );_bgg .I8 =&i8 ;_egfg .setOrReplaceProperty (_bgg );};
// RelID returns the relationship ID.
func (_afde ImageRef )RelID ()string {return _afde ._adcb };func (_fag CustomProperties )SetPropertyAsClsid (name string ,clsid string ){_fca :=_fag .getNewProperty (name );_fca .Clsid =&clsid ;_fag .setOrReplaceProperty (_fca );};func (_ffbb CustomProperties )SetPropertyAsError (name string ,error string ){_gfa :=_ffbb .getNewProperty (name );_gfa .Error =&error ;_ffbb .setOrReplaceProperty (_gfa );};func (_cbb CustomProperties )SetPropertyAsInt (name string ,i int ){_aabe :=_cbb .getNewProperty (name );_eb :=int32 (i );_aabe .Int =&_eb ;_cbb .setOrReplaceProperty (_aabe );};
// X returns the inner wrapped XML type.
func (_gbb TableStyles )X ()*_ee .TblStyleLst {return _gbb ._gcc };
// SetHeight sets row height, see measurement package.
func (_ead TableRow )SetHeight (m _dg .Distance ){_eaeb :=_dg .ToEMU (float64 (m ));_ead ._facb .HAttr =_ee .ST_Coordinate {ST_CoordinateUnqualified :&_eaeb };};
// Type returns the type of a relationship.
func (_bga Relationship )Type ()string {return _bga ._bcd .TypeAttr };
// ContentStatus returns the content status of the document (e.g. "Final", "Draft")
func (_ab CoreProperties )ContentStatus ()string {if _ab ._aae .ContentStatus !=nil {return *_ab ._aae .ContentStatus ;};return "";};
// Application returns the name of the application that created the document.
// For unioffice created documents, it defaults to github.com/unidoc/unioffice
func (_ef AppProperties )Application ()string {if _ef ._aged .Application !=nil {return *_ef ._aged .Application ;};return "";};func (_gga CustomProperties )SetPropertyAsFiletime (name string ,filetime _ea .Time ){_becd :=_gga .getNewProperty (name );_becd .Filetime =&filetime ;_gga .setOrReplaceProperty (_becd );};func (_gcga CustomProperties )SetPropertyAsStream (name string ,stream string ){_daf :=_gcga .getNewProperty (name );_daf .Stream =&stream ;_gcga .setOrReplaceProperty (_daf );};
// Clear removes any existing relationships.
func (_gaef Relationships )Clear (){_gaef ._fffg .Relationship =nil };
// NewContentTypes returns a wrapper around a newly constructed content-types.
func NewContentTypes ()ContentTypes {_dcg :=ContentTypes {_bbb :_cbf .NewTypes ()};_dcg .AddDefault ("\u0078\u006d\u006c","\u0061p\u0070l\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u0078\u006d\u006c");_dcg .AddDefault ("\u0072\u0065\u006c\u0073","\u0061\u0070\u0070\u006c\u0069\u0063a\u0074\u0069\u006fn\u002f\u0076\u006ed\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066\u006fr\u006d\u0061\u0074\u0073\u002dpa\u0063\u006b\u0061\u0067\u0065\u002e\u0072\u0065\u006c\u0061\u0074\u0069\u006f\u006e\u0073\u0068\u0069\u0070\u0073\u002b\u0078\u006d\u006c");_dcg .AddDefault ("\u0070\u006e\u0067","\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg");_dcg .AddDefault ("\u006a\u0070\u0065\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_dcg .AddDefault ("\u006a\u0070\u0067","\u0069m\u0061\u0067\u0065\u002f\u006a\u0070g");_dcg .AddDefault ("\u0077\u006d\u0066","i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066");_dcg .AddOverride ("\u002fd\u006fc\u0050\u0072\u006f\u0070\u0073/\u0063\u006fr\u0065\u002e\u0078\u006d\u006c","\u0061\u0070\u0070\u006c\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u0076\u006e\u0064\u002e\u006f\u0070\u0065\u006ex\u006d\u006c\u0066\u006f\u0072\u006d\u0061\u0074\u0073-\u0070\u0061\u0063\u006b\u0061\u0067\u0065\u002e\u0063\u006f\u0072\u0065\u002dp\u0072\u006f\u0070\u0065\u0072\u0074i\u0065\u0073\u002bx\u006d\u006c");_dcg .AddOverride ("\u002f\u0064\u006f\u0063\u0050\u0072\u006f\u0070\u0073\u002f\u0061\u0070p\u002e\u0078\u006d\u006c","a\u0070\u0070l\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u0076\u006e\u0064\u002e\u006f\u0070\u0065\u006e\u0078\u006d\u006c\u0066o\u0072\u006d\u0061\u0074\u0073\u002d\u006f\u0066\u0066\u0069\u0063\u0065\u0064\u006f\u0063\u0075m\u0065\u006e\u0074\u002e\u0065\u0078\u0074\u0065\u006e\u0064\u0065\u0064\u002dp\u0072\u006f\u0070\u0065\u0072\u0074\u0069\u0065\u0073\u002b\u0078m\u006c");return _dcg ;};func (_adcd CustomProperties )SetPropertyAsVstream (name string ,vstream *_da .Vstream ){_ggb :=_adcd .getNewProperty (name );_ggb .Vstream =vstream ;_adcd .setOrReplaceProperty (_ggb );};
// GetByRelId returns a relationship with the associated relation ID.
func (_gba Relationships )GetByRelId (idAttr string )Relationship {for _ ,_aee :=range _gba ._fffg .Relationship {if _aee .IdAttr ==idAttr {return Relationship {_bcd :_aee };};};return Relationship {};};
// CopyOverride copies override content type for a given `path` and puts it with a path `newPath`.
func (_bed ContentTypes )CopyOverride (path ,newPath string ){if !_ga .HasPrefix (path ,"\u002f"){path ="\u002f"+path ;};if !_ga .HasPrefix (newPath ,"\u002f"){newPath ="\u002f"+newPath ;};for _bee :=range _bed ._bbb .Override {if _bed ._bbb .Override [_bee ].PartNameAttr ==path {_fad :=*_bed ._bbb .Override [_bee ];_fad .PartNameAttr =newPath ;_bed ._bbb .Override =append (_bed ._bbb .Override ,&_fad );};};};
// Theme is a drawingml theme.
type Theme struct{_cbcg *_ee .Theme };
// Cells returns an array of row cells.
func (_gded TableRow )Cells ()[]*_ee .CT_TableCell {return _gded ._facb .Tc };
// ID returns the ID of a relationship.
func (_ffe Relationship )ID ()string {return _ffe ._bcd .IdAttr };
// X returns the inner raw content types.
func (_bbg ContentTypes )X ()*_cbf .Types {return _bbg ._bbb };
// Description returns the description of the document
func (_efd CoreProperties )Description ()string {if _efd ._aae .Description !=nil {return string (_efd ._aae .Description .Data );};return "";};
// X returns the inner wrapped XML type.
func (_beg Relationship )X ()*_faf .Relationship {return _beg ._bcd };
// Remove removes an existing relationship.
func (_feb Relationships )Remove (rel Relationship )bool {for _edc ,_cged :=range _feb ._fffg .Relationship {if _cged ==rel ._bcd {copy (_feb ._fffg .Relationship [_edc :],_feb ._fffg .Relationship [_edc +1:]);_feb ._fffg .Relationship =_feb ._fffg .Relationship [0:len (_feb ._fffg .Relationship )-1];return true ;};};return false ;};func (_dacf CustomProperties )setOrReplaceProperty (_aded *_a .CT_Property ){_dacf .setPropertyHelper (_aded ,true );};
// IsEmpty returns true if there are no relationships.
func (_cgf Relationships )IsEmpty ()bool {return _cgf ._fffg ==nil ||len (_cgf ._fffg .Relationship )==0;};
// SetAuthor records the author of the document.
func (_gee CoreProperties )SetAuthor (s string ){if _gee ._aae .Creator ==nil {_gee ._aae .Creator =&_ff .XSDAny {XMLName :_gd .Name {Local :"\u0064\u0063\u003a\u0063\u0072\u0065\u0061\u0074\u006f\u0072"}};};_gee ._aae .Creator .Data =[]byte (s );};func (_bcb CustomProperties )SetPropertyAsUint (name string ,ui uint ){_gde :=_bcb .getNewProperty (name );_gdd :=uint32 (ui );_gde .Uint =&_gdd ;_bcb .setOrReplaceProperty (_gde );};
// ExtraFile is an unsupported file type extracted from, or to be written to a
// zip package
type ExtraFile struct{ZipPath string ;DiskPath string ;};
// WriteExtraFiles writes the extra files to the zip package.
func (_edg *DocBase )WriteExtraFiles (z *_cb .Writer )error {for _ ,_gfc :=range _edg .ExtraFiles {if _cfb :=_gc .AddFileFromDisk (z ,_gfc .ZipPath ,_gfc .DiskPath );_cfb !=nil {return _cfb ;};};return nil ;};
// NewTableStyles constructs a new TableStyles.
func NewTableStyles ()TableStyles {return TableStyles {_gcc :_ee .NewTblStyleLst ()}};
// ApplicationVersion returns the version of the application that created the
// document.
func (_fgbf AppProperties )ApplicationVersion ()string {if _fgbf ._aged .AppVersion !=nil {return *_fgbf ._aged .AppVersion ;};return "";};
// NewCoreProperties constructs a new CoreProperties.
func NewCoreProperties ()CoreProperties {return CoreProperties {_aae :_ac .NewCoreProperties ()}};func (_bfa CustomProperties )SetPropertyAsUi2 (name string ,ui2 uint16 ){_geg :=_bfa .getNewProperty (name );_geg .Ui2 =&ui2 ;_bfa .setOrReplaceProperty (_geg );};func (_ddb CustomProperties )SetPropertyAsI2 (name string ,i2 int16 ){_adg :=_ddb .getNewProperty (name );_adg .I2 =&i2 ;_ddb .setOrReplaceProperty (_adg );};
// NewTheme constructs a new theme.
func NewTheme ()Theme {return Theme {_ee .NewTheme ()}};
// NewCustomProperties constructs a new CustomProperties.
func NewCustomProperties ()CustomProperties {return CustomProperties {_gge :_a .NewProperties ()}};
// GetTargetByRelId returns a target path with the associated relation ID.
func (_dag Relationships )GetTargetByRelId (idAttr string )string {for _ ,_cafg :=range _dag ._fffg .Relationship {if _cafg .IdAttr ==idAttr {return _cafg .TargetAttr ;};};return "";};const _eff =25;func (_agdg *ImageRef )SetRelID (id string ){_agdg ._adcb =id };
// SetWidth sets column width, see measurement package.
func (_fgfg TableCol )SetWidth (m _dg .Distance ){_ebcg :=_dg .ToEMU (float64 (m ));_fgfg ._abd .WAttr =_ee .ST_Coordinate {ST_CoordinateUnqualified :&_ebcg };};
// AddCustomRelationships adds relationships related to custom properties to the document.
func (_cbgb *DocBase )AddCustomRelationships (){_cbgb .ContentTypes .AddOverride ("/\u0064o\u0063\u0050\u0072\u006f\u0070\u0073\u002f\u0063u\u0073\u0074\u006f\u006d.x\u006d\u006c","\u0061\u0070\u0070\u006c\u0069\u0063a\u0074\u0069\u006f\u006e\u002fv\u006e\u0064\u002e\u006f\u0070\u0065n\u0078\u006d\u006c\u0066\u006fr\u006d\u0061\u0074\u0073\u002d\u006f\u0066\u0066\u0069\u0063\u0065\u0064o\u0063\u0075\u006d\u0065\u006e\u0074\u002e\u0063\u0075\u0073\u0074\u006f\u006d\u002d\u0070r\u006f\u0070\u0065\u0072\u0074\u0069\u0065\u0073+\u0078\u006d\u006c");_cbgb .Rels .AddRelationship ("\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c",_ff .CustomPropertiesType );};const _bad =2;func (_eda CustomProperties )SetPropertyAsDecimal (name string ,decimal float64 ){_eede :=_eda .getNewProperty (name );_eede .Decimal =&decimal ;_eda .setOrReplaceProperty (_eede );};func _dcb (_eed _ea .Time ,_daa string )*_ff .XSDAny {_fec :=&_ff .XSDAny {XMLName :_gd .Name {Local :_daa }};_fec .Attrs =append (_fec .Attrs ,_gd .Attr {Name :_gd .Name {Local :"\u0078\u0073\u0069\u003a\u0074\u0079\u0070\u0065"},Value :"\u0064\u0063\u0074\u0065\u0072\u006d\u0073\u003a\u00573\u0043\u0044\u0054\u0046"});_fec .Attrs =append (_fec .Attrs ,_gd .Attr {Name :_gd .Name {Local :"\u0078m\u006c\u006e\u0073\u003a\u0078\u0073i"},Value :"\u0068\u0074\u0074\u0070\u003a/\u002f\u0077\u0077\u0077\u002e\u0077\u0033\u002e\u006f\u0072\u0067\u002f\u00320\u0030\u0031\u002f\u0058\u004d\u004c\u0053\u0063\u0068\u0065\u006d\u0061\u002d\u0069\u006e\u0073\u0074\u0061\u006e\u0063\u0065"});_fec .Attrs =append (_fec .Attrs ,_gd .Attr {Name :_gd .Name {Local :"\u0078\u006d\u006c\u006e\u0073\u003a\u0064\u0063\u0074\u0065\u0072\u006d\u0073"},Value :"\u0068t\u0074\u0070\u003a\u002f/\u0070\u0075\u0072\u006c\u002eo\u0072g\u002fd\u0063\u002f\u0074\u0065\u0072\u006d\u0073/"});_fec .Data =[]byte (_eed .Format (_bbgd ));return _fec ;};const _bbgd ="2\u00300\u0036\u002d\u0030\u0031\u002d\u0030\u0032\u00541\u0035\u003a\u0030\u0034:0\u0035\u005a";
// ImageFromStorage reads an image using the currently set
// temporary storage mechanism (see tempstorage). You can also
// construct an Image directly if the file and size are known.
func ImageFromStorage (path string )(Image ,error ){_bggd :=Image {};_bfe ,_gaec :=_fgb .Open (path );if _gaec !=nil {return _bggd ,_ba .Errorf ("\u0065\u0072\u0072or\u0020\u0072\u0065\u0061\u0064\u0069\u006e\u0067\u0020\u0069\u006d\u0061\u0067\u0065\u003a\u0020\u0025\u0073",_gaec );};defer _bfe .Close ();_ddbf ,_bace ,_gaec :=_dc .Decode (_bfe );if _gaec !=nil {return _bggd ,_ba .Errorf ("\u0075n\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0070\u0061r\u0073e\u0020i\u006d\u0061\u0067\u0065\u003a\u0020\u0025s",_gaec );};_bggd .Path =path ;_bggd .Format =_bace ;_bggd .Size =_ddbf .Bounds ().Size ();return _bggd ,nil ;};const _fdd =30;
// AddImageToZip adds an image (either from bytes or from disk) and adds it to the zip file.
func AddImageToZip (z *_cb .Writer ,img ImageRef ,imageNum int ,dt _ff .DocType )error {_fda :=_ff .AbsoluteImageFilename (dt ,imageNum ,_ga .ToLower (img .Format ()));if img .Data ()!=nil &&len (*img .Data ())> 0{if _ddd :=_gc .AddFileFromBytes (z ,_fda ,*img .Data ());_ddd !=nil {return _ddd ;};}else if img .Path ()!=""{if _fbb :=_gc .AddFileFromDisk (z ,_fda ,img .Path ());_fbb !=nil {return _fbb ;};}else {return _ba .Errorf ("\u0075\u006es\u0075\u0070\u0070\u006f\u0072\u0074\u0065\u0064\u0020\u0069\u006d\u0061\u0067\u0065\u0020\u0073\u006f\u0075\u0072\u0063\u0065\u003a %\u002b\u0076",img );};return nil ;};
// SetLanguage records the language of the document.
func (_bbc CoreProperties )SetLanguage (s string ){_bbc ._aae .Language =&_ff .XSDAny {XMLName :_gd .Name {Local :"d\u0063\u003a\u006c\u0061\u006e\u0067\u0075\u0061\u0067\u0065"}};_bbc ._aae .Language .Data =[]byte (s );};func (_eeg CustomProperties )SetPropertyAsUi1 (name string ,ui1 uint8 ){_cfcb :=_eeg .getNewProperty (name );_cfcb .Ui1 =&ui1 ;_eeg .setOrReplaceProperty (_cfcb );};func (_fgf CustomProperties )SetPropertyAsEmpty (name string ){_egg :=_fgf .getNewProperty (name );_egg .Empty =_da .NewEmpty ();_fgf .setOrReplaceProperty (_egg );};
// AppProperties contains properties specific to the document and the
// application that created it.
type AppProperties struct{_aged *_cf .Properties };func (_bdb CustomProperties )SetPropertyAsR8 (name string ,r8 float64 ){_cbg :=_bdb .getNewProperty (name );_cbg .R8 =&r8 ;_bdb .setOrReplaceProperty (_cbg );};
// Size returns the size of an image
func (_feg ImageRef )Size ()_dc .Point {return _feg ._adab .Size };func (_fdc CustomProperties )SetPropertyAsNull (name string ){_cafb :=_fdc .getNewProperty (name );_cafb .Null =_da .NewNull ();_fdc .setOrReplaceProperty (_cafb );};
// X returns the inner wrapped XML type.
func (_dcfc Table )X ()*_ee .Tbl {return _dcfc ._bcda };
// Created returns the time that the document was created.
func (_efe CoreProperties )Created ()_ea .Time {return _deba (_efe ._aae .Created )};
// Path returns the path to an image file, if any.
func (_gdb ImageRef )Path ()string {return _gdb ._adab .Path };
// SetContentStatus records the content status of the document.
func (_cfc CoreProperties )SetContentStatus (s string ){_cfc ._aae .ContentStatus =&s };
// FindRIDForN returns the relationship ID for the i'th relationship of type t.
func (_fcef Relationships )FindRIDForN (i int ,t string )string {for _ ,_bgcc :=range _fcef ._fffg .CT_Relationships .Relationship {if _bgcc .TypeAttr ==t {if i ==0{return _bgcc .IdAttr ;};i --;};};return "";};
// X returns the inner wrapped XML type.
func (_afd CustomProperties )X ()*_a .Properties {return _afd ._gge };var _daeg =_fa .New ("\u0069\u006d\u0061\u0067\u0065\u0020\u006e\u006f\u0074\u0020\u0066o\u0075\u006e\u0064\u0020\u0069\u006e\u0020\u0073\u0074\u006fr\u0061\u0067\u0065");
// SetApplicationVersion sets the version of the application that created the
// document. Per MS, the verison string mut be in the form 'XX.YYYY'.
func (_aff AppProperties )SetApplicationVersion (s string ){_aff ._aged .AppVersion =&s };
// GetOrCreateCustomProperties returns the custom properties of the document (and if they not exist yet, creating them first).
func (_gdae *DocBase )GetOrCreateCustomProperties ()CustomProperties {if _gdae .CustomProperties .X ()==nil {_gdae .CreateCustomProperties ();};return _gdae .CustomProperties ;};
// NewTable makes a new table.
func NewTable ()*Table {_geea :=_ee .NewTbl ();_geea .TblPr =_ee .NewCT_TableProperties ();return &Table {_bcda :_geea };};
// Properties returns table properties.
func (_fbggf Table )Grid ()*_ee .CT_TableGrid {return _fbggf ._bcda .TblGrid };
// TableStyles contains document specific properties.
type TableStyles struct{_gcc *_ee .TblStyleLst };
// Target returns the target (path) of a relationship.
func (_cecb Relationship )Target ()string {return _cecb ._bcd .TargetAttr };const _eade ="\u0032\u0020\u004aan\u0075\u0061\u0072\u0079\u0020\u0032\u0030\u0030\u0036\u0020\u0061\u0074\u0020\u0031\u0035\u003a\u0030\u0034";
// NewTableWithXfrm makes a new table with a pointer to its parent Xfrm for changing its offset and size.
func NewTableWithXfrm (xfrm *_ee .CT_Transform2D )*Table {_dec :=_ee .NewTbl ();_dec .TblPr =_ee .NewCT_TableProperties ();return &Table {_bcda :_dec ,_cgbd :xfrm };};func (_cdcf CustomProperties )SetPropertyAsR4 (name string ,r4 float32 ){_dgbb :=_cdcf .getNewProperty (name );_dgbb .R4 =&r4 ;_cdcf .setOrReplaceProperty (_dgbb );};
// AddRelationship adds a relationship.
func (_adeda Relationships )AddRelationship (target ,ctype string )Relationship {if !_ga .HasPrefix (ctype ,"\u0068t\u0074\u0070\u003a\u002f\u002f"){_eg .Log .Debug ("\u0072\u0065\u006c\u0061\u0074\u0069\u006f\u006es\u0068\u0069\u0070 t\u0079\u0070\u0065\u0020\u0025\u0073 \u0073\u0068\u006f\u0075\u006c\u0064\u0020\u0073\u0074\u0061\u0072\u0074\u0020\u0077\u0069t\u0068\u0020\u0027\u0068\u0074\u0074\u0070\u003a/\u002f\u0027",ctype );};_aega :=_faf .NewRelationship ();_defb :=len (_adeda ._fffg .Relationship )+1;_cge :=map[string ]struct{}{};for _ ,_acba :=range _adeda ._fffg .Relationship {_cge [_acba .IdAttr ]=struct{}{};};for _ ,_fagg :=_cge [_ba .Sprintf ("\u0072\u0049\u0064%\u0064",_defb )];_fagg ;_ ,_fagg =_cge [_ba .Sprintf ("\u0072\u0049\u0064%\u0064",_defb )]{_defb ++;};_aega .IdAttr =_ba .Sprintf ("\u0072\u0049\u0064%\u0064",_defb );_aega .TargetAttr =target ;_aega .TypeAttr =ctype ;_adeda ._fffg .Relationship =append (_adeda ._fffg .Relationship ,_aega );return Relationship {_bcd :_aega };};
// SetTitle records the title of the document.
func (_geb CoreProperties )SetTitle (s string ){if _geb ._aae .Title ==nil {_geb ._aae .Title =&_ff .XSDAny {XMLName :_gd .Name {Local :"\u0064\u0063\u003a\u0074\u0069\u0074\u006c\u0065"}};};_geb ._aae .Title .Data =[]byte (s );};
// Relationships returns a slice of all of the relationships.
func (_bgb Relationships )Relationships ()[]Relationship {_ffba :=[]Relationship {};for _ ,_fegd :=range _bgb ._fffg .Relationship {_ffba =append (_ffba ,Relationship {_bcd :_fegd });};return _ffba ;};func _deba (_efa *_ff .XSDAny )_ea .Time {if _efa ==nil {return _ea .Time {};};_efb ,_adb :=_ea .Parse (_bbgd ,string (_efa .Data ));if _adb !=nil {_eg .Log .Debug ("\u0065\u0072\u0072\u006f\u0072\u0020\u0070\u0061\u0072\u0073i\u006e\u0067\u0020\u0074\u0069\u006d\u0065 \u0066\u0072\u006f\u006d\u0020\u0025\u0073\u003a\u0020\u0025\u0073",string (_efa .Data ),_adb );};return _efb ;};func init (){_gaf .SetAsStorage ()};
// SetCompany sets the name of the company that created the document.
func (_dae AppProperties )SetCompany (s string ){_dae ._aged .Company =&s };func (_fcg CustomProperties )SetPropertyAsBool (name string ,b bool ){_gag :=_fcg .getNewProperty (name );_gag .Bool =&b ;_fcg .setOrReplaceProperty (_gag );};
// MakeImageRef constructs an image reference which is a reference to a
// particular image file inside a document. The same image can be used multiple
// times in a document by re-use the ImageRef.
func MakeImageRef (img Image ,d *DocBase ,rels Relationships )ImageRef {return ImageRef {_adab :img ,_cff :d ,_dcgf :rels };};
// ImageRef is a reference to an image within a document.
type ImageRef struct{_cff *DocBase ;_dcgf Relationships ;_adab Image ;_adcb string ;_adfe string ;};
// DocBase is the type embedded in in the Document/Workbook/Presentation types
// that contains members common to all.
type DocBase struct{ContentTypes ContentTypes ;AppProperties AppProperties ;Rels Relationships ;CoreProperties CoreProperties ;CustomProperties CustomProperties ;Thumbnail _dc .Image ;Images []ImageRef ;ExtraFiles []ExtraFile ;TmpPath string ;};
// Data returns the data of an image file, if any.
func (_ebc ImageRef )Data ()*[]byte {return _ebc ._adab .Data };
// AddCol adds a column to a table.
func (_ddg Table )AddCol ()*TableCol {_cfdb :=_ee .NewCT_TableCol ();_ddg ._bcda .TblGrid .GridCol =append (_ddg ._bcda .TblGrid .GridCol ,_cfdb );for _ ,_gcfb :=range _ddg ._bcda .Tr {_egda :=_ee .NewCT_TableCell ();_gcfb .Tc =append (_gcfb .Tc ,_egda );};return &TableCol {_abd :_cfdb };};
// LastModifiedBy returns the name of the last person to modify the document
func (_agd CoreProperties )LastModifiedBy ()string {if _agd ._aae .LastModifiedBy !=nil {return *_agd ._aae .LastModifiedBy ;};return "";};
// AddRow adds a row to a table.
func (_bde Table )AddRow ()*TableRow {_cea :=_ee .NewCT_TableRow ();for _fcd :=0;_fcd < len (_bde ._bcda .TblGrid .GridCol );_fcd ++{_cea .Tc =append (_cea .Tc ,_ee .NewCT_TableCell ());};_bde ._bcda .Tr =append (_bde ._bcda .Tr ,_cea );return &TableRow {_facb :_cea };};
// Table represents a table in the document.
type Table struct{_bcda *_ee .Tbl ;_cgbd *_ee .CT_Transform2D ;};
// TblStyle returns the TblStyle property.
func (_dabc TableStyles )TblStyle ()[]*_ee .CT_TableStyle {return _dabc ._gcc .TblStyle };func (_defe CustomProperties )SetPropertyAsOblob (name ,oblob string ){_faa :=_defe .getNewProperty (name );_faa .Oblob =&oblob ;_defe .setOrReplaceProperty (_faa );};
// Append appends DocBase part of an office document to another DocBase.
func (_gf DocBase )Append (docBase1 DocBase )DocBase {_egd :=docBase1 .ContentTypes .X ();for _ ,_dce :=range _egd .Default {_gf .ContentTypes .AddDefault (_dce .ExtensionAttr ,_dce .ContentTypeAttr );};for _ ,_cfa :=range _egd .Override {_gf .ContentTypes .AddOverride (_cfa .PartNameAttr ,_cfa .ContentTypeAttr );};_cbff :=_gf .AppProperties .X ();_aa :=docBase1 .AppProperties .X ();if _cbff .Pages !=nil {if _aa .Pages !=nil {*_cbff .Pages +=*_aa .Pages ;};}else if _aa .Pages !=nil {_cbff .Pages =_aa .Pages ;};if _cbff .Words !=nil {if _aa .Words !=nil {*_cbff .Words +=*_aa .Words ;};}else if _aa .Words !=nil {_cbff .Words =_aa .Words ;};if _cbff .Characters !=nil {if _aa .Characters !=nil {*_cbff .Characters +=*_aa .Characters ;};}else if _aa .Characters !=nil {_cbff .Characters =_aa .Characters ;};if _cbff .Lines !=nil {if _aa .Lines !=nil {*_cbff .Lines +=*_aa .Lines ;};}else if _aa .Lines !=nil {_cbff .Lines =_aa .Lines ;};if _cbff .Paragraphs !=nil {if _aa .Paragraphs !=nil {*_cbff .Paragraphs +=*_aa .Paragraphs ;};}else if _aa .Paragraphs !=nil {_cbff .Paragraphs =_aa .Paragraphs ;};if _cbff .Notes !=nil {if _aa .Notes !=nil {*_cbff .Notes +=*_aa .Notes ;};}else if _aa .Notes !=nil {_cbff .Notes =_aa .Notes ;};if _cbff .HiddenSlides !=nil {if _aa .HiddenSlides !=nil {*_cbff .HiddenSlides +=*_aa .HiddenSlides ;};}else if _aa .HiddenSlides !=nil {_cbff .HiddenSlides =_aa .HiddenSlides ;};if _cbff .MMClips !=nil {if _aa .MMClips !=nil {*_cbff .MMClips +=*_aa .MMClips ;};}else if _aa .MMClips !=nil {_cbff .MMClips =_aa .MMClips ;};if _cbff .LinksUpToDate !=nil {if _aa .LinksUpToDate !=nil {*_cbff .LinksUpToDate =*_cbff .LinksUpToDate &&*_aa .LinksUpToDate ;};}else if _aa .LinksUpToDate !=nil {_cbff .LinksUpToDate =_aa .LinksUpToDate ;};if _cbff .CharactersWithSpaces !=nil {if _aa .CharactersWithSpaces !=nil {*_cbff .CharactersWithSpaces +=*_aa .CharactersWithSpaces ;};}else if _aa .CharactersWithSpaces !=nil {_cbff .CharactersWithSpaces =_aa .CharactersWithSpaces ;};if _cbff .SharedDoc !=nil {if _aa .SharedDoc !=nil {*_cbff .SharedDoc =*_cbff .SharedDoc ||*_aa .SharedDoc ;};}else if _aa .SharedDoc !=nil {_cbff .SharedDoc =_aa .SharedDoc ;};if _cbff .HyperlinksChanged !=nil {if _aa .HyperlinksChanged !=nil {*_cbff .HyperlinksChanged =*_cbff .HyperlinksChanged ||*_aa .HyperlinksChanged ;};}else if _aa .HyperlinksChanged !=nil {_cbff .HyperlinksChanged =_aa .HyperlinksChanged ;};_cbff .DigSig =nil ;if _cbff .TitlesOfParts ==nil &&_aa .TitlesOfParts !=nil {_cbff .TitlesOfParts =_aa .TitlesOfParts ;};if _cbff .HeadingPairs !=nil {if _aa .HeadingPairs !=nil {_ad :=_cbff .HeadingPairs .Vector ;_af :=_aa .HeadingPairs .Vector ;_bd :=_ad .Variant ;_fc :=_af .Variant ;_cg :=[]*_da .Variant {};for _ade :=0;_ade < len (_fc );_ade +=2{_cfg :=_fc [_ade ].Lpstr ;_dd :=false ;for _df :=0;_df < len (_bd );_df +=2{_fd :=_bd [_df ].Lpstr ;if _fd !=nil &&_cfg !=nil &&*_fd ==*_cfg {*_bd [_df +1].I4 =*_bd [_df +1].I4 +*_fc [_ade +1].I4 ;_dd =true ;break ;};};if !_dd {_cg =append (_cg ,&_da .Variant {CT_Variant :_da .CT_Variant {Lpstr :_fc [_ade ].Lpstr }});_cg =append (_cg ,&_da .Variant {CT_Variant :_da .CT_Variant {I4 :_fc [_ade ].I4 }});};};_bd =append (_bd ,_cg ...);_ad .SizeAttr =uint32 (len (_bd ));};}else if _aa .HeadingPairs !=nil {_cbff .HeadingPairs =_aa .HeadingPairs ;};if _cbff .HLinks !=nil {if _aa .HLinks !=nil {_eag :=_cbff .HLinks .Vector ;_db :=_aa .HLinks .Vector ;_bc :=_eag .Variant ;_dac :=_db .Variant ;for _ ,_ge :=range _dac {_ae :=true ;for _ ,_ece :=range _bc {if _e .DeepEqual (_ece ,_ge ){_ae =false ;break ;};};if _ae {_bc =append (_bc ,_ge );_eag .SizeAttr ++;};};};}else if _aa .HLinks !=nil {_cbff .HLinks =_aa .HLinks ;};_egb :=_gf .GetOrCreateCustomProperties ();_bf :=docBase1 .GetOrCreateCustomProperties ();for _ ,_ag :=range _bf .PropertiesList (){_egb .setProperty (_ag );};_gf .CustomProperties =_egb ;_de :=_gf .Rels .X ().Relationship ;for _ ,_gac :=range docBase1 .Rels .X ().Relationship {_adc :=true ;for _ ,_egf :=range _de {if _egf .TargetAttr ==_gac .TargetAttr &&_egf .TypeAttr ==_gac .TypeAttr {_adc =false ;break ;};};if _adc {_gf .Rels .AddRelationship (_gac .TargetAttr ,_gac .TypeAttr );};};for _ ,_afc :=range docBase1 .ExtraFiles {_dab :=_afc .ZipPath ;_dfg :=true ;for _ ,_gcg :=range _gf .ExtraFiles {if _gcg .ZipPath ==_dab {_dfg =false ;break ;};};if _dfg {_gf .ExtraFiles =append (_gf .ExtraFiles ,_afc );};};return _gf ;};
// SetCategory records the category of the document.
func (_egdf CoreProperties )SetCategory (s string ){_egdf ._aae .Category =&s };
// Modified returns the time that the document was modified.
func (_eee CoreProperties )Modified ()_ea .Time {return _deba (_eee ._aae .Modified )};func (_fbg CustomProperties )setProperty (_ccd *_a .CT_Property ){_fbg .setPropertyHelper (_ccd ,false )};
// SetLastModifiedBy records the last person to modify the document.
func (_acb CoreProperties )SetLastModifiedBy (s string ){_acb ._aae .LastModifiedBy =&s };
// DefAttr returns the DefAttr property.
func (_dbb TableStyles )DefAttr ()string {return _dbb ._gcc .DefAttr };
// CustomProperty contains document specific property.
// Using of this type is deprecated.
type CustomProperty struct{_cca *_a .CT_Property };
// AddHyperlink adds an external hyperlink relationship.
func (_egec Relationships )AddHyperlink (target string )Hyperlink {_efgd :=_egec .AddRelationship (target ,_ff .HyperLinkType );_efgd ._bcd .TargetModeAttr =_faf .ST_TargetModeExternal ;return Hyperlink (_efgd );};
// Category returns the category of the document
func (_bdaa CoreProperties )Category ()string {if _bdaa ._aae .Category !=nil {return *_bdaa ._aae .Category ;};return "";};
// Properties returns table properties.
func (_cfd Table )Properties ()*_ee .CT_TableProperties {return _cfd ._bcda .TblPr };
// X returns the inner wrapped XML type.
func (_bead Theme )X ()*_ee .Theme {return _bead ._cbcg };
// X returns the underlying raw XML data.
func (_fgd Relationships )X ()*_faf .Relationships {return _fgd ._fffg };func (_abe CustomProperties )SetPropertyAsBlob (name ,blob string ){_eab :=_abe .getNewProperty (name );_eab .Blob =&blob ;_abe .setOrReplaceProperty (_eab );};func (_cba CustomProperties )SetPropertyAsOstream (name string ,ostream string ){_efg :=_cba .getNewProperty (name );_efg .Ostream =&ostream ;_cba .setOrReplaceProperty (_efg );};func (_cbc CustomProperties )SetPropertyAsDate (name string ,date _ea .Time ){date =date .UTC ();_fcf ,_ced ,_fbc :=date .Date ();_gfaf ,_bac ,_ecaf :=date .Clock ();_fab :=_ea .Date (_fcf ,_ced ,_fbc ,_gfaf ,_bac ,_ecaf ,0,_ea .UTC );_cgg :=_cbc .getNewProperty (name );_cgg .Filetime =&_fab ;_cbc .setOrReplaceProperty (_cgg );};
// Format returns the format of the underlying image
func (_eabe ImageRef )Format ()string {return _eabe ._adab .Format };
// CustomProperties contains document specific properties.
type CustomProperties struct{_gge *_a .Properties };
// ImageFromBytes returns an Image struct for an in-memory image. You can also
// construct an Image directly if the file and size are known.
func ImageFromBytes (data []byte )(Image ,error ){_dbf :=Image {};_gaee ,_bbf ,_dcfbf :=_dc .Decode (_b .NewReader (data ));if _dcfbf !=nil {return _dbf ,_ba .Errorf ("\u0075n\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0070\u0061r\u0073e\u0020i\u006d\u0061\u0067\u0065\u003a\u0020\u0025s",_dcfbf );};_dbf .Data =&data ;_dbf .Format =_bbf ;_dbf .Size =_gaee .Bounds ().Size ();return _dbf ,nil ;};func UtcTimeFormat (t _ea .Time )string {return t .Format (_eade )+"\u0020\u0055\u0054\u0043"};func (_ceb CustomProperties )SetPropertyAsI1 (name string ,i1 int8 ){_agb :=_ceb .getNewProperty (name );_agb .I1 =&i1 ;_ceb .setOrReplaceProperty (_agb );};
// SetID set the ID of a relationship.
func (_cab Relationship )SetID (ID string ){_cab ._bcd .IdAttr =ID ;};
// Target returns the target attrubute of the image reference (a path where the image file is located in the document structure).
func (_fbbg *ImageRef )Target ()string {return _fbbg ._adfe };
// EnsureDefault esnures that an extension and default content type exist,
// adding it if necessary.
func (_dcfb ContentTypes )EnsureDefault (ext ,contentType string ){ext =_ga .ToLower (ext );for _ ,_fdb :=range _dcfb ._bbb .Default {if _fdb .ExtensionAttr ==ext {_fdb .ContentTypeAttr =contentType ;return ;};};_ada :=&_cbf .Default {};_ada .ContentTypeAttr =contentType ;_ada .ExtensionAttr =ext ;_dcfb ._bbb .Default =append (_dcfb ._bbb .Default ,_ada );};