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.
2024-05-22 00:21:11 +00:00
package common ; import ( _f "archive/zip" ; _be "bytes" ; _ed "encoding/xml" ; _ad "errors" ; _ec "fmt" ; _ead "github.com/unidoc/unioffice" ; _def "github.com/unidoc/unioffice/common/logger" ; _db "github.com/unidoc/unioffice/common/tempstorage" ; _ee "github.com/unidoc/unioffice/common/tempstorage/diskstore" ;
_dee "github.com/unidoc/unioffice/measurement" ; _c "github.com/unidoc/unioffice/schema/soo/dml" ; _bd "github.com/unidoc/unioffice/schema/soo/ofc/custom_properties" ; _fa "github.com/unidoc/unioffice/schema/soo/ofc/docPropsVTypes" ; _ff "github.com/unidoc/unioffice/schema/soo/ofc/extended_properties" ;
_gc "github.com/unidoc/unioffice/schema/soo/pkg/content_types" ; _fad "github.com/unidoc/unioffice/schema/soo/pkg/metadata/core_properties" ; _ae "github.com/unidoc/unioffice/schema/soo/pkg/relationships" ; _bg "github.com/unidoc/unioffice/zippkg" ; _g "image" ;
_ "image/gif" ; _ "image/jpeg" ; _ "image/png" ; _ea "os" ; _b "reflect" ; _de "regexp" ; _dc "strconv" ; _gdg "strings" ; _gd "time" ; ) ; func ( _cegf Relationship ) String ( ) string { return _ec . 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" , _cegf . ID ( ) , _cegf . Target ( ) , _cegf . Type ( ) ) ;
} ;
2023-07-04 11:04:03 +00:00
2024-05-08 13:54:39 +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.
2024-05-22 00:21:11 +00:00
func ImageFromStorage ( path string ) ( Image , error ) { _fgbd := Image { } ; _dcag , _cdc := _db . Open ( path ) ; if _cdc != nil { return _fgbd , _ec . Errorf ( "\u0065\u0072\u0072or\u0020\u0072\u0065\u0061\u0064\u0069\u006e\u0067\u0020\u0069\u006d\u0061\u0067\u0065\u003a\u0020\u0025\u0073" , _cdc ) ;
} ; defer _dcag . Close ( ) ; _debd , _geaf , _cdc := _g . Decode ( _dcag ) ; if _cdc != nil { return _fgbd , _ec . Errorf ( "\u0075n\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0070\u0061r\u0073e\u0020i\u006d\u0061\u0067\u0065\u003a\u0020\u0025s" , _cdc ) ; } ; _fgbd . Path = path ;
_fgbd . Format = _geaf ; _fgbd . Size = _debd . Bounds ( ) . Size ( ) ; return _fgbd , nil ; } ;
2023-07-04 11:04:03 +00:00
2024-05-22 00:21:11 +00:00
// AddCustomRelationships adds relationships related to custom properties to the document.
func ( _beeg * DocBase ) AddCustomRelationships ( ) { _beeg . 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" ) ;
_beeg . Rels . AddRelationship ( "\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c" , _ead . CustomPropertiesType ) ; } ;
2020-08-23 14:15:53 +00:00
2024-05-22 00:21:11 +00:00
// SetLastModifiedBy records the last person to modify the document.
func ( _cfd CoreProperties ) SetLastModifiedBy ( s string ) { _cfd . _ceg . LastModifiedBy = & s } ;
2020-08-23 14:15:53 +00:00
2024-05-22 00:21:11 +00:00
// SetPages sets the pages count of the document.
func ( _cge AppProperties ) SetPages ( n int32 ) { _cge . _eec . Pages = & n } ;
2020-08-23 14:15:53 +00:00
2024-05-22 00:21:11 +00:00
// GetTargetByRelId returns a target path with the associated relation ID.
func ( _bfc Relationships ) GetTargetByRelId ( idAttr string ) string { for _ , _egg := range _bfc . _bda . Relationship { if _egg . IdAttr == idAttr { return _egg . TargetAttr ; } ; } ; return "" ; } ;
2020-08-23 14:15:53 +00:00
2024-05-22 00:21:11 +00:00
// SetLinksUpToDate sets the links up to date flag.
func ( _dg AppProperties ) SetLinksUpToDate ( v bool ) { _dg . _eec . LinksUpToDate = _ead . Bool ( v ) } ;
2022-04-09 14:27:46 +00:00
2024-05-22 00:21:11 +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 ( _eegd AppProperties ) Company ( ) string { if _eegd . _eec . Company != nil { return * _eegd . _eec . Company ; } ; return "" ; } ;
2021-05-31 16:22:30 +00:00
2024-05-08 13:54:39 +00:00
// X returns the inner wrapped XML type.
2024-05-22 00:21:11 +00:00
func ( _fcd Table ) X ( ) * _c . Tbl { return _fcd . _bbcb } ;
2020-08-23 14:15:53 +00:00
2024-05-22 00:21:11 +00:00
// FindRIDForN returns the relationship ID for the i'th relationship of type t.
func ( _bdc Relationships ) FindRIDForN ( i int , t string ) string { for _ , _bggf := range _bdc . _bda . CT_Relationships . Relationship { if _bggf . TypeAttr == t { if i == 0 { return _bggf . IdAttr ; } ; i -- ; } ; } ; return "" ; } ;
2023-09-16 17:56:36 +00:00
2024-05-22 00:21:11 +00:00
// SetCreated sets the time that the document was created.
func ( _egd CoreProperties ) SetCreated ( t _gd . Time ) { _egd . _ceg . Created = _ggaf ( t , "\u0064c\u0074e\u0072\u006d\u0073\u003a\u0063\u0072\u0065\u0061\u0074\u0065\u0064" ) ; } ; func ( _gee CustomProperties ) SetPropertyAsBstr ( name string , bstr string ) { _egde := _gee . getNewProperty ( name ) ;
_egde . Bstr = & bstr ; _gee . setOrReplaceProperty ( _egde ) ; } ;
2021-11-10 11:45:21 +00:00
2024-05-22 00:21:11 +00:00
// ID returns the ID of a relationship.
func ( _dded Relationship ) ID ( ) string { return _dded . _befc . IdAttr } ; func ( _ggd CustomProperties ) SetPropertyAsUi4 ( name string , ui4 uint32 ) { _bgf := _ggd . getNewProperty ( name ) ; _bgf . Ui4 = & ui4 ; _ggd . setOrReplaceProperty ( _bgf ) ; } ; func ( _caa CustomProperties ) SetPropertyAsOblob ( name , oblob string ) { _cee := _caa . getNewProperty ( name ) ;
_cee . Oblob = & oblob ; _caa . setOrReplaceProperty ( _cee ) ; } ;
2024-04-03 00:10:23 +07:00
2024-05-08 13:54:39 +00:00
// CopyRelationship copies the relationship.
2024-05-22 00:21:11 +00:00
func ( _bfgc Relationships ) CopyRelationship ( idAttr string ) ( Relationship , bool ) { for _gbb := range _bfgc . _bda . Relationship { if _bfgc . _bda . Relationship [ _gbb ] . IdAttr == idAttr { _ccec := * _bfgc . _bda . Relationship [ _gbb ] ; _gaec := len ( _bfgc . _bda . Relationship ) + 1 ;
_fgc := map [ string ] struct { } { } ; for _ , _acc := range _bfgc . _bda . Relationship { _fgc [ _acc . IdAttr ] = struct { } { } ; } ; for _ , _cbf := _fgc [ _ec . Sprintf ( "\u0072\u0049\u0064%\u0064" , _gaec ) ] ; _cbf ; _ , _cbf = _fgc [ _ec . Sprintf ( "\u0072\u0049\u0064%\u0064" , _gaec ) ] { _gaec ++ ;
} ; _ccec . IdAttr = _ec . Sprintf ( "\u0072\u0049\u0064%\u0064" , _gaec ) ; _bfgc . _bda . Relationship = append ( _bfgc . _bda . Relationship , & _ccec ) ; return Relationship { _befc : & _ccec } , true ; } ; } ; return Relationship { } , false ; } ;
2021-11-10 11:45:21 +00:00
2024-05-22 00:21:11 +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 ( _dffga ImageRef ) RelativeWidth ( h _dee . Distance ) _dee . Distance { _bac := float64 ( _dffga . Size ( ) . X ) / float64 ( _dffga . Size ( ) . Y ) ; return h * _dee . Distance ( _bac ) ; } ;
2021-11-10 11:45:21 +00:00
2024-05-08 13:54:39 +00:00
// TableCol represents a column in a table.
2024-05-22 00:21:11 +00:00
type TableCol struct { _cba * _c . CT_TableCol } ; const Version = "\u0031\u002e\u0033\u0033\u002e\u0030" ;
2020-10-12 13:59:12 +00:00
2024-05-22 00:21:11 +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 ( _gcbf * ImageRef ) SetTarget ( target string ) { _gcbf . _dab = target } ;
2021-05-31 16:22:30 +00:00
2024-05-22 00:21:11 +00:00
// TableRow represents a row in a table.
type TableRow struct { _cga * _c . CT_TableRow } ;
2022-01-15 21:17:38 +00:00
2024-05-22 00:21:11 +00:00
// X returns the inner wrapped XML type of CustomProperty.
func ( _cce CustomProperty ) X ( ) * _bd . CT_Property { return _cce . _dccb } ; func ( _gabe CustomProperties ) SetPropertyAsUi1 ( name string , ui1 uint8 ) { _gdd := _gabe . getNewProperty ( name ) ; _gdd . Ui1 = & ui1 ; _gabe . setOrReplaceProperty ( _gdd ) ; } ;
2024-05-04 18:48:06 +00:00
2024-05-22 00:21:11 +00:00
// AddDefault registers a default content type for a given file extension.
func ( _ddd ContentTypes ) AddDefault ( fileExtension string , contentType string ) { fileExtension = _gdg . ToLower ( fileExtension ) ; for _ , _gb := range _ddd . _cab . Default { if _gb . ExtensionAttr == fileExtension { return ; } ; } ; _beb := _gc . NewDefault ( ) ; _beb . ExtensionAttr = fileExtension ;
_beb . ContentTypeAttr = contentType ; _ddd . _cab . Default = append ( _ddd . _cab . Default , _beb ) ; } ;
2024-05-04 18:48:06 +00:00
2024-05-22 00:21:11 +00:00
// CreateCustomProperties creates the custom properties of the document.
func ( _agfg * DocBase ) CreateCustomProperties ( ) { _agfg . CustomProperties = NewCustomProperties ( ) ; _agfg . AddCustomRelationships ( ) ; } ;
2024-05-04 18:48:06 +00:00
2024-05-22 00:21:11 +00:00
// NewRelationships creates a new relationship wrapper.
func NewRelationships ( ) Relationships { return Relationships { _bda : _ae . NewRelationships ( ) } } ;
2024-05-04 18:48:06 +00:00
2024-05-22 00:21:11 +00:00
// EnsureDefault esnures that an extension and default content type exist,
// adding it if necessary.
func ( _fae ContentTypes ) EnsureDefault ( ext , contentType string ) { ext = _gdg . ToLower ( ext ) ; for _ , _eba := range _fae . _cab . Default { if _eba . ExtensionAttr == ext { _eba . ContentTypeAttr = contentType ; return ; } ; } ; _bfd := & _gc . Default { } ; _bfd . ContentTypeAttr = contentType ;
_bfd . ExtensionAttr = ext ; _fae . _cab . Default = append ( _fae . _cab . Default , _bfd ) ; } ;
2022-01-15 21:17:38 +00:00
2024-05-22 00:21:11 +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 _g . Image ; Images [ ] ImageRef ; ExtraFiles [ ] ExtraFile ; TmpPath string ; } ;
2022-01-15 21:17:38 +00:00
2024-05-22 00:21:11 +00:00
// GetPropertyByName returns a custom property selected by it's name.
func ( _fbd CustomProperties ) GetPropertyByName ( name string ) CustomProperty { _gfg := _fbd . _faeg . Property ; for _ , _fcc := range _gfg { if * _fcc . NameAttr == name { return CustomProperty { _dccb : _fcc } ; } ; } ; return CustomProperty { } ; } ;
2020-11-09 01:00:18 +00:00
2024-05-22 00:21:11 +00:00
// NewTableStyles constructs a new TableStyles.
func NewTableStyles ( ) TableStyles { return TableStyles { _bfeg : _c . NewTblStyleLst ( ) } } ;
2020-12-17 22:07:08 +00:00
2024-05-22 00:21:11 +00:00
// X returns the inner wrapped XML type.
func ( _abf CoreProperties ) X ( ) * _fad . CoreProperties { return _abf . _ceg } ;
2020-12-17 22:07:08 +00:00
2024-05-22 00:21:11 +00:00
// AddRelationship adds a relationship.
func ( _ege Relationships ) AddRelationship ( target , ctype string ) Relationship { if ! _gdg . HasPrefix ( ctype , "\u0068t\u0074\u0070\u003a\u002f\u002f" ) { _def . 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 ) ;
} ; _egf := _ae . NewRelationship ( ) ; _fce := len ( _ege . _bda . Relationship ) + 1 ; _gcd := map [ string ] struct { } { } ; for _ , _ebd := range _ege . _bda . Relationship { _gcd [ _ebd . IdAttr ] = struct { } { } ; } ; for _ , _agb := _gcd [ _ec . Sprintf ( "\u0072\u0049\u0064%\u0064" , _fce ) ] ;
_agb ; _ , _agb = _gcd [ _ec . Sprintf ( "\u0072\u0049\u0064%\u0064" , _fce ) ] { _fce ++ ; } ; _egf . IdAttr = _ec . Sprintf ( "\u0072\u0049\u0064%\u0064" , _fce ) ; _egf . TargetAttr = target ; _egf . TypeAttr = ctype ; _ege . _bda . Relationship = append ( _ege . _bda . Relationship , _egf ) ;
return Relationship { _befc : _egf } ; } ;
2023-05-26 09:49:04 +00:00
2024-05-22 00:21:11 +00:00
// IsEmpty returns true if there are no relationships.
func ( _adeg Relationships ) IsEmpty ( ) bool { return _adeg . _bda == nil || len ( _adeg . _bda . Relationship ) == 0 ; } ; func ( _ffg CustomProperties ) SetPropertyAsVector ( name string , vector * _fa . Vector ) { _eegg := _ffg . getNewProperty ( name ) ; _eegg . Vector = vector ;
_ffg . setOrReplaceProperty ( _eegg ) ; } ;
2024-05-04 18:48:06 +00:00
2024-05-22 00:21:11 +00:00
// Created returns the time that the document was created.
func ( _cgbc CoreProperties ) Created ( ) _gd . Time { return _fac ( _cgbc . _ceg . Created ) } ; func ( _bcf CustomProperties ) setOrReplaceProperty ( _ffb * _bd . CT_Property ) { _bcf . setPropertyHelper ( _ffb , true ) ; } ;
2024-05-04 18:48:06 +00:00
2024-05-22 00:21:11 +00:00
// Hyperlink is just an appropriately configured relationship.
type Hyperlink Relationship ;
2024-05-04 18:48:06 +00:00
2024-05-22 00:21:11 +00:00
// NewTheme constructs a new theme.
func NewTheme ( ) Theme { return Theme { _c . NewTheme ( ) } } ;
2020-12-17 22:07:08 +00:00
2024-05-22 00:21:11 +00:00
// GetByRelId returns a relationship with the associated relation ID.
func ( _efaa Relationships ) GetByRelId ( idAttr string ) Relationship { for _ , _aaf := range _efaa . _bda . Relationship { if _aaf . IdAttr == idAttr { return Relationship { _befc : _aaf } ; } ; } ; return Relationship { } ; } ; func ( _gda * ImageRef ) SetRelID ( id string ) { _gda . _ggb = id } ;
2020-12-17 22:07:08 +00:00
2021-11-10 11:45:21 +00:00
2024-05-22 00:21:11 +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 ( _agf * DocBase ) AddExtraFileFromZip ( f * _f . File ) error { _acg , _adc := _bg . ExtractToDiskTmp ( f , _agf . TmpPath ) ; if _adc != nil { return _ec . 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" , _adc ) ;
} ; _agf . ExtraFiles = append ( _agf . ExtraFiles , ExtraFile { ZipPath : f . Name , DiskPath : _acg } ) ; return nil ; } ; const _cabb = 30 ;
2024-05-04 18:48:06 +00:00
2024-05-22 00:21:11 +00:00
// SetAuthor records the author of the document.
func ( _cca CoreProperties ) SetAuthor ( s string ) { if _cca . _ceg . Creator == nil { _cca . _ceg . Creator = & _ead . XSDAny { XMLName : _ed . Name { Local : "\u0064\u0063\u003a\u0063\u0072\u0065\u0061\u0074\u006f\u0072" } } ; } ; _cca . _ceg . Creator . Data = [ ] byte ( s ) ; } ; const _dace = 5 ;
func ( _gea CustomProperties ) SetPropertyAsBlob ( name , blob string ) { _cef := _gea . getNewProperty ( name ) ; _cef . Blob = & blob ; _gea . setOrReplaceProperty ( _cef ) ; } ; func ( _fdf CustomProperties ) SetPropertyAsI4 ( name string , i4 int32 ) { _feec := _fdf . getNewProperty ( name ) ;
_feec . I4 = & i4 ; _fdf . setOrReplaceProperty ( _feec ) ; } ;
2021-11-10 11:45:21 +00:00
2024-05-22 00:21:11 +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 ( _gcb AppProperties ) SetApplicationVersion ( s string ) { _gcb . _eec . AppVersion = & s } ;
2024-05-04 18:48:06 +00:00
2024-05-22 00:21:11 +00:00
// NewRelationshipsCopy creates a new relationships wrapper as a copy of passed in instance.
func NewRelationshipsCopy ( rels Relationships ) Relationships { _gba := * rels . _bda ; return Relationships { _bda : & _gba } ; } ;
2024-04-03 00:10:23 +07:00
2024-05-08 13:54:39 +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.
2024-05-22 00:21:11 +00:00
func ( _bbaa ImageRef ) RelativeHeight ( w _dee . Distance ) _dee . Distance { _ebb := float64 ( _bbaa . Size ( ) . Y ) / float64 ( _bbaa . Size ( ) . X ) ; return w * _dee . Distance ( _ebb ) ; } ;
2024-04-03 00:10:23 +07:00
2024-05-22 00:21:11 +00:00
// GetImageBytesByTarget returns Image object with Data bytes read from its target.
func ( _dbdf * DocBase ) GetImageBytesByTarget ( target string ) ( Image , error ) { if target != "" { target = "\u0077\u006f\u0072d\u002f" + target ; for _ , _bff := range _dbdf . Images { if _bff . Target ( ) == target { if _gdg . ToLower ( _bff . Format ( ) ) != "\u0065\u006d\u0066" { return ImageFromStorage ( _bff . Path ( ) ) ;
} ; return Image { Path : _bff . Path ( ) , Format : _bff . Format ( ) } , nil ; } ; } ; } ; return Image { } , _fdgc ; } ;
2022-04-09 14:27:46 +00:00
2024-05-22 00:21:11 +00:00
// Format returns the format of the underlying image
func ( _fgb ImageRef ) Format ( ) string { return _fgb . _dgc . Format } ; func ( _dgbf CustomProperties ) SetPropertyAsUi2 ( name string , ui2 uint16 ) { _fga := _dgbf . getNewProperty ( name ) ; _fga . Ui2 = & ui2 ; _dgbf . setOrReplaceProperty ( _fga ) ; } ; func ( _add CustomProperties ) getNewProperty ( _bbdc string ) * _bd . CT_Property { _dda := _add . _faeg . Property ;
_gfa := int32 ( 1 ) ; for _ , _dfb := range _dda { if _dfb . PidAttr > _gfa { _gfa = _dfb . PidAttr ; } ; } ; _bbc := _bd . NewCT_Property ( ) ; _bbc . NameAttr = & _bbdc ; _bbc . PidAttr = _gfa + 1 ; _bbc . 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 _bbc ; } ;
2021-06-16 07:10:52 +00:00
2024-05-22 00:21:11 +00:00
// SetDocSecurity sets the document security flag.
func ( _aab AppProperties ) SetDocSecurity ( v int32 ) { _aab . _eec . DocSecurity = _ead . Int32 ( v ) } ; func ( _fcgd CustomProperties ) SetPropertyAsArray ( name string , array * _fa . Array ) { _cfca := _fcgd . getNewProperty ( name ) ; _cfca . Array = array ; _fcgd . setOrReplaceProperty ( _cfca ) ;
2024-05-08 13:54:39 +00:00
} ;
2023-05-26 09:49:04 +00:00
2024-05-22 00:21:11 +00:00
// Relationships represents a .rels file.
type Relationships struct { _bda * _ae . Relationships } ;
2021-06-16 07:10:52 +00:00
2024-05-22 00:21:11 +00:00
// NewRelationship constructs a new relationship.
func NewRelationship ( ) Relationship { return Relationship { _befc : _ae . NewRelationship ( ) } } ;
2021-06-16 07:10:52 +00:00
2024-05-22 00:21:11 +00:00
// TableStyles contains document specific properties.
type TableStyles struct { _bfeg * _c . TblStyleLst } ;
2024-05-04 18:48:06 +00:00
2024-05-08 13:54:39 +00:00
// AddOverride adds an override content type for a given path name.
2024-05-22 00:21:11 +00:00
func ( _fgd ContentTypes ) AddOverride ( path , contentType string ) { if ! _gdg . HasPrefix ( path , "\u002f" ) { path = "\u002f" + path ; } ; if _gdg . HasPrefix ( contentType , "\u0068\u0074\u0074\u0070" ) { _def . 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 _ , _cfb := range _fgd . _cab . Override { if _cfb . PartNameAttr == path { return ; } ; } ; _ce := _gc . NewOverride ( ) ; _ce . PartNameAttr = path ; _ce . ContentTypeAttr = contentType ; _fgd . _cab . Override = append ( _fgd . _cab . Override , _ce ) ; } ;
2022-02-25 19:20:45 +00:00
2024-05-22 00:21:11 +00:00
// SetApplication sets the name of the application that created the document.
func ( _ge AppProperties ) SetApplication ( s string ) { _ge . _eec . Application = & s } ;
2022-02-25 19:20:45 +00:00
2024-05-08 13:54:39 +00:00
// X returns the inner raw content types.
2024-05-22 00:21:11 +00:00
func ( _edf ContentTypes ) X ( ) * _gc . Types { return _edf . _cab } ; const _ggbe = 15 ; func ( _dff CustomProperties ) SetPropertyAsDecimal ( name string , decimal float64 ) { _cadb := _dff . getNewProperty ( name ) ; _cadb . Decimal = & decimal ; _dff . setOrReplaceProperty ( _cadb ) ;
} ; func _ggaf ( _cfc _gd . Time , _ccd string ) * _ead . XSDAny { _bgg := & _ead . XSDAny { XMLName : _ed . Name { Local : _ccd } } ; _bgg . Attrs = append ( _bgg . Attrs , _ed . Attr { Name : _ed . Name { Local : "\u0078\u0073\u0069\u003a\u0074\u0079\u0070\u0065" } , Value : "\u0064\u0063\u0074\u0065\u0072\u006d\u0073\u003a\u00573\u0043\u0044\u0054\u0046" } ) ;
_bgg . Attrs = append ( _bgg . Attrs , _ed . Attr { Name : _ed . 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" } ) ;
_bgg . Attrs = append ( _bgg . Attrs , _ed . Attr { Name : _ed . 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/" } ) ;
_bgg . Data = [ ] byte ( _cfc . Format ( _fee ) ) ; return _bgg ; } ;
2021-08-23 20:44:48 +00:00
2024-05-22 00:21:11 +00:00
// X returns the inner wrapped XML type.
func ( _fcce TableStyles ) X ( ) * _c . TblStyleLst { return _fcce . _bfeg } ;
2023-09-16 17:56:36 +00:00
2024-05-08 13:54:39 +00:00
// Author returns the author of the document
2024-05-22 00:21:11 +00:00
func ( _aae CoreProperties ) Author ( ) string { if _aae . _ceg . Creator != nil { return string ( _aae . _ceg . Creator . Data ) ; } ; return "" ; } ; func ( _dbab CustomProperties ) SetPropertyAsVstream ( name string , vstream * _fa . Vstream ) { _fada := _dbab . getNewProperty ( name ) ;
_fada . Vstream = vstream ; _dbab . setOrReplaceProperty ( _fada ) ; } ; func ( _bgb CustomProperties ) SetPropertyAsOstream ( name string , ostream string ) { _bbe := _bgb . getNewProperty ( name ) ; _bbe . Ostream = & ostream ; _bgb . setOrReplaceProperty ( _bbe ) ; } ; func ( _edge CustomProperties ) SetPropertyAsInt ( name string , i int ) { _gfab := _edge . getNewProperty ( name ) ;
_bef := int32 ( i ) ; _gfab . Int = & _bef ; _edge . setOrReplaceProperty ( _gfab ) ; } ; func ( _ccg CustomProperties ) SetPropertyAsI1 ( name string , i1 int8 ) { _acbb := _ccg . getNewProperty ( name ) ; _acbb . I1 = & i1 ; _ccg . setOrReplaceProperty ( _acbb ) ; } ;
2023-09-16 17:56:36 +00:00
2024-05-22 00:21:11 +00:00
// AddImageToZip adds an image (either from bytes or from disk) and adds it to the zip file.
func AddImageToZip ( z * _f . Writer , img ImageRef , imageNum int , dt _ead . DocType ) error { _bfg := _ead . AbsoluteImageFilename ( dt , imageNum , _gdg . ToLower ( img . Format ( ) ) ) ; if img . Data ( ) != nil && len ( * img . Data ( ) ) > 0 { if _cceb := _bg . AddFileFromBytes ( z , _bfg , * img . Data ( ) ) ;
_cceb != nil { return _cceb ; } ; } else if img . Path ( ) != "" { if _gacg := _bg . AddFileFromDisk ( z , _bfg , img . Path ( ) ) ; _gacg != nil { return _gacg ; } ; } else { return _ec . 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 ; } ; var ReleasedAt = _gd . Date ( _bgag , _dace , _ffc , _ggbe , _cabb , 0 , 0 , _gd . UTC ) ; const _bgag = 2024 ;
2022-06-27 19:44:23 +00:00
2024-05-22 00:21:11 +00:00
// Rows returns all table rows.
func ( _eed Table ) Rows ( ) [ ] * TableRow { _aac := _eed . _bbcb . Tr ; _afc := [ ] * TableRow { } ; for _ , _afdc := range _aac { _afc = append ( _afc , & TableRow { _cga : _afdc } ) ; } ; return _afc ; } ;
2022-06-27 19:44:23 +00:00
2024-05-22 00:21:11 +00:00
// Type returns the type of a relationship.
func ( _dbac Relationship ) Type ( ) string { return _dbac . _befc . TypeAttr } ;
2023-06-10 07:12:37 +00:00
2024-05-08 13:54:39 +00:00
// Application returns the name of the application that created the document.
// For unioffice created documents, it defaults to github.com/unidoc/unioffice
2024-05-22 00:21:11 +00:00
func ( _gga AppProperties ) Application ( ) string { if _gga . _eec . Application != nil { return * _gga . _eec . Application ; } ; return "" ; } ;
2023-06-10 07:12:37 +00:00
2024-05-22 00:21:11 +00:00
// Theme is a drawingml theme.
type Theme struct { _eag * _c . Theme } ; func ( _egdc CustomProperties ) SetPropertyAsI8 ( name string , i8 int64 ) { _fab := _egdc . getNewProperty ( name ) ; _fab . I8 = & i8 ; _egdc . setOrReplaceProperty ( _fab ) ; } ;
2023-06-10 07:12:37 +00:00
2024-05-22 00:21:11 +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 _g . Point ; Format string ; Path string ; Data * [ ] byte ; } ;
2023-06-10 07:12:37 +00:00
2024-05-22 00:21:11 +00:00
// SetID set the ID of a relationship.
func ( _cbd Relationship ) SetID ( ID string ) { _cbd . _befc . IdAttr = ID ; } ; func ( _eddf CustomProperties ) SetPropertyAsR4 ( name string , r4 float32 ) { _ged := _eddf . getNewProperty ( name ) ; _ged . R4 = & r4 ; _eddf . setOrReplaceProperty ( _ged ) ; } ;
2023-06-10 07:12:37 +00:00
2024-05-22 00:21:11 +00:00
// SetTitle records the title of the document.
func ( _ddb CoreProperties ) SetTitle ( s string ) { if _ddb . _ceg . Title == nil { _ddb . _ceg . Title = & _ead . XSDAny { XMLName : _ed . Name { Local : "\u0064\u0063\u003a\u0074\u0069\u0074\u006c\u0065" } } ; } ; _ddb . _ceg . Title . Data = [ ] byte ( s ) ; } ;
// X returns the inner wrapped XML type.
func ( _afd Relationship ) X ( ) * _ae . Relationship { return _afd . _befc } ; func ( _bgbc CustomProperties ) SetPropertyAsClsid ( name string , clsid string ) { _cgf := _bgbc . getNewProperty ( name ) ; _cgf . Clsid = & clsid ; _bgbc . setOrReplaceProperty ( _cgf ) ; } ;
// Target returns the target attrubute of the image reference (a path where the image file is located in the document structure).
func ( _dfcg * ImageRef ) Target ( ) string { return _dfcg . _dab } ; func ( _daag CustomProperties ) SetPropertyAsStream ( name string , stream string ) { _eece := _daag . getNewProperty ( name ) ; _eece . Stream = & stream ; _daag . setOrReplaceProperty ( _eece ) ; } ; func ( _ebab CustomProperties ) SetPropertyAsUi8 ( name string , ui8 uint64 ) { _gdgg := _ebab . getNewProperty ( name ) ;
_gdgg . Ui8 = & ui8 ; _ebab . setOrReplaceProperty ( _gdgg ) ; } ; func ( _bag CustomProperties ) SetPropertyAsLpstr ( name string , lpstr string ) { _dec := _bag . getNewProperty ( name ) ; _dec . Lpstr = & lpstr ; _bag . setOrReplaceProperty ( _dec ) ; } ;
2023-07-04 11:04:03 +00:00
2024-05-08 13:54:39 +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.
2024-05-22 00:21:11 +00:00
func MakeImageRef ( img Image , d * DocBase , rels Relationships ) ImageRef { return ImageRef { _dgc : img , _ceeb : d , _debbg : rels } ; } ; const _fee = "2\u00300\u0036\u002d\u0030\u0031\u002d\u0030\u0032\u00541\u0035\u003a\u0030\u0034:0\u0035\u005a" ; func ( _aabf TableRow ) addCell ( ) * _c . CT_TableCell { _bbga := _c . NewCT_TableCell ( ) ;
_aabf . _cga . Tc = append ( _aabf . _cga . Tc , _bbga ) ; return _bbga ; } ; const _dbc = "\u0032\u0020\u004aan\u0075\u0061\u0072\u0079\u0020\u0032\u0030\u0030\u0036\u0020\u0061\u0074\u0020\u0031\u0035\u003a\u0030\u0034" ;
2023-06-10 07:12:37 +00:00
2024-05-08 13:54:39 +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.
2024-05-22 00:21:11 +00:00
func ImageFromFile ( path string ) ( Image , error ) { _eac , _efc := _ea . Open ( path ) ; _fdfb := Image { } ; if _efc != nil { return _fdfb , _ec . Errorf ( "\u0065\u0072\u0072or\u0020\u0072\u0065\u0061\u0064\u0069\u006e\u0067\u0020\u0069\u006d\u0061\u0067\u0065\u003a\u0020\u0025\u0073" , _efc ) ;
} ; defer _eac . Close ( ) ; _fcbc , _dfa , _efc := _g . Decode ( _eac ) ; if _efc != nil { return _fdfb , _ec . Errorf ( "\u0075n\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0070\u0061r\u0073e\u0020i\u006d\u0061\u0067\u0065\u003a\u0020\u0025s" , _efc ) ; } ; _fdfb . Path = path ;
_fdfb . Format = _dfa ; _fdfb . Size = _fcbc . Bounds ( ) . Size ( ) ; return _fdfb , nil ; } ;
2022-09-02 11:46:53 +00:00
2024-05-22 00:21:11 +00:00
// SetContentStatus records the content status of the document.
func ( _bead CoreProperties ) SetContentStatus ( s string ) { _bead . _ceg . ContentStatus = & s } ;
2022-09-02 11:46:53 +00:00
2024-05-22 00:21:11 +00:00
// ImageRef is a reference to an image within a document.
type ImageRef struct { _ceeb * DocBase ; _debbg Relationships ; _dgc Image ; _ggb string ; _dab string ; } ; func ( _bbg CustomProperties ) SetPropertyAsError ( name string , error string ) { _ccdg := _bbg . getNewProperty ( name ) ; _ccdg . Error = & error ; _bbg . setOrReplaceProperty ( _ccdg ) ;
} ;
2022-09-02 11:46:53 +00:00
2024-05-22 00:21:11 +00:00
// DefAttr returns the DefAttr property.
func ( _aeb TableStyles ) DefAttr ( ) string { return _aeb . _bfeg . DefAttr } ;
2022-12-06 11:56:49 +00:00
2024-05-22 00:21:11 +00:00
// CoreProperties contains document specific properties.
type CoreProperties struct { _ceg * _fad . CoreProperties } ;
2023-08-06 17:57:53 +00:00
2024-05-22 00:21:11 +00:00
// Cells returns an array of row cells.
func ( _cecg TableRow ) Cells ( ) [ ] * _c . CT_TableCell { return _cecg . _cga . Tc } ;
2022-12-06 11:56:49 +00:00
2024-05-22 00:21:11 +00:00
// SetOffsetY sets vertical offset of a table in distance units (see measurement package).
func ( _deg Table ) SetOffsetY ( offY float64 ) { if _deg . _cda . Off == nil { _deg . _cda . Off = _c . NewCT_Point2D ( ) ; _dgd := int64 ( 0 ) ; _deg . _cda . Off . XAttr = _c . ST_Coordinate { ST_CoordinateUnqualified : & _dgd } ; } ; _fed := _dee . ToEMU ( offY ) ; _deg . _cda . Off . YAttr = _c . ST_Coordinate { ST_CoordinateUnqualified : & _fed } ;
} ;
2024-04-03 00:10:23 +07:00
2024-05-22 00:21:11 +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 ; } ;
2022-12-06 11:56:49 +00:00
2024-05-22 00:21:11 +00:00
// Table represents a table in the document.
type Table struct { _bbcb * _c . Tbl ; _cda * _c . CT_Transform2D ; } ;
2023-03-01 18:42:44 +00:00
2024-05-22 00:21:11 +00:00
// X returns the inner wrapped XML type.
func ( _daf Theme ) X ( ) * _c . Theme { return _daf . _eag } ;
2023-03-01 18:42:44 +00:00
2024-05-08 13:54:39 +00:00
// SetOffsetX sets horizontal offset of a table in distance units (see measurement package).
2024-05-22 00:21:11 +00:00
func ( _feb Table ) SetOffsetX ( offX float64 ) { if _feb . _cda . Off == nil { _feb . _cda . Off = _c . NewCT_Point2D ( ) ; _gbed := int64 ( 0 ) ; _feb . _cda . Off . YAttr = _c . ST_Coordinate { ST_CoordinateUnqualified : & _gbed } ; } ; _ddg := _dee . ToEMU ( offX ) ; _feb . _cda . Off . XAttr = _c . ST_Coordinate { ST_CoordinateUnqualified : & _ddg } ;
} ;
// Title returns the Title of the document
func ( _bdd CoreProperties ) Title ( ) string { if _bdd . _ceg . Title != nil { return string ( _bdd . _ceg . Title . Data ) ; } ; return "" ; } ;
// X returns the inner wrapped XML type.
func ( _bdeg CustomProperties ) X ( ) * _bd . Properties { return _bdeg . _faeg } ;
2022-12-06 11:56:49 +00:00
2024-05-08 13:54:39 +00:00
// GetTargetByRelIdAndType returns a target path with the associated relation ID.
2024-05-22 00:21:11 +00:00
func ( _faf Relationships ) GetTargetByRelIdAndType ( idAttr string , typeAttr string ) string { for _ , _dad := range _faf . _bda . Relationship { if _dad . IdAttr == idAttr && _dad . TypeAttr == typeAttr { return _dad . TargetAttr ; } ; } ; return "" ; } ; func ( _dffg CustomProperties ) SetPropertyAsFiletime ( name string , filetime _gd . Time ) { _fbg := _dffg . getNewProperty ( name ) ;
_fbg . Filetime = & filetime ; _dffg . setOrReplaceProperty ( _fbg ) ; } ;
2023-03-01 18:42:44 +00:00
2024-05-22 00:21:11 +00:00
// WriteExtraFiles writes the extra files to the zip package.
func ( _deeg * DocBase ) WriteExtraFiles ( z * _f . Writer ) error { for _ , _fcb := range _deeg . ExtraFiles { if _egc := _bg . AddFileFromDisk ( z , _fcb . ZipPath , _fcb . DiskPath ) ; _egc != nil { return _egc ; } ; } ; return nil ; } ;
2024-05-08 13:54:39 +00:00
2024-05-22 00:21:11 +00:00
// ContentStatus returns the content status of the document (e.g. "Final", "Draft")
func ( _gac CoreProperties ) ContentStatus ( ) string { if _gac . _ceg . ContentStatus != nil { return * _gac . _ceg . ContentStatus ; } ; return "" ; } ;
2023-03-01 18:42:44 +00:00
2024-05-22 00:21:11 +00:00
// PropertiesList returns the list of all custom properties of the document.
func ( _abba CustomProperties ) PropertiesList ( ) [ ] * _bd . CT_Property { return _abba . _faeg . Property } ;
2023-05-26 09:49:04 +00:00
2024-05-22 00:21:11 +00:00
// Modified returns the time that the document was modified.
func ( _fcf CoreProperties ) Modified ( ) _gd . Time { return _fac ( _fcf . _ceg . Modified ) } ;
2023-05-26 09:49:04 +00:00
2024-05-22 00:21:11 +00:00
// CustomProperties contains document specific properties.
type CustomProperties struct { _faeg * _bd . Properties } ;
2023-08-06 17:57:53 +00:00
2024-05-22 00:21:11 +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 ( _bgc Relationships ) AddAutoRelationship ( dt _ead . DocType , src string , idx int , ctype string ) Relationship { return _bgc . AddRelationship ( _ead . RelativeFilename ( dt , src , ctype , idx ) , ctype ) ; } ;
2023-08-06 17:57:53 +00:00
2024-05-22 00:21:11 +00:00
// Data returns the data of an image file, if any.
func ( _efbe ImageRef ) Data ( ) * [ ] byte { return _efbe . _dgc . Data } ;
2024-02-17 03:37:07 +00:00
2024-05-22 00:21:11 +00:00
// Append appends DocBase part of an office document to another DocBase.
func ( _fg DocBase ) Append ( docBase1 DocBase ) DocBase { _aef := docBase1 . ContentTypes . X ( ) ; for _ , _dd := range _aef . Default { _fg . ContentTypes . AddDefault ( _dd . ExtensionAttr , _dd . ContentTypeAttr ) ; } ; for _ , _edd := range _aef . Override { _fg . ContentTypes . AddOverride ( _edd . PartNameAttr , _edd . ContentTypeAttr ) ;
} ; _ece := _fg . AppProperties . X ( ) ; _aa := docBase1 . AppProperties . X ( ) ; if _ece . Pages != nil { if _aa . Pages != nil { * _ece . Pages += * _aa . Pages ; } ; } else if _aa . Pages != nil { _ece . Pages = _aa . Pages ; } ; if _ece . Words != nil { if _aa . Words != nil { * _ece . Words += * _aa . Words ;
} ; } else if _aa . Words != nil { _ece . Words = _aa . Words ; } ; if _ece . Characters != nil { if _aa . Characters != nil { * _ece . Characters += * _aa . Characters ; } ; } else if _aa . Characters != nil { _ece . Characters = _aa . Characters ; } ; if _ece . Lines != nil { if _aa . Lines != nil { * _ece . Lines += * _aa . Lines ;
} ; } else if _aa . Lines != nil { _ece . Lines = _aa . Lines ; } ; if _ece . Paragraphs != nil { if _aa . Paragraphs != nil { * _ece . Paragraphs += * _aa . Paragraphs ; } ; } else if _aa . Paragraphs != nil { _ece . Paragraphs = _aa . Paragraphs ; } ; if _ece . Notes != nil { if _aa . Notes != nil { * _ece . Notes += * _aa . Notes ;
} ; } else if _aa . Notes != nil { _ece . Notes = _aa . Notes ; } ; if _ece . HiddenSlides != nil { if _aa . HiddenSlides != nil { * _ece . HiddenSlides += * _aa . HiddenSlides ; } ; } else if _aa . HiddenSlides != nil { _ece . HiddenSlides = _aa . HiddenSlides ; } ; if _ece . MMClips != nil { if _aa . MMClips != nil { * _ece . MMClips += * _aa . MMClips ;
} ; } else if _aa . MMClips != nil { _ece . MMClips = _aa . MMClips ; } ; if _ece . LinksUpToDate != nil { if _aa . LinksUpToDate != nil { * _ece . LinksUpToDate = * _ece . LinksUpToDate && * _aa . LinksUpToDate ; } ; } else if _aa . LinksUpToDate != nil { _ece . LinksUpToDate = _aa . LinksUpToDate ;
} ; if _ece . CharactersWithSpaces != nil { if _aa . CharactersWithSpaces != nil { * _ece . CharactersWithSpaces += * _aa . CharactersWithSpaces ; } ; } else if _aa . CharactersWithSpaces != nil { _ece . CharactersWithSpaces = _aa . CharactersWithSpaces ; } ; if _ece . SharedDoc != nil { if _aa . SharedDoc != nil { * _ece . SharedDoc = * _ece . SharedDoc || * _aa . SharedDoc ;
} ; } else if _aa . SharedDoc != nil { _ece . SharedDoc = _aa . SharedDoc ; } ; if _ece . HyperlinksChanged != nil { if _aa . HyperlinksChanged != nil { * _ece . HyperlinksChanged = * _ece . HyperlinksChanged || * _aa . HyperlinksChanged ; } ; } else if _aa . HyperlinksChanged != nil { _ece . HyperlinksChanged = _aa . HyperlinksChanged ;
} ; _ece . DigSig = nil ; if _ece . TitlesOfParts == nil && _aa . TitlesOfParts != nil { _ece . TitlesOfParts = _aa . TitlesOfParts ; } ; if _ece . HeadingPairs != nil { if _aa . HeadingPairs != nil { _da := _ece . HeadingPairs . Vector ; _cb := _aa . HeadingPairs . Vector ; _cg := _da . Variant ;
_gf := _cb . Variant ; _ca := [ ] * _fa . Variant { } ; for _gcc := 0 ; _gcc < len ( _gf ) ; _gcc += 2 { _eg := _gf [ _gcc ] . Lpstr ; _cc := false ; for _eea := 0 ; _eea < len ( _cg ) ; _eea += 2 { _cbc := _cg [ _eea ] . Lpstr ; if _cbc != nil && _eg != nil && * _cbc == * _eg { * _cg [ _eea + 1 ] . I4 = * _cg [ _eea + 1 ] . I4 + * _gf [ _gcc + 1 ] . I4 ;
_cc = true ; break ; } ; } ; if ! _cc { _ca = append ( _ca , & _fa . Variant { CT_Variant : _fa . CT_Variant { Lpstr : _gf [ _gcc ] . Lpstr } } ) ; _ca = append ( _ca , & _fa . Variant { CT_Variant : _fa . CT_Variant { I4 : _gf [ _gcc ] . I4 } } ) ; } ; } ; _cg = append ( _cg , _ca ... ) ; _da . SizeAttr = uint32 ( len ( _cg ) ) ;
} ; } else if _aa . HeadingPairs != nil { _ece . HeadingPairs = _aa . HeadingPairs ; } ; if _ece . HLinks != nil { if _aa . HLinks != nil { _ga := _ece . HLinks . Vector ; _fb := _aa . HLinks . Vector ; _eeb := _ga . Variant ; _gaa := _fb . Variant ; for _ , _gff := range _gaa { _fc := true ;
for _ , _ab := range _eeb { if _b . DeepEqual ( _ab , _gff ) { _fc = false ; break ; } ; } ; if _fc { _eeb = append ( _eeb , _gff ) ; _ga . SizeAttr ++ ; } ; } ; } ; } else if _aa . HLinks != nil { _ece . HLinks = _aa . HLinks ; } ; _edg := _fg . GetOrCreateCustomProperties ( ) ; _eeac := docBase1 . GetOrCreateCustomProperties ( ) ;
for _ , _dde := range _eeac . PropertiesList ( ) { _edg . setProperty ( _dde ) ; } ; _fg . CustomProperties = _edg ; _dbd := _fg . Rels . X ( ) . Relationship ; for _ , _abg := range docBase1 . Rels . X ( ) . Relationship { _cf := true ; for _ , _ddf := range _dbd { if _ddf . TargetAttr == _abg . TargetAttr && _ddf . TypeAttr == _abg . TypeAttr { _cf = false ;
break ; } ; } ; if _cf { _fg . Rels . AddRelationship ( _abg . TargetAttr , _abg . TypeAttr ) ; } ; } ; for _ , _gg := range docBase1 . ExtraFiles { _efb := _gg . ZipPath ; _ecg := true ; for _ , _eadg := range _fg . ExtraFiles { if _eadg . ZipPath == _efb { _ecg = false ; break ; } ; } ; if _ecg { _fg . ExtraFiles = append ( _fg . ExtraFiles , _gg ) ;
} ; } ; return _fg ; } ;
2024-02-17 03:37:07 +00:00
2024-05-22 00:21:11 +00:00
// AddHyperlink adds an external hyperlink relationship.
func ( _ddaf Relationships ) AddHyperlink ( target string ) Hyperlink { _bab := _ddaf . AddRelationship ( target , _ead . HyperLinkType ) ; _bab . _befc . TargetModeAttr = _ae . ST_TargetModeExternal ; return Hyperlink ( _bab ) ; } ; func ( _cec CustomProperties ) SetPropertyAsOstorage ( name string , ostorage string ) { _debb := _cec . getNewProperty ( name ) ;
_debb . Ostorage = & ostorage ; _cec . setOrReplaceProperty ( _debb ) ; } ; func ( _ecb CustomProperties ) SetPropertyAsEmpty ( name string ) { _dfbe := _ecb . getNewProperty ( name ) ; _dfbe . Empty = _fa . NewEmpty ( ) ; _ecb . setOrReplaceProperty ( _dfbe ) ; } ;
2024-02-17 03:37:07 +00:00
2024-05-22 00:21:11 +00:00
// SetHeight sets row height, see measurement package.
func ( _cfcb TableRow ) SetHeight ( m _dee . Distance ) { _afdd := _dee . ToEMU ( float64 ( m ) ) ; _cfcb . _cga . HAttr = _c . ST_Coordinate { ST_CoordinateUnqualified : & _afdd } ; } ;
// SetCompany sets the name of the company that created the document.
func ( _df AppProperties ) SetCompany ( s string ) { _df . _eec . Company = & s } ;
// X returns the underlying raw XML data.
func ( _ccbf Relationships ) X ( ) * _ae . Relationships { return _ccbf . _bda } ;
// NewTable makes a new table.
func NewTable ( ) * Table { _fbf := _c . NewTbl ( ) ; _fbf . TblPr = _c . NewCT_TableProperties ( ) ; return & Table { _bbcb : _fbf } ; } ; func ( _adf CustomProperties ) SetPropertyAsR8 ( name string , r8 float64 ) { _cgc := _adf . getNewProperty ( name ) ; _cgc . R8 = & r8 ; _adf . setOrReplaceProperty ( _cgc ) ;
2024-05-04 18:48:06 +00:00
} ;
2024-02-17 03:37:07 +00:00
2024-05-22 00:21:11 +00:00
// CustomProperty contains document specific property.
// Using of this type is deprecated.
type CustomProperty struct { _dccb * _bd . CT_Property } ;
// CopyOverride copies override content type for a given `path` and puts it with a path `newPath`.
func ( _dcd ContentTypes ) CopyOverride ( path , newPath string ) { if ! _gdg . HasPrefix ( path , "\u002f" ) { path = "\u002f" + path ; } ; if ! _gdg . HasPrefix ( newPath , "\u002f" ) { newPath = "\u002f" + newPath ; } ; for _aag := range _dcd . _cab . Override { if _dcd . _cab . Override [ _aag ] . PartNameAttr == path { _fcg := * _dcd . _cab . Override [ _aag ] ;
_fcg . PartNameAttr = newPath ; _dcd . _cab . Override = append ( _dcd . _cab . Override , & _fcg ) ; } ; } ; } ;
// SetLanguage records the language of the document.
func ( _dfc CoreProperties ) SetLanguage ( s string ) { _dfc . _ceg . Language = & _ead . XSDAny { XMLName : _ed . Name { Local : "d\u0063\u003a\u006c\u0061\u006e\u0067\u0075\u0061\u0067\u0065" } } ; _dfc . _ceg . Language . Data = [ ] byte ( s ) ; } ;
// NewCoreProperties constructs a new CoreProperties.
func NewCoreProperties ( ) CoreProperties { return CoreProperties { _ceg : _fad . NewCoreProperties ( ) } } ;
// NewTableWithXfrm makes a new table with a pointer to its parent Xfrm for changing its offset and size.
func NewTableWithXfrm ( xfrm * _c . CT_Transform2D ) * Table { _bgga := _c . NewTbl ( ) ; _bgga . TblPr = _c . NewCT_TableProperties ( ) ; return & Table { _bbcb : _bgga , _cda : xfrm } ; } ; const _ffc = 22 ; func UtcTimeFormat ( t _gd . Time ) string { return t . Format ( _dbc ) + "\u0020\u0055\u0054\u0043" } ;
// SetModified sets the time that the document was modified.
func ( _abbf CoreProperties ) SetModified ( t _gd . Time ) { _abbf . _ceg . Modified = _ggaf ( t , "\u0064\u0063t\u0065\u0072\u006ds\u003a\u006d\u006f\u0064\u0069\u0066\u0069\u0065\u0064" ) ; } ;
// X returns the inner wrapped XML type.
func ( _ggg AppProperties ) X ( ) * _ff . Properties { return _ggg . _eec } ;
// Relationship is a relationship within a .rels file.
type Relationship struct { _befc * _ae . Relationship } ;
2024-05-08 13:54:39 +00:00
// ApplicationVersion returns the version of the application that created the
// document.
2024-05-22 00:21:11 +00:00
func ( _bc AppProperties ) ApplicationVersion ( ) string { if _bc . _eec . AppVersion != nil { return * _bc . _eec . AppVersion ; } ; return "" ; } ; func _fac ( _cbce * _ead . XSDAny ) _gd . Time { if _cbce == nil { return _gd . Time { } ; } ; _dbf , _fd := _gd . Parse ( _fee , string ( _cbce . Data ) ) ;
if _fd != nil { _def . 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 ( _cbce . Data ) , _fd ) ; } ; return _dbf ; } ;
2024-02-17 03:37:07 +00:00
2024-05-08 13:54:39 +00:00
// SetCategory records the category of the document.
2024-05-22 00:21:11 +00:00
func ( _dgb CoreProperties ) SetCategory ( s string ) { _dgb . _ceg . Category = & s } ; func ( _dac CustomProperties ) SetPropertyAsDate ( name string , date _gd . Time ) { date = date . UTC ( ) ; _ffba , _dbfa , _bcb := date . Date ( ) ; _fdc , _dcb , _cgbb := date . Clock ( ) ; _fecf := _gd . Date ( _ffba , _dbfa , _bcb , _fdc , _dcb , _cgbb , 0 , _gd . UTC ) ;
_eff := _dac . getNewProperty ( name ) ; _eff . Filetime = & _fecf ; _dac . setOrReplaceProperty ( _eff ) ; } ;
2024-02-17 03:37:07 +00:00
2024-05-22 00:21:11 +00:00
// Category returns the category of the document
func ( _fea CoreProperties ) Category ( ) string { if _fea . _ceg . Category != nil { return * _fea . _ceg . Category ; } ; return "" ; } ;
2023-03-01 18:42:44 +00:00
2024-05-22 00:21:11 +00:00
// EnsureOverride ensures that an override for the given path exists, adding it if necessary
func ( _bfe ContentTypes ) EnsureOverride ( path , contentType string ) { for _ , _efa := range _bfe . _cab . Override { if _efa . PartNameAttr == path { if _gdg . HasPrefix ( contentType , "\u0068\u0074\u0074\u0070" ) { _def . 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 ) ;
} ; _efa . ContentTypeAttr = contentType ; return ; } ; } ; _bfe . AddOverride ( path , contentType ) ; } ;
2023-03-01 18:42:44 +00:00
2024-05-22 00:21:11 +00:00
// LastModifiedBy returns the name of the last person to modify the document
func ( _debe CoreProperties ) LastModifiedBy ( ) string { if _debe . _ceg . LastModifiedBy != nil { return * _debe . _ceg . LastModifiedBy ; } ; return "" ; } ;
// ContentTypes is the top level "[Content_Types].xml" in a zip package.
type ContentTypes struct { _cab * _gc . Types } ;
2023-03-01 18:42:44 +00:00
2024-05-08 13:54:39 +00:00
// SetTarget set the target (path) of a relationship.
2024-05-22 00:21:11 +00:00
func ( _bgbe Relationship ) SetTarget ( s string ) { _bgbe . _befc . TargetAttr = s } ; func init ( ) { _ee . SetAsStorage ( ) } ;
2023-03-01 18:42:44 +00:00
2024-05-22 00:21:11 +00:00
// AddCol adds a column to a table.
func ( _fdfa Table ) AddCol ( ) * TableCol { _faff := _c . NewCT_TableCol ( ) ; _fdfa . _bbcb . TblGrid . GridCol = append ( _fdfa . _bbcb . TblGrid . GridCol , _faff ) ; for _ , _dfbf := range _fdfa . _bbcb . Tr { _acd := _c . NewCT_TableCell ( ) ; _dfbf . Tc = append ( _dfbf . Tc , _acd ) ;
} ; return & TableCol { _cba : _faff } ; } ;
// NewContentTypes returns a wrapper around a newly constructed content-types.
func NewContentTypes ( ) ContentTypes { _gde := ContentTypes { _cab : _gc . NewTypes ( ) } ; _gde . AddDefault ( "\u0078\u006d\u006c" , "\u0061p\u0070l\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u0078\u006d\u006c" ) ; _gde . 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" ) ;
_gde . AddDefault ( "\u0070\u006e\u0067" , "\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg" ) ; _gde . AddDefault ( "\u006a\u0070\u0065\u0067" , "\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067" ) ; _gde . AddDefault ( "\u006a\u0070\u0067" , "\u0069m\u0061\u0067\u0065\u002f\u006a\u0070g" ) ;
_gde . AddDefault ( "\u0077\u006d\u0066" , "i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066" ) ; _gde . 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" ) ;
_gde . 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 _gde ; } ;
// SetDescription records the description of the document.
func ( _geb CoreProperties ) SetDescription ( s string ) { if _geb . _ceg . Description == nil { _geb . _ceg . Description = & _ead . XSDAny { XMLName : _ed . Name { Local : "\u0064\u0063\u003a\u0064\u0065\u0073\u0063\u0072\u0069p\u0074\u0069\u006f\u006e" } } ; } ; _geb . _ceg . Description . Data = [ ] byte ( s ) ;
2024-05-08 13:54:39 +00:00
} ;
2023-04-15 17:27:31 +00:00
2024-05-22 00:21:11 +00:00
// AppProperties contains properties specific to the document and the
// application that created it.
type AppProperties struct { _eec * _ff . Properties } ; func ( _cdee CustomProperties ) SetPropertyAsBool ( name string , b bool ) { _bba := _cdee . getNewProperty ( name ) ; _bba . Bool = & b ; _cdee . setOrReplaceProperty ( _bba ) ; } ;
2023-05-26 09:49:04 +00:00
2024-05-22 00:21:11 +00:00
// SetStyle assigns TableStyle to a table.
func ( _bae Table ) SetStyle ( style * _c . CT_TableStyle ) { if _bae . _bbcb . TblPr == nil { _bae . _bbcb . TblPr = _c . NewCT_TableProperties ( ) ; } ; if _bae . _bbcb . TblPr . Choice == nil { _bae . _bbcb . TblPr . Choice = _c . NewCT_TablePropertiesChoice ( ) ; } ; _bae . _bbcb . TblPr . Choice . TableStyle = style ;
} ;
2023-08-06 17:57:53 +00:00
2024-05-22 00:21:11 +00:00
// Size returns the size of an image
func ( _eca ImageRef ) Size ( ) _g . Point { return _eca . _dgc . Size } ; func ( _dgf CustomProperties ) setProperty ( _dbg * _bd . CT_Property ) { _dgf . setPropertyHelper ( _dbg , false ) } ;
2023-12-12 23:20:29 +00:00
2024-05-22 00:21:11 +00:00
// GetOrCreateCustomProperties returns the custom properties of the document (and if they not exist yet, creating them first).
func ( _cea * DocBase ) GetOrCreateCustomProperties ( ) CustomProperties { if _cea . CustomProperties . X ( ) == nil { _cea . CreateCustomProperties ( ) ; } ; return _cea . CustomProperties ; } ;
2023-12-12 23:20:29 +00:00
2024-05-22 00:21:11 +00:00
// Remove removes an existing relationship.
func ( _afb Relationships ) Remove ( rel Relationship ) bool { for _ebe , _bfdb := range _afb . _bda . Relationship { if _bfdb == rel . _befc { copy ( _afb . _bda . Relationship [ _ebe : ] , _afb . _bda . Relationship [ _ebe + 1 : ] ) ; _afb . _bda . Relationship = _afb . _bda . Relationship [ 0 : len ( _afb . _bda . Relationship ) - 1 ] ;
return true ; } ; } ; return false ; } ;
2023-12-12 23:20:29 +00:00
2024-05-22 00:21:11 +00:00
// RemoveOverride removes an override given a path.
func ( _dcc ContentTypes ) RemoveOverride ( path string ) { if ! _gdg . HasPrefix ( path , "\u002f" ) { path = "\u002f" + path ; } ; for _gab , _abb := range _dcc . _cab . Override { if _abb . PartNameAttr == path { copy ( _dcc . _cab . Override [ _gab : ] , _dcc . _cab . Override [ _gab + 1 : ] ) ;
_dcc . _cab . Override = _dcc . _cab . Override [ 0 : len ( _dcc . _cab . Override ) - 1 ] ; } ; } ; } ;
2024-05-08 13:54:39 +00:00
2024-05-22 00:21:11 +00:00
// Relationships returns a slice of all of the relationships.
func ( _adgf Relationships ) Relationships ( ) [ ] Relationship { _aaga := [ ] Relationship { } ; for _ , _agg := range _adgf . _bda . Relationship { _aaga = append ( _aaga , Relationship { _befc : _agg } ) ; } ; return _aaga ; } ;
2024-05-08 13:54:39 +00:00
2024-05-22 00:21:11 +00:00
// Path returns the path to an image file, if any.
func ( _fcgc ImageRef ) Path ( ) string { return _fcgc . _dgc . Path } ;
2023-12-12 23:20:29 +00:00
2024-05-22 00:21:11 +00:00
// Properties returns table properties.
func ( _bebb Table ) Properties ( ) * _c . CT_TableProperties { return _bebb . _bbcb . TblPr } ;
2024-05-04 18:48:06 +00:00
2024-05-22 00:21:11 +00:00
// AddRow adds a row to a table.
func ( _feg Table ) AddRow ( ) * TableRow { _dcad := _c . NewCT_TableRow ( ) ; for _fdad := 0 ; _fdad < len ( _feg . _bbcb . TblGrid . GridCol ) ; _fdad ++ { _dcad . Tc = append ( _dcad . Tc , _c . NewCT_TableCell ( ) ) ; } ; _feg . _bbcb . Tr = append ( _feg . _bbcb . Tr , _dcad ) ; return & TableRow { _cga : _dcad } ;
} ; func ( _dca CustomProperties ) SetPropertyAsStorage ( name string , storage string ) { _dfe := _dca . getNewProperty ( name ) ; _dfe . Storage = & storage ; _dca . setOrReplaceProperty ( _dfe ) ; } ;
2024-05-04 18:48:06 +00:00
2024-05-08 13:54:39 +00:00
// NewCustomProperties constructs a new CustomProperties.
2024-05-22 00:21:11 +00:00
func NewCustomProperties ( ) CustomProperties { return CustomProperties { _faeg : _bd . NewProperties ( ) } } ; func ( _gbc CustomProperties ) SetPropertyAsNull ( name string ) { _cbcg := _gbc . getNewProperty ( name ) ; _cbcg . Null = _fa . NewNull ( ) ; _gbc . setOrReplaceProperty ( _cbcg ) ;
} ; var _fdgc = _ad . 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" ) ; func ( _bee CustomProperties ) SetPropertyAsI2 ( name string , i2 int16 ) { _ccad := _bee . getNewProperty ( name ) ;
_ccad . I2 = & i2 ; _bee . setOrReplaceProperty ( _ccad ) ; } ; func ( _fec CustomProperties ) SetPropertyAsCy ( name string , cy string ) { _cde := _fec . getNewProperty ( name ) ; _cde . Cy = & cy ; _fec . setOrReplaceProperty ( _cde ) ; } ;
2024-05-04 18:48:06 +00:00
2024-05-22 00:21:11 +00:00
// SetWidth sets column width, see measurement package.
func ( _beg TableCol ) SetWidth ( m _dee . Distance ) { _gdf := _dee . ToEMU ( float64 ( m ) ) ; _beg . _cba . WAttr = _c . ST_Coordinate { ST_CoordinateUnqualified : & _gdf } ; } ; func ( _dbgc CustomProperties ) SetPropertyAsLpwstr ( name string , lpwstr string ) { _gbe := _dbgc . getNewProperty ( name ) ;
_gbe . Lpwstr = & lpwstr ; _dbgc . setOrReplaceProperty ( _gbe ) ; } ;
// Description returns the description of the document
func ( _bebd CoreProperties ) Description ( ) string { if _bebd . _ceg . Description != nil { return string ( _bebd . _ceg . Description . Data ) ; } ; return "" ; } ;
// NewAppProperties constructs a new AppProperties.
func NewAppProperties ( ) AppProperties { _ade := AppProperties { _eec : _ff . NewProperties ( ) } ; _ade . SetCompany ( "\u0046\u006f\u0078\u0079\u0055\u0074\u0069\u006c\u0073\u0020\u0065\u0068\u0066" ) ; _ade . SetApplication ( "g\u0069\u0074\u0068\u0075\u0062\u002ec\u006f\u006d\u002f\u0075\u006e\u0069\u0064\u006f\u0063/\u0075\u006e\u0069o\u0066f\u0069\u0063\u0065" ) ;
_ade . SetDocSecurity ( 0 ) ; _ade . SetLinksUpToDate ( false ) ; var _dba , _bf , _deea int64 ; _ec . Sscanf ( Version , "\u0025\u0064\u002e\u0025\u0064\u002e\u0025\u0064" , & _dba , & _bf , & _deea ) ; _eeg := float64 ( _dba ) + float64 ( _bf ) / 10000.0 ; _ade . SetApplicationVersion ( _ec . Sprintf ( "\u0025\u0030\u0037\u002e\u0034\u0066" , _eeg ) ) ;
return _ade ; } ;
// TblStyle returns the TblStyle property.
func ( _bfcb TableStyles ) TblStyle ( ) [ ] * _c . CT_TableStyle { return _bfcb . _bfeg . TblStyle } ;
// 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 ( _acb AppProperties ) Pages ( ) int32 { if _acb . _eec . Pages != nil { return * _acb . _eec . Pages ; } ; return 0 ; } ;
// Target returns the target (path) of a relationship.
func ( _ecbf Relationship ) Target ( ) string { return _ecbf . _befc . TargetAttr } ;
// Clear removes any existing relationships.
func ( _aga Relationships ) Clear ( ) { _aga . _bda . Relationship = nil } ; func ( _fdg CustomProperties ) SetPropertyAsUint ( name string , ui uint ) { _ddac := _fdg . getNewProperty ( name ) ; _ffd := uint32 ( ui ) ; _ddac . Uint = & _ffd ; _fdg . setOrReplaceProperty ( _ddac ) ; } ;
// 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 ) { _dfea := Image { } ; _fcgf , _cfa , _dacg := _g . Decode ( _be . NewReader ( data ) ) ; if _dacg != nil { return _dfea , _ec . Errorf ( "\u0075n\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0070\u0061r\u0073e\u0020i\u006d\u0061\u0067\u0065\u003a\u0020\u0025s" , _dacg ) ;
} ; _dfea . Data = & data ; _dfea . Format = _cfa ; _dfea . Size = _fcgf . Bounds ( ) . Size ( ) ; return _dfea , nil ; } ;
// RelID returns the relationship ID.
func ( _feca ImageRef ) RelID ( ) string { return _feca . _ggb } ; func ( _fda CustomProperties ) setPropertyHelper ( _eab * _bd . CT_Property , _agdf bool ) { _afea := _fda . GetPropertyByName ( * _eab . NameAttr ) ; if ( _afea == CustomProperty { } ) { _fda . _faeg . Property = append ( _fda . _faeg . Property , _eab ) ;
} else if _agdf { _eab . FmtidAttr = _afea . _dccb . FmtidAttr ; if _afea . _dccb . PidAttr == 0 { _eab . PidAttr = _afea . _dccb . PidAttr ; } ; _eab . LinkTargetAttr = _afea . _dccb . LinkTargetAttr ; * _afea . _dccb = * _eab ; } ; } ;
// Properties returns table properties.
func ( _beab Table ) Grid ( ) * _c . CT_TableGrid { return _beab . _bbcb . TblGrid } ;
// RemoveOverrideByIndex removes an override given a path and override index.
func ( _cd ContentTypes ) RemoveOverrideByIndex ( path string , indexToFind int ) error { _ag := path [ 0 : len ( path ) - 5 ] ; if ! _gdg . HasPrefix ( _ag , "\u002f" ) { _ag = "\u002f" + _ag ; } ; _fe , _cad := _de . Compile ( _ag + "\u0028\u005b\u0030-\u0039\u005d\u002b\u0029\u002e\u0078\u006d\u006c" ) ;
if _cad != nil { return _cad ; } ; _cfg := 0 ; _bde := - 1 ; for _ccb , _bea := range _cd . _cab . Override { if _af := _fe . FindStringSubmatch ( _bea . PartNameAttr ) ; len ( _af ) > 1 { if _cfg == indexToFind { _bde = _ccb ; } else if _cfg > indexToFind { _afe , _ := _dc . Atoi ( _af [ 1 ] ) ;
_afe -- ; _bea . PartNameAttr = _ec . Sprintf ( "\u0025\u0073\u0025\u0064\u002e\u0078\u006d\u006c" , _ag , _afe ) ; } ; _cfg ++ ; } ; } ; if _bde > - 1 { copy ( _cd . _cab . Override [ _bde : ] , _cd . _cab . Override [ _bde + 1 : ] ) ; _cd . _cab . Override = _cd . _cab . Override [ 0 : len ( _cd . _cab . Override ) - 1 ] ;
} ; return nil ; } ;