From 19bd2a8817940d4f8725a85ebfa595faa214a24d Mon Sep 17 00:00:00 2001 From: Oliver Maus Date: Fri, 11 Aug 2023 13:23:54 +0200 Subject: [PATCH] Add `MinRowIndex` and `MinColIndex` to FsColumn --- src/FsSpreadsheet/FsColumn.fs | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/FsSpreadsheet/FsColumn.fs b/src/FsSpreadsheet/FsColumn.fs index a1a7eabe..68a93514 100644 --- a/src/FsSpreadsheet/FsColumn.fs +++ b/src/FsSpreadsheet/FsColumn.fs @@ -52,17 +52,29 @@ type FsColumn (rangeAddress : FsRangeAddress, cells : FsCellsCollection)= // ---------- /// The associated FsCells. - member self.Cells = + member this.Cells = base.Cells(cells) /// /// The index of the FsColumn. /// - member self.Index - with get() = self.RangeAddress.FirstAddress.ColumnNumber + member this.Index + with get() = this.RangeAddress.FirstAddress.ColumnNumber and set(i) = - self.RangeAddress.FirstAddress.ColumnNumber <- i - self.RangeAddress.LastAddress.ColumnNumber <- i + this.RangeAddress.FirstAddress.ColumnNumber <- i + this.RangeAddress.LastAddress.ColumnNumber <- i + + /// + /// The number of the lowest row index of the FsColumn where an FsCell exists. + /// + member this.MinRowIndex + with get() = this.RangeAddress.FirstAddress.RowNumber + + /// + /// The number of the highest row index of the FsColumn where an FsCell exists. + /// + member this.MaxRowIndex + with get() = this.RangeAddress.LastAddress.RowNumber // ------- @@ -70,11 +82,11 @@ type FsColumn (rangeAddress : FsRangeAddress, cells : FsCellsCollection)= // ------- /// - /// Creates a deep copy of this FsRow. + /// Creates a deep copy of this FsColumn. /// - member self.Copy() = - let ra = self.RangeAddress.Copy() - let cells = self.Cells |> Seq.map (fun c -> c.Copy()) + member this.Copy() = + let ra = this.RangeAddress.Copy() + let cells = this.Cells |> Seq.map (fun c -> c.Copy()) let fcc = FsCellsCollection() fcc.Add cells FsColumn(ra, fcc) @@ -90,7 +102,7 @@ type FsColumn (rangeAddress : FsRangeAddress, cells : FsCellsCollection)= /// static member getIndex (column : FsColumn) = column.Index - + /// /// Returns the FsCell at rowIndex. /// @@ -120,7 +132,7 @@ type FsColumn (rangeAddress : FsRangeAddress, cells : FsCellsCollection)= // row.InsertValueAt(colIndex, value) |> ignore // row - //member self.SortCells() = _cells <- _cells |> List.sortBy (fun c -> c.WorksheetColumn) + //member this.SortCells() = _cells <- _cells |> List.sortBy (fun c -> c.WorksheetColumn) // TO DO (later) ///// Takes an FsCellsCollection and creates an FsRow from the given rowIndex and the cells in the FsCellsCollection that share the same rowIndex.