mirror of
https://github.com/fumiama/go-docx.git
synced 2026-06-08 01:00:25 +08:00
add xmlns wp
This commit is contained in:
5
empty.go
5
empty.go
@@ -8,8 +8,9 @@ func newEmptyFile() *Docx {
|
||||
XMLName: xml.Name{
|
||||
Space: "w",
|
||||
},
|
||||
XMLW: XMLNS_W,
|
||||
XMLR: XMLNS_R,
|
||||
XMLW: XMLNS_W,
|
||||
XMLR: XMLNS_R,
|
||||
XMLWP: XMLNS_WP,
|
||||
Body: &Body{
|
||||
XMLName: xml.Name{
|
||||
Space: "w",
|
||||
|
||||
@@ -3,8 +3,9 @@ package docxlib
|
||||
import "encoding/xml"
|
||||
|
||||
const (
|
||||
XMLNS_W = `http://schemas.openxmlformats.org/wordprocessingml/2006/main`
|
||||
XMLNS_R = `http://schemas.openxmlformats.org/officeDocument/2006/relationships`
|
||||
XMLNS_W = `http://schemas.openxmlformats.org/wordprocessingml/2006/main`
|
||||
XMLNS_R = `http://schemas.openxmlformats.org/officeDocument/2006/relationships`
|
||||
XMLNS_WP = `http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing`
|
||||
)
|
||||
|
||||
type Body struct {
|
||||
@@ -16,5 +17,6 @@ type Document struct {
|
||||
XMLName xml.Name `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main document"`
|
||||
XMLW string `xml:"xmlns:w,attr"`
|
||||
XMLR string `xml:"xmlns:r,attr"`
|
||||
XMLWP string `xml:"xmlns:wp,attr"`
|
||||
Body *Body
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ func TestPlainStructure(t *testing.T) {
|
||||
doc := Document{
|
||||
XMLW: XMLNS_W,
|
||||
XMLR: XMLNS_R,
|
||||
XMLWP: XMLNS_WP,
|
||||
XMLName: xml.Name{Space: XMLNS_W, Local: "document"}}
|
||||
testCases := []struct {
|
||||
content string
|
||||
@@ -515,6 +516,7 @@ func TestDrawingStructure(t *testing.T) {
|
||||
doc := Document{
|
||||
XMLW: XMLNS_W,
|
||||
XMLR: XMLNS_R,
|
||||
XMLWP: XMLNS_WP,
|
||||
XMLName: xml.Name{Space: XMLNS_W, Local: "document"}}
|
||||
err := xml.Unmarshal(StringToBytes(drawing_doc), &doc)
|
||||
if err != nil {
|
||||
|
||||
@@ -42,10 +42,10 @@ type Drawing struct {
|
||||
// WPInline wp:inline
|
||||
type WPInline struct {
|
||||
XMLName xml.Name `xml:"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing inline,omitempty"`
|
||||
DistT string `xml:"wp:distT,attr"`
|
||||
DistB string `xml:"wp:distB,attr"`
|
||||
DistL string `xml:"wp:distL,attr"`
|
||||
DistR string `xml:"wp:distR,attr"`
|
||||
DistT string `xml:"distT,attr"`
|
||||
DistB string `xml:"distB,attr"`
|
||||
DistL string `xml:"distL,attr"`
|
||||
DistR string `xml:"distR,attr"`
|
||||
}
|
||||
|
||||
// RunProperties encapsulates visual properties of a run
|
||||
|
||||
Reference in New Issue
Block a user