From 2285d4dc718fb8b96c3b2291c63b39c57468b0b9 Mon Sep 17 00:00:00 2001 From: xuri Date: Fri, 24 Apr 2020 08:26:16 +0800 Subject: handle the cell without r attribute in a row element --- rows.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'rows.go') 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 -- cgit v1.2.1