From 01883a5e8766eeb5e2c678c9a96fb6bc9f9fed3f Mon Sep 17 00:00:00 2001 From: Todd Date: Thu, 18 Jan 2018 11:48:37 -0500 Subject: [PATCH] common: support more app/core properties Support language, links up to date, and document security flag and update unit test golden files. --- common/appproperties.go | 12 ++++++++++++ common/coreproperties.go | 6 ++++++ document/testdata/header-footer-multiple.docx | Bin 6033 -> 6033 bytes document/testdata/simple-1.docx | Bin 4785 -> 4816 bytes spreadsheet/testdata/simple-1.xlsx | Bin 4121 -> 4152 bytes spreadsheet/testdata/simple-2.xlsx | Bin 4125 -> 4156 bytes 6 files changed, 18 insertions(+) diff --git a/common/appproperties.go b/common/appproperties.go index 6423c7c0f6..120205a2c7 100644 --- a/common/appproperties.go +++ b/common/appproperties.go @@ -25,6 +25,8 @@ func NewAppProperties() AppProperties { p := AppProperties{x: extended_properties.NewProperties()} p.SetCompany("Baliance LLC") p.SetApplication("baliance.com/gooxml") + p.SetDocSecurity(0) + p.SetLinksUpToDate(false) p.SetApplicationVersion(strings.Replace(gooxml.ReleaseVersion, "v", "", -1)) return p } @@ -38,6 +40,16 @@ func (a AppProperties) Application() string { return "" } +// SetLinksUpToDate sets the links up to date flag. +func (a AppProperties) SetLinksUpToDate(v bool) { + a.x.LinksUpToDate = gooxml.Bool(v) +} + +// SetDocSecurity sets the document security flag. +func (a AppProperties) SetDocSecurity(v int32) { + a.x.DocSecurity = gooxml.Int32(v) +} + // SetApplication sets the name of the application that created the document. func (a AppProperties) SetApplication(s string) { a.x.Application = &s diff --git a/common/coreproperties.go b/common/coreproperties.go index ba229bee41..4978f8c51d 100644 --- a/common/coreproperties.go +++ b/common/coreproperties.go @@ -85,6 +85,12 @@ func (c CoreProperties) SetLastModifiedBy(s string) { c.x.LastModifiedBy = &s } +// SetLanguage records the language of the document. +func (c CoreProperties) SetLanguage(s string) { + c.x.Language = &gooxml.XSDAny{XMLName: xml.Name{Local: "dc:language"}} + c.x.Language.Data = []byte(s) +} + const cpTimeFormatW3CDTF = "2006-01-02T15:04:05Z" func parseTime(x *gooxml.XSDAny) time.Time { diff --git a/document/testdata/header-footer-multiple.docx b/document/testdata/header-footer-multiple.docx index e4e03f90c80030cd7d4da6b27f63b83676863a2d..cfcc4f92aef716beb4f183aabc71e6feb13cb826 100644 GIT binary patch delta 226 zcmbQJKT)4Az?+#xgn&0?hXLis6+$+ delta 226 zcmbQJKT)4Az?+#xgn&)tL#R&X+wH zDz=2911e^~y_p3pJGoF$dNY$iHq0c!4k+ud&?N|K@?{ZIh*BO=D+t3&)EdI*gfULQ e80=zh5UD^h8wg{fm?ea9P7JD@M;vC3xH|yy6jHVT diff --git a/document/testdata/simple-1.docx b/document/testdata/simple-1.docx index fac05dfa6aa9a57321fa1e370557c8f9a3ccb2a5..ad8d5855e6b941d8e73d6cecb6526104a3807d6f 100644 GIT binary patch delta 628 zcmdm}dO?*hz?+#xgnd@{(69 zndo~nn7w)B8&mImQ=OgWCKtEeuUql?eBAdLlMnZEyPvaqzsc6*qL5h5k>Y8LQmb_G zxVA;@<2$a??U}q(R#9Y4`-!wHh5OQ67gV?nU+*~_u_4zhQOm_7`h!&wSHs+LQ`5NR zCsy9%Se2cf;8>sboN@Aw^PkljW0}@0kZR*T;rFOy{=e?96u$3Azi#3WU;p_X)3)5x zx7(FJ{0!^5m|`Th!uH4lUIW$VPnwU#?afFxl{#^%NbjiS)TKw?@8I%|dcm^lnqHGg zz4K3*rp<2Z-YfRiN#>pC<_&y4S7dvub9HT$L(uE&?%X0B&w#;(&zU=04_DC`+8R5X$OdgNE*|%~i<)VXfdh3=RE!0aIR3G{7yIyiveV9whQQ&$aw40|P?^&}u;-jR2D; zGYTqz)y!Ptc-#vp-^q-wX8vRcsG4;%l(fx&YGN_eXiTn$s50RWCT**X9K delta 618 zcmcbhx>1!cz?+#xgnnj7*}OLA`+aGL1IE|Q_2bq2*KI04D)%dcQ`_vZsx||!so3tW z+Pr(qio=d9*?6%}K+DW2McZ_uye;dC$*mD7?+wCorUylE37+NK(>I4H;o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