parent
70b1a29165
commit
7d197c6d89
9
col.go
9
col.go
|
@ -337,11 +337,12 @@ func (f *File) RemoveCol(sheet, col string) {
|
|||
|
||||
xlsx := f.workSheetReader(sheet)
|
||||
for rowIdx := range xlsx.SheetData.Row {
|
||||
rowData := xlsx.SheetData.Row[rowIdx]
|
||||
for colIdx, cellData := range rowData.C {
|
||||
colName, _, _ := SplitCellName(cellData.R)
|
||||
rowData := &xlsx.SheetData.Row[rowIdx]
|
||||
for colIdx := range rowData.C {
|
||||
colName, _, _ := SplitCellName(rowData.C[colIdx].R)
|
||||
if colName == col {
|
||||
rowData.C = append(rowData.C[:colIdx], rowData.C[colIdx+1:]...)
|
||||
rowData.C = append(rowData.C[:colIdx], rowData.C[colIdx+1:]...)[:len(rowData.C)-1]
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
7
rows.go
7
rows.go
|
@ -379,9 +379,10 @@ func (f *File) RemoveRow(sheet string, row int) {
|
|||
if row > len(xlsx.SheetData.Row) {
|
||||
return
|
||||
}
|
||||
for i, r := range xlsx.SheetData.Row {
|
||||
if r.R == row {
|
||||
xlsx.SheetData.Row = append(xlsx.SheetData.Row[:i], xlsx.SheetData.Row[i+1:]...)
|
||||
for rowIdx := range xlsx.SheetData.Row {
|
||||
if xlsx.SheetData.Row[rowIdx].R == row {
|
||||
xlsx.SheetData.Row = append(xlsx.SheetData.Row[:rowIdx],
|
||||
xlsx.SheetData.Row[rowIdx+1:]...)[:len(xlsx.SheetData.Row)-1]
|
||||
f.adjustHelper(sheet, rows, row, -1)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue