Skip to content

Commit

Permalink
Merge branch 'master' into v2
Browse files Browse the repository at this point in the history
  • Loading branch information
xuri committed Aug 14, 2020
2 parents 3cf3101 + c98fd7e commit cb6f885
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions adjust.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,15 @@ func (f *File) adjustHyperlinks(xlsx *xlsxWorksheet, sheet string, dir adjustDir

// order is important
if offset < 0 {
for rowIdx, linkData := range xlsx.Hyperlinks.Hyperlink {
for i := len(xlsx.Hyperlinks.Hyperlink) - 1; i >= 0; i-- {
linkData := xlsx.Hyperlinks.Hyperlink[i]
colNum, rowNum, _ := CellNameToCoordinates(linkData.Ref)

if (dir == rows && num == rowNum) || (dir == columns && num == colNum) {
f.deleteSheetRelationships(sheet, linkData.RID)
if len(xlsx.Hyperlinks.Hyperlink) > 1 {
xlsx.Hyperlinks.Hyperlink = append(xlsx.Hyperlinks.Hyperlink[:rowIdx],
xlsx.Hyperlinks.Hyperlink[rowIdx+1:]...)
xlsx.Hyperlinks.Hyperlink = append(xlsx.Hyperlinks.Hyperlink[:i],
xlsx.Hyperlinks.Hyperlink[i+1:]...)
} else {
xlsx.Hyperlinks = nil
}
Expand Down

0 comments on commit cb6f885

Please sign in to comment.