unioffice/common/common.go
2025-01-02 13:04:03 +00:00

504 lines
49 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 (_c "archive/zip";_b "bytes";_ba "encoding/xml";_d "errors";_fb "fmt";_bc "github.com/unidoc/unioffice";_aa "github.com/unidoc/unioffice/common/logger";_bbb "github.com/unidoc/unioffice/common/tempstorage";_de "github.com/unidoc/unioffice/common/tempstorage/diskstore";
_fc "github.com/unidoc/unioffice/measurement";_acd "github.com/unidoc/unioffice/schema/soo/dml";_dg "github.com/unidoc/unioffice/schema/soo/ofc/custom_properties";_ac "github.com/unidoc/unioffice/schema/soo/ofc/docPropsVTypes";_ec "github.com/unidoc/unioffice/schema/soo/ofc/extended_properties";
_df "github.com/unidoc/unioffice/schema/soo/pkg/content_types";_ge "github.com/unidoc/unioffice/schema/soo/pkg/metadata/core_properties";_efb "github.com/unidoc/unioffice/schema/soo/pkg/relationships";_db "github.com/unidoc/unioffice/zippkg";_g "image";
_ "image/gif";_ "image/jpeg";_ "image/png";_fg "os";_eg "reflect";_gf "regexp";_cg "strconv";_bb "strings";_cd "time";);
// RelID returns the relationship ID.
func (_gegc ImageRef )RelID ()string {return _gegc ._fbd };
// GetPropertyByName returns a custom property selected by it's name.
func (_eae CustomProperties )GetPropertyByName (name string )CustomProperty {_dbd :=_eae ._gga .Property ;for _ ,_abe :=range _dbd {if *_abe .NameAttr ==name {return CustomProperty {_gfb :_abe };};};return CustomProperty {};};
// SetWidth sets column width, see measurement package.
func (_gea TableCol )SetWidth (m _fc .Distance ){_ebb :=_fc .ToEMU (float64 (m ));_gea ._ddca .WAttr =_acd .ST_Coordinate {ST_CoordinateUnqualified :&_ebb };};
// Table represents a table in the document.
type Table struct{_bgc *_acd .Tbl ;_ecf *_acd .CT_Transform2D ;};func (_ecdd CustomProperties )SetPropertyAsStorage (name string ,storage string ){_gcc :=_ecdd .getNewProperty (name );_gcc .Storage =&storage ;_ecdd .setOrReplaceProperty (_gcc );};
// GetTargetByRelId returns a target path with the associated relation ID.
func (_gfaa Relationships )GetTargetByRelId (idAttr string )string {for _ ,_dac :=range _gfaa ._gac .Relationship {if _dac .IdAttr ==idAttr {return _dac .TargetAttr ;};};return "";};func (_gfab CustomProperties )SetPropertyAsR4 (name string ,r4 float32 ){_fcfd :=_gfab .getNewProperty (name );
_fcfd .R4 =&r4 ;_gfab .setOrReplaceProperty (_fcfd );};
// Relationship is a relationship within a .rels file.
type Relationship struct{_fcad *_efb .Relationship };
// Path returns the path to an image file, if any.
func (_defe ImageRef )Path ()string {return _defe ._bff .Path };func (_dead CustomProperties )SetPropertyAsDate (name string ,date _cd .Time ){date =date .UTC ();_gafg ,_fcae ,_ffc :=date .Date ();_gedd ,_fcdf ,_dfec :=date .Clock ();_bcee :=_cd .Date (_gafg ,_fcae ,_ffc ,_gedd ,_fcdf ,_dfec ,0,_cd .UTC );
_eaa :=_dead .getNewProperty (name );_eaa .Filetime =&_bcee ;_dead .setOrReplaceProperty (_eaa );};
// Theme is a drawingml theme.
type Theme struct{_fdbd *_acd .Theme };func _gce (_bfag _cd .Time ,_cgf string )*_bc .XSDAny {_dfdc :=&_bc .XSDAny {XMLName :_ba .Name {Local :_cgf }};_dfdc .Attrs =append (_dfdc .Attrs ,_ba .Attr {Name :_ba .Name {Local :"\u0078\u0073\u0069\u003a\u0074\u0079\u0070\u0065"},Value :"\u0064\u0063\u0074\u0065\u0072\u006d\u0073\u003a\u00573\u0043\u0044\u0054\u0046"});
_dfdc .Attrs =append (_dfdc .Attrs ,_ba .Attr {Name :_ba .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"});
_dfdc .Attrs =append (_dfdc .Attrs ,_ba .Attr {Name :_ba .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/"});
_dfdc .Data =[]byte (_bfag .Format (_ebaf ));return _dfdc ;};var _fbgd =_d .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");
// AddCol adds a column to a table.
func (_dgfc Table )AddCol ()*TableCol {_adf :=_acd .NewCT_TableCol ();_dgfc ._bgc .TblGrid .GridCol =append (_dgfc ._bgc .TblGrid .GridCol ,_adf );for _ ,_dec :=range _dgfc ._bgc .Tr {_fdf :=_acd .NewCT_TableCell ();_dec .Tc =append (_dec .Tc ,_fdf );};
return &TableCol {_ddca :_adf };};
// Append appends DocBase part of an office document to another DocBase.
func (_ff DocBase )Append (docBase1 DocBase )DocBase {_bcb :=docBase1 .ContentTypes .X ();for _ ,_fd :=range _bcb .Default {_ff .ContentTypes .AddDefault (_fd .ExtensionAttr ,_fd .ContentTypeAttr );};for _ ,_ga :=range _bcb .Override {_ff .ContentTypes .AddOverride (_ga .PartNameAttr ,_ga .ContentTypeAttr );
};_eb :=_ff .AppProperties .X ();_aag :=docBase1 .AppProperties .X ();if _eb .Pages !=nil {if _aag .Pages !=nil {*_eb .Pages +=*_aag .Pages ;};}else if _aag .Pages !=nil {_eb .Pages =_aag .Pages ;};if _eb .Words !=nil {if _aag .Words !=nil {*_eb .Words +=*_aag .Words ;
};}else if _aag .Words !=nil {_eb .Words =_aag .Words ;};if _eb .Characters !=nil {if _aag .Characters !=nil {*_eb .Characters +=*_aag .Characters ;};}else if _aag .Characters !=nil {_eb .Characters =_aag .Characters ;};if _eb .Lines !=nil {if _aag .Lines !=nil {*_eb .Lines +=*_aag .Lines ;
};}else if _aag .Lines !=nil {_eb .Lines =_aag .Lines ;};if _eb .Paragraphs !=nil {if _aag .Paragraphs !=nil {*_eb .Paragraphs +=*_aag .Paragraphs ;};}else if _aag .Paragraphs !=nil {_eb .Paragraphs =_aag .Paragraphs ;};if _eb .Notes !=nil {if _aag .Notes !=nil {*_eb .Notes +=*_aag .Notes ;
};}else if _aag .Notes !=nil {_eb .Notes =_aag .Notes ;};if _eb .HiddenSlides !=nil {if _aag .HiddenSlides !=nil {*_eb .HiddenSlides +=*_aag .HiddenSlides ;};}else if _aag .HiddenSlides !=nil {_eb .HiddenSlides =_aag .HiddenSlides ;};if _eb .MMClips !=nil {if _aag .MMClips !=nil {*_eb .MMClips +=*_aag .MMClips ;
};}else if _aag .MMClips !=nil {_eb .MMClips =_aag .MMClips ;};if _eb .LinksUpToDate !=nil {if _aag .LinksUpToDate !=nil {*_eb .LinksUpToDate =*_eb .LinksUpToDate &&*_aag .LinksUpToDate ;};}else if _aag .LinksUpToDate !=nil {_eb .LinksUpToDate =_aag .LinksUpToDate ;
};if _eb .CharactersWithSpaces !=nil {if _aag .CharactersWithSpaces !=nil {*_eb .CharactersWithSpaces +=*_aag .CharactersWithSpaces ;};}else if _aag .CharactersWithSpaces !=nil {_eb .CharactersWithSpaces =_aag .CharactersWithSpaces ;};if _eb .SharedDoc !=nil {if _aag .SharedDoc !=nil {*_eb .SharedDoc =*_eb .SharedDoc ||*_aag .SharedDoc ;
};}else if _aag .SharedDoc !=nil {_eb .SharedDoc =_aag .SharedDoc ;};if _eb .HyperlinksChanged !=nil {if _aag .HyperlinksChanged !=nil {*_eb .HyperlinksChanged =*_eb .HyperlinksChanged ||*_aag .HyperlinksChanged ;};}else if _aag .HyperlinksChanged !=nil {_eb .HyperlinksChanged =_aag .HyperlinksChanged ;
};_eb .DigSig =nil ;if _eb .TitlesOfParts ==nil &&_aag .TitlesOfParts !=nil {_eb .TitlesOfParts =_aag .TitlesOfParts ;};if _eb .HeadingPairs !=nil {if _aag .HeadingPairs !=nil {_ecg :=_eb .HeadingPairs .Vector ;_aaf :=_aag .HeadingPairs .Vector ;_faf :=_ecg .Variant ;
_af :=_aaf .Variant ;_ecc :=[]*_ac .Variant {};for _da :=0;_da < len (_af );_da +=2{_fab :=_af [_da ].Lpstr ;_gb :=false ;for _fafd :=0;_fafd < len (_faf );_fafd +=2{_cgb :=_faf [_fafd ].Lpstr ;if _cgb !=nil &&_fab !=nil &&*_cgb ==*_fab {*_faf [_fafd +1].I4 =*_faf [_fafd +1].I4 +*_af [_da +1].I4 ;
_gb =true ;break ;};};if !_gb {_ecc =append (_ecc ,&_ac .Variant {CT_Variant :_ac .CT_Variant {Lpstr :_af [_da ].Lpstr }});_ecc =append (_ecc ,&_ac .Variant {CT_Variant :_ac .CT_Variant {I4 :_af [_da ].I4 }});};};_faf =append (_faf ,_ecc ...);_ecg .SizeAttr =uint32 (len (_faf ));
};}else if _aag .HeadingPairs !=nil {_eb .HeadingPairs =_aag .HeadingPairs ;};if _eb .HLinks !=nil {if _aag .HLinks !=nil {_ae :=_eb .HLinks .Vector ;_bcg :=_aag .HLinks .Vector ;_gg :=_ae .Variant ;_cb :=_bcg .Variant ;for _ ,_bae :=range _cb {_cf :=true ;
for _ ,_gd :=range _gg {if _eg .DeepEqual (_gd ,_bae ){_cf =false ;break ;};};if _cf {_gg =append (_gg ,_bae );_ae .SizeAttr ++;};};};}else if _aag .HLinks !=nil {_eb .HLinks =_aag .HLinks ;};_bcge :=_ff .GetOrCreateCustomProperties ();_ea :=docBase1 .GetOrCreateCustomProperties ();
for _ ,_ggd :=range _ea .PropertiesList (){_bcge .setProperty (_ggd );};_ff .CustomProperties =_bcge ;_acg :=_ff .Rels .X ().Relationship ;for _ ,_aef :=range docBase1 .Rels .X ().Relationship {_bg :=true ;for _ ,_cdf :=range _acg {if _cdf .TargetAttr ==_aef .TargetAttr &&_cdf .TypeAttr ==_aef .TypeAttr {_bg =false ;
break ;};};if _bg {_ff .Rels .AddRelationship (_aef .TargetAttr ,_aef .TypeAttr );};};for _ ,_dga :=range docBase1 .ExtraFiles {_gfa :=_dga .ZipPath ;_aee :=true ;for _ ,_aed :=range _ff .ExtraFiles {if _aed .ZipPath ==_gfa {_aee =false ;break ;};};if _aee {_ff .ExtraFiles =append (_ff .ExtraFiles ,_dga );
};};return _ff ;};
// SetContentStatus records the content status of the document.
func (_cc CoreProperties )SetContentStatus (s string ){_cc ._bba .ContentStatus =&s };
// 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 (_fggb *DocBase )AddExtraFileFromZip (f *_c .File )error {_edb ,_dfad :=_db .ExtractToDiskTmp (f ,_fggb .TmpPath );if _dfad !=nil {return _fb .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",_dfad );
};_fggb .ExtraFiles =append (_fggb .ExtraFiles ,ExtraFile {ZipPath :f .Name ,DiskPath :_edb });return nil ;};func (_agaa Relationship )String ()string {return _fb .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",_agaa .ID (),_agaa .Target (),_agaa .Type ());
};
// CreateCustomProperties creates the custom properties of the document.
func (_bcbe *DocBase )CreateCustomProperties (){_bcbe .CustomProperties =NewCustomProperties ();_bcbe .AddCustomRelationships ();};
// Title returns the Title of the document
func (_aaaa CoreProperties )Title ()string {if _aaaa ._bba .Title !=nil {return string (_aaaa ._bba .Title .Data );};return "";};
// NewRelationship constructs a new relationship.
func NewRelationship ()Relationship {return Relationship {_fcad :_efb .NewRelationship ()}};
// LastModifiedBy returns the name of the last person to modify the document
func (_aac CoreProperties )LastModifiedBy ()string {if _aac ._bba .LastModifiedBy !=nil {return *_aac ._bba .LastModifiedBy ;};return "";};func (_dgc CustomProperties )SetPropertyAsUi1 (name string ,ui1 uint8 ){_bafe :=_dgc .getNewProperty (name );_bafe .Ui1 =&ui1 ;
_dgc .setOrReplaceProperty (_bafe );};
// 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 (_egf *ImageRef )SetTarget (target string ){_egf ._aafb =target };
// GetByRelId returns a relationship with the associated relation ID.
func (_fed Relationships )GetByRelId (idAttr string )Relationship {for _ ,_cca :=range _fed ._gac .Relationship {if _cca .IdAttr ==idAttr {return Relationship {_fcad :_cca };};};return Relationship {};};
// 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 ){_cbcg :=Image {};_gbf ,_eegc ,_debb :=_g .Decode (_b .NewReader (data ));if _debb !=nil {return _cbcg ,_fb .Errorf ("\u0075n\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0070\u0061r\u0073e\u0020i\u006d\u0061\u0067\u0065\u003a\u0020\u0025s",_debb );
};_cbcg .Data =&data ;_cbcg .Format =_eegc ;_cbcg .Size =_gbf .Bounds ().Size ();return _cbcg ,nil ;};
// Properties returns table properties.
func (_fbgc Table )Grid ()*_acd .CT_TableGrid {return _fbgc ._bgc .TblGrid };func (_bdbb CustomProperties )SetPropertyAsOblob (name ,oblob string ){_dae :=_bdbb .getNewProperty (name );_dae .Oblob =&oblob ;_bdbb .setOrReplaceProperty (_dae );};
// SetCategory records the category of the document.
func (_daa CoreProperties )SetCategory (s string ){_daa ._bba .Category =&s };func (_dcc TableRow )addCell ()*_acd .CT_TableCell {_bebg :=_acd .NewCT_TableCell ();_dcc ._ebdcc .Tc =append (_dcc ._ebdcc .Tc ,_bebg );return _bebg ;};
// Application returns the name of the application that created the document.
// For unioffice created documents, it defaults to github.com/unidoc/unioffice
func (_ce AppProperties )Application ()string {if _ce ._bgg .Application !=nil {return *_ce ._bgg .Application ;};return "";};func (_dd CustomProperties )SetPropertyAsR8 (name string ,r8 float64 ){_bbf :=_dd .getNewProperty (name );_bbf .R8 =&r8 ;_dd .setOrReplaceProperty (_bbf );
};func (_cgfd CustomProperties )SetPropertyAsClsid (name string ,clsid string ){_adg :=_cgfd .getNewProperty (name );_adg .Clsid =&clsid ;_cgfd .setOrReplaceProperty (_adg );};func (_abf CustomProperties )SetPropertyAsVector (name string ,vector *_ac .Vector ){_fae :=_abf .getNewProperty (name );
_fae .Vector =vector ;_abf .setOrReplaceProperty (_fae );};
// SetModified sets the time that the document was modified.
func (_cce CoreProperties )SetModified (t _cd .Time ){_cce ._bba .Modified =_gce (t ,"\u0064\u0063t\u0065\u0072\u006ds\u003a\u006d\u006f\u0064\u0069\u0066\u0069\u0065\u0064");};
// CustomProperties contains document specific properties.
type CustomProperties struct{_gga *_dg .Properties };
// Modified returns the time that the document was modified.
func (_dfa CoreProperties )Modified ()_cd .Time {return _cfg (_dfa ._bba .Modified )};
// SetCreated sets the time that the document was created.
func (_bgeb CoreProperties )SetCreated (t _cd .Time ){_bgeb ._bba .Created =_gce (t ,"\u0064c\u0074e\u0072\u006d\u0073\u003a\u0063\u0072\u0065\u0061\u0074\u0065\u0064");};
// ApplicationVersion returns the version of the application that created the
// document.
func (_eba AppProperties )ApplicationVersion ()string {if _eba ._bgg .AppVersion !=nil {return *_eba ._bgg .AppVersion ;};return "";};
// NewTableStyles constructs a new TableStyles.
func NewTableStyles ()TableStyles {return TableStyles {_gef :_acd .NewTblStyleLst ()}};func (_deb CustomProperties )setProperty (_ca *_dg .CT_Property ){_deb .setPropertyHelper (_ca ,false )};
// Size returns the size of an image
func (_ggaa ImageRef )Size ()_g .Point {return _ggaa ._bff .Size };
// SetOffsetY sets vertical offset of a table in distance units (see measurement package).
func (_cadg Table )SetOffsetY (offY float64 ){if _cadg ._ecf .Off ==nil {_cadg ._ecf .Off =_acd .NewCT_Point2D ();_bfgb :=int64 (0);_cadg ._ecf .Off .XAttr =_acd .ST_Coordinate {ST_CoordinateUnqualified :&_bfgb };};_bad :=_fc .ToEMU (offY );_cadg ._ecf .Off .YAttr =_acd .ST_Coordinate {ST_CoordinateUnqualified :&_bad };
};func (_gafa CustomProperties )SetPropertyAsFiletime (name string ,filetime _cd .Time ){_bbe :=_gafa .getNewProperty (name );_bbe .Filetime =&filetime ;_gafa .setOrReplaceProperty (_bbe );};
// X returns the inner raw content types.
func (_cge ContentTypes )X ()*_df .Types {return _cge ._bce };func (_afgd CustomProperties )SetPropertyAsBool (name string ,b bool ){_ceab :=_afgd .getNewProperty (name );_ceab .Bool =&b ;_afgd .setOrReplaceProperty (_ceab );};
// NewRelationships creates a new relationship wrapper.
func NewRelationships ()Relationships {return Relationships {_gac :_efb .NewRelationships ()}};
// AddOverride adds an override content type for a given path name.
func (_fe ContentTypes )AddOverride (path ,contentType string ){if !_bb .HasPrefix (path ,"\u002f"){path ="\u002f"+path ;};if _bb .HasPrefix (contentType ,"\u0068\u0074\u0074\u0070"){_aa .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 _ ,_aga :=range _fe ._bce .Override {if _aga .PartNameAttr ==path {return ;};};_feg :=_df .NewOverride ();_feg .PartNameAttr =path ;_feg .ContentTypeAttr =contentType ;_fe ._bce .Override =append (_fe ._bce .Override ,_feg );};
// Company returns the name of the company that created the document.
// For unioffice created documents, it defaults to github.com/unidoc/unioffice
func (_ag AppProperties )Company ()string {if _ag ._bgg .Company !=nil {return *_ag ._bgg .Company ;};return "";};func (_gfg CustomProperties )SetPropertyAsUint (name string ,ui uint ){_fbg :=_gfg .getNewProperty (name );_fgc :=uint32 (ui );_fbg .Uint =&_fgc ;
_gfg .setOrReplaceProperty (_fbg );};
// AddCustomRelationships adds relationships related to custom properties to the document.
func (_gbd *DocBase )AddCustomRelationships (){_gbd .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");
_gbd .Rels .AddRelationship ("\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c",_bc .CustomPropertiesType );};func (_bdc CustomProperties )SetPropertyAsVstream (name string ,vstream *_ac .Vstream ){_edc :=_bdc .getNewProperty (name );
_edc .Vstream =vstream ;_bdc .setOrReplaceProperty (_edc );};
// NewAppProperties constructs a new AppProperties.
func NewAppProperties ()AppProperties {_aec :=AppProperties {_bgg :_ec .NewProperties ()};_aec .SetCompany ("\u0046\u006f\u0078\u0079\u0055\u0074\u0069\u006c\u0073\u0020\u0065\u0068\u0066");_aec .SetApplication ("g\u0069\u0074\u0068\u0075\u0062\u002ec\u006f\u006d\u002f\u0075\u006e\u0069\u0064\u006f\u0063/\u0075\u006e\u0069o\u0066f\u0069\u0063\u0065");
_aec .SetDocSecurity (0);_aec .SetLinksUpToDate (false );var _fde ,_cba ,_bf int64 ;_fb .Sscanf (Version ,"\u0025\u0064\u002e\u0025\u0064\u002e\u0025\u0064",&_fde ,&_cba ,&_bf );_def :=float64 (_fde )+float64 (_cba )/10000.0;_aec .SetApplicationVersion (_fb .Sprintf ("\u0025\u0030\u0037\u002e\u0034\u0066",_def ));
return _aec ;};
// Data returns the data of an image file, if any.
func (_fba ImageRef )Data ()*[]byte {return _fba ._bff .Data };const _eec ="\u0032\u0020\u004aan\u0075\u0061\u0072\u0079\u0020\u0032\u0030\u0030\u0036\u0020\u0061\u0074\u0020\u0031\u0035\u003a\u0030\u0034";
// Format returns the format of the underlying image
func (_cgcg ImageRef )Format ()string {return _cgcg ._bff .Format };func (_bfg CustomProperties )SetPropertyAsUi4 (name string ,ui4 uint32 ){_afc :=_bfg .getNewProperty (name );_afc .Ui4 =&ui4 ;_bfg .setOrReplaceProperty (_afc );};func (_eef CustomProperties )SetPropertyAsNull (name string ){_ecga :=_eef .getNewProperty (name );
_ecga .Null =_ac .NewNull ();_eef .setOrReplaceProperty (_ecga );};func (_bga *ImageRef )SetRelID (id string ){_bga ._fbd =id };
// SetDocSecurity sets the document security flag.
func (_dbf AppProperties )SetDocSecurity (v int32 ){_dbf ._bgg .DocSecurity =_bc .Int32 (v )};
// Author returns the author of the document
func (_bge CoreProperties )Author ()string {if _bge ._bba .Creator !=nil {return string (_bge ._bba .Creator .Data );};return "";};
// Created returns the time that the document was created.
func (_aafa CoreProperties )Created ()_cd .Time {return _cfg (_aafa ._bba .Created )};
// TblStyle returns the TblStyle property.
func (_aeee TableStyles )TblStyle ()[]*_acd .CT_TableStyle {return _aeee ._gef .TblStyle };
// 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 ){_deab ,_cae :=_fg .Open (path );_gbg :=Image {};if _cae !=nil {return _gbg ,_fb .Errorf ("\u0065\u0072\u0072or\u0020\u0072\u0065\u0061\u0064\u0069\u006e\u0067\u0020\u0069\u006d\u0061\u0067\u0065\u003a\u0020\u0025\u0073",_cae );
};defer _deab .Close ();_gegg ,_aff ,_cae :=_g .Decode (_deab );if _cae !=nil {return _gbg ,_fb .Errorf ("\u0075n\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0070\u0061r\u0073e\u0020i\u006d\u0061\u0067\u0065\u003a\u0020\u0025s",_cae );};_gbg .Path =path ;
_gbg .Format =_aff ;_gbg .Size =_gegg .Bounds ().Size ();return _gbg ,nil ;};func (_eeg CustomProperties )SetPropertyAsInt (name string ,i int ){_fdb :=_eeg .getNewProperty (name );_acc :=int32 (i );_fdb .Int =&_acc ;_eeg .setOrReplaceProperty (_fdb );
};func (_gab CustomProperties )SetPropertyAsBstr (name string ,bstr string ){_eded :=_gab .getNewProperty (name );_eded .Bstr =&bstr ;_gab .setOrReplaceProperty (_eded );};func UtcTimeFormat (t _cd .Time )string {return t .Format (_eec )+"\u0020\u0055\u0054\u0043"};
func (_abc CustomProperties )SetPropertyAsUi8 (name string ,ui8 uint64 ){_agcd :=_abc .getNewProperty (name );_agcd .Ui8 =&ui8 ;_abc .setOrReplaceProperty (_agcd );};func _cfg (_gcf *_bc .XSDAny )_cd .Time {if _gcf ==nil {return _cd .Time {};};_geb ,_geg :=_cd .Parse (_ebaf ,string (_gcf .Data ));
if _geg !=nil {_aa .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 (_gcf .Data ),_geg );};return _geb ;};
// X returns the inner wrapped XML type.
func (_ced AppProperties )X ()*_ec .Properties {return _ced ._bgg };
// Target returns the target attrubute of the image reference (a path where the image file is located in the document structure).
func (_bdg *ImageRef )Target ()string {return _bdg ._aafb };
// NewCustomProperties constructs a new CustomProperties.
func NewCustomProperties ()CustomProperties {return CustomProperties {_gga :_dg .NewProperties ()}};
// AppProperties contains properties specific to the document and the
// application that created it.
type AppProperties struct{_bgg *_ec .Properties };
// SetApplicationVersion sets the version of the application that created the
// document. Per MS, the verison string mut be in the form 'XX.YYYY'.
func (_dag AppProperties )SetApplicationVersion (s string ){_dag ._bgg .AppVersion =&s };
// Category returns the category of the document
func (_fcd CoreProperties )Category ()string {if _fcd ._bba .Category !=nil {return *_fcd ._bba .Category ;};return "";};
// SetLinksUpToDate sets the links up to date flag.
func (_bca AppProperties )SetLinksUpToDate (v bool ){_bca ._bgg .LinksUpToDate =_bc .Bool (v )};func (_fbf CustomProperties )SetPropertyAsI4 (name string ,i4 int32 ){_gfea :=_fbf .getNewProperty (name );_gfea .I4 =&i4 ;_fbf .setOrReplaceProperty (_gfea );
};
// AddDefault registers a default content type for a given file extension.
func (_bab ContentTypes )AddDefault (fileExtension string ,contentType string ){fileExtension =_bb .ToLower (fileExtension );for _ ,_aecd :=range _bab ._bce .Default {if _aecd .ExtensionAttr ==fileExtension {return ;};};_bac :=_df .NewDefault ();_bac .ExtensionAttr =fileExtension ;
_bac .ContentTypeAttr =contentType ;_bab ._bce .Default =append (_bab ._bce .Default ,_bac );};
// SetTarget set the target (path) of a relationship.
func (_bdgd Relationship )SetTarget (s string ){_bdgd ._fcad .TargetAttr =s };
// SetID set the ID of a relationship.
func (_bafeb Relationship )SetID (ID string ){_bafeb ._fcad .IdAttr =ID ;};
// WriteExtraFiles writes the extra files to the zip package.
func (_ebd *DocBase )WriteExtraFiles (z *_c .Writer )error {for _ ,_agg :=range _ebd .ExtraFiles {if _fggd :=_db .AddFileFromDisk (z ,_agg .ZipPath ,_agg .DiskPath );_fggd !=nil {return _fggd ;};};return nil ;};
// TableStyles contains document specific properties.
type TableStyles struct{_gef *_acd .TblStyleLst };const Version ="\u0031\u002e\u0033\u0039\u002e\u0030";
// 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 (_gdg ImageRef )RelativeWidth (h _fc .Distance )_fc .Distance {_adgg :=float64 (_gdg .Size ().X )/float64 (_gdg .Size ().Y );return h *_fc .Distance (_adgg );};const _ebaf ="2\u00300\u0036\u002d\u0030\u0031\u002d\u0030\u0032\u00541\u0035\u003a\u0030\u0034:0\u0035\u005a";
// 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 _g .Point ;Format string ;Path string ;Data *[]byte ;};
// NewRelationshipsCopy creates a new relationships wrapper as a copy of passed in instance.
func NewRelationshipsCopy (rels Relationships )Relationships {_aaef :=*rels ._gac ;return Relationships {_gac :&_aaef };};
// SetAuthor records the author of the document.
func (_adb CoreProperties )SetAuthor (s string ){if _adb ._bba .Creator ==nil {_adb ._bba .Creator =&_bc .XSDAny {XMLName :_ba .Name {Local :"\u0064\u0063\u003a\u0063\u0072\u0065\u0061\u0074\u006f\u0072"}};};_adb ._bba .Creator .Data =[]byte (s );};
// 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 (_ee AppProperties )Pages ()int32 {if _ee ._bgg .Pages !=nil {return *_ee ._bgg .Pages ;};return 0;};func (_gcff CustomProperties )setPropertyHelper (_fca *_dg .CT_Property ,_gee bool ){_cbag :=_gcff .GetPropertyByName (*_fca .NameAttr );if (_cbag ==CustomProperty {}){_gcff ._gga .Property =append (_gcff ._gga .Property ,_fca );
}else if _gee {_fca .FmtidAttr =_cbag ._gfb .FmtidAttr ;if _cbag ._gfb .PidAttr ==0{_fca .PidAttr =_cbag ._gfb .PidAttr ;};_fca .LinkTargetAttr =_cbag ._gfb .LinkTargetAttr ;*_cbag ._gfb =*_fca ;};};
// X returns the inner wrapped XML type.
func (_adc Table )X ()*_acd .Tbl {return _adc ._bgc };
// ContentStatus returns the content status of the document (e.g. "Final", "Draft")
func (_bd CoreProperties )ContentStatus ()string {if _bd ._bba .ContentStatus !=nil {return *_bd ._bba .ContentStatus ;};return "";};
// CopyRelationship copies the relationship.
func (_aacd Relationships )CopyRelationship (idAttr string )(Relationship ,bool ){for _ccbe :=range _aacd ._gac .Relationship {if _aacd ._gac .Relationship [_ccbe ].IdAttr ==idAttr {_bfea :=*_aacd ._gac .Relationship [_ccbe ];_cfa :=len (_aacd ._gac .Relationship )+1;
_dfb :=map[string ]struct{}{};for _ ,_dgdb :=range _aacd ._gac .Relationship {_dfb [_dgdb .IdAttr ]=struct{}{};};for _ ,_fcfc :=_dfb [_fb .Sprintf ("\u0072\u0049\u0064%\u0064",_cfa )];_fcfc ;_ ,_fcfc =_dfb [_fb .Sprintf ("\u0072\u0049\u0064%\u0064",_cfa )]{_cfa ++;
};_bfea .IdAttr =_fb .Sprintf ("\u0072\u0049\u0064%\u0064",_cfa );_aacd ._gac .Relationship =append (_aacd ._gac .Relationship ,&_bfea );return Relationship {_fcad :&_bfea },true ;};};return Relationship {},false ;};
// TableRow represents a row in a table.
type TableRow struct{_ebdcc *_acd .CT_TableRow };func (_aeg CustomProperties )SetPropertyAsEmpty (name string ){_dca :=_aeg .getNewProperty (name );_dca .Empty =_ac .NewEmpty ();_aeg .setOrReplaceProperty (_dca );};
// SetHeight sets row height, see measurement package.
func (_fgbf TableRow )SetHeight (m _fc .Distance ){_bega :=_fc .ToEMU (float64 (m ));_fgbf ._ebdcc .HAttr =_acd .ST_Coordinate {ST_CoordinateUnqualified :&_bega };};func (_gbe CustomProperties )SetPropertyAsStream (name string ,stream string ){_aeb :=_gbe .getNewProperty (name );
_aeb .Stream =&stream ;_gbe .setOrReplaceProperty (_aeb );};
// RemoveOverride removes an override given a path.
func (_fec ContentTypes )RemoveOverride (path string ){if !_bb .HasPrefix (path ,"\u002f"){path ="\u002f"+path ;};for _gfe ,_aaa :=range _fec ._bce .Override {if _aaa .PartNameAttr ==path {copy (_fec ._bce .Override [_gfe :],_fec ._bce .Override [_gfe +1:]);
_fec ._bce .Override =_fec ._bce .Override [0:len (_fec ._bce .Override )-1];};};};
// NewTable makes a new table.
func NewTable ()*Table {_fdbf :=_acd .NewTbl ();_fdbf .TblPr =_acd .NewCT_TableProperties ();return &Table {_bgc :_fdbf };};
// ImageRef is a reference to an image within a document.
type ImageRef struct{_feae *DocBase ;_afdg Relationships ;_bff Image ;_fbd string ;_aafb string ;};
// CopyOverride copies override content type for a given `path` and puts it with a path `newPath`.
func (_fee ContentTypes )CopyOverride (path ,newPath string ){if !_bb .HasPrefix (path ,"\u002f"){path ="\u002f"+path ;};if !_bb .HasPrefix (newPath ,"\u002f"){newPath ="\u002f"+newPath ;};for _cea :=range _fee ._bce .Override {if _fee ._bce .Override [_cea ].PartNameAttr ==path {_bbg :=*_fee ._bce .Override [_cea ];
_bbg .PartNameAttr =newPath ;_fee ._bce .Override =append (_fee ._bce .Override ,&_bbg );};};};
// ID returns the ID of a relationship.
func (_cgbe Relationship )ID ()string {return _cgbe ._fcad .IdAttr };
// X returns the inner wrapped XML type.
func (_fge CustomProperties )X ()*_dg .Properties {return _fge ._gga };
// NewTheme constructs a new theme.
func NewTheme ()Theme {return Theme {_acd .NewTheme ()}};const _bebf =2025;
// SetDescription records the description of the document.
func (_fea CoreProperties )SetDescription (s string ){if _fea ._bba .Description ==nil {_fea ._bba .Description =&_bc .XSDAny {XMLName :_ba .Name {Local :"\u0064\u0063\u003a\u0064\u0065\u0073\u0063\u0072\u0069p\u0074\u0069\u006f\u006e"}};};_fea ._bba .Description .Data =[]byte (s );
};
// GetImageBytesByTarget returns Image object with Data bytes read from its target.
func (_fcg *DocBase )GetImageBytesByTarget (target string )(Image ,error ){if target !=""{target ="\u0077\u006f\u0072d\u002f"+target ;for _ ,_aedf :=range _fcg .Images {if _aedf .Target ()==target {if _bb .ToLower (_aedf .Format ())!="\u0065\u006d\u0066"{return ImageFromStorage (_aedf .Path ());
};return Image {Path :_aedf .Path (),Format :_aedf .Format ()},nil ;};};};return Image {},_fbgd ;};
// X returns the inner wrapped XML type.
func (_ged CoreProperties )X ()*_ge .CoreProperties {return _ged ._bba };
// NewCoreProperties constructs a new CoreProperties.
func NewCoreProperties ()CoreProperties {return CoreProperties {_bba :_ge .NewCoreProperties ()}};const _cdg =15;
// CustomProperty contains document specific property.
// Using of this type is deprecated.
type CustomProperty struct{_gfb *_dg .CT_Property };const _eff =30;func (_bebb CustomProperties )SetPropertyAsOstream (name string ,ostream string ){_fdd :=_bebb .getNewProperty (name );_fdd .Ostream =&ostream ;_bebb .setOrReplaceProperty (_fdd );};
// Properties returns table properties.
func (_ecba Table )Properties ()*_acd .CT_TableProperties {return _ecba ._bgc .TblPr };
// 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 {_bff :img ,_feae :d ,_afdg :rels };};func (_bfc CustomProperties )SetPropertyAsBlob (name ,blob string ){_ecd :=_bfc .getNewProperty (name );_ecd .Blob =&blob ;_bfc .setOrReplaceProperty (_ecd );
};
// Type returns the type of a relationship.
func (_cad Relationship )Type ()string {return _cad ._fcad .TypeAttr };func (_ege CustomProperties )SetPropertyAsCy (name string ,cy string ){_ebc :=_ege .getNewProperty (name );_ebc .Cy =&cy ;_ege .setOrReplaceProperty (_ebc );};
// X returns the underlying raw XML data.
func (_cbg Relationships )X ()*_efb .Relationships {return _cbg ._gac };func (_cga CustomProperties )SetPropertyAsI8 (name string ,i8 int64 ){_beb :=_cga .getNewProperty (name );_beb .I8 =&i8 ;_cga .setOrReplaceProperty (_beb );};var ReleasedAt =_cd .Date (_bebf ,_beeg ,_fbfc ,_cdg ,_eff ,0,0,_cd .UTC );
// AddHyperlink adds an external hyperlink relationship.
func (_cbca Relationships )AddHyperlink (target string )Hyperlink {_cead :=_cbca .AddRelationship (target ,_bc .HyperLinkType );_cead ._fcad .TargetModeAttr =_efb .ST_TargetModeExternal ;return Hyperlink (_cead );};func (_gffe CustomProperties )SetPropertyAsI2 (name string ,i2 int16 ){_dgd :=_gffe .getNewProperty (name );
_dgd .I2 =&i2 ;_gffe .setOrReplaceProperty (_dgd );};
// SetTitle records the title of the document.
func (_dfe CoreProperties )SetTitle (s string ){if _dfe ._bba .Title ==nil {_dfe ._bba .Title =&_bc .XSDAny {XMLName :_ba .Name {Local :"\u0064\u0063\u003a\u0074\u0069\u0074\u006c\u0065"}};};_dfe ._bba .Title .Data =[]byte (s );};
// Target returns the target (path) of a relationship.
func (_edce Relationship )Target ()string {return _edce ._fcad .TargetAttr };
// Cells returns an array of row cells.
func (_dde TableRow )Cells ()[]*_acd .CT_TableCell {return _dde ._ebdcc .Tc };func (_aca CustomProperties )SetPropertyAsError (name string ,error string ){_gad :=_aca .getNewProperty (name );_gad .Error =&error ;_aca .setOrReplaceProperty (_gad );};
// Rows returns all table rows.
func (_agfb Table )Rows ()[]*TableRow {_cgbf :=_agfb ._bgc .Tr ;_eac :=[]*TableRow {};for _ ,_eed :=range _cgbf {_eac =append (_eac ,&TableRow {_ebdcc :_eed });};return _eac ;};
// AddRow adds a row to a table.
func (_ddad Table )AddRow ()*TableRow {_aggd :=_acd .NewCT_TableRow ();for _ccg :=0;_ccg < len (_ddad ._bgc .TblGrid .GridCol );_ccg ++{_aggd .Tc =append (_aggd .Tc ,_acd .NewCT_TableCell ());};_ddad ._bgc .Tr =append (_ddad ._bgc .Tr ,_aggd );return &TableRow {_ebdcc :_aggd };
};
// AddImageToZip adds an image (either from bytes or from disk) and adds it to the zip file.
func AddImageToZip (z *_c .Writer ,img ImageRef ,imageNum int ,dt _bc .DocType )error {_efa :=_bc .AbsoluteImageFilename (dt ,imageNum ,_bb .ToLower (img .Format ()));if img .Data ()!=nil &&len (*img .Data ())> 0{if _bdf :=_db .AddFileFromBytes (z ,_efa ,*img .Data ());
_bdf !=nil {return _bdf ;};}else if img .Path ()!=""{if _gcee :=_db .AddFileFromDisk (z ,_efa ,img .Path ());_gcee !=nil {return _gcee ;};}else {return _fb .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 ;};
// AddRelationship adds a relationship.
func (_gcb Relationships )AddRelationship (target ,ctype string )Relationship {if !_bb .HasPrefix (ctype ,"\u0068t\u0074\u0070\u003a\u002f\u002f"){_aa .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 );
};_dff :=_efb .NewRelationship ();_cbcd :=len (_gcb ._gac .Relationship )+1;_ecb :=map[string ]struct{}{};for _ ,_dda :=range _gcb ._gac .Relationship {_ecb [_dda .IdAttr ]=struct{}{};};for _ ,_dfc :=_ecb [_fb .Sprintf ("\u0072\u0049\u0064%\u0064",_cbcd )];
_dfc ;_ ,_dfc =_ecb [_fb .Sprintf ("\u0072\u0049\u0064%\u0064",_cbcd )]{_cbcd ++;};_dff .IdAttr =_fb .Sprintf ("\u0072\u0049\u0064%\u0064",_cbcd );_dff .TargetAttr =target ;_dff .TypeAttr =ctype ;_gcb ._gac .Relationship =append (_gcb ._gac .Relationship ,_dff );
return Relationship {_fcad :_dff };};
// FindRIDForN returns the relationship ID for the i'th relationship of type t.
func (_cbb Relationships )FindRIDForN (i int ,t string )string {for _ ,_ebaa :=range _cbb ._gac .CT_Relationships .Relationship {if _ebaa .TypeAttr ==t {if i ==0{return _ebaa .IdAttr ;};i --;};};return "";};
// X returns the inner wrapped XML type.
func (_eea TableStyles )X ()*_acd .TblStyleLst {return _eea ._gef };
// CoreProperties contains document specific properties.
type CoreProperties struct{_bba *_ge .CoreProperties };
// 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 ){_ddc :=Image {};_cda ,_ggc :=_bbb .Open (path );if _ggc !=nil {return _ddc ,_fb .Errorf ("\u0065\u0072\u0072or\u0020\u0072\u0065\u0061\u0064\u0069\u006e\u0067\u0020\u0069\u006d\u0061\u0067\u0065\u003a\u0020\u0025\u0073",_ggc );
};defer _cda .Close ();_cgff ,_ebde ,_ggc :=_g .Decode (_cda );if _ggc !=nil {return _ddc ,_fb .Errorf ("\u0075n\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0070\u0061r\u0073e\u0020i\u006d\u0061\u0067\u0065\u003a\u0020\u0025s",_ggc );};_ddc .Path =path ;
_ddc .Format =_ebde ;_ddc .Size =_cgff .Bounds ().Size ();return _ddc ,nil ;};
// Hyperlink is just an appropriately configured relationship.
type Hyperlink Relationship ;
// SetPages sets the pages count of the document.
func (_fcf AppProperties )SetPages (n int32 ){_fcf ._bgg .Pages =&n };
// EnsureOverride ensures that an override for the given path exists, adding it if necessary
func (_add ContentTypes )EnsureOverride (path ,contentType string ){for _ ,_be :=range _add ._bce .Override {if _be .PartNameAttr ==path {if _bb .HasPrefix (contentType ,"\u0068\u0074\u0074\u0070"){_aa .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 );
};_be .ContentTypeAttr =contentType ;return ;};};_add .AddOverride (path ,contentType );};func (_dbb CustomProperties )SetPropertyAsOstorage (name string ,ostorage string ){_gfd :=_dbb .getNewProperty (name );_gfd .Ostorage =&ostorage ;_dbb .setOrReplaceProperty (_gfd );
};
// 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 (_gge ImageRef )RelativeHeight (w _fc .Distance )_fc .Distance {_efc :=float64 (_gge .Size ().Y )/float64 (_gge .Size ().X );return w *_fc .Distance (_efc );};
// GetOrCreateCustomProperties returns the custom properties of the document (and if they not exist yet, creating them first).
func (_deffb *DocBase )GetOrCreateCustomProperties ()CustomProperties {if _deffb .CustomProperties .X ()==nil {_deffb .CreateCustomProperties ();};return _deffb .CustomProperties ;};
// SetApplication sets the name of the application that created the document.
func (_ad AppProperties )SetApplication (s string ){_ad ._bgg .Application =&s };
// ContentTypes is the top level "[Content_Types].xml" in a zip package.
type ContentTypes struct{_bce *_df .Types };func init (){_de .SetAsStorage ()};
// IsEmpty returns true if there are no relationships.
func (_bafg Relationships )IsEmpty ()bool {return _bafg ._gac ==nil ||len (_bafg ._gac .Relationship )==0;};func (_ede CustomProperties )SetPropertyAsI1 (name string ,i1 int8 ){_ggg :=_ede .getNewProperty (name );_ggg .I1 =&i1 ;_ede .setOrReplaceProperty (_ggg );
};
// SetLastModifiedBy records the last person to modify the document.
func (_gdcd CoreProperties )SetLastModifiedBy (s string ){_gdcd ._bba .LastModifiedBy =&s };func (_fgg CustomProperties )SetPropertyAsDecimal (name string ,decimal float64 ){_fbe :=_fgg .getNewProperty (name );_fbe .Decimal =&decimal ;_fgg .setOrReplaceProperty (_fbe );
};
// NewContentTypes returns a wrapper around a newly constructed content-types.
func NewContentTypes ()ContentTypes {_ffg :=ContentTypes {_bce :_df .NewTypes ()};_ffg .AddDefault ("\u0078\u006d\u006c","\u0061p\u0070l\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u0078\u006d\u006c");_ffg .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");
_ffg .AddDefault ("\u0070\u006e\u0067","\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg");_ffg .AddDefault ("\u006a\u0070\u0065\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_ffg .AddDefault ("\u006a\u0070\u0067","\u0069m\u0061\u0067\u0065\u002f\u006a\u0070g");
_ffg .AddDefault ("\u0077\u006d\u0066","i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066");_ffg .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");
_ffg .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 _ffg ;};func (_gafb CustomProperties )SetPropertyAsLpstr (name string ,lpstr string ){_fcfa :=_gafb .getNewProperty (name );_fcfa .Lpstr =&lpstr ;_gafb .setOrReplaceProperty (_fcfa );};
// GetTargetByRelIdAndType returns a target path with the associated relation ID.
func (_ffd Relationships )GetTargetByRelIdAndType (idAttr string ,typeAttr string )string {for _ ,_efcb :=range _ffd ._gac .Relationship {if _efcb .IdAttr ==idAttr &&_efcb .TypeAttr ==typeAttr {return _efcb .TargetAttr ;};};return "";};
// NewTableWithXfrm makes a new table with a pointer to its parent Xfrm for changing its offset and size.
func NewTableWithXfrm (xfrm *_acd .CT_Transform2D )*Table {_bbgb :=_acd .NewTbl ();_bbgb .TblPr =_acd .NewCT_TableProperties ();return &Table {_bgc :_bbgb ,_ecf :xfrm };};
// 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 _g .Image ;Images []ImageRef ;ExtraFiles []ExtraFile ;TmpPath string ;};const _beeg =1;
// X returns the inner wrapped XML type of CustomProperty.
func (_gba CustomProperty )X ()*_dg .CT_Property {return _gba ._gfb };
// PropertiesList returns the list of all custom properties of the document.
func (_dbc CustomProperties )PropertiesList ()[]*_dg .CT_Property {return _dbc ._gga .Property };
// DefAttr returns the DefAttr property.
func (_cgeg TableStyles )DefAttr ()string {return _cgeg ._gef .DefAttr };
// SetStyle assigns TableStyle to a table.
func (_fac Table )SetStyle (style *_acd .CT_TableStyle ){if _fac ._bgc .TblPr ==nil {_fac ._bgc .TblPr =_acd .NewCT_TableProperties ();};if _fac ._bgc .TblPr .Choice ==nil {_fac ._bgc .TblPr .Choice =_acd .NewCT_TablePropertiesChoice ();};_fac ._bgc .TblPr .Choice .TableStyle =style ;
};func (_gdce CustomProperties )SetPropertyAsArray (name string ,array *_ac .Array ){_baf :=_gdce .getNewProperty (name );_baf .Array =array ;_gdce .setOrReplaceProperty (_baf );};
// Relationships returns a slice of all of the relationships.
func (_ebdc Relationships )Relationships ()[]Relationship {_gaa :=[]Relationship {};for _ ,_abcf :=range _ebdc ._gac .Relationship {_gaa =append (_gaa ,Relationship {_fcad :_abcf });};return _gaa ;};
// SetLanguage records the language of the document.
func (_ccb CoreProperties )SetLanguage (s string ){_ccb ._bba .Language =&_bc .XSDAny {XMLName :_ba .Name {Local :"d\u0063\u003a\u006c\u0061\u006e\u0067\u0075\u0061\u0067\u0065"}};_ccb ._bba .Language .Data =[]byte (s );};func (_dgcd CustomProperties )SetPropertyAsLpwstr (name string ,lpwstr string ){_afd :=_dgcd .getNewProperty (name );
_afd .Lpwstr =&lpwstr ;_dgcd .setOrReplaceProperty (_afd );};
// TableCol represents a column in a table.
type TableCol struct{_ddca *_acd .CT_TableCol };func (_bdb CustomProperties )setOrReplaceProperty (_bfd *_dg .CT_Property ){_bdb .setPropertyHelper (_bfd ,true );};func (_bfe CustomProperties )SetPropertyAsUi2 (name string ,ui2 uint16 ){_ebf :=_bfe .getNewProperty (name );
_ebf .Ui2 =&ui2 ;_bfe .setOrReplaceProperty (_ebf );};func (_dgf CustomProperties )getNewProperty (_gdb string )*_dg .CT_Property {_acgb :=_dgf ._gga .Property ;_ace :=int32 (1);for _ ,_deff :=range _acgb {if _deff .PidAttr > _ace {_ace =_deff .PidAttr ;
};};_gff :=_dg .NewCT_Property ();_gff .NameAttr =&_gdb ;_gff .PidAttr =_ace +1;_gff .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 _gff ;};
// X returns the inner wrapped XML type.
func (_afa Relationship )X ()*_efb .Relationship {return _afa ._fcad };const _fbfc =2;
// SetOffsetX sets horizontal offset of a table in distance units (see measurement package).
func (_afad Table )SetOffsetX (offX float64 ){if _afad ._ecf .Off ==nil {_afad ._ecf .Off =_acd .NewCT_Point2D ();_efag :=int64 (0);_afad ._ecf .Off .YAttr =_acd .ST_Coordinate {ST_CoordinateUnqualified :&_efag };};_edg :=_fc .ToEMU (offX );_afad ._ecf .Off .XAttr =_acd .ST_Coordinate {ST_CoordinateUnqualified :&_edg };
};
// ExtraFile is an unsupported file type extracted from, or to be written to a
// zip package
type ExtraFile struct{ZipPath string ;DiskPath string ;};
// RemoveOverrideByIndex removes an override given a path and override index.
func (_aab ContentTypes )RemoveOverrideByIndex (path string ,indexToFind int )error {_dea :=path [0:len (path )-5];if !_bb .HasPrefix (_dea ,"\u002f"){_dea ="\u002f"+_dea ;};_gae ,_ab :=_gf .Compile (_dea +"\u0028\u005b\u0030-\u0039\u005d\u002b\u0029\u002e\u0078\u006d\u006c");
if _ab !=nil {return _ab ;};_ed :=0;_ece :=-1;for _gaf ,_cbc :=range _aab ._bce .Override {if _fegg :=_gae .FindStringSubmatch (_cbc .PartNameAttr );len (_fegg )> 1{if _ed ==indexToFind {_ece =_gaf ;}else if _ed > indexToFind {_fgf ,_ :=_cg .Atoi (_fegg [1]);
_fgf --;_cbc .PartNameAttr =_fb .Sprintf ("\u0025\u0073\u0025\u0064\u002e\u0078\u006d\u006c",_dea ,_fgf );};_ed ++;};};if _ece > -1{copy (_aab ._bce .Override [_ece :],_aab ._bce .Override [_ece +1:]);_aab ._bce .Override =_aab ._bce .Override [0:len (_aab ._bce .Override )-1];
};return nil ;};
// Clear removes any existing relationships.
func (_dge Relationships )Clear (){_dge ._gac .Relationship =nil };
// X returns the inner wrapped XML type.
func (_ccd Theme )X ()*_acd .Theme {return _ccd ._fdbd };
// EnsureDefault esnures that an extension and default content type exist,
// adding it if necessary.
func (_agc ContentTypes )EnsureDefault (ext ,contentType string ){ext =_bb .ToLower (ext );for _ ,_cgc :=range _agc ._bce .Default {if _cgc .ExtensionAttr ==ext {_cgc .ContentTypeAttr =contentType ;return ;};};_bfa :=&_df .Default {};_bfa .ContentTypeAttr =contentType ;
_bfa .ExtensionAttr =ext ;_agc ._bce .Default =append (_agc ._bce .Default ,_bfa );};
// SetCompany sets the name of the company that created the document.
func (_fgb AppProperties )SetCompany (s string ){_fgb ._bgg .Company =&s };
// 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 (_fged Relationships )AddAutoRelationship (dt _bc .DocType ,src string ,idx int ,ctype string )Relationship {return _fged .AddRelationship (_bc .RelativeFilename (dt ,src ,ctype ,idx ),ctype );};
// Relationships represents a .rels file.
type Relationships struct{_gac *_efb .Relationships };
// Remove removes an existing relationship.
func (_ceda Relationships )Remove (rel Relationship )bool {for _gbc ,_acec :=range _ceda ._gac .Relationship {if _acec ==rel ._fcad {copy (_ceda ._gac .Relationship [_gbc :],_ceda ._gac .Relationship [_gbc +1:]);_ceda ._gac .Relationship =_ceda ._gac .Relationship [0:len (_ceda ._gac .Relationship )-1];
return true ;};};return false ;};
// Description returns the description of the document
func (_afe CoreProperties )Description ()string {if _afe ._bba .Description !=nil {return string (_afe ._bba .Description .Data );};return "";};