diff --git a/structnodes.go b/structnodes.go index a284032..a056ca5 100644 --- a/structnodes.go +++ b/structnodes.go @@ -13,11 +13,18 @@ type ParagraphChild struct { type Paragraph struct { XMLName xml.Name `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main p"` - Children []ParagraphChild // Children will generate an unnecessary tag ... but we have no other choice + Children []ParagraphChild // Children will generate an unnecessary tag ... and we skip it by a self-defined xml.Marshaler file *Docx } +func (p *Paragraph) MarshalXML(e *xml.Encoder, start xml.StartElement) error { + for _, c := range p.Children { + e.EncodeElement(c, start) + } + return nil +} + func (p *Paragraph) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { children := make([]ParagraphChild, 0, 64) for {