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

add AddInlineDrawingFrom

This commit is contained in:
源文雨
2023-02-20 22:48:04 +08:00
parent f07b5dd914
commit 292a298c57
27 changed files with 634 additions and 130 deletions

View File

@@ -1,28 +1,9 @@
package docxlib
import (
"strconv"
"sync/atomic"
)
const (
HYPERLINK_STYLE = "a1"
)
// when adding an hyperlink we need to store a reference in the relationship field
func (f *Docx) addLinkRelation(link string) string {
rel := &Relationship{
ID: "rId" + strconv.Itoa(int(atomic.AddUintptr(&f.rId, 1))),
Type: REL_HYPERLINK,
Target: link,
TargetMode: REL_TARGETMODE,
}
f.DocRelation.Relationships = append(f.DocRelation.Relationships, rel)
return rel.ID
}
// AddLink adds an hyperlink to paragraph
func (p *Paragraph) AddLink(text string, link string) *Hyperlink {
rId := p.file.addLinkRelation(link)