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

make lint happy

This commit is contained in:
源文雨
2023-03-02 18:12:08 +08:00
parent 64b3464cbf
commit 8b3cf0260d
4 changed files with 10 additions and 6 deletions

View File

@@ -26,7 +26,7 @@ import (
)
// AddInlineShape adds wsp named drawing to paragraph
func (p *Paragraph) AddInlineShape(w, h int64, name, bwMode, prst string, ln *ALine) (*Run, error) {
func (p *Paragraph) AddInlineShape(w, h int64, name, bwMode, prst string, ln *ALine) *Run {
idn := int(atomic.AddUintptr(&p.file.docID, 1))
id := strconv.Itoa(int(p.file.IncreaseID(name)))
d := &Drawing{
@@ -77,11 +77,11 @@ func (p *Paragraph) AddInlineShape(w, h int64, name, bwMode, prst string, ln *AL
Children: c,
}
p.Children = append(p.Children, run)
return run, nil
return run
}
// AddAnchorShape adds wsp named drawing to paragraph
func (p *Paragraph) AddAnchorShape(w, h int64, name, bwMode, prst string, ln *ALine) (*Run, error) {
func (p *Paragraph) AddAnchorShape(w, h int64, name, bwMode, prst string, ln *ALine) *Run {
idn := int(atomic.AddUintptr(&p.file.docID, 1))
id := strconv.Itoa(int(p.file.IncreaseID(name)))
d := &Drawing{
@@ -144,5 +144,5 @@ func (p *Paragraph) AddAnchorShape(w, h int64, name, bwMode, prst string, ln *AL
Children: c,
}
p.Children = append(p.Children, run)
return run, nil
return run
}

View File

@@ -125,7 +125,7 @@ func main() {
p := w.AddParagraph().Justification("center")
p.AddText("测试 AutoShape w:ln").Size("44")
p.AddAnchorShape(808355, 238760, "AutoShape", "auto", "straightConnector1",
_ = p.AddAnchorShape(808355, 238760, "AutoShape", "auto", "straightConnector1",
&docx.ALine{
W: 9525,
SolidFill: &docx.ASolidFill{SrgbClr: &docx.ASrgbClr{Val: "000000"}},
@@ -134,7 +134,7 @@ func main() {
TailEnd: &docx.ATailEnd{},
},
)
p.AddInlineShape(808355, 238760, "AutoShape", "auto", "straightConnector1",
_ = p.AddInlineShape(808355, 238760, "AutoShape", "auto", "straightConnector1",
&docx.ALine{
W: 9525,
SolidFill: &docx.ASolidFill{SrgbClr: &docx.ASrgbClr{Val: "000000"}},

1
id.go
View File

@@ -20,6 +20,7 @@
package docx
// IncreaseID by name
func (f *Docx) IncreaseID(name string) (n uintptr) {
f.slowIDsMu.Lock()
n = f.slowIDs[name]

View File

@@ -26,6 +26,7 @@ import (
"strings"
)
// WordprocessingCanvas ...
type WordprocessingCanvas struct {
XMLName xml.Name `xml:"wpc:wpc,omitempty"`
Background *WPCBackground
@@ -81,6 +82,7 @@ func (c *WordprocessingCanvas) UnmarshalXML(d *xml.Decoder, start xml.StartEleme
return nil
}
// WPCBackground ...
type WPCBackground struct {
XMLName xml.Name `xml:"wpc:bg,omitempty"`
NoFill *struct{} `xml:"a:noFill,omitempty"`
@@ -113,6 +115,7 @@ func (b *WPCBackground) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (er
return nil
}
// WPCWhole ...
type WPCWhole struct {
XMLName xml.Name `xml:"wpc:whole,omitempty"`
Line *ALine