Forum


Replies: 1   Views: 284
Conversion of numeric cell coordinates to excel style coordinates
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpxlsx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpxlsx version and check the Documentation available.

Posted by jeroen8087  · 02-02-2023 - 15:49

Is there a utility to convert numeric cell coordinates to Excel-style coordinates? For instance, an (x,y) position (4,2) can be converted to D2 and (28,74) can be converted to AB74. I can use getCellPositions, but that is not useful if I want to put data in a field that has no data yet.

This functionality is useful when I have to put information in a cell, where the exact position is variable. This can be the case when using different Excel templates.

I created my own basic base26 converter, but I think it should be present in the phpxlsx library.

Posted by admin  · 03-02-2023 - 12:47

Hello,

phpxlsx includes the following public function in CreateElement class:

public function wordToInt($value)

This method transforms a string position to int starting from 0. It's not exactly the method you are requesting for (it doesn't allow both coordinates) but it can be used to accomplish it.

Regards.