Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] FsTable.Cell access is relative to table start #50

Open
Freymaurer opened this issue Jul 27, 2023 · 0 comments
Open

[BUG] FsTable.Cell access is relative to table start #50

Freymaurer opened this issue Jul 27, 2023 · 0 comments
Labels
Type: Bug Something is not working, and it is confirmed by maintainers to be a bug.

Comments

@Freymaurer
Copy link
Collaborator

#r "nuget: FsSpreadsheet, 3.1.1"
#r "nuget: FsSpreadsheet.ExcelIO, 3.1.1"

let path = @"C:/Users/Kevin/Desktop/Book1.xlsx"

open FsSpreadsheet
open FsSpreadsheet.ExcelIO

let wb = new FsWorkbook()

let ws = wb.InitWorksheet("New Worksheet")

ws.AddCell(FsCell("My Column 1",address=FsAddress("B1")))
ws.AddCell(FsCell("My Column 2",address=FsAddress("C1")))
let t = FsTable("My New Table", FsRangeAddress("B1:C2"))

ws.AddTable(t)

// Cell access
t.Cell(FsAddress("B1"), ws.CellCollection).Value // "My Column 2"
t.Cell(FsAddress("A1"), ws.CellCollection).Value //  "My Column 1"
t.Cell(FsAddress("C1"), ws.CellCollection).Value // ""

Setup: As you can see i set two cells "B1" and "C1" and create a table over their range.

Now i would expect that the "Cell access" via FsAddress on "B1" should return "My Column 1", but instead it returns "My Column 2".

Testing the same access for "A1" and "C1" shows, that this cell access, even though it is done via address works relative to table start, which i can only assume is a bug.
I would understand and appreciate this behaviour in a function with index based access but not here.

The correct insert can be checked via:

let b1 = FsAddress("B1")

ws.GetCellAt(b1.RowNumber, b1.ColumnNumber).Value // "My Column 1"
@Freymaurer Freymaurer added the bug Something isn't working label Jul 27, 2023
@Freymaurer Freymaurer changed the title [BUG] FsTable.Cell access seems to be relative to table start [BUG] FsTable.Cell access is relative to table start Jul 27, 2023
@kMutagene kMutagene added Type: Bug Something is not working, and it is confirmed by maintainers to be a bug. and removed bug Something isn't working labels Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something is not working, and it is confirmed by maintainers to be a bug.
Projects
None yet
Development

No branches or pull requests

2 participants