diff options
| author | xuri <xuri.me@gmail.com> | 2019-01-11 11:24:53 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-11 11:24:53 +0800 |
| commit | 7f1323f7ac7037670848fb8ab103ace59748c28e (patch) | |
| tree | a2ca4ea8afe8f48ddb11ad3dc7744b59a497ddc0 /excelize.go | |
| parent | b0ed4c12d2cced29d82e8a4af47f7b42f555ca8c (diff) | |
| parent | 725c1a0c40971282ff924f4802a57e4c17431691 (diff) | |
Merge pull request #334 from albenik/duplicate_row
Resolve #333 New feature: File.DuplicateRowTo() duplicate row to a specified row position
Diffstat (limited to 'excelize.go')
| -rw-r--r-- | excelize.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/excelize.go b/excelize.go index 61f6dd6..32f0451 100644 --- a/excelize.go +++ b/excelize.go @@ -238,18 +238,16 @@ func (f *File) adjustRowDimensions(xlsx *xlsxWorksheet, rowIndex, offset int) { } for i, r := range xlsx.SheetData.Row { if r.R >= rowIndex { - f.ajustSingleRowDimensions(&xlsx.SheetData.Row[i], offset) + f.ajustSingleRowDimensions(&xlsx.SheetData.Row[i], r.R+offset) } } } -// ajustSingleRowDimensions provides a function to ajust single row -// dimensions. -func (f *File) ajustSingleRowDimensions(r *xlsxRow, offset int) { - r.R += offset +// ajustSingleRowDimensions provides a function to ajust single row dimensions. +func (f *File) ajustSingleRowDimensions(r *xlsxRow, row int) { + r.R = row 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) + r.C[i].R = string(strings.Map(letterOnlyMapF, col.R)) + strconv.Itoa(r.R) } } |
