1
0
mirror of https://github.com/fumiama/go-docx.git synced 2026-06-05 07:40:24 +08:00

make lint happy

This commit is contained in:
源文雨
2023-02-23 14:34:44 +08:00
parent 59cce024f7
commit fa053fefd4
13 changed files with 350 additions and 170 deletions

View File

@@ -3,6 +3,7 @@ package docxlib
import (
"encoding/xml"
"io"
"strings"
)
// Run is part of a paragraph that has its own style. It could be
@@ -36,19 +37,31 @@ func (r *Run) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
switch tt.Name.Local {
case "rPr":
var value RunProperties
d.DecodeElement(&value, &tt)
err = d.DecodeElement(&value, &tt)
if err != nil && !strings.HasPrefix(err.Error(), "expected") {
return err
}
r.RunProperties = &value
case "instrText":
var value string
d.DecodeElement(&value, &tt)
err = d.DecodeElement(&value, &tt)
if err != nil && !strings.HasPrefix(err.Error(), "expected") {
return err
}
r.InstrText = value
case "t":
var value Text
d.DecodeElement(&value, &tt)
err = d.DecodeElement(&value, &tt)
if err != nil && !strings.HasPrefix(err.Error(), "expected") {
return err
}
r.Text = &value
case "drawing":
var value Drawing
d.DecodeElement(&value, &tt)
err = d.DecodeElement(&value, &tt)
if err != nil && !strings.HasPrefix(err.Error(), "expected") {
return err
}
r.Drawing = &value
case "tab":
if r.InstrText == "" && r.Text == nil && r.Drawing == nil {
@@ -159,6 +172,6 @@ type Size struct {
// both两端对齐。
// distribute分散对齐。
type Justification struct {
XMLName xml.Name `xml:"w:jc"`
Val string `xml:"w:val,attr"`
// XMLName xml.Name `xml:"w:jc"`
Val string `xml:"w:val,attr"`
}