Skip to content

Commit

Permalink
common: support more app/core properties
Browse files Browse the repository at this point in the history
Support language, links up to date, and document security
flag and update unit test golden files.
  • Loading branch information
tbaliance committed Jan 18, 2018
1 parent 2c86cf1 commit 01883a5
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions common/appproperties.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
Expand Down
6 changes: 6 additions & 0 deletions common/coreproperties.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Binary file modified document/testdata/header-footer-multiple.docx
Binary file not shown.
Binary file modified document/testdata/simple-1.docx
Binary file not shown.
Binary file modified spreadsheet/testdata/simple-1.xlsx
Binary file not shown.
Binary file modified spreadsheet/testdata/simple-2.xlsx
Binary file not shown.

0 comments on commit 01883a5

Please sign in to comment.