1
0
mirror of https://github.com/fumiama/go-docx.git synced 2026-06-06 08:10:25 +08:00

add KeepElements & DropDrawingOf

This commit is contained in:
源文雨
2023-03-09 20:50:39 +08:00
parent 54e7323f63
commit b68d555c67
7 changed files with 275 additions and 13 deletions

View File

@@ -536,7 +536,7 @@ type WTableRowHeight struct {
type WTableCell struct {
XMLName xml.Name `xml:"w:tc,omitempty"`
TableCellProperties *WTableCellProperties
Paragraphs []Paragraph `xml:"w:p,omitempty"`
Paragraphs []*Paragraph `xml:"w:p,omitempty"`
file *Docx
}
@@ -556,12 +556,12 @@ func (c *WTableCell) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
switch tt.Name.Local {
case "p":
var value Paragraph
value.file = c.file
err = d.DecodeElement(&value, &tt)
if err != nil && !strings.HasPrefix(err.Error(), "expected") {
return err
}
value.file = c.file
c.Paragraphs = append(c.Paragraphs, value)
c.Paragraphs = append(c.Paragraphs, &value)
case "tcPr":
var value WTableCellProperties
err = d.DecodeElement(&value, &tt)