mirror of
https://github.com/fumiama/go-docx.git
synced 2026-06-06 08:10:25 +08:00
fix: <Children> tag in Paragraph
This commit is contained in:
@@ -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 <Children> ... </Children> but we have no other choice
|
||||
Children []ParagraphChild // Children will generate an unnecessary tag <Children> ... </Children> 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 {
|
||||
|
||||
Reference in New Issue
Block a user