unioffice/common/common.go
2024-02-17 03:37:07 +00:00

502 lines
49 KiB
Go

//
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/
// Package common contains wrapper types and utilities common to all of the
// OOXML document formats.
//
// Package common contains common properties used by the subpackages.
package common ;import (_ea "archive/zip";_b "bytes";_ac "encoding/xml";_ebb "errors";_fc "fmt";_ga "github.com/unidoc/unioffice";_ad "github.com/unidoc/unioffice/common/logger";_fce "github.com/unidoc/unioffice/common/tempstorage";_gd "github.com/unidoc/unioffice/common/tempstorage/diskstore";
_gf "github.com/unidoc/unioffice/measurement";_ebc "github.com/unidoc/unioffice/schema/soo/dml";_cd "github.com/unidoc/unioffice/schema/soo/ofc/custom_properties";_dc "github.com/unidoc/unioffice/schema/soo/ofc/docPropsVTypes";_ce "github.com/unidoc/unioffice/schema/soo/ofc/extended_properties";
_acc "github.com/unidoc/unioffice/schema/soo/pkg/content_types";_db "github.com/unidoc/unioffice/schema/soo/pkg/metadata/core_properties";_gfd "github.com/unidoc/unioffice/schema/soo/pkg/relationships";_ed "github.com/unidoc/unioffice/zippkg";_eb "image";
_ "image/gif";_ "image/jpeg";_ "image/png";_e "os";_d "reflect";_g "regexp";_ef "strconv";_ec "strings";_bc "time";);
// Append appends DocBase part of an office document to another DocBase.
func (_fcd DocBase )Append (docBase1 DocBase )DocBase {_efd :=docBase1 .ContentTypes .X ();for _ ,_ca :=range _efd .Default {_fcd .ContentTypes .AddDefault (_ca .ExtensionAttr ,_ca .ContentTypeAttr );};for _ ,_fb :=range _efd .Override {_fcd .ContentTypes .AddOverride (_fb .PartNameAttr ,_fb .ContentTypeAttr );
};_bb :=_fcd .AppProperties .X ();_adb :=docBase1 .AppProperties .X ();if _bb .Pages !=nil {if _adb .Pages !=nil {*_bb .Pages +=*_adb .Pages ;};}else if _adb .Pages !=nil {_bb .Pages =_adb .Pages ;};if _bb .Words !=nil {if _adb .Words !=nil {*_bb .Words +=*_adb .Words ;
};}else if _adb .Words !=nil {_bb .Words =_adb .Words ;};if _bb .Characters !=nil {if _adb .Characters !=nil {*_bb .Characters +=*_adb .Characters ;};}else if _adb .Characters !=nil {_bb .Characters =_adb .Characters ;};if _bb .Lines !=nil {if _adb .Lines !=nil {*_bb .Lines +=*_adb .Lines ;
};}else if _adb .Lines !=nil {_bb .Lines =_adb .Lines ;};if _bb .Paragraphs !=nil {if _adb .Paragraphs !=nil {*_bb .Paragraphs +=*_adb .Paragraphs ;};}else if _adb .Paragraphs !=nil {_bb .Paragraphs =_adb .Paragraphs ;};if _bb .Notes !=nil {if _adb .Notes !=nil {*_bb .Notes +=*_adb .Notes ;
};}else if _adb .Notes !=nil {_bb .Notes =_adb .Notes ;};if _bb .HiddenSlides !=nil {if _adb .HiddenSlides !=nil {*_bb .HiddenSlides +=*_adb .HiddenSlides ;};}else if _adb .HiddenSlides !=nil {_bb .HiddenSlides =_adb .HiddenSlides ;};if _bb .MMClips !=nil {if _adb .MMClips !=nil {*_bb .MMClips +=*_adb .MMClips ;
};}else if _adb .MMClips !=nil {_bb .MMClips =_adb .MMClips ;};if _bb .LinksUpToDate !=nil {if _adb .LinksUpToDate !=nil {*_bb .LinksUpToDate =*_bb .LinksUpToDate &&*_adb .LinksUpToDate ;};}else if _adb .LinksUpToDate !=nil {_bb .LinksUpToDate =_adb .LinksUpToDate ;
};if _bb .CharactersWithSpaces !=nil {if _adb .CharactersWithSpaces !=nil {*_bb .CharactersWithSpaces +=*_adb .CharactersWithSpaces ;};}else if _adb .CharactersWithSpaces !=nil {_bb .CharactersWithSpaces =_adb .CharactersWithSpaces ;};if _bb .SharedDoc !=nil {if _adb .SharedDoc !=nil {*_bb .SharedDoc =*_bb .SharedDoc ||*_adb .SharedDoc ;
};}else if _adb .SharedDoc !=nil {_bb .SharedDoc =_adb .SharedDoc ;};if _bb .HyperlinksChanged !=nil {if _adb .HyperlinksChanged !=nil {*_bb .HyperlinksChanged =*_bb .HyperlinksChanged ||*_adb .HyperlinksChanged ;};}else if _adb .HyperlinksChanged !=nil {_bb .HyperlinksChanged =_adb .HyperlinksChanged ;
};_bb .DigSig =nil ;if _bb .TitlesOfParts ==nil &&_adb .TitlesOfParts !=nil {_bb .TitlesOfParts =_adb .TitlesOfParts ;};if _bb .HeadingPairs !=nil {if _adb .HeadingPairs !=nil {_fg :=_bb .HeadingPairs .Vector ;_gc :=_adb .HeadingPairs .Vector ;_ecd :=_fg .Variant ;
_gg :=_gc .Variant ;_fbc :=[]*_dc .Variant {};for _adc :=0;_adc < len (_gg );_adc +=2{_fd :=_gg [_adc ].Lpstr ;_ced :=false ;for _de :=0;_de < len (_ecd );_de +=2{_ba :=_ecd [_de ].Lpstr ;if _ba !=nil &&_fd !=nil &&*_ba ==*_fd {*_ecd [_de +1].I4 =*_ecd [_de +1].I4 +*_gg [_adc +1].I4 ;
_ced =true ;break ;};};if !_ced {_fbc =append (_fbc ,&_dc .Variant {CT_Variant :_dc .CT_Variant {Lpstr :_gg [_adc ].Lpstr }});_fbc =append (_fbc ,&_dc .Variant {CT_Variant :_dc .CT_Variant {I4 :_gg [_adc ].I4 }});};};_ecd =append (_ecd ,_fbc ...);_fg .SizeAttr =uint32 (len (_ecd ));
};}else if _adb .HeadingPairs !=nil {_bb .HeadingPairs =_adb .HeadingPairs ;};if _bb .HLinks !=nil {if _adb .HLinks !=nil {_dec :=_bb .HLinks .Vector ;_bd :=_adb .HLinks .Vector ;_cc :=_dec .Variant ;_ded :=_bd .Variant ;for _ ,_dg :=range _ded {_bdc :=true ;
for _ ,_aca :=range _cc {if _d .DeepEqual (_aca ,_dg ){_bdc =false ;break ;};};if _bdc {_cc =append (_cc ,_dg );_dec .SizeAttr ++;};};};}else if _adb .HLinks !=nil {_bb .HLinks =_adb .HLinks ;};_ecf :=_fcd .GetOrCreateCustomProperties ();_ag :=docBase1 .GetOrCreateCustomProperties ();
for _ ,_bcc :=range _ag .PropertiesList (){_ecf .setProperty (_bcc );};_fcd .CustomProperties =_ecf ;_eg :=_fcd .Rels .X ().Relationship ;for _ ,_dcb :=range docBase1 .Rels .X ().Relationship {_eaf :=true ;for _ ,_cb :=range _eg {if _cb .TargetAttr ==_dcb .TargetAttr &&_cb .TypeAttr ==_dcb .TypeAttr {_eaf =false ;
break ;};};if _eaf {_fcd .Rels .AddRelationship (_dcb .TargetAttr ,_dcb .TypeAttr );};};for _ ,_bg :=range docBase1 .ExtraFiles {_gb :=_bg .ZipPath ;_ecc :=true ;for _ ,_bda :=range _fcd .ExtraFiles {if _bda .ZipPath ==_gb {_ecc =false ;break ;};};if _ecc {_fcd .ExtraFiles =append (_fcd .ExtraFiles ,_bg );
};};return _fcd ;};func (_eafg CustomProperties )SetPropertyAsI2 (name string ,i2 int16 ){_fcb :=_eafg .getNewProperty (name );_fcb .I2 =&i2 ;_eafg .setOrReplaceProperty (_fcb );};
// 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 _eb .Point ;Format string ;Path string ;Data *[]byte ;};
// Category returns the category of the document
func (_eef CoreProperties )Category ()string {if _eef ._bccg .Category !=nil {return *_eef ._bccg .Category ;};return "";};func (_baf CustomProperties )setOrReplaceProperty (_abe *_cd .CT_Property ){_baf .setPropertyHelper (_abe ,true );};
// 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 (_adca *DocBase )AddExtraFileFromZip (f *_ea .File )error {_effe ,_bagd :=_ed .ExtractToDiskTmp (f ,_adca .TmpPath );if _bagd !=nil {return _fc .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",_bagd );
};_adca .ExtraFiles =append (_adca .ExtraFiles ,ExtraFile {ZipPath :f .Name ,DiskPath :_effe });return nil ;};func (_edc CustomProperties )SetPropertyAsOstorage (name string ,ostorage string ){_ddd :=_edc .getNewProperty (name );_ddd .Ostorage =&ostorage ;
_edc .setOrReplaceProperty (_ddd );};
// ContentStatus returns the content status of the document (e.g. "Final", "Draft")
func (_edd CoreProperties )ContentStatus ()string {if _edd ._bccg .ContentStatus !=nil {return *_edd ._bccg .ContentStatus ;};return "";};
// AddCol adds a column to a table.
func (_eea Table )AddCol ()*TableCol {_fcca :=_ebc .NewCT_TableCol ();_eea ._adce .TblGrid .GridCol =append (_eea ._adce .TblGrid .GridCol ,_fcca );for _ ,_fdf :=range _eea ._adce .Tr {_dgeb :=_ebc .NewCT_TableCell ();_fdf .Tc =append (_fdf .Tc ,_dgeb );
};return &TableCol {_aad :_fcca };};
// SetCreated sets the time that the document was created.
func (_gadc CoreProperties )SetCreated (t _bc .Time ){_gadc ._bccg .Created =_bcgc (t ,"\u0064c\u0074e\u0072\u006d\u0073\u003a\u0063\u0072\u0065\u0061\u0074\u0065\u0064");};func (_fea CustomProperties )SetPropertyAsStream (name string ,stream string ){_dcfe :=_fea .getNewProperty (name );
_dcfe .Stream =&stream ;_fea .setOrReplaceProperty (_dcfe );};
// SetID set the ID of a relationship.
func (_dbd Relationship )SetID (ID string ){_dbd ._ebf .IdAttr =ID ;};
// NewRelationships creates a new relationship wrapper.
func NewRelationships ()Relationships {return Relationships {_fgb :_gfd .NewRelationships ()}};
// X returns the inner wrapped XML type.
func (_bbfb CoreProperties )X ()*_db .CoreProperties {return _bbfb ._bccg };
// SetCategory records the category of the document.
func (_eccd CoreProperties )SetCategory (s string ){_eccd ._bccg .Category =&s };func (_bga Relationship )String ()string {return _fc .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",_bga .ID (),_bga .Target (),_bga .Type ());
};
// SetDocSecurity sets the document security flag.
func (_eed AppProperties )SetDocSecurity (v int32 ){_eed ._bf .DocSecurity =_ga .Int32 (v )};
// CopyRelationship copies the relationship.
func (_aag Relationships )CopyRelationship (idAttr string )(Relationship ,bool ){for _aba :=range _aag ._fgb .Relationship {if _aag ._fgb .Relationship [_aba ].IdAttr ==idAttr {_aaf :=*_aag ._fgb .Relationship [_aba ];_gba :=len (_aag ._fgb .Relationship )+1;
_cggf :=map[string ]struct{}{};for _ ,_dfged :=range _aag ._fgb .Relationship {_cggf [_dfged .IdAttr ]=struct{}{};};for _ ,_fgdd :=_cggf [_fc .Sprintf ("\u0072\u0049\u0064%\u0064",_gba )];_fgdd ;_ ,_fgdd =_cggf [_fc .Sprintf ("\u0072\u0049\u0064%\u0064",_gba )]{_gba ++;
};_aaf .IdAttr =_fc .Sprintf ("\u0072\u0049\u0064%\u0064",_gba );_aag ._fgb .Relationship =append (_aag ._fgb .Relationship ,&_aaf );return Relationship {_ebf :&_aaf },true ;};};return Relationship {},false ;};func (_ege CustomProperties )SetPropertyAsOblob (name ,oblob string ){_dcbe :=_ege .getNewProperty (name );
_dcbe .Oblob =&oblob ;_ege .setOrReplaceProperty (_dcbe );};const _dgfe =30;
// IsEmpty returns true if there are no relationships.
func (_eedb Relationships )IsEmpty ()bool {return _eedb ._fgb ==nil ||len (_eedb ._fgb .Relationship )==0;};
// TableRow represents a row in a table.
type TableRow struct{_fdaad *_ebc .CT_TableRow };const _dfgd ="\u0032\u0020\u004aan\u0075\u0061\u0072\u0079\u0020\u0032\u0030\u0030\u0036\u0020\u0061\u0074\u0020\u0031\u0035\u003a\u0030\u0034";func (_egd CustomProperties )SetPropertyAsVector (name string ,vector *_dc .Vector ){_gcb :=_egd .getNewProperty (name );
_gcb .Vector =vector ;_egd .setOrReplaceProperty (_gcb );};
// Title returns the Title of the document
func (_ebg CoreProperties )Title ()string {if _ebg ._bccg .Title !=nil {return string (_ebg ._bccg .Title .Data );};return "";};func (_af CustomProperties )SetPropertyAsBstr (name string ,bstr string ){_egeb :=_af .getNewProperty (name );_egeb .Bstr =&bstr ;
_af .setOrReplaceProperty (_egeb );};
// Target returns the target attrubute of the image reference (a path where the image file is located in the document structure).
func (_dcbf *ImageRef )Target ()string {return _dcbf ._gfa };func (_eedf CustomProperties )SetPropertyAsOstream (name string ,ostream string ){_fgga :=_eedf .getNewProperty (name );_fgga .Ostream =&ostream ;_eedf .setOrReplaceProperty (_fgga );};func (_accc CustomProperties )SetPropertyAsBlob (name ,blob string ){_cbb :=_accc .getNewProperty (name );
_cbb .Blob =&blob ;_accc .setOrReplaceProperty (_cbb );};func (_afb CustomProperties )SetPropertyAsCy (name string ,cy string ){_ccd :=_afb .getNewProperty (name );_ccd .Cy =&cy ;_afb .setOrReplaceProperty (_ccd );};
// CustomProperty contains document specific property.
// Using of this type is deprecated.
type CustomProperty struct{_fbf *_cd .CT_Property };func (_gff CustomProperties )SetPropertyAsDecimal (name string ,decimal float64 ){_acag :=_gff .getNewProperty (name );_acag .Decimal =&decimal ;_gff .setOrReplaceProperty (_acag );};
// 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 (_edb *ImageRef )SetTarget (target string ){_edb ._gfa =target };
// SetOffsetY sets vertical offset of a table in distance units (see measurement package).
func (_cgfc Table )SetOffsetY (offY float64 ){if _cgfc ._dde .Off ==nil {_cgfc ._dde .Off =_ebc .NewCT_Point2D ();_fgaa :=int64 (0);_cgfc ._dde .Off .XAttr =_ebc .ST_Coordinate {ST_CoordinateUnqualified :&_fgaa };};_gcga :=_gf .ToEMU (offY );_cgfc ._dde .Off .YAttr =_ebc .ST_Coordinate {ST_CoordinateUnqualified :&_gcga };
};
// LastModifiedBy returns the name of the last person to modify the document
func (_fa CoreProperties )LastModifiedBy ()string {if _fa ._bccg .LastModifiedBy !=nil {return *_fa ._bccg .LastModifiedBy ;};return "";};
// AddHyperlink adds an external hyperlink relationship.
func (_ebbc Relationships )AddHyperlink (target string )Hyperlink {_gaca :=_ebbc .AddRelationship (target ,_ga .HyperLinkType );_gaca ._ebf .TargetModeAttr =_gfd .ST_TargetModeExternal ;return Hyperlink (_gaca );};
// RemoveOverrideByIndex removes an override given a path and override index.
func (_dbg ContentTypes )RemoveOverrideByIndex (path string ,indexToFind int )error {_gfe :=path [0:len (path )-5];if !_ec .HasPrefix (_gfe ,"\u002f"){_gfe ="\u002f"+_gfe ;};_cag ,_dedf :=_g .Compile (_gfe +"\u0028\u005b\u0030-\u0039\u005d\u002b\u0029\u002e\u0078\u006d\u006c");
if _dedf !=nil {return _dedf ;};_fgf :=0;_adbc :=-1;for _cdf ,_gedf :=range _dbg ._gbe .Override {if _bdf :=_cag .FindStringSubmatch (_gedf .PartNameAttr );len (_bdf )> 1{if _fgf ==indexToFind {_adbc =_cdf ;}else if _fgf > indexToFind {_fgg ,_ :=_ef .Atoi (_bdf [1]);
_fgg --;_gedf .PartNameAttr =_fc .Sprintf ("\u0025\u0073\u0025\u0064\u002e\u0078\u006d\u006c",_gfe ,_fgg );};_fgf ++;};};if _adbc > -1{copy (_dbg ._gbe .Override [_adbc :],_dbg ._gbe .Override [_adbc +1:]);_dbg ._gbe .Override =_dbg ._gbe .Override [0:len (_dbg ._gbe .Override )-1];
};return nil ;};func (_aea CustomProperties )SetPropertyAsEmpty (name string ){_gcgg :=_aea .getNewProperty (name );_gcgg .Empty =_dc .NewEmpty ();_aea .setOrReplaceProperty (_gcgg );};func (_dcf CustomProperties )SetPropertyAsUi8 (name string ,ui8 uint64 ){_gda :=_dcf .getNewProperty (name );
_gda .Ui8 =&ui8 ;_dcf .setOrReplaceProperty (_gda );};
// Path returns the path to an image file, if any.
func (_cffe ImageRef )Path ()string {return _cffe ._egdb .Path };func (_bgbd CustomProperties )SetPropertyAsR4 (name string ,r4 float32 ){_cbe :=_bgbd .getNewProperty (name );_cbe .R4 =&r4 ;_bgbd .setOrReplaceProperty (_cbe );};
// SetApplicationVersion sets the version of the application that created the
// document. Per MS, the verison string mut be in the form 'XX.YYYY'.
func (_be AppProperties )SetApplicationVersion (s string ){_be ._bf .AppVersion =&s };func (_agcc CustomProperties )SetPropertyAsDate (name string ,date _bc .Time ){date =date .UTC ();_begf ,_dbae ,_ebbf :=date .Date ();_aeg ,_daba ,_ggc :=date .Clock ();
_bfeb :=_bc .Date (_begf ,_dbae ,_ebbf ,_aeg ,_daba ,_ggc ,0,_bc .UTC );_gde :=_agcc .getNewProperty (name );_gde .Filetime =&_bfeb ;_agcc .setOrReplaceProperty (_gde );};func (_gea CustomProperties )SetPropertyAsInt (name string ,i int ){_dd :=_gea .getNewProperty (name );
_acb :=int32 (i );_dd .Int =&_acb ;_gea .setOrReplaceProperty (_dd );};
// DefAttr returns the DefAttr property.
func (_bgcc TableStyles )DefAttr ()string {return _bgcc ._cdgd .DefAttr };
// NewTable makes a new table.
func NewTable ()*Table {_bca :=_ebc .NewTbl ();_bca .TblPr =_ebc .NewCT_TableProperties ();return &Table {_adce :_bca };};
// X returns the inner wrapped XML type.
func (_gcd AppProperties )X ()*_ce .Properties {return _gcd ._bf };
// FindRIDForN returns the relationship ID for the i'th relationship of type t.
func (_ffb Relationships )FindRIDForN (i int ,t string )string {for _ ,_fda :=range _ffb ._fgb .CT_Relationships .Relationship {if _fda .TypeAttr ==t {if i ==0{return _fda .IdAttr ;};i --;};};return "";};
// X returns the inner wrapped XML type.
func (_gddb Theme )X ()*_ebc .Theme {return _gddb ._dgfg };
// RelativeHeight returns the relative height of an image given a fixed width.
// This is used when setting image to a fixed width to calculate the height
// required to keep the same image aspect ratio.
func (_gfc ImageRef )RelativeHeight (w _gf .Distance )_gf .Distance {_dfeb :=float64 (_gfc .Size ().Y )/float64 (_gfc .Size ().X );return w *_gf .Distance (_dfeb );};
// TableStyles contains document specific properties.
type TableStyles struct{_cdgd *_ebc .TblStyleLst };
// Author returns the author of the document
func (_fcg CoreProperties )Author ()string {if _fcg ._bccg .Creator !=nil {return string (_fcg ._bccg .Creator .Data );};return "";};
// CoreProperties contains document specific properties.
type CoreProperties struct{_bccg *_db .CoreProperties };
// NewRelationshipsCopy creates a new relationships wrapper as a copy of passed in instance.
func NewRelationshipsCopy (rels Relationships )Relationships {_fcgg :=*rels ._fgb ;return Relationships {_fgb :&_fcgg };};func (_gbb CustomProperties )SetPropertyAsUint (name string ,ui uint ){_ceb :=_gbb .getNewProperty (name );_cdfd :=uint32 (ui );_ceb .Uint =&_cdfd ;
_gbb .setOrReplaceProperty (_ceb );};func (_bag CustomProperties )SetPropertyAsLpwstr (name string ,lpwstr string ){_ffg :=_bag .getNewProperty (name );_ffg .Lpwstr =&lpwstr ;_bag .setOrReplaceProperty (_ffg );};
// Data returns the data of an image file, if any.
func (_fege ImageRef )Data ()*[]byte {return _fege ._egdb .Data };func (_ebbbd CustomProperties )SetPropertyAsVstream (name string ,vstream *_dc .Vstream ){_agea :=_ebbbd .getNewProperty (name );_agea .Vstream =vstream ;_ebbbd .setOrReplaceProperty (_agea );
};
// AddDefault registers a default content type for a given file extension.
func (_gec ContentTypes )AddDefault (fileExtension string ,contentType string ){fileExtension =_ec .ToLower (fileExtension );for _ ,_gaa :=range _gec ._gbe .Default {if _gaa .ExtensionAttr ==fileExtension {return ;};};_bfe :=_acc .NewDefault ();_bfe .ExtensionAttr =fileExtension ;
_bfe .ContentTypeAttr =contentType ;_gec ._gbe .Default =append (_gec ._gbe .Default ,_bfe );};
// ExtraFile is an unsupported file type extracted from, or to be written to a
// zip package
type ExtraFile struct{ZipPath string ;DiskPath string ;};func (_bgb CustomProperties )SetPropertyAsI8 (name string ,i8 int64 ){_agg :=_bgb .getNewProperty (name );_agg .I8 =&i8 ;_bgb .setOrReplaceProperty (_agg );};
// TableCol represents a column in a table.
type TableCol struct{_aad *_ebc .CT_TableCol };
// X returns the inner wrapped XML type.
func (_egcb Relationship )X ()*_gfd .Relationship {return _egcb ._ebf };
// TblStyle returns the TblStyle property.
func (_cbcf TableStyles )TblStyle ()[]*_ebc .CT_TableStyle {return _cbcf ._cdgd .TblStyle };
// Relationships returns a slice of all of the relationships.
func (_cbd Relationships )Relationships ()[]Relationship {_dad :=[]Relationship {};for _ ,_cdgg :=range _cbd ._fgb .Relationship {_dad =append (_dad ,Relationship {_ebf :_cdgg });};return _dad ;};func (_faaf CustomProperties )SetPropertyAsUi1 (name string ,ui1 uint8 ){_fad :=_faaf .getNewProperty (name );
_fad .Ui1 =&ui1 ;_faaf .setOrReplaceProperty (_fad );};
// ID returns the ID of a relationship.
func (_feae Relationship )ID ()string {return _feae ._ebf .IdAttr };
// X returns the inner wrapped XML type.
func (_ebfg Table )X ()*_ebc .Tbl {return _ebfg ._adce };var _egccc =_ebb .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 (_cff CustomProperties )SetPropertyAsLpstr (name string ,lpstr string ){_add :=_cff .getNewProperty (name );
_add .Lpstr =&lpstr ;_cff .setOrReplaceProperty (_add );};
// GetByRelId returns a relationship with the associated relation ID.
func (_cade Relationships )GetByRelId (idAttr string )Relationship {for _ ,_gdd :=range _cade ._fgb .Relationship {if _gdd .IdAttr ==idAttr {return Relationship {_ebf :_gdd };};};return Relationship {};};
// EnsureDefault esnures that an extension and default content type exist,
// adding it if necessary.
func (_gad ContentTypes )EnsureDefault (ext ,contentType string ){ext =_ec .ToLower (ext );for _ ,_bdb :=range _gad ._gbe .Default {if _bdb .ExtensionAttr ==ext {_bdb .ContentTypeAttr =contentType ;return ;};};_dba :=&_acc .Default {};_dba .ContentTypeAttr =contentType ;
_dba .ExtensionAttr =ext ;_gad ._gbe .Default =append (_gad ._gbe .Default ,_dba );};
// Relationships represents a .rels file.
type Relationships struct{_fgb *_gfd .Relationships };
// GetPropertyByName returns a custom property selected by it's name.
func (_cegc CustomProperties )GetPropertyByName (name string )CustomProperty {_aga :=_cegc ._aaa .Property ;for _ ,_gab :=range _aga {if *_gab .NameAttr ==name {return CustomProperty {_fbf :_gab };};};return CustomProperty {};};
// ContentTypes is the top level "[Content_Types].xml" in a zip package.
type ContentTypes struct{_gbe *_acc .Types };
// NewContentTypes returns a wrapper around a newly constructed content-types.
func NewContentTypes ()ContentTypes {_ggfb :=ContentTypes {_gbe :_acc .NewTypes ()};_ggfb .AddDefault ("\u0078\u006d\u006c","\u0061p\u0070l\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u0078\u006d\u006c");_ggfb .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");
_ggfb .AddDefault ("\u0070\u006e\u0067","\u0069m\u0061\u0067\u0065\u002f\u0070\u006eg");_ggfb .AddDefault ("\u006a\u0070\u0065\u0067","\u0069\u006d\u0061\u0067\u0065\u002f\u006a\u0070\u0065\u0067");_ggfb .AddDefault ("\u006a\u0070\u0067","\u0069m\u0061\u0067\u0065\u002f\u006a\u0070g");
_ggfb .AddDefault ("\u0077\u006d\u0066","i\u006d\u0061\u0067\u0065\u002f\u0078\u002d\u0077\u006d\u0066");_ggfb .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");
_ggfb .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 _ggfb ;};
// 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 ){_gdg :=Image {};_gace ,_geg :=_fce .Open (path );if _geg !=nil {return _gdg ,_fc .Errorf ("\u0065\u0072\u0072or\u0020\u0072\u0065\u0061\u0064\u0069\u006e\u0067\u0020\u0069\u006d\u0061\u0067\u0065\u003a\u0020\u0025\u0073",_geg );
};defer _gace .Close ();_gacd ,_gca ,_geg :=_eb .Decode (_gace );if _geg !=nil {return _gdg ,_fc .Errorf ("\u0075n\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0070\u0061r\u0073e\u0020i\u006d\u0061\u0067\u0065\u003a\u0020\u0025s",_geg );};_gdg .Path =path ;
_gdg .Format =_gca ;_gdg .Size =_gacd .Bounds ().Size ();return _gdg ,nil ;};
// NewRelationship constructs a new relationship.
func NewRelationship ()Relationship {return Relationship {_ebf :_gfd .NewRelationship ()}};
// RelID returns the relationship ID.
func (_ebd ImageRef )RelID ()string {return _ebd ._egf };
// Table represents a table in the document.
type Table struct{_adce *_ebc .Tbl ;_dde *_ebc .CT_Transform2D ;};
// NewCoreProperties constructs a new CoreProperties.
func NewCoreProperties ()CoreProperties {return CoreProperties {_bccg :_db .NewCoreProperties ()}};
// Company returns the name of the company that created the document.
// For unioffice created documents, it defaults to github.com/unidoc/unioffice
func (_age AppProperties )Company ()string {if _age ._bf .Company !=nil {return *_age ._bf .Company ;};return "";};func (_gge CustomProperties )getNewProperty (_ffd string )*_cd .CT_Property {_dff :=_gge ._aaa .Property ;_dce :=int32 (1);for _ ,_gfg :=range _dff {if _gfg .PidAttr > _dce {_dce =_gfg .PidAttr ;
};};_bcd :=_cd .NewCT_Property ();_bcd .NameAttr =&_ffd ;_bcd .PidAttr =_dce +1;_bcd .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 _bcd ;};
// AddOverride adds an override content type for a given path name.
func (_cgg ContentTypes )AddOverride (path ,contentType string ){if !_ec .HasPrefix (path ,"\u002f"){path ="\u002f"+path ;};if _ec .HasPrefix (contentType ,"\u0068\u0074\u0074\u0070"){_ad .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 _ ,_bee :=range _cgg ._gbe .Override {if _bee .PartNameAttr ==path {return ;};};_deg :=_acc .NewOverride ();_deg .PartNameAttr =path ;_deg .ContentTypeAttr =contentType ;_cgg ._gbe .Override =append (_cgg ._gbe .Override ,_deg );};func (_eedd CustomProperties )SetPropertyAsI1 (name string ,i1 int8 ){_cbf :=_eedd .getNewProperty (name );
_cbf .I1 =&i1 ;_eedd .setOrReplaceProperty (_cbf );};
// SetTitle records the title of the document.
func (_dab CoreProperties )SetTitle (s string ){if _dab ._bccg .Title ==nil {_dab ._bccg .Title =&_ga .XSDAny {XMLName :_ac .Name {Local :"\u0064\u0063\u003a\u0074\u0069\u0074\u006c\u0065"}};};_dab ._bccg .Title .Data =[]byte (s );};func (_gcg CustomProperties )setPropertyHelper (_acdd *_cd .CT_Property ,_gaaf bool ){_ageg :=_gcg .GetPropertyByName (*_acdd .NameAttr );
if (_ageg ==CustomProperty {}){_gcg ._aaa .Property =append (_gcg ._aaa .Property ,_acdd );}else if _gaaf {_acdd .FmtidAttr =_ageg ._fbf .FmtidAttr ;if _ageg ._fbf .PidAttr ==0{_acdd .PidAttr =_ageg ._fbf .PidAttr ;};_acdd .LinkTargetAttr =_ageg ._fbf .LinkTargetAttr ;
*_ageg ._fbf =*_acdd ;};};
// SetLanguage records the language of the document.
func (_fbd CoreProperties )SetLanguage (s string ){_fbd ._bccg .Language =&_ga .XSDAny {XMLName :_ac .Name {Local :"d\u0063\u003a\u006c\u0061\u006e\u0067\u0075\u0061\u0067\u0065"}};_fbd ._bccg .Language .Data =[]byte (s );};
// AppProperties contains properties specific to the document and the
// application that created it.
type AppProperties struct{_bf *_ce .Properties };
// 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 {_egdb :img ,_gbg :d ,_fac :rels };};
// WriteExtraFiles writes the extra files to the zip package.
func (_ecfd *DocBase )WriteExtraFiles (z *_ea .Writer )error {for _ ,_fgdc :=range _ecfd .ExtraFiles {if _eba :=_ed .AddFileFromDisk (z ,_fgdc .ZipPath ,_fgdc .DiskPath );_eba !=nil {return _eba ;};};return nil ;};
// RemoveOverride removes an override given a path.
func (_egcc ContentTypes )RemoveOverride (path string ){if !_ec .HasPrefix (path ,"\u002f"){path ="\u002f"+path ;};for _ff ,_daa :=range _egcc ._gbe .Override {if _daa .PartNameAttr ==path {copy (_egcc ._gbe .Override [_ff :],_egcc ._gbe .Override [_ff +1:]);
_egcc ._gbe .Override =_egcc ._gbe .Override [0:len (_egcc ._gbe .Override )-1];};};};func (_ceae CustomProperties )SetPropertyAsError (name string ,error string ){_aef :=_ceae .getNewProperty (name );_aef .Error =&error ;_ceae .setOrReplaceProperty (_aef );
};
// 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 ){_cafe :=Image {};_dge ,_gfdb ,_abg :=_eb .Decode (_b .NewReader (data ));if _abg !=nil {return _cafe ,_fc .Errorf ("\u0075n\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0070\u0061r\u0073e\u0020i\u006d\u0061\u0067\u0065\u003a\u0020\u0025s",_abg );
};_cafe .Data =&data ;_cafe .Format =_gfdb ;_cafe .Size =_dge .Bounds ().Size ();return _cafe ,nil ;};
// CreateCustomProperties creates the custom properties of the document.
func (_fcdf *DocBase )CreateCustomProperties (){_fcdf .CustomProperties =NewCustomProperties ();_fcdf .AddCustomRelationships ();};
// Properties returns table properties.
func (_eeg Table )Properties ()*_ebc .CT_TableProperties {return _eeg ._adce .TblPr };
// GetImageBytesByTarget returns Image object with Data bytes read from its target.
func (_gdea *DocBase )GetImageBytesByTarget (target string )(Image ,error ){if target !=""{target ="\u0077\u006f\u0072d\u002f"+target ;for _ ,_bge :=range _gdea .Images {if _bge .Target ()==target {if _ec .ToLower (_bge .Format ())!="\u0065\u006d\u0066"{return ImageFromStorage (_bge .Path ());
};return Image {Path :_bge .Path (),Format :_bge .Format ()},nil ;};};};return Image {},_egccc ;};
// X returns the inner wrapped XML type.
func (_ddc TableStyles )X ()*_ebc .TblStyleLst {return _ddc ._cdgd };
// Clear removes any existing relationships.
func (_cbc Relationships )Clear (){_cbc ._fgb .Relationship =nil };func (_eee CustomProperties )SetPropertyAsUi2 (name string ,ui2 uint16 ){_bbfbb :=_eee .getNewProperty (name );_bbfbb .Ui2 =&ui2 ;_eee .setOrReplaceProperty (_bbfbb );};
// SetContentStatus records the content status of the document.
func (_gefc CoreProperties )SetContentStatus (s string ){_gefc ._bccg .ContentStatus =&s };func (_egba CustomProperties )SetPropertyAsArray (name string ,array *_dc .Array ){_cce :=_egba .getNewProperty (name );_cce .Array =array ;_egba .setOrReplaceProperty (_cce );
};func (_bcf CustomProperties )SetPropertyAsI4 (name string ,i4 int32 ){_bcgg :=_bcf .getNewProperty (name );_bcgg .I4 =&i4 ;_bcf .setOrReplaceProperty (_bcgg );};
// AddRelationship adds a relationship.
func (_aac Relationships )AddRelationship (target ,ctype string )Relationship {if !_ec .HasPrefix (ctype ,"\u0068t\u0074\u0070\u003a\u002f\u002f"){_ad .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 );
};_cgb :=_gfd .NewRelationship ();_ggd :=len (_aac ._fgb .Relationship )+1;_cbeb :=map[string ]struct{}{};for _ ,_bdbfe :=range _aac ._fgb .Relationship {_cbeb [_bdbfe .IdAttr ]=struct{}{};};for _ ,_ecb :=_cbeb [_fc .Sprintf ("\u0072\u0049\u0064%\u0064",_ggd )];
_ecb ;_ ,_ecb =_cbeb [_fc .Sprintf ("\u0072\u0049\u0064%\u0064",_ggd )]{_ggd ++;};_cgb .IdAttr =_fc .Sprintf ("\u0072\u0049\u0064%\u0064",_ggd );_cgb .TargetAttr =target ;_cgb .TypeAttr =ctype ;_aac ._fgb .Relationship =append (_aac ._fgb .Relationship ,_cgb );
return Relationship {_ebf :_cgb };};
// Modified returns the time that the document was modified.
func (_fcc CoreProperties )Modified ()_bc .Time {return _aa (_fcc ._bccg .Modified )};const _ecca =2;
// Remove removes an existing relationship.
func (_cec Relationships )Remove (rel Relationship )bool {for _gcc ,_cbcd :=range _cec ._fgb .Relationship {if _cbcd ==rel ._ebf {copy (_cec ._fgb .Relationship [_gcc :],_cec ._fgb .Relationship [_gcc +1:]);_cec ._fgb .Relationship =_cec ._fgb .Relationship [0:len (_cec ._fgb .Relationship )-1];
return true ;};};return false ;};const Version ="\u0031\u002e\u0033\u0030\u002e\u0030";
// SetAuthor records the author of the document.
func (_cfa CoreProperties )SetAuthor (s string ){if _cfa ._bccg .Creator ==nil {_cfa ._bccg .Creator =&_ga .XSDAny {XMLName :_ac .Name {Local :"\u0064\u0063\u003a\u0063\u0072\u0065\u0061\u0074\u006f\u0072"}};};_cfa ._bccg .Creator .Data =[]byte (s );};
// Hyperlink is just an appropriately configured relationship.
type Hyperlink Relationship ;func (_dfe CustomProperties )SetPropertyAsR8 (name string ,r8 float64 ){_gcgga :=_dfe .getNewProperty (name );_gcgga .R8 =&r8 ;_dfe .setOrReplaceProperty (_gcgga );};
// 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 ){_bega ,_ebcb :=_e .Open (path );_bfgb :=Image {};if _ebcb !=nil {return _bfgb ,_fc .Errorf ("\u0065\u0072\u0072or\u0020\u0072\u0065\u0061\u0064\u0069\u006e\u0067\u0020\u0069\u006d\u0061\u0067\u0065\u003a\u0020\u0025\u0073",_ebcb );
};defer _bega .Close ();_aeb ,_ecdb ,_ebcb :=_eb .Decode (_bega );if _ebcb !=nil {return _bfgb ,_fc .Errorf ("\u0075n\u0061\u0062\u006c\u0065 \u0074\u006f\u0020\u0070\u0061r\u0073e\u0020i\u006d\u0061\u0067\u0065\u003a\u0020\u0025s",_ebcb );};_bfgb .Path =path ;
_bfgb .Format =_ecdb ;_bfgb .Size =_aeb .Bounds ().Size ();return _bfgb ,nil ;};
// GetTargetByRelIdAndType returns a target path with the associated relation ID.
func (_cgce Relationships )GetTargetByRelIdAndType (idAttr string ,typeAttr string )string {for _ ,_dgef :=range _cgce ._fgb .Relationship {if _dgef .IdAttr ==idAttr &&_dgef .TypeAttr ==typeAttr {return _dgef .TargetAttr ;};};return "";};
// Rows returns all table rows.
func (_dbe Table )Rows ()[]*TableRow {_cgf :=_dbe ._adce .Tr ;_ada :=[]*TableRow {};for _ ,_eab :=range _cgf {_ada =append (_ada ,&TableRow {_fdaad :_eab });};return _ada ;};
// GetOrCreateCustomProperties returns the custom properties of the document (and if they not exist yet, creating them first).
func (_gbba *DocBase )GetOrCreateCustomProperties ()CustomProperties {if _gbba .CustomProperties .X ()==nil {_gbba .CreateCustomProperties ();};return _gbba .CustomProperties ;};
// SetOffsetX sets horizontal offset of a table in distance units (see measurement package).
func (_fbfg Table )SetOffsetX (offX float64 ){if _fbfg ._dde .Off ==nil {_fbfg ._dde .Off =_ebc .NewCT_Point2D ();_degf :=int64 (0);_fbfg ._dde .Off .YAttr =_ebc .ST_Coordinate {ST_CoordinateUnqualified :&_degf };};_cddg :=_gf .ToEMU (offX );_fbfg ._dde .Off .XAttr =_ebc .ST_Coordinate {ST_CoordinateUnqualified :&_cddg };
};
// NewAppProperties constructs a new AppProperties.
func NewAppProperties ()AppProperties {_efa :=AppProperties {_bf :_ce .NewProperties ()};_efa .SetCompany ("\u0046\u006f\u0078\u0079\u0055\u0074\u0069\u006c\u0073\u0020\u0065\u0068\u0066");_efa .SetApplication ("g\u0069\u0074\u0068\u0075\u0062\u002ec\u006f\u006d\u002f\u0075\u006e\u0069\u0064\u006f\u0063/\u0075\u006e\u0069o\u0066f\u0069\u0063\u0065");
_efa .SetDocSecurity (0);_efa .SetLinksUpToDate (false );var _cda ,_ee ,_eff int64 ;_fc .Sscanf (Version ,"\u0025\u0064\u002e\u0025\u0064\u002e\u0025\u0064",&_cda ,&_ee ,&_eff );_cg :=float64 (_cda )+float64 (_ee )/10000.0;_efa .SetApplicationVersion (_fc .Sprintf ("\u0025\u0030\u0037\u002e\u0034\u0066",_cg ));
return _efa ;};
// Type returns the type of a relationship.
func (_agad Relationship )Type ()string {return _agad ._ebf .TypeAttr };
// ApplicationVersion returns the version of the application that created the
// document.
func (_df AppProperties )ApplicationVersion ()string {if _df ._bf .AppVersion !=nil {return *_df ._bf .AppVersion ;};return "";};
// SetHeight sets row height, see measurement package.
func (_cfc TableRow )SetHeight (m _gf .Distance ){_bgc :=_gf .ToEMU (float64 (m ));_cfc ._fdaad .HAttr =_ebc .ST_Coordinate {ST_CoordinateUnqualified :&_bgc };};
// ImageRef is a reference to an image within a document.
type ImageRef struct{_gbg *DocBase ;_fac Relationships ;_egdb Image ;_egf string ;_gfa string ;};
// Size returns the size of an image
func (_bce ImageRef )Size ()_eb .Point {return _bce ._egdb .Size };
// SetApplication sets the name of the application that created the document.
func (_egb AppProperties )SetApplication (s string ){_egb ._bf .Application =&s };func _bcgc (_cfe _bc .Time ,_fcge string )*_ga .XSDAny {_ebbe :=&_ga .XSDAny {XMLName :_ac .Name {Local :_fcge }};_ebbe .Attrs =append (_ebbe .Attrs ,_ac .Attr {Name :_ac .Name {Local :"\u0078\u0073\u0069\u003a\u0074\u0079\u0070\u0065"},Value :"\u0064\u0063\u0074\u0065\u0072\u006d\u0073\u003a\u00573\u0043\u0044\u0054\u0046"});
_ebbe .Attrs =append (_ebbe .Attrs ,_ac .Attr {Name :_ac .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"});
_ebbe .Attrs =append (_ebbe .Attrs ,_ac .Attr {Name :_ac .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/"});
_ebbe .Data =[]byte (_cfe .Format (_fe ));return _ebbe ;};
// SetLinksUpToDate sets the links up to date flag.
func (_dgf AppProperties )SetLinksUpToDate (v bool ){_dgf ._bf .LinksUpToDate =_ga .Bool (v )};func (_cdca TableRow )addCell ()*_ebc .CT_TableCell {_aefb :=_ebc .NewCT_TableCell ();_cdca ._fdaad .Tc =append (_cdca ._fdaad .Tc ,_aefb );return _aefb ;};
// Created returns the time that the document was created.
func (_aab CoreProperties )Created ()_bc .Time {return _aa (_aab ._bccg .Created )};
// SetCompany sets the name of the company that created the document.
func (_bcg AppProperties )SetCompany (s string ){_bcg ._bf .Company =&s };
// Cells returns an array of row cells.
func (_eafge TableRow )Cells ()[]*_ebc .CT_TableCell {return _eafge ._fdaad .Tc };func (_abee CustomProperties )SetPropertyAsFiletime (name string ,filetime _bc .Time ){_bea :=_abee .getNewProperty (name );_bea .Filetime =&filetime ;_abee .setOrReplaceProperty (_bea );
};
// EnsureOverride ensures that an override for the given path exists, adding it if necessary
func (_fbe ContentTypes )EnsureOverride (path ,contentType string ){for _ ,_acd :=range _fbe ._gbe .Override {if _acd .PartNameAttr ==path {if _ec .HasPrefix (contentType ,"\u0068\u0074\u0074\u0070"){_ad .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 );
};_acd .ContentTypeAttr =contentType ;return ;};};_fbe .AddOverride (path ,contentType );};func (_feg CustomProperties )SetPropertyAsStorage (name string ,storage string ){_bccf :=_feg .getNewProperty (name );_bccf .Storage =&storage ;_feg .setOrReplaceProperty (_bccf );
};
// X returns the inner wrapped XML type of CustomProperty.
func (_cdg CustomProperty )X ()*_cd .CT_Property {return _cdg ._fbf };
// Relationship is a relationship within a .rels file.
type Relationship struct{_ebf *_gfd .Relationship };
// SetModified sets the time that the document was modified.
func (_beg CoreProperties )SetModified (t _bc .Time ){_beg ._bccg .Modified =_bcgc (t ,"\u0064\u0063t\u0065\u0072\u006ds\u003a\u006d\u006f\u0064\u0069\u0066\u0069\u0065\u0064");};
// SetStyle assigns TableStyle to a table.
func (_caea Table )SetStyle (style *_ebc .CT_TableStyle ){if _caea ._adce .TblPr ==nil {_caea ._adce .TblPr =_ebc .NewCT_TableProperties ();};if _caea ._adce .TblPr .Choice ==nil {_caea ._adce .TblPr .Choice =_ebc .NewCT_TablePropertiesChoice ();};_caea ._adce .TblPr .Choice .TableStyle =style ;
};
// 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 _eb .Image ;Images []ImageRef ;ExtraFiles []ExtraFile ;TmpPath string ;};func _aa (_fdg *_ga .XSDAny )_bc .Time {if _fdg ==nil {return _bc .Time {};
};_def ,_gefb :=_bc .Parse (_fe ,string (_fdg .Data ));if _gefb !=nil {_ad .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 (_fdg .Data ),_gefb );
};return _def ;};func (_gadb CustomProperties )SetPropertyAsBool (name string ,b bool ){_ccdf :=_gadb .getNewProperty (name );_ccdf .Bool =&b ;_gadb .setOrReplaceProperty (_ccdf );};
// X returns the underlying raw XML data.
func (_ece Relationships )X ()*_gfd .Relationships {return _ece ._fgb };
// Target returns the target (path) of a relationship.
func (_bbd Relationship )Target ()string {return _bbd ._ebf .TargetAttr };
// PropertiesList returns the list of all custom properties of the document.
func (_ae CustomProperties )PropertiesList ()[]*_cd .CT_Property {return _ae ._aaa .Property };func init (){_gd .SetAsStorage ()};func UtcTimeFormat (t _bc .Time )string {return t .Format (_dfgd )+"\u0020\u0055\u0054\u0043"};
// CopyOverride copies override content type for a given `path` and puts it with a path `newPath`.
func (_ceg ContentTypes )CopyOverride (path ,newPath string ){if !_ec .HasPrefix (path ,"\u002f"){path ="\u002f"+path ;};if !_ec .HasPrefix (newPath ,"\u002f"){newPath ="\u002f"+newPath ;};for _cab :=range _ceg ._gbe .Override {if _ceg ._gbe .Override [_cab ].PartNameAttr ==path {_ebbb :=*_ceg ._gbe .Override [_cab ];
_ebbb .PartNameAttr =newPath ;_ceg ._gbe .Override =append (_ceg ._gbe .Override ,&_ebbb );};};};func (_cedd *ImageRef )SetRelID (id string ){_cedd ._egf =id };
// X returns the inner raw content types.
func (_bbf ContentTypes )X ()*_acc .Types {return _bbf ._gbe };func (_eca CustomProperties )SetPropertyAsUi4 (name string ,ui4 uint32 ){_eeef :=_eca .getNewProperty (name );_eeef .Ui4 =&ui4 ;_eca .setOrReplaceProperty (_eeef );};const _bfga =15;
// SetWidth sets column width, see measurement package.
func (_feeb TableCol )SetWidth (m _gf .Distance ){_bfee :=_gf .ToEMU (float64 (m ));_feeb ._aad .WAttr =_ebc .ST_Coordinate {ST_CoordinateUnqualified :&_bfee };};
// Theme is a drawingml theme.
type Theme struct{_dgfg *_ebc .Theme };
// 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 (_egef ImageRef )RelativeWidth (h _gf .Distance )_gf .Distance {_afba :=float64 (_egef .Size ().X )/float64 (_egef .Size ().Y );return h *_gf .Distance (_afba );};const _fe ="2\u00300\u0036\u002d\u0030\u0031\u002d\u0030\u0032\u00541\u0035\u003a\u0030\u0034:0\u0035\u005a";
func (_caf CustomProperties )SetPropertyAsNull (name string ){_dgff :=_caf .getNewProperty (name );_dgff .Null =_dc .NewNull ();_caf .setOrReplaceProperty (_dgff );};
// AddRow adds a row to a table.
func (_ace Table )AddRow ()*TableRow {_bcef :=_ebc .NewCT_TableRow ();for _eddb :=0;_eddb < len (_ace ._adce .TblGrid .GridCol );_eddb ++{_bcef .Tc =append (_bcef .Tc ,_ebc .NewCT_TableCell ());};_ace ._adce .Tr =append (_ace ._adce .Tr ,_bcef );return &TableRow {_fdaad :_bcef };
};
// SetDescription records the description of the document.
func (_ede CoreProperties )SetDescription (s string ){if _ede ._bccg .Description ==nil {_ede ._bccg .Description =&_ga .XSDAny {XMLName :_ac .Name {Local :"\u0064\u0063\u003a\u0064\u0065\u0073\u0063\u0072\u0069p\u0074\u0069\u006f\u006e"}};};_ede ._bccg .Description .Data =[]byte (s );
};
// SetLastModifiedBy records the last person to modify the document.
func (_bfg CoreProperties )SetLastModifiedBy (s string ){_bfg ._bccg .LastModifiedBy =&s };
// NewTableWithXfrm makes a new table with a pointer to its parent Xfrm for changing its offset and size.
func NewTableWithXfrm (xfrm *_ebc .CT_Transform2D )*Table {_ggb :=_ebc .NewTbl ();_ggb .TblPr =_ebc .NewCT_TableProperties ();return &Table {_adce :_ggb ,_dde :xfrm };};
// Description returns the description of the document
func (_adbcf CoreProperties )Description ()string {if _adbcf ._bccg .Description !=nil {return string (_adbcf ._bccg .Description .Data );};return "";};var ReleasedAt =_bc .Date (_gegd ,_ecca ,_fcf ,_bfga ,_dgfe ,0,0,_bc .UTC );
// NewTableStyles constructs a new TableStyles.
func NewTableStyles ()TableStyles {return TableStyles {_cdgd :_ebc .NewTblStyleLst ()}};func (_ccc CustomProperties )setProperty (_faa *_cd .CT_Property ){_ccc .setPropertyHelper (_faa ,false )};func (_bdbf CustomProperties )SetPropertyAsClsid (name string ,clsid string ){_eccb :=_bdbf .getNewProperty (name );
_eccb .Clsid =&clsid ;_bdbf .setOrReplaceProperty (_eccb );};
// AddCustomRelationships adds relationships related to custom properties to the document.
func (_agf *DocBase )AddCustomRelationships (){_agf .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");
_agf .Rels .AddRelationship ("\u0064\u006f\u0063\u0050ro\u0070\u0073\u002f\u0063\u0075\u0073\u0074\u006f\u006d\u002e\u0078\u006d\u006c",_ga .CustomPropertiesType );};
// NewTheme constructs a new theme.
func NewTheme ()Theme {return Theme {_ebc .NewTheme ()}};
// 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 (_gga Relationships )AddAutoRelationship (dt _ga .DocType ,src string ,idx int ,ctype string )Relationship {return _gga .AddRelationship (_ga .RelativeFilename (dt ,src ,ctype ,idx ),ctype );};
// Properties returns table properties.
func (_bde Table )Grid ()*_ebc .CT_TableGrid {return _bde ._adce .TblGrid };
// NewCustomProperties constructs a new CustomProperties.
func NewCustomProperties ()CustomProperties {return CustomProperties {_aaa :_cd .NewProperties ()}};
// 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 (_dfg AppProperties )Pages ()int32 {if _dfg ._bf .Pages !=nil {return *_dfg ._bf .Pages ;};return 0;};
// CustomProperties contains document specific properties.
type CustomProperties struct{_aaa *_cd .Properties };
// Application returns the name of the application that created the document.
// For unioffice created documents, it defaults to github.com/unidoc/unioffice
func (_fgd AppProperties )Application ()string {if _fgd ._bf .Application !=nil {return *_fgd ._bf .Application ;};return "";};
// GetTargetByRelId returns a target path with the associated relation ID.
func (_gefg Relationships )GetTargetByRelId (idAttr string )string {for _ ,_fdc :=range _gefg ._fgb .Relationship {if _fdc .IdAttr ==idAttr {return _fdc .TargetAttr ;};};return "";};
// X returns the inner wrapped XML type.
func (_ab CustomProperties )X ()*_cd .Properties {return _ab ._aaa };const _fcf =17;
// Format returns the format of the underlying image
func (_fga ImageRef )Format ()string {return _fga ._egdb .Format };const _gegd =2024;
// SetTarget set the target (path) of a relationship.
func (_edf Relationship )SetTarget (s string ){_edf ._ebf .TargetAttr =s };
// AddImageToZip adds an image (either from bytes or from disk) and adds it to the zip file.
func AddImageToZip (z *_ea .Writer ,img ImageRef ,imageNum int ,dt _ga .DocType )error {_dggd :=_ga .AbsoluteImageFilename (dt ,imageNum ,_ec .ToLower (img .Format ()));if img .Data ()!=nil &&len (*img .Data ())> 0{if _dfc :=_ed .AddFileFromBytes (z ,_dggd ,*img .Data ());
_dfc !=nil {return _dfc ;};}else if img .Path ()!=""{if _cad :=_ed .AddFileFromDisk (z ,_dggd ,img .Path ());_cad !=nil {return _cad ;};}else {return _fc .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 ;};