-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check if coordinate is inside range #3779
Conversation
Thank you for the suggestion. You will need to eliminate the phpcs and php-cs-fixer errors. One way to do so would be to run the command:
at the topmost directory. You will probably have to run it twice - once for phpcs and once for php-cs-fixer. When that is done, I would suggest some changes.
|
|
I don't know why that happened. Are you possibly running on Windows, and fixer changed the line endings? |
Yes, that was it. When I added the changes git ignored those other files. |
What you have added is good. You are still missing what will happen when a sheet name is supplied as part of the string. Right now, you get an "Invalid cell coordinate" exception. We can, I suppose, live with that, but I'm not convinced it's the correct result. I am prepared to hear alternatives, but I think best would be:
Take a look at Coordinate::extractAllCellReferencesInRange to see how it extracts the sheetname and non-sheetname portion of the address. You should be able to do something similar. You also might consider (I will not require it) making your non-exception tests use the same design as the tests for extractAllCellReferencesInRange, a single test method with the test cases in an external module; this will reduce the number of test methods in CoordinateTest. |
I've added the support to worksheet name. But I had to add another function to valid the cell reference. Please, check if it is ok now. I will add the tests after your validation. |
That wasn't really what I had in mind, and we already have some regexp's for coordinates. But ... I couldn't find any existing ones that were suitable, and yours is an interesting approach, so I'd like to see where it leads. I would suggest some changes:
|
That wasn't what I was thinking in the begining too. But, I didn't find any other function that helps me with the worksheet name part. |
Yes, Excel needs the apostrophes sometimes. However, your routine does not. You are just comparing two sheet names for equality, and the apostrophes could interfere with that. |
Is there anything else I need to do in this pull request? |
I added some test cases. If I don't think of anything else that needs to be done, I will probably merge this tomorrow. |
Thank you for your contribution. |
This is:
Checklist:
Why this change is needed?
This feature can help users to check if a coordinate is inside a range. Very useful to check if a cell is inside a table for example.