2020-08-23 14:15:53 +00:00
//
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/
// Package common contains wrapper types and utilities common to all of the
// OOXML document formats.
//
// Package common contains common properties used by the subpackages.
2021-09-22 16:41:01 +00:00
package common ; import ( _eg "archive/zip" ; _g "bytes" ; _fc "encoding/xml" ; _dg "errors" ; _af "fmt" ; _ea "github.com/unidoc/unioffice" ; _dd "github.com/unidoc/unioffice/common/tempstorage" ; _ec "github.com/unidoc/unioffice/common/tempstorage/diskstore" ; _afa "github.com/unidoc/unioffice/measurement" ; _cd "github.com/unidoc/unioffice/schema/soo/dml" ; _ef "github.com/unidoc/unioffice/schema/soo/ofc/custom_properties" ; _fd "github.com/unidoc/unioffice/schema/soo/ofc/docPropsVTypes" ; _cb "github.com/unidoc/unioffice/schema/soo/ofc/extended_properties" ; _ba "github.com/unidoc/unioffice/schema/soo/pkg/content_types" ; _gbd "github.com/unidoc/unioffice/schema/soo/pkg/metadata/core_properties" ; _gb "github.com/unidoc/unioffice/schema/soo/pkg/relationships" ; _ece "github.com/unidoc/unioffice/zippkg" ; _ee "image" ; _ "image/gif" ; _ "image/jpeg" ; _ "image/png" ; _e "os" ; _a "reflect" ; _bea "regexp" ; _ff "strconv" ; _ce "strings" ; _f "time" ; ) ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// Remove removes an existing relationship.
func ( _egf Relationships ) Remove ( rel Relationship ) bool { for _dde , _dacg := range _egf . _dag . Relationship { if _dacg == rel . _eadc { copy ( _egf . _dag . Relationship [ _dde : ] , _egf . _dag . Relationship [ _dde + 1 : ] ) ; _egf . _dag . Relationship = _egf . _dag . Relationship [ 0 : len ( _egf . _dag . Relationship ) - 1 ] ; return true ; } ; } ; return false ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// RemoveOverride removes an override given a path.
func ( _fbeg ContentTypes ) RemoveOverride ( path string ) { if ! _ce . HasPrefix ( path , "\u002f" ) { path = "\u002f" + path ; } ; for _dea , _ecbd := range _fbeg . _ccb . Override { if _ecbd . PartNameAttr == path { copy ( _fbeg . _ccb . Override [ _dea : ] , _fbeg . _ccb . Override [ _dea + 1 : ] ) ; _fbeg . _ccb . Override = _fbeg . _ccb . Override [ 0 : len ( _fbeg . _ccb . Override ) - 1 ] ; } ; } ; } ;
2020-08-23 14:15:53 +00:00
2021-08-23 20:44:48 +00:00
// 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.
2021-09-22 16:41:01 +00:00
func ( _ebdc ImageRef ) RelativeHeight ( w _afa . Distance ) _afa . Distance { _ace := float64 ( _ebdc . Size ( ) . Y ) / float64 ( _ebdc . Size ( ) . X ) ; return w * _afa . Distance ( _ace ) ; } ; func ( _eda CustomProperties ) SetPropertyAsLpstr ( name string , lpstr string ) { _ged := _eda . getNewProperty ( name ) ; _ged . Lpstr = & lpstr ; _eda . setOrReplaceProperty ( _ged ) ; } ; func ( _bbgc CustomProperties ) SetPropertyAsVstream ( name string , vstream * _fd . Vstream ) { _aae := _bbgc . getNewProperty ( name ) ; _aae . Vstream = vstream ; _bbgc . setOrReplaceProperty ( _aae ) ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// X returns the inner wrapped XML type.
func ( _ebg CoreProperties ) X ( ) * _gbd . CoreProperties { return _ebg . _eebg } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// SetTitle records the title of the document.
func ( _fge CoreProperties ) SetTitle ( s string ) { if _fge . _eebg . Title == nil { _fge . _eebg . Title = & _ea . XSDAny { XMLName : _fc . Name { Local : "\u0064\u0063\u003a\u0074\u0069\u0074\u006c\u0065" } } ; } ; _fge . _eebg . Title . Data = [ ] byte ( s ) ; } ; func ( _ebce CustomProperties ) SetPropertyAsI8 ( name string , i8 int64 ) { _bda := _ebce . getNewProperty ( name ) ; _bda . I8 = & i8 ; _ebce . setOrReplaceProperty ( _bda ) ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// AddImageToZip adds an image (either from bytes or from disk) and adds it to the zip file.
func AddImageToZip ( z * _eg . Writer , img ImageRef , imageNum int , dt _ea . DocType ) error { _eba := _ea . AbsoluteImageFilename ( dt , imageNum , _ce . ToLower ( img . Format ( ) ) ) ; if img . Data ( ) != nil && len ( * img . Data ( ) ) > 0 { if _ced := _ece . AddFileFromBytes ( z , _eba , * img . Data ( ) ) ; _ced != nil { return _ced ; } ; } else if img . Path ( ) != "" { if _fca := _ece . AddFileFromDisk ( z , _eba , img . Path ( ) ) ; _fca != nil { return _fca ; } ; } else { return _af . 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 ; } ; const _fcc = 9 ; func ( _geb Relationship ) String ( ) string { return _af . 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" , _geb . ID ( ) , _geb . Target ( ) , _geb . Type ( ) ) ; } ;
2020-08-23 14:15:53 +00:00
2021-08-23 20:44:48 +00:00
// X returns the inner wrapped XML type.
2021-09-22 16:41:01 +00:00
func ( _egfga TableStyles ) X ( ) * _cd . TblStyleLst { return _egfga . _bff } ;
2020-10-12 13:59:12 +00:00
2021-09-22 16:41:01 +00:00
// Category returns the category of the document
func ( _fafd CoreProperties ) Category ( ) string { if _fafd . _eebg . Category != nil { return * _fafd . _eebg . Category ; } ; return "" ; } ;
2020-10-12 13:59:12 +00:00
2021-09-22 16:41:01 +00:00
// Format returns the format of the underlying image
func ( _ccd ImageRef ) Format ( ) string { return _ccd . _beg . Format } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// ExtraFile is an unsupported file type extracted from, or to be written to a
// zip package
type ExtraFile struct { ZipPath string ; DiskPath string ; } ;
2020-08-31 22:58:25 +00:00
2021-09-22 16:41:01 +00:00
// SetOffsetY sets vertical offset of a table in distance units (see measurement package).
func ( _ggcg Table ) SetOffsetY ( offY float64 ) { if _ggcg . _fdgd . Off == nil { _ggcg . _fdgd . Off = _cd . NewCT_Point2D ( ) ; _dba := int64 ( 0 ) ; _ggcg . _fdgd . Off . XAttr = _cd . ST_Coordinate { ST_CoordinateUnqualified : & _dba } ; } ; _adcd := _afa . ToEMU ( offY ) ; _ggcg . _fdgd . Off . YAttr = _cd . ST_Coordinate { ST_CoordinateUnqualified : & _adcd } ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// NewTable makes a new table.
func NewTable ( ) * Table { _ddf := _cd . NewTbl ( ) ; _ddf . TblPr = _cd . NewCT_TableProperties ( ) ; return & Table { _efdb : _ddf } ; } ; const _fcce = 22 ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// RemoveOverrideByIndex removes an override given a path and override index.
func ( _ab ContentTypes ) RemoveOverrideByIndex ( path string , indexToFind int ) error { _ggc := path [ 0 : len ( path ) - 5 ] ; if ! _ce . HasPrefix ( _ggc , "\u002f" ) { _ggc = "\u002f" + _ggc ; } ; _adbf , _cbbg := _bea . Compile ( _ggc + "\u0028\u005b\u0030-\u0039\u005d\u002b\u0029\u002e\u0078\u006d\u006c" ) ; if _cbbg != nil { return _cbbg ; } ; _gca := 0 ; _efc := - 1 ; for _bba , _cac := range _ab . _ccb . Override { if _faf := _adbf . FindStringSubmatch ( _cac . PartNameAttr ) ; len ( _faf ) > 1 { if _gca == indexToFind { _efc = _bba ; } else if _gca > indexToFind { _gef , _ := _ff . Atoi ( _faf [ 1 ] ) ; _gef -- ; _cac . PartNameAttr = _af . Sprintf ( "\u0025\u0073\u0025\u0064\u002e\u0078\u006d\u006c" , _ggc , _gef ) ; } ; _gca ++ ; } ; } ; if _efc > - 1 { copy ( _ab . _ccb . Override [ _efc : ] , _ab . _ccb . Override [ _efc + 1 : ] ) ; _ab . _ccb . Override = _ab . _ccb . Override [ 0 : len ( _ab . _ccb . Override ) - 1 ] ; } ; return nil ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// Company returns the name of the company that created the document.
// For unioffice created documents, it defaults to github.com/unidoc/unioffice
func ( _egb AppProperties ) Company ( ) string { if _egb . _edc . Company != nil { return * _egb . _edc . Company ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// RelID returns the relationship ID.
func ( _ccc ImageRef ) RelID ( ) string { return _ccc . _ggea } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// WriteExtraFiles writes the extra files to the zip package.
func ( _aef * DocBase ) WriteExtraFiles ( z * _eg . Writer ) error { for _ , _egc := range _aef . ExtraFiles { if _caf := _ece . AddFileFromDisk ( z , _egc . ZipPath , _egc . DiskPath ) ; _caf != nil { return _caf ; } ; } ; return nil ; } ; func ( _bgc CustomProperties ) SetPropertyAsLpwstr ( name string , lpwstr string ) { _fee := _bgc . getNewProperty ( name ) ; _fee . Lpwstr = & lpwstr ; _bgc . setOrReplaceProperty ( _fee ) ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// Target returns the target (path) of a relationship.
func ( _gfgb Relationship ) Target ( ) string { return _gfgb . _eadc . TargetAttr } ;
2020-10-12 13:59:12 +00:00
2021-09-22 16:41:01 +00:00
// Type returns the type of a relationship.
func ( _ggcb Relationship ) Type ( ) string { return _ggcb . _eadc . TypeAttr } ;
2020-10-12 13:59:12 +00:00
2021-09-22 16:41:01 +00:00
// X returns the inner wrapped XML type.
func ( _gge CustomProperties ) X ( ) * _ef . Properties { return _gge . _afg } ;
2020-10-12 13:59:12 +00:00
2021-09-22 16:41:01 +00:00
// AddOverride adds an override content type for a given path name.
func ( _efba ContentTypes ) AddOverride ( path , contentType string ) { if ! _ce . HasPrefix ( path , "\u002f" ) { path = "\u002f" + path ; } ; if _ce . HasPrefix ( contentType , "\u0068\u0074\u0074\u0070" ) { _ea . Log ( "\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 _ , _adb := range _efba . _ccb . Override { if _adb . PartNameAttr == path && _adb . ContentTypeAttr == contentType { return ; } ; } ; _ggd := _ba . NewOverride ( ) ; _ggd . PartNameAttr = path ; _ggd . ContentTypeAttr = contentType ; _efba . _ccb . Override = append ( _efba . _ccb . Override , _ggd ) ; } ; func ( _ffg CustomProperties ) SetPropertyAsI1 ( name string , i1 int8 ) { _bd := _ffg . getNewProperty ( name ) ; _bd . I1 = & i1 ; _ffg . setOrReplaceProperty ( _bd ) ; } ;
2020-10-12 13:59:12 +00:00
2021-09-22 16:41:01 +00:00
// NewRelationship constructs a new relationship.
func NewRelationship ( ) Relationship { return Relationship { _eadc : _gb . NewRelationship ( ) } } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// AppProperties contains properties specific to the document and the
// application that created it.
type AppProperties struct { _edc * _cb . Properties } ;
2020-08-23 14:15:53 +00:00
2021-08-23 20:44:48 +00:00
// TableRow represents a row in a table.
2021-09-22 16:41:01 +00:00
type TableRow struct { _ebda * _cd . CT_TableRow } ;
2021-08-23 20:44:48 +00:00
2021-09-22 16:41:01 +00:00
// EnsureOverride ensures that an override for the given path exists, adding it if necessary
func ( _agfb ContentTypes ) EnsureOverride ( path , contentType string ) { for _ , _dab := range _agfb . _ccb . Override { if _dab . PartNameAttr == path { if _ce . HasPrefix ( contentType , "\u0068\u0074\u0074\u0070" ) { _ea . Log ( "\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 ) ; } ; _dab . ContentTypeAttr = contentType ; return ; } ; } ; _agfb . AddOverride ( path , contentType ) ; } ; const _bgg = 15 ; func ( _aag CustomProperties ) SetPropertyAsCy ( name string , cy string ) { _dfg := _aag . getNewProperty ( name ) ; _dfg . Cy = & cy ; _aag . setOrReplaceProperty ( _dfg ) ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// SetContentStatus records the content status of the document.
func ( _ffa CoreProperties ) SetContentStatus ( s string ) { _ffa . _eebg . ContentStatus = & s } ;
2021-07-30 17:03:26 +00:00
2021-09-22 16:41:01 +00:00
// DefAttr returns the DefAttr property.
func ( _ege TableStyles ) DefAttr ( ) string { return _ege . _bff . DefAttr } ; func ( _dgf CustomProperties ) SetPropertyAsUint ( name string , ui uint ) { _adgf := _dgf . getNewProperty ( name ) ; _ebcd := uint32 ( ui ) ; _adgf . Uint = & _ebcd ; _dgf . setOrReplaceProperty ( _adgf ) ; } ;
2021-07-30 17:03:26 +00:00
2021-09-22 16:41:01 +00:00
// SetLanguage records the language of the document.
func ( _fbd CoreProperties ) SetLanguage ( s string ) { _fbd . _eebg . Language = & _ea . XSDAny { XMLName : _fc . Name { Local : "d\u0063\u003a\u006c\u0061\u006e\u0067\u0075\u0061\u0067\u0065" } } ; _fbd . _eebg . Language . Data = [ ] byte ( s ) ; } ; const Version = "\u0031\u002e\u0031\u0035\u002e\u0030" ;
2021-07-30 17:03:26 +00:00
2021-09-22 16:41:01 +00:00
// Path returns the path to an image file, if any.
func ( _fec ImageRef ) Path ( ) string { return _fec . _beg . Path } ;
2021-07-30 17:03:26 +00:00
2021-09-22 16:41:01 +00:00
// CreateCustomProperties creates the custom properties of the document.
func ( _fef * DocBase ) CreateCustomProperties ( ) { _fef . CustomProperties = NewCustomProperties ( ) ; _fef . AddCustomRelationships ( ) ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// 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 ) { _bgd := Image { } ; _cff , _badb , _aced := _ee . Decode ( _g . NewReader ( data ) ) ; if _aced != nil { return _bgd , _af . Errorf ( "\u0075n\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0070\u0061r\u0073e\u0020i\u006d\u0061\u0067\u0065\u003a\u0020\u0025s" , _aced ) ; } ; _bgd . Data = & data ; _bgd . Format = _badb ; _bgd . Size = _cff . Bounds ( ) . Size ( ) ; return _bgd , nil ; } ; func ( _ffab CustomProperties ) SetPropertyAsEmpty ( name string ) { _abg := _ffab . getNewProperty ( name ) ; _abg . Empty = _fd . NewEmpty ( ) ; _ffab . setOrReplaceProperty ( _abg ) ; } ; func ( _ebd CustomProperties ) SetPropertyAsOstorage ( name string , ostorage string ) { _ecd := _ebd . getNewProperty ( name ) ; _ecd . Ostorage = & ostorage ; _ebd . setOrReplaceProperty ( _ecd ) ; } ; var ReleasedAt = _f . Date ( _efab , _fcc , _fcce , _bgg , _eggb , 0 , 0 , _f . UTC ) ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// GetImageBytesByTarget returns Image object with Data bytes read from its target.
func ( _cdb * DocBase ) GetImageBytesByTarget ( target string ) ( Image , error ) { if target != "" { target = "\u0077\u006f\u0072d\u002f" + target ; for _ , _efae := range _cdb . Images { if _efae . Target ( ) == target { return ImageFromStorage ( _efae . Path ( ) ) ; } ; } ; } ; return Image { } , _bcca ; } ;
// Relationship is a relationship within a .rels file.
type Relationship struct { _eadc * _gb . Relationship } ;
2020-08-23 14:15:53 +00:00
2021-08-23 20:44:48 +00:00
// EnsureDefault esnures that an extension and default content type exist,
// adding it if necessary.
2021-09-22 16:41:01 +00:00
func ( _eebb ContentTypes ) EnsureDefault ( ext , contentType string ) { ext = _ce . ToLower ( ext ) ; for _ , _fbe := range _eebb . _ccb . Default { if _fbe . ExtensionAttr == ext { _fbe . ContentTypeAttr = contentType ; return ; } ; } ; _aff := & _ba . Default { } ; _aff . ContentTypeAttr = contentType ; _aff . ExtensionAttr = ext ; _eebb . _ccb . Default = append ( _eebb . _ccb . Default , _aff ) ; } ; const _aec = "\u0032\u0020\u004aan\u0075\u0061\u0072\u0079\u0020\u0032\u0030\u0030\u0036\u0020\u0061\u0074\u0020\u0031\u0035\u003a\u0030\u0034" ;
2020-10-12 13:59:12 +00:00
2021-09-22 16:41:01 +00:00
// NewRelationshipsCopy creates a new relationships wrapper as a copy of passed in instance.
func NewRelationshipsCopy ( rels Relationships ) Relationships { _adf := * rels . _dag ; return Relationships { _dag : & _adf } ; } ;
2020-10-12 13:59:12 +00:00
2021-09-22 16:41:01 +00:00
// PropertiesList returns the list of all custom properties of the document.
func ( _gfe CustomProperties ) PropertiesList ( ) [ ] * _ef . CT_Property { return _gfe . _afg . Property } ; func ( _dgcf CustomProperties ) SetPropertyAsBstr ( name string , bstr string ) { _cbd := _dgcf . getNewProperty ( name ) ; _cbd . Bstr = & bstr ; _dgcf . setOrReplaceProperty ( _cbd ) ; } ;
2020-10-12 13:59:12 +00:00
2021-09-22 16:41:01 +00:00
// SetLinksUpToDate sets the links up to date flag.
func ( _bfe AppProperties ) SetLinksUpToDate ( v bool ) { _bfe . _edc . LinksUpToDate = _ea . Bool ( v ) } ; func ( _cge CustomProperties ) SetPropertyAsDecimal ( name string , decimal float64 ) { _gea := _cge . getNewProperty ( name ) ; _gea . Decimal = & decimal ; _cge . setOrReplaceProperty ( _gea ) ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// Modified returns the time that the document was modified.
func ( _eed CoreProperties ) Modified ( ) _f . Time { return _cg ( _eed . _eebg . Modified ) } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// GetOrCreateCustomProperties returns the custom properties of the document (and if they not exist yet, creating them first).
func ( _fbegd * DocBase ) GetOrCreateCustomProperties ( ) CustomProperties { if _fbegd . CustomProperties . X ( ) == nil { _fbegd . CreateCustomProperties ( ) ; } ; return _fbegd . CustomProperties ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// 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 _ee . Point ; Format string ; Path string ; Data * [ ] byte ; } ; func ( _agb CustomProperties ) SetPropertyAsUi2 ( name string , ui2 uint16 ) { _fad := _agb . getNewProperty ( name ) ; _fad . Ui2 = & ui2 ; _agb . setOrReplaceProperty ( _fad ) ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// TableStyles contains document specific properties.
type TableStyles struct { _bff * _cd . TblStyleLst } ; func ( _bbad CustomProperties ) SetPropertyAsOstream ( name string , ostream string ) { _ggf := _bbad . getNewProperty ( name ) ; _ggf . Ostream = & ostream ; _bbad . setOrReplaceProperty ( _ggf ) ; } ;
2021-03-16 20:51:18 +00:00
2021-09-22 16:41:01 +00:00
// 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 ( _gffc Relationships ) AddAutoRelationship ( dt _ea . DocType , src string , idx int , ctype string ) Relationship { return _gffc . AddRelationship ( _ea . RelativeFilename ( dt , src , ctype , idx ) , ctype ) ; } ;
2020-11-09 01:00:18 +00:00
2021-09-22 16:41:01 +00:00
// NewAppProperties constructs a new AppProperties.
func NewAppProperties ( ) AppProperties { _da := AppProperties { _edc : _cb . NewProperties ( ) } ; _da . SetCompany ( "\u0046\u006f\u0078\u0079\u0055\u0074\u0069\u006c\u0073\u0020\u0065\u0068\u0066" ) ; _da . SetApplication ( "g\u0069\u0074\u0068\u0075\u0062\u002ec\u006f\u006d\u002f\u0075\u006e\u0069\u0064\u006f\u0063/\u0075\u006e\u0069o\u0066f\u0069\u0063\u0065" ) ; _da . SetDocSecurity ( 0 ) ; _da . SetLinksUpToDate ( false ) ; var _ca , _bee , _bcb int64 ; _af . Sscanf ( Version , "\u0025\u0064\u002e\u0025\u0064\u002e\u0025\u0064" , & _ca , & _bee , & _bcb ) ; _cdc := float64 ( _ca ) + float64 ( _bee ) / 10000.0 ; _da . SetApplicationVersion ( _af . Sprintf ( "\u0025\u0030\u0037\u002e\u0034\u0066" , _cdc ) ) ; return _da ; } ; func ( _ae CustomProperties ) SetPropertyAsBool ( name string , b bool ) { _afba := _ae . getNewProperty ( name ) ; _afba . Bool = & b ; _ae . setOrReplaceProperty ( _afba ) ; } ;
2021-08-23 20:44:48 +00:00
2021-09-22 16:41:01 +00:00
// Title returns the Title of the document
func ( _aba CoreProperties ) Title ( ) string { if _aba . _eebg . Title != nil { return string ( _aba . _eebg . Title . Data ) ; } ; return "" ; } ; func ( _dbb CustomProperties ) getNewProperty ( _daa string ) * _ef . CT_Property { _bge := _dbb . _afg . Property ; _dfd := int32 ( 1 ) ; for _ , _gaab := range _bge { if _gaab . PidAttr > _dfd { _dfd = _gaab . PidAttr ; } ; } ; _abab := _ef . NewCT_Property ( ) ; _abab . NameAttr = & _daa ; _abab . PidAttr = _dfd + 1 ; _abab . 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 _abab ; } ; func ( _bccc CustomProperties ) SetPropertyAsOblob ( name , oblob string ) { _bce := _bccc . getNewProperty ( name ) ; _bce . Oblob = & oblob ; _bccc . setOrReplaceProperty ( _bce ) ; } ;
2021-08-23 20:44:48 +00:00
2021-09-22 16:41:01 +00:00
// AddRelationship adds a relationship.
func ( _adbc Relationships ) AddRelationship ( target , ctype string ) Relationship { if ! _ce . HasPrefix ( ctype , "\u0068t\u0074\u0070\u003a\u002f\u002f" ) { _ea . Log ( "\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 ) ; } ; _babb := _gb . NewRelationship ( ) ; _eaaa := len ( _adbc . _dag . Relationship ) + 1 ; _bbd := map [ string ] struct { } { } ; for _ , _aed := range _adbc . _dag . Relationship { _bbd [ _aed . IdAttr ] = struct { } { } ; } ; for _ , _ffgg := _bbd [ _af . Sprintf ( "\u0072\u0049\u0064%\u0064" , _eaaa ) ] ; _ffgg ; _ , _ffgg = _bbd [ _af . Sprintf ( "\u0072\u0049\u0064%\u0064" , _eaaa ) ] { _eaaa ++ ; } ; _babb . IdAttr = _af . Sprintf ( "\u0072\u0049\u0064%\u0064" , _eaaa ) ; _babb . TargetAttr = target ; _babb . TypeAttr = ctype ; _adbc . _dag . Relationship = append ( _adbc . _dag . Relationship , _babb ) ; return Relationship { _eadc : _babb } ; } ; func ( _eaf CustomProperties ) SetPropertyAsUi4 ( name string , ui4 uint32 ) { _eeec := _eaf . getNewProperty ( name ) ; _eeec . Ui4 = & ui4 ; _eaf . setOrReplaceProperty ( _eeec ) ; } ; func ( _abf CustomProperties ) SetPropertyAsFiletime ( name string , filetime _f . Time ) { _efe := _abf . getNewProperty ( name ) ; _efe . Filetime = & filetime ; _abf . setOrReplaceProperty ( _efe ) ; } ; func ( _ebb CustomProperties ) setOrReplaceProperty ( _adbd * _ef . CT_Property ) { _ebb . setPropertyHelper ( _adbd , true ) ; } ;
2020-11-09 01:00:18 +00:00
2021-09-22 16:41:01 +00:00
// Relationships returns a slice of all of the relationships.
func ( _bbb Relationships ) Relationships ( ) [ ] Relationship { _ggb := [ ] Relationship { } ; for _ , _aedg := range _bbb . _dag . Relationship { _ggb = append ( _ggb , Relationship { _eadc : _aedg } ) ; } ; return _ggb ; } ;
2020-11-09 01:00:18 +00:00
2021-09-22 16:41:01 +00:00
// ContentStatus returns the content status of the document (e.g. "Final", "Draft")
func ( _fg CoreProperties ) ContentStatus ( ) string { if _fg . _eebg . ContentStatus != nil { return * _fg . _eebg . ContentStatus ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// SetCompany sets the name of the company that created the document.
func ( _egd AppProperties ) SetCompany ( s string ) { _egd . _edc . Company = & s } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// NewTableWithXfrm makes a new table with a pointer to its parent Xfrm for changing its offset and size.
func NewTableWithXfrm ( xfrm * _cd . CT_Transform2D ) * Table { _aagg := _cd . NewTbl ( ) ; _aagg . TblPr = _cd . NewCT_TableProperties ( ) ; return & Table { _efdb : _aagg , _fdgd : xfrm } ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// SetCategory records the category of the document.
func ( _cbbf CoreProperties ) SetCategory ( s string ) { _cbbf . _eebg . Category = & s } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// Table represents a table in the document.
type Table struct { _efdb * _cd . Tbl ; _fdgd * _cd . CT_Transform2D ; } ;
2021-07-30 17:03:26 +00:00
2021-09-22 16:41:01 +00:00
// X returns the inner raw content types.
func ( _dbdf ContentTypes ) X ( ) * _ba . Types { return _dbdf . _ccb } ;
2021-05-31 16:22:30 +00:00
2021-09-22 16:41:01 +00:00
// AddRow adds a row to a table.
func ( _afef Table ) AddRow ( ) * TableRow { _agbe := _cd . NewCT_TableRow ( ) ; for _dbfe := 0 ; _dbfe < len ( _afef . _efdb . TblGrid . GridCol ) ; _dbfe ++ { _agbe . Tc = append ( _agbe . Tc , _cd . NewCT_TableCell ( ) ) ; } ; _afef . _efdb . Tr = append ( _afef . _efdb . Tr , _agbe ) ; return & TableRow { _ebda : _agbe } ; } ;
// SetAuthor records the author of the document.
func ( _bad CoreProperties ) SetAuthor ( s string ) { if _bad . _eebg . Creator == nil { _bad . _eebg . Creator = & _ea . XSDAny { XMLName : _fc . Name { Local : "\u0064\u0063\u003a\u0063\u0072\u0065\u0061\u0074\u006f\u0072" } } ; } ; _bad . _eebg . Creator . Data = [ ] byte ( s ) ; } ;
// X returns the underlying raw XML data.
func ( _fgc Relationships ) X ( ) * _gb . Relationships { return _fgc . _dag } ;
// SetLastModifiedBy records the last person to modify the document.
func ( _aa CoreProperties ) SetLastModifiedBy ( s string ) { _aa . _eebg . LastModifiedBy = & s } ;
// Cells returns an array of row cells.
func ( _eec TableRow ) Cells ( ) [ ] * _cd . CT_TableCell { return _eec . _ebda . Tc } ;
2021-05-31 16:22:30 +00:00
2021-08-23 20:44:48 +00:00
// SetDocSecurity sets the document security flag.
2021-09-22 16:41:01 +00:00
func ( _efa AppProperties ) SetDocSecurity ( v int32 ) { _efa . _edc . DocSecurity = _ea . Int32 ( v ) } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// SetDescription records the description of the document.
func ( _eggf CoreProperties ) SetDescription ( s string ) { if _eggf . _eebg . Description == nil { _eggf . _eebg . Description = & _ea . XSDAny { XMLName : _fc . Name { Local : "\u0064\u0063\u003a\u0064\u0065\u0073\u0063\u0072\u0069p\u0074\u0069\u006f\u006e" } } ; } ; _eggf . _eebg . Description . Data = [ ] byte ( s ) ; } ; func ( _afea * ImageRef ) SetRelID ( id string ) { _afea . _ggea = id } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// CustomProperty contains document specific property.
// Using of this type is deprecated.
type CustomProperty struct { _faff * _ef . CT_Property } ; func ( _fga CustomProperties ) SetPropertyAsBlob ( name , blob string ) { _adc := _fga . getNewProperty ( name ) ; _adc . Blob = & blob ; _fga . setOrReplaceProperty ( _adc ) ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// GetTargetByRelId returns a target path with the associated relation ID.
func ( _fbae Relationships ) GetTargetByRelId ( idAttr string ) string { for _ , _cgbe := range _fbae . _dag . Relationship { if _cgbe . IdAttr == idAttr { return _cgbe . TargetAttr ; } ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// AddCustomRelationships adds relationships related to custom properties to the document.
func ( _ffe * DocBase ) AddCustomRelationships ( ) { _ffe . 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" ) ; _ffe . Rels . AddRelationship ( "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" , _ea . CustomPropertiesType ) ; } ; func ( _cfb CustomProperties ) SetPropertyAsR8 ( name string , r8 float64 ) { _cfg := _cfb . getNewProperty ( name ) ; _cfg . R8 = & r8 ; _cfb . setOrReplaceProperty ( _cfg ) ; } ; func ( _dfc CustomProperties ) SetPropertyAsArray ( name string , array * _fd . Array ) { _dac := _dfc . getNewProperty ( name ) ; _dac . Array = array ; _dfc . setOrReplaceProperty ( _dac ) ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// SetApplication sets the name of the application that created the document.
func ( _bcc AppProperties ) SetApplication ( s string ) { _bcc . _edc . Application = & s } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// CopyRelationship copies the relationship.
func ( _dfa Relationships ) CopyRelationship ( idAttr string ) ( Relationship , bool ) { for _acd := range _dfa . _dag . Relationship { if _dfa . _dag . Relationship [ _acd ] . IdAttr == idAttr { _gcb := * _dfa . _dag . Relationship [ _acd ] ; _gcg := len ( _dfa . _dag . Relationship ) + 1 ; _fadd := map [ string ] struct { } { } ; for _ , _gde := range _dfa . _dag . Relationship { _fadd [ _gde . IdAttr ] = struct { } { } ; } ; for _ , _dbdfg := _fadd [ _af . Sprintf ( "\u0072\u0049\u0064%\u0064" , _gcg ) ] ; _dbdfg ; _ , _dbdfg = _fadd [ _af . Sprintf ( "\u0072\u0049\u0064%\u0064" , _gcg ) ] { _gcg ++ ; } ; _gcb . IdAttr = _af . Sprintf ( "\u0072\u0049\u0064%\u0064" , _gcg ) ; _dfa . _dag . Relationship = append ( _dfa . _dag . Relationship , & _gcb ) ; return Relationship { _eadc : & _gcb } , true ; } ; } ; return Relationship { } , false ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// GetPropertyByName returns a custom property selected by it's name.
func ( _bab CustomProperties ) GetPropertyByName ( name string ) CustomProperty { _def := _bab . _afg . Property ; for _ , _cgf := range _def { if * _cgf . NameAttr == name { return CustomProperty { _faff : _cgf } ; } ; } ; return CustomProperty { } ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// Size returns the size of an image
func ( _efd ImageRef ) Size ( ) _ee . Point { return _efd . _beg . Size } ;
2020-08-23 14:15:53 +00:00
2021-08-23 20:44:48 +00:00
// ID returns the ID of a relationship.
2021-09-22 16:41:01 +00:00
func ( _bafe Relationship ) ID ( ) string { return _bafe . _eadc . IdAttr } ; func ( _agg CustomProperties ) SetPropertyAsInt ( name string , i int ) { _bead := _agg . getNewProperty ( name ) ; _fdf := int32 ( i ) ; _bead . Int = & _fdf ; _agg . setOrReplaceProperty ( _bead ) ; } ;
2020-10-12 13:59:12 +00:00
2021-09-22 16:41:01 +00:00
// 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 ) { _agc := Image { } ; _bfaf , _ebe := _dd . Open ( path ) ; if _ebe != nil { return _agc , _af . Errorf ( "\u0065\u0072\u0072or\u0020\u0072\u0065\u0061\u0064\u0069\u006e\u0067\u0020\u0069\u006d\u0061\u0067\u0065\u003a\u0020\u0025\u0073" , _ebe ) ; } ; defer _bfaf . Close ( ) ; _ebf , _gae , _ebe := _ee . Decode ( _bfaf ) ; if _ebe != nil { return _agc , _af . Errorf ( "\u0075n\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0070\u0061r\u0073e\u0020i\u006d\u0061\u0067\u0065\u003a\u0020\u0025s" , _ebe ) ; } ; _agc . Path = path ; _agc . Format = _gae ; _agc . Size = _ebf . Bounds ( ) . Size ( ) ; return _agc , nil ; } ;
2021-07-30 17:03:26 +00:00
2021-09-22 16:41:01 +00:00
// SetApplicationVersion sets the version of the application that created the
// document. Per MS, the verison string mut be in the form 'XX.YYYY'.
func ( _df AppProperties ) SetApplicationVersion ( s string ) { _df . _edc . AppVersion = & s } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// NewRelationships creates a new relationship wrapper.
func NewRelationships ( ) Relationships { return Relationships { _dag : _gb . NewRelationships ( ) } } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// Append appends DocBase part of an office document to another DocBase.
func ( _cc DocBase ) Append ( docBase1 DocBase ) DocBase { _de := docBase1 . ContentTypes . X ( ) ; for _ , _db := range _de . Default { _cc . ContentTypes . AddDefault ( _db . ExtensionAttr , _db . ContentTypeAttr ) ; } ; for _ , _eb := range _de . Override { _cc . ContentTypes . AddOverride ( _eb . PartNameAttr , _eb . ContentTypeAttr ) ; } ; _eee := _cc . AppProperties . X ( ) ; _gf := docBase1 . AppProperties . X ( ) ; if _eee . Pages != nil { if _gf . Pages != nil { * _eee . Pages += * _gf . Pages ; } ; } else if _gf . Pages != nil { _eee . Pages = _gf . Pages ; } ; if _eee . Words != nil { if _gf . Words != nil { * _eee . Words += * _gf . Words ; } ; } else if _gf . Words != nil { _eee . Words = _gf . Words ; } ; if _eee . Characters != nil { if _gf . Characters != nil { * _eee . Characters += * _gf . Characters ; } ; } else if _gf . Characters != nil { _eee . Characters = _gf . Characters ; } ; if _eee . Lines != nil { if _gf . Lines != nil { * _eee . Lines += * _gf . Lines ; } ; } else if _gf . Lines != nil { _eee . Lines = _gf . Lines ; } ; if _eee . Paragraphs != nil { if _gf . Paragraphs != nil { * _eee . Paragraphs += * _gf . Paragraphs ; } ; } else if _gf . Paragraphs != nil { _eee . Paragraphs = _gf . Paragraphs ; } ; if _eee . Notes != nil { if _gf . Notes != nil { * _eee . Notes += * _gf . Notes ; } ; } else if _gf . Notes != nil { _eee . Notes = _gf . Notes ; } ; if _eee . HiddenSlides != nil { if _gf . HiddenSlides != nil { * _eee . HiddenSlides += * _gf . HiddenSlides ; } ; } else if _gf . HiddenSlides != nil { _eee . HiddenSlides = _gf . HiddenSlides ; } ; if _eee . MMClips != nil { if _gf . MMClips != nil { * _eee . MMClips += * _gf . MMClips ; } ; } else if _gf . MMClips != nil { _eee . MMClips = _gf . MMClips ; } ; if _eee . LinksUpToDate != nil { if _gf . LinksUpToDate != nil { * _eee . LinksUpToDate = * _eee . LinksUpToDate && * _gf . LinksUpToDate ; } ; } else if _gf . LinksUpToDate != nil { _eee . LinksUpToDate = _gf . LinksUpToDate ; } ; if _eee . CharactersWithSpaces != nil { if _gf . CharactersWithSpaces != nil { * _eee . CharactersWithSpaces += * _gf . CharactersWithSpaces ; } ; } else if _gf . CharactersWithSpaces != nil { _eee . CharactersWithSpaces = _gf . CharactersWithSpaces ; } ; if _eee . SharedDoc != nil { if _gf . SharedDoc != nil { * _eee . SharedDoc = * _eee . SharedDoc || * _gf . SharedDoc ; } ; } else if _gf . SharedDoc != nil { _eee . SharedDoc = _gf . SharedDoc ; } ; if _eee . HyperlinksChanged != nil { if _gf . HyperlinksChanged != nil { * _eee . HyperlinksChanged = * _eee . HyperlinksChanged || * _gf . HyperlinksChanged ; } ; } else if _gf . HyperlinksChanged != nil { _eee . HyperlinksChanged = _gf . HyperlinksChanged ; } ; _eee . DigSig = nil ; if _eee . TitlesOfParts == nil && _gf . TitlesOfParts != nil { _eee . TitlesOfParts = _gf . TitlesOfParts ; } ; if _eee . HeadingPairs != nil { if _gf . HeadingPairs != nil { _ag := _eee . HeadingPairs . Vector ; _bf := _gf . HeadingPairs . Vector ; _fa := _ag . Variant ; _egg := _bf . Variant ; _ed := [ ] * _fd . Variant { } ; for _fcg := 0 ; _fcg < len ( _egg ) ; _fcg += 2 { _bfa := _egg [ _fcg ] . Lpstr ; _cbb := false ; for _ega := 0 ; _ega < len ( _fa ) ; _ega += 2 { _fe := _fa [ _ega ] . Lpstr ; if _fe != nil && _bfa != nil && * _fe == * _bfa { * _fa [ _ega + 1 ] . I4 = * _fa [ _ega + 1 ] . I4 + * _egg [ _fcg + 1 ] . I4 ; _cbb = true ; break ; } ; } ; if ! _cbb { _ed = append ( _ed , & _fd . Variant { CT_Variant : _fd . CT_Variant { Lpstr : _egg [ _fcg ] . Lpstr } } ) ; _ed = append ( _ed , & _fd . Variant { CT_Variant : _fd . CT_Variant { I4 : _egg [ _fcg ] . I4 } } ) ; } ; } ; _fa = append ( _fa , _ed ... ) ; _ag . SizeAttr = uint32 ( len ( _fa ) ) ; } ; } else if _gf . HeadingPairs != nil { _eee . HeadingPairs = _gf . HeadingPairs ; } ; if _eee . HLinks != nil { if _gf . HLinks != nil { _gc := _eee . HLinks . Vector ; _ded := _gf . HLinks . Vector ; _ead := _gc . Variant ; _dgg := _ded . Variant ; for _ , _ecb := range _dgg { _bc := true ; for _ , _dgc := range _ead { if _a . DeepEqual ( _dgc , _ecb ) { _bc = false ; break ; } ; } ; if _bc { _ead = append ( _ead , _ecb ) ; _gc . SizeAttr ++ ; } ; } ; } ; } else if _gf . HLinks != nil { _eee . HLinks = _gf . HLinks ; } ; _ge := _cc . GetOrCreateCustomProperties ( ) ; _eeb := docBase1 . GetOrCreateCustomProperties ( ) ; for _ , _agf := range _eeb . PropertiesList ( ) { _ge . setProperty ( _agf ) ; } ; _cc . CustomProperties = _ge ; _dbd := _cc . Rels . X ( ) . Relationship ; for _ , _gcc := range docBase1 . Rels . X ( ) . Relationship { _ede := true ; for _ , _gec := range _dbd { if _gec . TargetAttr == _gcc . TargetAttr && _gec . TypeAttr == _gcc . TypeAttr { _ede = false ; break ; } ; } ; if _ede { _cc . Rels
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// X returns the inner wrapped XML type.
func ( _dcb Relationship ) X ( ) * _gb . Relationship { return _dcb . _eadc } ; func ( _adda CustomProperties ) SetPropertyAsR4 ( name string , r4 float32 ) { _ddd := _adda . getNewProperty ( name ) ; _ddd . R4 = & r4 ; _adda . setOrReplaceProperty ( _ddd ) ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// Description returns the description of the document
func ( _bg CoreProperties ) Description ( ) string { if _bg . _eebg . Description != nil { return string ( _bg . _eebg . Description . Data ) ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// SetModified sets the time that the document was modified.
func ( _dc CoreProperties ) SetModified ( t _f . Time ) { _dc . _eebg . Modified = _gefd ( t , "\u0064\u0063t\u0065\u0072\u006ds\u003a\u006d\u006f\u0064\u0069\u0066\u0069\u0065\u0064" ) ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// 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 ( _dgd AppProperties ) Pages ( ) int32 { if _dgd . _edc . Pages != nil { return * _dgd . _edc . Pages ; } ; return 0 ; } ;
2021-06-16 07:10:52 +00:00
2021-09-22 16:41:01 +00:00
// AddHyperlink adds an external hyperlink relationship.
func ( _bga Relationships ) AddHyperlink ( target string ) Hyperlink { _ceg := _bga . AddRelationship ( target , _ea . HyperLinkType ) ; _ceg . _eadc . TargetModeAttr = _gb . ST_TargetModeExternal ; return Hyperlink ( _ceg ) ; } ; func _gefd ( _afe _f . Time , _edee string ) * _ea . XSDAny { _add := & _ea . XSDAny { XMLName : _fc . Name { Local : _edee } } ; _add . Attrs = append ( _add . Attrs , _fc . Attr { Name : _fc . Name { Local : "\u0078\u0073\u0069\u003a\u0074\u0079\u0070\u0065" } , Value : "\u0064\u0063\u0074\u0065\u0072\u006d\u0073\u003a\u00573\u0043\u0044\u0054\u0046" } ) ; _add . Attrs = append ( _add . Attrs , _fc . Attr { Name : _fc . 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" } ) ; _add . Attrs = append ( _add . Attrs , _fc . Attr { Name : _fc . 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/" } ) ; _add . Data = [ ] byte ( _afe . Format ( _agfd ) ) ; return _add ; } ;
2021-06-16 07:10:52 +00:00
2021-09-22 16:41:01 +00:00
// AddDefault registers a default content type for a given file extension.
func ( _gfd ContentTypes ) AddDefault ( fileExtension string , contentType string ) { fileExtension = _ce . ToLower ( fileExtension ) ; for _ , _fea := range _gfd . _ccb . Default { if _fea . ExtensionAttr == fileExtension && _fea . ContentTypeAttr == contentType { return ; } ; } ; _ac := _ba . NewDefault ( ) ; _ac . ExtensionAttr = fileExtension ; _ac . ContentTypeAttr = contentType ; _gfd . _ccb . Default = append ( _gfd . _ccb . Default , _ac ) ; } ;
2021-06-16 07:10:52 +00:00
2021-09-22 16:41:01 +00:00
// Theme is a drawingml theme.
type Theme struct { _dge * _cd . Theme } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// CustomProperties contains document specific properties.
type CustomProperties struct { _afg * _ef . Properties } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// Relationships represents a .rels file.
type Relationships struct { _dag * _gb . Relationships } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// 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 ) { _cgc , _fabc := _e . Open ( path ) ; _fdg := Image { } ; if _fabc != nil { return _fdg , _af . Errorf ( "\u0065\u0072\u0072or\u0020\u0072\u0065\u0061\u0064\u0069\u006e\u0067\u0020\u0069\u006d\u0061\u0067\u0065\u003a\u0020\u0025\u0073" , _fabc ) ; } ; defer _cgc . Close ( ) ; _cgb , _dda , _fabc := _ee . Decode ( _cgc ) ; if _fabc != nil { return _fdg , _af . Errorf ( "\u0075n\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0070\u0061r\u0073e\u0020i\u006d\u0061\u0067\u0065\u003a\u0020\u0025s" , _fabc ) ; } ; _fdg . Path = path ; _fdg . Format = _dda ; _fdg . Size = _cgb . Bounds ( ) . Size ( ) ; return _fdg , nil ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// 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 ( _gcag * DocBase ) AddExtraFileFromZip ( f * _eg . File ) error { _gfg , _gff := _ece . ExtractToDiskTmp ( f , _gcag . TmpPath ) ; if _gff != nil { return _af . 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" , _gff ) ; } ; _gcag . ExtraFiles = append ( _gcag . ExtraFiles , ExtraFile { ZipPath : f . Name , DiskPath : _gfg } ) ; return nil ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// LastModifiedBy returns the name of the last person to modify the document
func ( _gaf CoreProperties ) LastModifiedBy ( ) string { if _gaf . _eebg . LastModifiedBy != nil { return * _gaf . _eebg . LastModifiedBy ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// X returns the inner wrapped XML type.
func ( _dbda AppProperties ) X ( ) * _cb . Properties { return _dbda . _edc } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// X returns the inner wrapped XML type.
func ( _acfa Theme ) X ( ) * _cd . Theme { return _acfa . _dge } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// Rows returns all table rows.
func ( _dbef Table ) Rows ( ) [ ] * TableRow { _dgcb := _dbef . _efdb . Tr ; _cfe := [ ] * TableRow { } ; for _ , _egbd := range _dgcb { _cfe = append ( _cfe , & TableRow { _ebda : _egbd } ) ; } ; return _cfe ; } ;
2020-08-23 14:15:53 +00:00
2021-08-23 20:44:48 +00:00
// NewCustomProperties constructs a new CustomProperties.
2021-09-22 16:41:01 +00:00
func NewCustomProperties ( ) CustomProperties { return CustomProperties { _afg : _ef . NewProperties ( ) } } ; const _eggb = 30 ;
2021-04-23 20:00:00 +00:00
2021-09-22 16:41:01 +00:00
// 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 _ee . Image ; Images [ ] ImageRef ; ExtraFiles [ ] ExtraFile ; TmpPath string ; } ;
2021-04-23 20:00:00 +00:00
2021-09-22 16:41:01 +00:00
// Target returns the target attrubute of the image reference (a path where the image file is located in the document structure).
func ( _fgb * ImageRef ) Target ( ) string { return _fgb . _dcc } ; func ( _egbe TableRow ) addCell ( ) * _cd . CT_TableCell { _daae := _cd . NewCT_TableCell ( ) ; _egbe . _ebda . Tc = append ( _egbe . _ebda . Tc , _daae ) ; return _daae ; } ; func ( _ceb CustomProperties ) SetPropertyAsVector ( name string , vector * _fd . Vector ) { _eggfa := _ceb . getNewProperty ( name ) ; _eggfa . Vector = vector ; _ceb . setOrReplaceProperty ( _eggfa ) ; } ; func ( _dff CustomProperties ) SetPropertyAsUi1 ( name string , ui1 uint8 ) { _gee := _dff . getNewProperty ( name ) ; _gee . Ui1 = & ui1 ; _dff . setOrReplaceProperty ( _gee ) ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// IsEmpty returns true if there are no relationships.
func ( _aeb Relationships ) IsEmpty ( ) bool { return _aeb . _dag == nil || len ( _aeb . _dag . Relationship ) == 0 } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// ImageRef is a reference to an image within a document.
type ImageRef struct { _dfcg * DocBase ; _gfb Relationships ; _beg Image ; _ggea string ; _dcc string ; } ; func ( _adg CustomProperties ) setProperty ( _gfef * _ef . CT_Property ) { _adg . setPropertyHelper ( _gfef , false ) ; } ; func ( _cbf CustomProperties ) SetPropertyAsDate ( name string , date _f . Time ) { date = date . UTC ( ) ; _gd , _fabfa , _cdcb := date . Date ( ) ; _fae , _bca , _afb := date . Clock ( ) ; _eaa := _f . Date ( _gd , _fabfa , _cdcb , _fae , _bca , _afb , 0 , _f . UTC ) ; _gcaf := _cbf . getNewProperty ( name ) ; _gcaf . Filetime = & _eaa ; _cbf . setOrReplaceProperty ( _gcaf ) ; } ; const _efab = 2021 ;
2021-05-31 16:22:30 +00:00
2021-09-22 16:41:01 +00:00
// CoreProperties contains document specific properties.
type CoreProperties struct { _eebg * _gbd . CoreProperties } ;
2021-05-31 16:22:30 +00:00
2021-09-22 16:41:01 +00:00
// SetWidth sets column width, see measurement package.
func ( _cbae TableCol ) SetWidth ( m _afa . Distance ) { _egfg := _afa . ToEMU ( float64 ( m ) ) ; _cbae . _cfa . WAttr = _cd . ST_Coordinate { ST_CoordinateUnqualified : & _egfg } ; } ;
2021-05-31 16:22:30 +00:00
2021-09-22 16:41:01 +00:00
// TableCol represents a column in a table.
type TableCol struct { _cfa * _cd . CT_TableCol } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// FindRIDForN returns the relationship ID for the i'th relationship of type t.
func ( _adfe Relationships ) FindRIDForN ( i int , t string ) string { for _ , _acf := range _adfe . _dag . CT_Relationships . Relationship { if _acf . TypeAttr == t { if i == 0 { return _acf . IdAttr ; } ; i -- ; } ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// 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 ( _feg * ImageRef ) SetTarget ( target string ) { _feg . _dcc = target } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// Data returns the data of an image file, if any.
func ( _begg ImageRef ) Data ( ) * [ ] byte { return _begg . _beg . Data } ; func ( _ada CustomProperties ) SetPropertyAsUi8 ( name string , ui8 uint64 ) { _agad := _ada . getNewProperty ( name ) ; _agad . Ui8 = & ui8 ; _ada . setOrReplaceProperty ( _agad ) ; } ; func _cg ( _dabd * _ea . XSDAny ) _f . Time { if _dabd == nil { return _f . Time { } ; } ; _cba , _gbda := _f . Parse ( _agfd , string ( _dabd . Data ) ) ; if _gbda != nil { _ea . Log ( "\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 ( _dabd . Data ) , _gbda ) ; } ; return _cba ; } ;
2020-08-23 14:15:53 +00:00
2021-09-22 16:41:01 +00:00
// NewCoreProperties constructs a new CoreProperties.
func NewCoreProperties ( ) CoreProperties { return CoreProperties { _eebg : _gbd . NewCoreProperties ( ) } } ; func init ( ) { _ec . SetAsStorage ( ) } ;
2020-10-12 13:59:12 +00:00
2021-09-22 16:41:01 +00:00
// ApplicationVersion returns the version of the application that created the
// document.
func ( _egab AppProperties ) ApplicationVersion ( ) string { if _egab . _edc . AppVersion != nil { return * _egab . _edc . AppVersion ; } ; return "" ; } ;
2021-06-16 07:10:52 +00:00
2021-09-22 16:41:01 +00:00
// X returns the inner wrapped XML type of CustomProperty.
func ( _aged CustomProperty ) X ( ) * _ef . CT_Property { return _aged . _faff } ;
2021-06-16 07:10:52 +00:00
2021-09-22 16:41:01 +00:00
// Properties returns table properties.
func ( _dgdc Table ) Properties ( ) * _cd . CT_TableProperties { return _dgdc . _efdb . TblPr } ;
2020-10-12 13:59:12 +00:00
2021-09-22 16:41:01 +00:00
// Clear removes any existing relationships.
func ( _fdb Relationships ) Clear ( ) { _fdb . _dag . Relationship = nil } ; func ( _fabf CustomProperties ) SetPropertyAsStorage ( name string , storage string ) { _bcf := _fabf . getNewProperty ( name ) ; _bcf . Storage = & storage ; _fabf . setOrReplaceProperty ( _bcf ) ; } ;
2021-05-31 16:22:30 +00:00
2021-09-22 16:41:01 +00:00
// NewTableStyles constructs a new TableStyles.
func NewTableStyles ( ) TableStyles { return TableStyles { _bff : _cd . NewTblStyleLst ( ) } } ; func ( _efcc CustomProperties ) SetPropertyAsStream ( name string , stream string ) { _dgdg := _efcc . getNewProperty ( name ) ; _dgdg . Stream = & stream ; _efcc . setOrReplaceProperty ( _dgdg ) ; } ;
2021-05-31 16:22:30 +00:00
2021-09-22 16:41:01 +00:00
// Hyperlink is just an appropriately configured relationship.
type Hyperlink Relationship ;
2021-06-16 07:10:52 +00:00
2021-09-22 16:41:01 +00:00
// NewContentTypes returns a wrapper around a newly constructed content-types.
func NewContentTypes ( ) ContentTypes { _ebc := ContentTypes { _ccb : _ba . NewTypes ( ) } ; _ebc . AddDefault ( "\u0078\u006d\u006c" , "\u0061p\u0070l\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u0078\u006d\u006c" ) ; _ebc . 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" ) ; _ebc . AddDefault ( "\u0070\u006e\u0067" , "\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg" ) ; _ebc . AddDefault ( "\u006a\u0070\u0065\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _ebc . AddDefault ( "\u006a\u0070\u0067" , "\u0069m\u0061\u0067\u0065\u002f\u006a\u0070g" ) ; _ebc . AddDefault ( "\u0077\u006d\u0066" , "i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066" ) ; _ebc . 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" ) ; _ebc . 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 _ebc ; } ;
2020-11-09 01:00:18 +00:00
2021-09-22 16:41:01 +00:00
// SetHeight sets row height, see measurement package.
func ( _aceb TableRow ) SetHeight ( m _afa . Distance ) { _bcfa := _afa . ToEMU ( float64 ( m ) ) ; _aceb . _ebda . HAttr = _cd . ST_Coordinate { ST_CoordinateUnqualified : & _bcfa } ; } ;
2020-11-09 01:00:18 +00:00
2021-09-22 16:41:01 +00:00
// TblStyle returns the TblStyle property.
func ( _faeg TableStyles ) TblStyle ( ) [ ] * _cd . CT_TableStyle { return _faeg . _bff . TblStyle } ;
2020-12-17 22:07:08 +00:00
2021-09-22 16:41:01 +00:00
// Created returns the time that the document was created.
func ( _age CoreProperties ) Created ( ) _f . Time { return _cg ( _age . _eebg . Created ) } ;
2020-12-17 22:07:08 +00:00
2021-09-22 16:41:01 +00:00
// Properties returns table properties.
func ( _fgd Table ) Grid ( ) * _cd . CT_TableGrid { return _fgd . _efdb . TblGrid } ; const _agfd = "2\u00300\u0036\u002d\u0030\u0031\u002d\u0030\u0032\u00541\u0035\u003a\u0030\u0034:0\u0035\u005a" ; func UtcTimeFormat ( t _f . Time ) string { return t . Format ( _aec ) + "\u0020\u0055\u0054\u0043" } ; func ( _dfdg CustomProperties ) SetPropertyAsI2 ( name string , i2 int16 ) { _dfda := _dfdg . getNewProperty ( name ) ; _dfda . I2 = & i2 ; _dfdg . setOrReplaceProperty ( _dfda ) ; } ;
2020-12-17 22:07:08 +00:00
2021-09-22 16:41:01 +00:00
// ContentTypes is the top level "[Content_Types].xml" in a zip package.
type ContentTypes struct { _ccb * _ba . Types } ; func ( _bae CustomProperties ) SetPropertyAsI4 ( name string , i4 int32 ) { _ddc := _bae . getNewProperty ( name ) ; _ddc . I4 = & i4 ; _bae . setOrReplaceProperty ( _ddc ) ; } ;
2020-12-17 22:07:08 +00:00
2021-09-22 16:41:01 +00:00
// AddCol adds a column to a table.
func ( _dcbe Table ) AddCol ( ) * TableCol { _dcf := _cd . NewCT_TableCol ( ) ; _dcbe . _efdb . TblGrid . GridCol = append ( _dcbe . _efdb . TblGrid . GridCol , _dcf ) ; for _ , _gaee := range _dcbe . _efdb . Tr { _gdb := _cd . NewCT_TableCell ( ) ; _gaee . Tc = append ( _gaee . Tc , _gdb ) ; } ; return & TableCol { _cfa : _dcf } ; } ; var _bcca = _dg . 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" ) ;
2020-12-17 22:07:08 +00:00
2021-09-22 16:41:01 +00:00
// Application returns the name of the application that created the document.
// For unioffice created documents, it defaults to github.com/unidoc/unioffice
func ( _eced AppProperties ) Application ( ) string { if _eced . _edc . Application != nil { return * _eced . _edc . Application ; } ; return "" ; } ; func ( _gcf CustomProperties ) SetPropertyAsError ( name string , error string ) { _gbfg := _gcf . getNewProperty ( name ) ; _gbfg . Error = & error ; _gcf . setOrReplaceProperty ( _gbfg ) ; } ;
2021-04-23 20:00:00 +00:00
2021-09-22 16:41:01 +00:00
// NewTheme constructs a new theme.
func NewTheme ( ) Theme { return Theme { _cd . NewTheme ( ) } } ; func ( _baf CustomProperties ) SetPropertyAsClsid ( name string , clsid string ) { _bbg := _baf . getNewProperty ( name ) ; _bbg . Clsid = & clsid ; _baf . setOrReplaceProperty ( _bbg ) ; } ;
2021-05-31 16:22:30 +00:00
2021-09-22 16:41:01 +00:00
// 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 ( _gda ImageRef ) RelativeWidth ( h _afa . Distance ) _afa . Distance { _ddg := float64 ( _gda . Size ( ) . X ) / float64 ( _gda . Size ( ) . Y ) ; return h * _afa . Distance ( _ddg ) ; } ;
2021-06-16 07:10:52 +00:00
2021-09-22 16:41:01 +00:00
// SetCreated sets the time that the document was created.
func ( _agec CoreProperties ) SetCreated ( t _f . Time ) { _agec . _eebg . Created = _gefd ( t , "\u0064c\u0074e\u0072\u006d\u0073\u003a\u0063\u0072\u0065\u0061\u0074\u0065\u0064" ) ; } ;
2021-06-16 07:10:52 +00:00
2021-09-22 16:41:01 +00:00
// SetOffsetX sets horizontal offset of a table in distance units (see measurement package).
func ( _ffd Table ) SetOffsetX ( offX float64 ) { if _ffd . _fdgd . Off == nil { _ffd . _fdgd . Off = _cd . NewCT_Point2D ( ) ; _badbd := int64 ( 0 ) ; _ffd . _fdgd . Off . YAttr = _cd . ST_Coordinate { ST_CoordinateUnqualified : & _badbd } ; } ; _bgf := _afa . ToEMU ( offX ) ; _ffd . _fdgd . Off . XAttr = _cd . ST_Coordinate { ST_CoordinateUnqualified : & _bgf } ; } ; func ( _cf CustomProperties ) setPropertyHelper ( _dec * _ef . CT_Property , _bcg bool ) { _dedd := _cf . GetPropertyByName ( * _dec . NameAttr ) ; if ( _dedd == CustomProperty { } ) { _cf . _afg . Property = append ( _cf . _afg . Property , _dec ) ; } else if _bcg { _dec . FmtidAttr = _dedd . _faff . FmtidAttr ; if _dedd . _faff . PidAttr == 0 { _dec . PidAttr = _dedd . _faff . PidAttr ; } ; _dec . LinkTargetAttr = _dedd . _faff . LinkTargetAttr ; * _dedd . _faff = * _dec ; } ; } ;
2021-06-16 07:10:52 +00:00
2021-08-23 20:44:48 +00:00
// Author returns the author of the document
2021-09-22 16:41:01 +00:00
func ( _ggdg CoreProperties ) Author ( ) string { if _ggdg . _eebg . Creator != nil { return string ( _ggdg . _eebg . Creator . Data ) ; } ; return "" ; } ; func ( _beagf CustomProperties ) SetPropertyAsNull ( name string ) { _defb := _beagf . getNewProperty ( name ) ; _defb . Null = _fd . NewNull ( ) ; _beagf . setOrReplaceProperty ( _defb ) ; } ;
2021-06-16 07:10:52 +00:00
2021-09-22 16:41:01 +00:00
// SetStyle assigns TableStyle to a table.
func ( _dbge Table ) SetStyle ( style * _cd . CT_TableStyle ) { if _dbge . _efdb . TblPr == nil { _dbge . _efdb . TblPr = _cd . NewCT_TableProperties ( ) ; } ; if _dbge . _efdb . TblPr . Choice == nil { _dbge . _efdb . TblPr . Choice = _cd . NewCT_TablePropertiesChoice ( ) ; } ; _dbge . _efdb . TblPr . Choice . TableStyle = style ; } ;
2021-06-16 07:10:52 +00:00
2021-09-22 16:41:01 +00:00
// SetTarget set the target (path) of a relationship.
func ( _cgbd Relationship ) SetTarget ( s string ) { _cgbd . _eadc . TargetAttr = s } ;
2021-06-16 07:10:52 +00:00
2021-09-22 16:41:01 +00:00
// 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 { _beg : img , _dfcg : d , _gfb : rels } ; } ;
2021-06-16 07:10:52 +00:00
2021-09-22 16:41:01 +00:00
// X returns the inner wrapped XML type.
func ( _gfbg Table ) X ( ) * _cd . Tbl { return _gfbg . _efdb } ;
2021-08-23 20:44:48 +00:00
2021-09-22 16:41:01 +00:00
// CopyOverride copies override content type for a given `path` and puts it with a path `newPath`.
func ( _gbf ContentTypes ) CopyOverride ( path , newPath string ) { if ! _ce . HasPrefix ( path , "\u002f" ) { path = "\u002f" + path ; } ; if ! _ce . HasPrefix ( newPath , "\u002f" ) { newPath = "\u002f" + newPath ; } ; for _gaa := range _gbf . _ccb . Override { if _gbf . _ccb . Override [ _gaa ] . PartNameAttr == path { _fba := * _gbf . _ccb . Override [ _gaa ] ; _fba . PartNameAttr = newPath ; _gbf . _ccb . Override = append ( _gbf . _ccb . Override , & _fba ) ; } ; } ; } ;