mirror of
https://github.com/fumiama/go-docx.git
synced 2026-06-24 12:54:58 +08:00
make lint happy
This commit is contained in:
@@ -116,7 +116,7 @@ func (p *Paragraph) AddAnchorDrawing(pic []byte) (*Run, error) {
|
|||||||
}
|
}
|
||||||
idn := int(atomic.AddUintptr(&p.file.imageID, 1))
|
idn := int(atomic.AddUintptr(&p.file.imageID, 1))
|
||||||
id := strconv.Itoa(idn)
|
id := strconv.Itoa(idn)
|
||||||
rId := p.file.addImage(Media{Name: "image" + id + "." + format, Data: pic})
|
rid := p.file.addImage(Media{Name: "image" + id + "." + format, Data: pic})
|
||||||
w, h := int64(sz.Width), int64(sz.Height)
|
w, h := int64(sz.Width), int64(sz.Height)
|
||||||
if float64(w)/float64(h) > 1.2 {
|
if float64(w)/float64(h) > 1.2 {
|
||||||
h = A4_EMU_MAX_WIDTH * h / w
|
h = A4_EMU_MAX_WIDTH * h / w
|
||||||
@@ -167,7 +167,7 @@ func (p *Paragraph) AddAnchorDrawing(pic []byte) (*Run, error) {
|
|||||||
},
|
},
|
||||||
BlipFill: &PICBlipFill{
|
BlipFill: &PICBlipFill{
|
||||||
Blip: ABlip{
|
Blip: ABlip{
|
||||||
Embed: rId,
|
Embed: rid,
|
||||||
Cstate: "print",
|
Cstate: "print",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ const (
|
|||||||
|
|
||||||
// AddLink adds an hyperlink to paragraph
|
// AddLink adds an hyperlink to paragraph
|
||||||
func (p *Paragraph) AddLink(text string, link string) *Hyperlink {
|
func (p *Paragraph) AddLink(text string, link string) *Hyperlink {
|
||||||
rId := p.file.addLinkRelation(link)
|
rid := p.file.addLinkRelation(link)
|
||||||
hyperlink := &Hyperlink{
|
hyperlink := &Hyperlink{
|
||||||
ID: rId,
|
ID: rid,
|
||||||
Run: Run{
|
Run: Run{
|
||||||
RunProperties: &RunProperties{
|
RunProperties: &RunProperties{
|
||||||
RunStyle: &RunStyle{
|
RunStyle: &RunStyle{
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ func Parse(reader io.ReaderAt, size int64) (doc *Docx, err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write allows to save a docx to a writer
|
// WriteTo allows to save a docx to a writer
|
||||||
func (f *Docx) WriteTo(writer io.Writer) (_ int64, err error) {
|
func (f *Docx) WriteTo(writer io.Writer) (_ int64, err error) {
|
||||||
zipWriter := zip.NewWriter(writer)
|
zipWriter := zip.NewWriter(writer)
|
||||||
defer zipWriter.Close()
|
defer zipWriter.Close()
|
||||||
|
|||||||
@@ -634,6 +634,7 @@ func (a *ABlip) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AAlphaModFix ...
|
||||||
type AAlphaModFix struct {
|
type AAlphaModFix struct {
|
||||||
XMLName xml.Name `xml:"a:alphaModFix,omitempty"`
|
XMLName xml.Name `xml:"a:alphaModFix,omitempty"`
|
||||||
Amount int `xml:"amt,attr"`
|
Amount int `xml:"amt,attr"`
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ func (p *Paragraph) String() string {
|
|||||||
return sb.String()
|
return sb.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MarshalXML ...
|
||||||
func (p *Paragraph) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
|
func (p *Paragraph) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
|
||||||
err := e.EncodeToken(start)
|
err := e.EncodeToken(start)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user