Page 1 of 1
[Solved] Transform CellAddress to cell name using Java
Posted: Mon May 28, 2018 7:17 pm
by Lookris
Is there a way to get human readable version of CellAddress struct? I desperately want to transform Sheet = 1, Column = 1, Row = 1 into simple and sleek A1 (or even 1.A1)
Re: Transform CellAddress to cell name using Java
Posted: Mon May 28, 2018 8:07 pm
by Villeroy
Get the cell object and then property AbsoluteName.
Re: Transform CellAddress to cell name using Java
Posted: Mon May 28, 2018 8:08 pm
by FJCC
A cell object that has a CellAddress will also have an AbsoluteName like $Sheet1.$A$1. Can you use that?
By the way, when CellAddress.Column = 1, that is column B and when CellAddress.Row = 1 that is row 2
Re: Transform CellAddress to cell name using Java
Posted: Mon May 28, 2018 8:54 pm
by Lookris
Yeah, a little string manipulation, and this will do the trick. Thank you
Re: [Solved] Transform CellAddress to cell name using Java
Posted: Tue May 29, 2018 8:51 pm
by Lookris
Any way to do the same with ComplexReference? The straightforward way of doing something like splitting reference in two, then getting cells by their addresses, then getting AbsoluteName of each of them, THEN handcrafting `A1:A3` string with `.split()`s and `.removeAll()`s seems cumbersome to say the least
Re: [Solved] Transform CellAddress to cell name using Java
Posted: Tue May 29, 2018 10:34 pm
by Villeroy
You have to install
the MRI extension.
AbsoluteName is a property of a cell range.