odoo/o-spreadsheet

getter to get currently selected coordinates

Closed this issue · 3 comments

is it possible to get the currently selected coordinates as in (A2:C4)?

or is it possible to convert zones to coordinates, example getters.getActivePosition() --> "A2" ?

Hello,

You can use the getter zoneToXC

  const sheetId = model.getters.getActiveSheetId();
  const selection = model.getters.getSelectedZone();
  console.log(model.getters.zoneToXC(sheetId, selection)); // => "A2:C4"

Have a nice day 👋

and is it possible to get a cell by its coordinates? example:

model.getters.getCellAtXC("A2")

?

cheers

Hello 👋

There is no getter that directly take the XC as argument, but you can convert the XC to {col , row} coordinates with the toCartesian helper, then use the getter getCell