Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to convert coordinates in the spreadsheet? (Read 514 times)
Ale
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 14
Joined: May 26th, 2023
How to convert coordinates in the spreadsheet?
May 30th, 2023 at 3:45pm
Print Post  
Hello,

the question seems trivial but...
if I have the spreadsheet coordinates as (row,col) as integer (13, 48) how can I convert them as a string (e.g. "AE14")?

Is there a method/function to do this? (possibly a static method so it can be used anywhere...)

Thank you
  
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3154
Joined: Oct 19th, 2005
Re: How to convert coordinates in the spreadsheet?
Reply #1 - May 30th, 2023 at 5:29pm
Print Post  
Hi,

There are only internal ones at this time, but you could get some indirect access to conversion using CellRange.ToString or =ADDRESS function:

Code
Select All
// zero-based
Debug.WriteLine(activeSheet.CellRanges[48, 13, 48, 13].ToString());

var calc = new Workbook();
calc.Worksheets.Add();

var addrConverter = calc.Worksheets[0].Cells[0, 0];
addrConverter.Data = "=ADDRESS(14,49,4)"; // 1-based
Debug.WriteLine(addrConverter.Value); 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Ale
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 14
Joined: May 26th, 2023
Re: How to convert coordinates in the spreadsheet?
Reply #2 - Jun 1st, 2023 at 8:32am
Print Post  
Ok, thank you.
Generally speaking I think is very important that, in a spreadsheet customizable application, you expose the conversion functions from/to ("A1"->[0,0] and [0,0]->"A1") Wink
  
Back to top
 
IP Logged
 
Slavcho
God Member
*****
Offline


tech.support

Posts: 3154
Joined: Oct 19th, 2005
Re: How to convert coordinates in the spreadsheet?
Reply #3 - Jun 2nd, 2023 at 5:51am
Print Post  
Hi,

This build publishes a previously internal CellIndex class -
https://mindfusion.eu/_beta/spreadwin_index.zip

Code
Select All
var idx1 = new CellIndex("AW14");
Debug.WriteLine(idx1.Column.ToString() +
	(idx1.ColumnAbsolute ? " (absolute)" : " (relative"));

var idx2 = new CellIndex("$AW14");
Debug.WriteLine(idx2.Column.ToString() +
	(idx2.ColumnAbsolute ? " (absolute)" : " (relative"));

var idx3 = new CellIndex(48, 13);
Debug.WriteLine(idx3.ToString()); 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint