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:
@@ -26,7 +26,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// AddInlineShape adds wsp named drawing to paragraph
|
// 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))
|
idn := int(atomic.AddUintptr(&p.file.docID, 1))
|
||||||
id := strconv.Itoa(int(p.file.IncreaseID(name)))
|
id := strconv.Itoa(int(p.file.IncreaseID(name)))
|
||||||
d := &Drawing{
|
d := &Drawing{
|
||||||
@@ -77,11 +77,11 @@ func (p *Paragraph) AddInlineShape(w, h int64, name, bwMode, prst string, ln *AL
|
|||||||
Children: c,
|
Children: c,
|
||||||
}
|
}
|
||||||
p.Children = append(p.Children, run)
|
p.Children = append(p.Children, run)
|
||||||
return run, nil
|
return run
|
||||||
}
|
}
|
||||||
|
|
||||||
// AddAnchorShape adds wsp named drawing to paragraph
|
// 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))
|
idn := int(atomic.AddUintptr(&p.file.docID, 1))
|
||||||
id := strconv.Itoa(int(p.file.IncreaseID(name)))
|
id := strconv.Itoa(int(p.file.IncreaseID(name)))
|
||||||
d := &Drawing{
|
d := &Drawing{
|
||||||
@@ -144,5 +144,5 @@ func (p *Paragraph) AddAnchorShape(w, h int64, name, bwMode, prst string, ln *AL
|
|||||||
Children: c,
|
Children: c,
|
||||||
}
|
}
|
||||||
p.Children = append(p.Children, run)
|
p.Children = append(p.Children, run)
|
||||||
return run, nil
|
return run
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ func main() {
|
|||||||
|
|
||||||
p := w.AddParagraph().Justification("center")
|
p := w.AddParagraph().Justification("center")
|
||||||
p.AddText("测试 AutoShape w:ln").Size("44")
|
p.AddText("测试 AutoShape w:ln").Size("44")
|
||||||
p.AddAnchorShape(808355, 238760, "AutoShape", "auto", "straightConnector1",
|
_ = p.AddAnchorShape(808355, 238760, "AutoShape", "auto", "straightConnector1",
|
||||||
&docx.ALine{
|
&docx.ALine{
|
||||||
W: 9525,
|
W: 9525,
|
||||||
SolidFill: &docx.ASolidFill{SrgbClr: &docx.ASrgbClr{Val: "000000"}},
|
SolidFill: &docx.ASolidFill{SrgbClr: &docx.ASrgbClr{Val: "000000"}},
|
||||||
@@ -134,7 +134,7 @@ func main() {
|
|||||||
TailEnd: &docx.ATailEnd{},
|
TailEnd: &docx.ATailEnd{},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
p.AddInlineShape(808355, 238760, "AutoShape", "auto", "straightConnector1",
|
_ = p.AddInlineShape(808355, 238760, "AutoShape", "auto", "straightConnector1",
|
||||||
&docx.ALine{
|
&docx.ALine{
|
||||||
W: 9525,
|
W: 9525,
|
||||||
SolidFill: &docx.ASolidFill{SrgbClr: &docx.ASrgbClr{Val: "000000"}},
|
SolidFill: &docx.ASolidFill{SrgbClr: &docx.ASrgbClr{Val: "000000"}},
|
||||||
|
|||||||
1
id.go
1
id.go
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
package docx
|
package docx
|
||||||
|
|
||||||
|
// IncreaseID by name
|
||||||
func (f *Docx) IncreaseID(name string) (n uintptr) {
|
func (f *Docx) IncreaseID(name string) (n uintptr) {
|
||||||
f.slowIDsMu.Lock()
|
f.slowIDsMu.Lock()
|
||||||
n = f.slowIDs[name]
|
n = f.slowIDs[name]
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// WordprocessingCanvas ...
|
||||||
type WordprocessingCanvas struct {
|
type WordprocessingCanvas struct {
|
||||||
XMLName xml.Name `xml:"wpc:wpc,omitempty"`
|
XMLName xml.Name `xml:"wpc:wpc,omitempty"`
|
||||||
Background *WPCBackground
|
Background *WPCBackground
|
||||||
@@ -81,6 +82,7 @@ func (c *WordprocessingCanvas) UnmarshalXML(d *xml.Decoder, start xml.StartEleme
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WPCBackground ...
|
||||||
type WPCBackground struct {
|
type WPCBackground struct {
|
||||||
XMLName xml.Name `xml:"wpc:bg,omitempty"`
|
XMLName xml.Name `xml:"wpc:bg,omitempty"`
|
||||||
NoFill *struct{} `xml:"a:noFill,omitempty"`
|
NoFill *struct{} `xml:"a:noFill,omitempty"`
|
||||||
@@ -113,6 +115,7 @@ func (b *WPCBackground) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (er
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WPCWhole ...
|
||||||
type WPCWhole struct {
|
type WPCWhole struct {
|
||||||
XMLName xml.Name `xml:"wpc:whole,omitempty"`
|
XMLName xml.Name `xml:"wpc:whole,omitempty"`
|
||||||
Line *ALine
|
Line *ALine
|
||||||
|
|||||||
Reference in New Issue
Block a user