1
0
mirror of https://github.com/fumiama/go-docx.git synced 2026-06-05 15:50:24 +08:00
Files
go-docx/apilink.go
2023-02-23 15:35:53 +08:00

27 lines
467 B
Go

package docxlib
//nolint:revive,stylecheck
const (
HYPERLINK_STYLE = "a3"
)
// AddLink adds an hyperlink to paragraph
func (p *Paragraph) AddLink(text string, link string) *Hyperlink {
rid := p.file.addLinkRelation(link)
hyperlink := &Hyperlink{
ID: rid,
Run: Run{
RunProperties: &RunProperties{
RunStyle: &RunStyle{
Val: HYPERLINK_STYLE,
},
},
InstrText: text,
},
}
p.Children = append(p.Children, hyperlink)
return hyperlink
}