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:
13
docxlib.go
13
docxlib.go
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user