本帖最后由 libo 于 2018-4-9 13:51 编辑
Spread7追加行,然后对行进行排序,减少行,追加的行消失了,追加的数据也消失了,怎样减少行不考虑排序?
如图,初始数据是001.png:
1.点击Button12追加行,写入数据,按A列行排序,代码如下,运行后如图002.png:
Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
FpSpread1.ActiveSheet.RowCount = FpSpread1.ActiveSheet.RowCount + 2
FpSpread1.ActiveSheet.SetText(FpSpread1.ActiveSheet.RowCount - 1, 0, "a")
FpSpread1.ActiveSheet.SetText(FpSpread1.ActiveSheet.RowCount - 2, 0, "e")
FpSpread1.ActiveSheet.SortRows(0, True, True)
End Sub
2.点击Button13,减少行,代码如下,追加的行不见了,追加的数据(a,e所在行)也丢失了,运行后如图003.png:
Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
FpSpread1.ActiveSheet.RowCount = FpSpread1.ActiveSheet.RowCount - 4
End Sub
我只是想不考虑排序,从下面减少行数,不要造成新追加的数据丢失,怎样实现?
|
|