0

Im using umya spreadsheet to edit a xlsx file and want to add a comment with the changed cells. I am very new to rust and it could be that i am missing something, but i cantf find a way to specify coordinate of a comment.

I am using umya spreadsheet version 0.9.1

docs As you can see, there is no implementation for "set_coordinate" and i am very confused as to why. I have no problem creating and adding a comment with Comment::default(), but it only appears on A1.

Luca
  • 19
  • 4
  • 1
    `let coord = comment.get_coordinate_mut(); coord.set_col_num(12); coord.set_row_num(3);` – PitaJ Apr 19 '23 at 21:03
  • 2
    FYI: in the future, please include some code in your question. It's supposed to have a [Minimal Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) – PitaJ Apr 19 '23 at 21:05
  • 1
    @PitaJ why don't you post as an answer instead of a comment? – aled Apr 20 '23 at 01:10
  • @PitaJ Thanks, that helped, as for reproduktion, the most i coud have given you was code snippet where i invoke a not existing method. – Luca Apr 20 '23 at 07:06
  • 1
    @Luca, any code is better than nothing. – PitaJ Apr 20 '23 at 16:35
  • @aled if what I suggest doesn't actually work, I'd prefer it just be a comment. In this case, without much context or code, there wasn't really a way for me to test it – PitaJ Apr 20 '23 at 16:35

1 Answers1

1

The get_coordinate_mut method is what you're looking for. This returns a mutable reference to the coordinates, which you can use to modify the coordinates:

let coord = comment.get_coordinate_mut();
coord.set_col_num(3);
coord.set_row_num(12);

// comment is now at C12
PitaJ
  • 12,969
  • 6
  • 36
  • 55