diff options
Diffstat (limited to 'excelize.go')
-rw-r--r-- | excelize.go | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/excelize.go b/excelize.go index 4b4aa32..b162b79 100644 --- a/excelize.go +++ b/excelize.go @@ -238,18 +238,19 @@ func (f *File) adjustRowDimensions(xlsx *xlsxWorksheet, rowIndex, offset int) { } for i, r := range xlsx.SheetData.Row { if r.R >= rowIndex { - xlsx.SheetData.Row[i].R += offset - for k, v := range xlsx.SheetData.Row[i].C { - axis := v.R - col := string(strings.Map(letterOnlyMapF, axis)) - row, _ := strconv.Atoi(strings.Map(intOnlyMapF, axis)) - xAxis := row + offset - xlsx.SheetData.Row[i].C[k].R = col + strconv.Itoa(xAxis) - } + f.ajustSingleRowDimensions(&xlsx.SheetData.Row[i], offset) } } } +func (f *File) ajustSingleRowDimensions(r *xlsxRow, offset int) { + r.R += offset + for i, col := range r.C { + row, _ := strconv.Atoi(strings.Map(intOnlyMapF, col.R)) + r.C[i].R = string(strings.Map(letterOnlyMapF, col.R)) + strconv.Itoa(row+offset) + } +} + // adjustHyperlinks provides a function to update hyperlinks when inserting or // deleting rows or columns. func (f *File) adjustHyperlinks(sheet string, column, rowIndex, offset int) { |