summaryrefslogtreecommitdiff
path: root/rows.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2020-04-24 08:26:16 +0800
committerxuri <xuri.me@gmail.com>2020-04-24 08:26:16 +0800
commit2285d4dc718fb8b96c3b2291c63b39c57468b0b9 (patch)
tree0690e862e54512d5ba676f8e2555954a112e5bf6 /rows.go
parent1fe660df648422a53eef0c735657cb2f5237ef7b (diff)
handle the cell without r attribute in a row element
Diffstat (limited to 'rows.go')
-rw-r--r--rows.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/rows.go b/rows.go
index 8f000b3..6a67672 100644
--- a/rows.go
+++ b/rows.go
@@ -593,6 +593,22 @@ func checkRow(xlsx *xlsxWorksheet) error {
if colCount == 0 {
continue
}
+ // check and fill the cell without r attribute in a row element
+ rCount := 0
+ for idx, cell := range rowData.C {
+ rCount++
+ if cell.R != "" {
+ lastR, _, err := CellNameToCoordinates(cell.R)
+ if err != nil {
+ return err
+ }
+ if lastR > rCount {
+ rCount = lastR
+ }
+ continue
+ }
+ rowData.C[idx].R, _ = CoordinatesToCellName(rCount, rowIdx+1)
+ }
lastCol, _, err := CellNameToCoordinates(rowData.C[colCount-1].R)
if err != nil {
return err