1
0
mirror of https://github.com/fumiama/go-docx.git synced 2026-06-16 06:20:25 +08:00

普适化 template

This commit is contained in:
源文雨
2023-02-21 13:14:21 +08:00
parent 092b86e7f4
commit 585ee6cda8
13 changed files with 51 additions and 28 deletions

View File

@@ -5,7 +5,7 @@ import (
"encoding/xml"
)
func newEmptyFile() *Docx {
func newEmptyA4File() *Docx {
docx := &Docx{
Document: Document{
XMLName: xml.Name{
@@ -45,7 +45,16 @@ func newEmptyFile() *Docx {
media: make([]Media, 0, 64),
mediaNameIdx: make(map[string]int, 64),
rId: 3,
buf: bytes.NewBuffer(make([]byte, 0, 1024*1024*4)),
template: "a4",
tmpfslst: []string{
"_rels/.rels",
"docProps/app.xml",
"docProps/core.xml",
"word/theme/theme1.xml",
"word/styles.xml",
"[Content_Types].xml",
},
buf: bytes.NewBuffer(make([]byte, 0, 1024*1024*4)),
}
docx.Document.file = docx
return docx