mirror of
https://github.com/fumiama/go-docx.git
synced 2026-06-05 07:40:24 +08:00
add: xmlns:wp14 in Document
This commit is contained in:
@@ -5,6 +5,10 @@ import (
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
const (
|
||||
HYPERLINK_STYLE = "a1"
|
||||
)
|
||||
|
||||
// when adding an hyperlink we need to store a reference in the relationship field
|
||||
func (f *Docx) addLinkRelation(link string) string {
|
||||
rel := &Relationship{
|
||||
|
||||
7
empty.go
7
empty.go
@@ -11,9 +11,10 @@ func newEmptyFile() *Docx {
|
||||
XMLName: xml.Name{
|
||||
Space: "w",
|
||||
},
|
||||
XMLW: XMLNS_W,
|
||||
XMLR: XMLNS_R,
|
||||
XMLWP: XMLNS_WP,
|
||||
XMLW: XMLNS_W,
|
||||
XMLR: XMLNS_R,
|
||||
XMLWP: XMLNS_WP,
|
||||
XMLWP14: XMLNS_WP14,
|
||||
Body: &Body{
|
||||
XMLName: xml.Name{
|
||||
Space: "w",
|
||||
|
||||
@@ -3,9 +3,10 @@ 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_WP = `http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing`
|
||||
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`
|
||||
XMLNS_WP14 = `http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing`
|
||||
)
|
||||
|
||||
func getAtt(atts []xml.Attr, name string) string {
|
||||
@@ -27,5 +28,6 @@ type Document struct {
|
||||
XMLW string `xml:"xmlns:w,attr"`
|
||||
XMLR string `xml:"xmlns:r,attr"`
|
||||
XMLWP string `xml:"xmlns:wp,attr"`
|
||||
XMLWP14 string `xml:"xmlns:wp14,attr"`
|
||||
Body *Body
|
||||
}
|
||||
|
||||
@@ -519,6 +519,7 @@ func TestUnmarshalDrawingStructure(t *testing.T) {
|
||||
XMLW: XMLNS_W,
|
||||
XMLR: XMLNS_R,
|
||||
XMLWP: XMLNS_WP,
|
||||
XMLWP14: XMLNS_WP14,
|
||||
XMLName: xml.Name{Space: XMLNS_W, Local: "document"}}
|
||||
err := xml.Unmarshal(StringToBytes(drawing_doc), &doc)
|
||||
if err != nil {
|
||||
|
||||
@@ -5,10 +5,6 @@ import (
|
||||
"io"
|
||||
)
|
||||
|
||||
const (
|
||||
HYPERLINK_STYLE = "a1"
|
||||
)
|
||||
|
||||
// Run is part of a paragraph that has its own style. It could be
|
||||
// a piece of text in bold, or a link
|
||||
type Run struct {
|
||||
|
||||
@@ -42,6 +42,7 @@ func (f *Docx) parseDocument(file *zip.File) error {
|
||||
f.Document.XMLW = XMLNS_W
|
||||
f.Document.XMLR = XMLNS_R
|
||||
f.Document.XMLWP = XMLNS_WP
|
||||
f.Document.XMLWP14 = XMLNS_WP14
|
||||
f.Document.XMLName.Space = XMLNS_W
|
||||
f.Document.XMLName.Local = "document"
|
||||
err = xml.NewDecoder(zf).Decode(&f.Document)
|
||||
|
||||
Reference in New Issue
Block a user