summaryrefslogtreecommitdiff
path: root/excelize.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2022-05-01 12:28:36 +0800
committerGitHub <noreply@github.com>2022-05-01 12:28:36 +0800
commit773d4afa32a55349a7b178c4c76d182f9ed0221f (patch)
treed176338fc1c550dab8201180f822dbf6dfad074d /excelize.go
parent856ee57c4019b4478da0f6cb3010ae636914a6be (diff)
This closes #1217, support update cell hyperlink
Ref #1129, make `SetRowStyle` overwrite style of the cells
Diffstat (limited to 'excelize.go')
-rw-r--r--excelize.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/excelize.go b/excelize.go
index 9fe3d88..d78d2b1 100644
--- a/excelize.go
+++ b/excelize.go
@@ -327,6 +327,28 @@ func checkSheetR0(ws *xlsxWorksheet, sheetData *xlsxSheetData, r0 *xlsxRow) {
ws.SheetData = *sheetData
}
+// setRels provides a function to set relationships by given relationship ID,
+// XML path, relationship type, target and target mode.
+func (f *File) setRels(rID, relPath, relType, target, targetMode string) int {
+ rels := f.relsReader(relPath)
+ if rels == nil || rID == "" {
+ return f.addRels(relPath, relType, target, targetMode)
+ }
+ rels.Lock()
+ defer rels.Unlock()
+ var ID int
+ for i, rel := range rels.Relationships {
+ if rel.ID == rID {
+ rels.Relationships[i].Type = relType
+ rels.Relationships[i].Target = target
+ rels.Relationships[i].TargetMode = targetMode
+ ID, _ = strconv.Atoi(strings.TrimPrefix(rID, "rId"))
+ break
+ }
+ }
+ return ID
+}
+
// addRels provides a function to add relationships by given XML path,
// relationship type, target and target mode.
func (f *File) addRels(relPath, relType, target, targetMode string) int {