forked from p30928647/excelize
Merge branch 'master' into v2
This commit is contained in:
commit
cb6f8852bb
|
@ -109,14 +109,15 @@ func (f *File) adjustHyperlinks(xlsx *xlsxWorksheet, sheet string, dir adjustDir
|
||||||
|
|
||||||
// order is important
|
// order is important
|
||||||
if offset < 0 {
|
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)
|
colNum, rowNum, _ := CellNameToCoordinates(linkData.Ref)
|
||||||
|
|
||||||
if (dir == rows && num == rowNum) || (dir == columns && num == colNum) {
|
if (dir == rows && num == rowNum) || (dir == columns && num == colNum) {
|
||||||
f.deleteSheetRelationships(sheet, linkData.RID)
|
f.deleteSheetRelationships(sheet, linkData.RID)
|
||||||
if len(xlsx.Hyperlinks.Hyperlink) > 1 {
|
if len(xlsx.Hyperlinks.Hyperlink) > 1 {
|
||||||
xlsx.Hyperlinks.Hyperlink = append(xlsx.Hyperlinks.Hyperlink[:rowIdx],
|
xlsx.Hyperlinks.Hyperlink = append(xlsx.Hyperlinks.Hyperlink[:i],
|
||||||
xlsx.Hyperlinks.Hyperlink[rowIdx+1:]...)
|
xlsx.Hyperlinks.Hyperlink[i+1:]...)
|
||||||
} else {
|
} else {
|
||||||
xlsx.Hyperlinks = nil
|
xlsx.Hyperlinks = nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue