From 6e7f6b743b67ee213d5ae71efe540d3d8f171052 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Fri, 3 Mar 2023 16:15:42 +0800 Subject: [PATCH] add xmlns:wpg --- empty.go | 1 + structdoc.go | 2 ++ structgroup.go | 21 +++++++++++++++++++++ unpack.go | 1 + 4 files changed, 25 insertions(+) create mode 100644 structgroup.go diff --git a/empty.go b/empty.go index e3735cb..71509b5 100644 --- a/empty.go +++ b/empty.go @@ -36,6 +36,7 @@ func newEmptyA4File() *Docx { XMLWP: XMLNS_WP, XMLWPS: XMLNS_WPS, XMLWPC: XMLNS_WPC, + XMLWPG: XMLNS_WPG, // XMLMC: XMLNS_MC, // XMLWP14: XMLNS_WP14, Body: Body{ diff --git a/structdoc.go b/structdoc.go index 4f4f468..696d7ad 100644 --- a/structdoc.go +++ b/structdoc.go @@ -33,6 +33,7 @@ const ( XMLNS_WP = `http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing` XMLNS_WPS = `http://schemas.microsoft.com/office/word/2010/wordprocessingShape` XMLNS_WPC = `http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas` + XMLNS_WPG = `http://schemas.microsoft.com/office/word/2010/wordprocessingGroup` // XMLNS_MC = `http://schemas.openxmlformats.org/markup-compatibility/2006` // XMLNS_WP14 = `http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing` @@ -103,6 +104,7 @@ type Document struct { XMLWP string `xml:"xmlns:wp,attr,omitempty"` // cannot be unmarshalled in XMLWPS string `xml:"xmlns:wps,attr,omitempty"` // cannot be unmarshalled in XMLWPC string `xml:"xmlns:wpc,attr,omitempty"` // cannot be unmarshalled in + XMLWPG string `xml:"xmlns:wpg,attr,omitempty"` // cannot be unmarshalled in // XMLMC string `xml:"xmlns:mc,attr,omitempty"` // cannot be unmarshalled in // XMLWP14 string `xml:"xmlns:wp14,attr,omitempty"` // cannot be unmarshalled in diff --git a/structgroup.go b/structgroup.go new file mode 100644 index 0000000..7d29af9 --- /dev/null +++ b/structgroup.go @@ -0,0 +1,21 @@ +/* + Copyright (c) 2020 gingfrederik + Copyright (c) 2021 Gonzalo Fernandez-Victorio + Copyright (c) 2021 Basement Crowd Ltd (https://www.basementcrowd.com) + Copyright (c) 2023 Fumiama Minamoto (源文雨) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . +*/ + +package docx diff --git a/unpack.go b/unpack.go index a955da2..7aa3685 100644 --- a/unpack.go +++ b/unpack.go @@ -85,6 +85,7 @@ func (f *Docx) parseDocument(file *zip.File) error { // f.Document.XMLMC = XMLNS_MC f.Document.XMLWPS = XMLNS_WPS f.Document.XMLWPC = XMLNS_WPC + f.Document.XMLWPG = XMLNS_WPG // f.Document.XMLWP14 = XMLNS_WP14 f.Document.XMLName.Space = XMLNS_W f.Document.XMLName.Local = "document"