summaryrefslogtreecommitdiff
path: root/excelize.go
diff options
context:
space:
mode:
authorRi Xu <xuri.me@gmail.com>2017-09-30 17:07:59 +0800
committerRi Xu <xuri.me@gmail.com>2017-09-30 17:07:59 +0800
commit905be463edc6d9b0ed184bdee0116217a5118c5e (patch)
treeb5e1869ad992ed2fc7e3e4e56b8178b0473dcb88 /excelize.go
parentd4df70bd9fa671d20a5e000d20e621ca69451274 (diff)
Improve code readability.
Diffstat (limited to 'excelize.go')
-rw-r--r--excelize.go27
1 files changed, 13 insertions, 14 deletions
diff --git a/excelize.go b/excelize.go
index f06ecb0..e3b5dac 100644
--- a/excelize.go
+++ b/excelize.go
@@ -120,11 +120,11 @@ func checkSheet(xlsx *xlsxWorksheet) {
_, ok := existsRows[i+1]
if ok {
sheetData.Row = append(sheetData.Row, xlsx.SheetData.Row[existsRows[i+1]])
- continue
+ } else {
+ sheetData.Row = append(sheetData.Row, xlsxRow{
+ R: i + 1,
+ })
}
- sheetData.Row = append(sheetData.Row, xlsxRow{
- R: i + 1,
- })
}
xlsx.SheetData = sheetData
}
@@ -223,16 +223,15 @@ func (f *File) adjustRowDimensions(xlsx *xlsxWorksheet, rowIndex, offset int) {
return
}
for i, r := range xlsx.SheetData.Row {
- if r.R < rowIndex {
- continue
- }
- 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)
+ 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)
+ }
}
}
}