forked from p30928647/excelize
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)
|
xlsx := f.workSheetReader(sheet)
|
||||||
for rowIdx := range xlsx.SheetData.Row {
|
for rowIdx := range xlsx.SheetData.Row {
|
||||||
rowData := xlsx.SheetData.Row[rowIdx]
|
rowData := &xlsx.SheetData.Row[rowIdx]
|
||||||
for colIdx, cellData := range rowData.C {
|
for colIdx := range rowData.C {
|
||||||
colName, _, _ := SplitCellName(cellData.R)
|
colName, _, _ := SplitCellName(rowData.C[colIdx].R)
|
||||||
if colName == col {
|
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) {
|
if row > len(xlsx.SheetData.Row) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for i, r := range xlsx.SheetData.Row {
|
for rowIdx := range xlsx.SheetData.Row {
|
||||||
if r.R == row {
|
if xlsx.SheetData.Row[rowIdx].R == row {
|
||||||
xlsx.SheetData.Row = append(xlsx.SheetData.Row[:i], xlsx.SheetData.Row[i+1:]...)
|
xlsx.SheetData.Row = append(xlsx.SheetData.Row[:rowIdx],
|
||||||
|
xlsx.SheetData.Row[rowIdx+1:]...)[:len(xlsx.SheetData.Row)-1]
|
||||||
f.adjustHelper(sheet, rows, row, -1)
|
f.adjustHelper(sheet, rows, row, -1)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue