1
0
mirror of https://github.com/fumiama/go-docx.git synced 2026-06-10 02:00:24 +08:00

fix: cannot open in word

This commit is contained in:
源文雨
2023-02-21 16:12:20 +08:00
parent 6ba1fa9485
commit d2666ec617
16 changed files with 583 additions and 68 deletions

View File

@@ -11,10 +11,10 @@ func newEmptyA4File() *Docx {
XMLName: xml.Name{
Space: "w",
},
XMLW: XMLNS_W,
XMLR: XMLNS_R,
XMLWP: XMLNS_WP,
XMLWP14: XMLNS_WP14,
XMLW: XMLNS_W,
XMLR: XMLNS_R,
XMLWP: XMLNS_WP,
// XMLWP14: XMLNS_WP14,
Body: &Body{
XMLName: xml.Name{
Space: "w",
@@ -40,18 +40,31 @@ func newEmptyA4File() *Docx {
Type: `http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable`,
Target: "fontTable.xml",
},
{
ID: "rId4",
Type: `http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings`,
Target: "settings.xml",
},
{
ID: "rId5",
Type: `http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings`,
Target: "webSettings.xml",
},
},
},
media: make([]Media, 0, 64),
mediaNameIdx: make(map[string]int, 64),
rId: 3,
rId: 5,
template: "a4",
tmpfslst: []string{
"_rels/.rels",
"docProps/app.xml",
"docProps/core.xml",
"word/theme/theme1.xml",
"word/fontTable.xml",
"word/settings.xml",
"word/styles.xml",
"word/webSettings.xml",
"[Content_Types].xml",
},
buf: bytes.NewBuffer(make([]byte, 0, 1024*1024*4)),