-
Notifications
You must be signed in to change notification settings - Fork 820
/
xmlContentTypes.go
50 lines (42 loc) · 1.99 KB
/
xmlContentTypes.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package xlsx
import (
"encoding/xml"
)
type xlsxTypes struct {
XMLName xml.Name `xml:"http://schemas.openxmlformats.org/package/2006/content-types Types"`
Overrides []xlsxOverride `xml:"Override"`
Defaults []xlsxDefault `xml:"Default"`
}
type xlsxOverride struct {
PartName string `xml:",attr"`
ContentType string `xml:",attr"`
}
type xlsxDefault struct {
Extension string `xml:",attr"`
ContentType string `xml:",attr"`
}
func MakeDefaultContentTypes() (types xlsxTypes) {
types.Overrides = make([]xlsxOverride, 8)
types.Defaults = make([]xlsxDefault, 2)
types.Overrides[0].PartName = "/_rels/.rels"
types.Overrides[0].ContentType = "application/vnd.openxmlformats-package.relationships+xml"
types.Overrides[1].PartName = "/docProps/app.xml"
types.Overrides[1].ContentType = "application/vnd.openxmlformats-officedocument.extended-properties+xml"
types.Overrides[2].PartName = "/docProps/core.xml"
types.Overrides[2].ContentType = "application/vnd.openxmlformats-package.core-properties+xml"
types.Overrides[3].PartName = "/xl/_rels/workbook.xml.rels"
types.Overrides[3].ContentType = "application/vnd.openxmlformats-package.relationships+xml"
types.Overrides[4].PartName = "/xl/sharedStrings.xml"
types.Overrides[4].ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"
types.Overrides[5].PartName = "/xl/styles.xml"
types.Overrides[5].ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"
types.Overrides[6].PartName = "/xl/workbook.xml"
types.Overrides[6].ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"
types.Overrides[7].PartName = "/xl/theme/theme1.xml"
types.Overrides[7].ContentType = "application/vnd.openxmlformats-officedocument.theme+xml"
types.Defaults[0].Extension = "rels"
types.Defaults[0].ContentType = "application/vnd.openxmlformats-package.relationships+xml"
types.Defaults[1].Extension = "xml"
types.Defaults[1].ContentType = "application/xml"
return
}