1
0
mirror of https://github.com/fumiama/go-docx.git synced 2026-06-17 15:30:27 +08:00

Fix links

This commit is contained in:
Gonzalo Fernandez-Victorio
2021-04-30 13:51:52 +01:00
parent c821a33692
commit 9cb29541da
6 changed files with 33 additions and 13 deletions

View File

@@ -2,6 +2,7 @@ package docxlib
import (
"archive/zip"
"errors"
"io"
)
@@ -37,3 +38,15 @@ func (f *DocxLib) Write(writer io.Writer) (err error) {
return f.pack(zipWriter)
}
// References gets the url for a reference
func (f *DocxLib) References(id string) (href string, err error) {
for _, a := range f.DocRelation.Relationships {
if a.ID == id {
href = a.Target
return
}
}
err = errors.New("id not found")
return
}