Originally posted by MarkBaker March 20, 2022
I'm planning version 2.0 with some bc breaks, and I'm looking at dropping methods like setCellValueByColumnAndRow() which accepts column and row number arguments, leaving only setCellValue() which requires a cell address as a string value(e.g. 'C5').
There are 14 such methods defined in the WorkSheet class:
setCellValueByColumnAndRow() has equivalent setCellValue()
setCellValueExplicitByColumnAndRow() has equivalent setCellValueExplicit()
getCellByColumnAndRow() has equivalent getCell()
cellExistsByColumnAndRow() has equivalent cellExists()
getStyleByColumnAndRow() has equivalent getStyle()
setBreakByColumnAndRow() has equivalent setBreak()
mergeCellsByColumnAndRow() has equivalent mergeCells()
unmergeCellsByColumnAndRow() has equivalent unmergeCells()
protectCellsByColumnAndRow() has equivalent protectCells()
unprotectCellsByColumnAndRow() has equivalent unprotectCells()
setAutoFilterByColumnAndRow() has equivalent setAutoFilter()
freezePaneByColumnAndRow() has equivalent freezePane()
getCommentByColumnAndRow() has equivalent getComment()
setSelectedCellByColumnAndRow() has equivalent setSelectedCells()
There is some inconsistency here, with other methods that only accept a cell address like IV255 and that have no "byColumnAndRow" eqivalent (e.g setTopLeftCell() and setSelectedCell()); so this deprecation will provide more consistency.
The base methods already provide more flexibility than the byColumnAndRow() methods
There are also a couple of column-only methods:
getColumnDimensionByColumn() has equivalent getColumnDimension()
insertNewColumnBeforeByIndex() has equivalent insertNewColumnBefore()
A CellAddress object could be defined with static creator methods like fromRowAndColumn($rowIndex, $columnIndex), fromColumnAndRow($columnIndex, $rowIndex), fromCoordinate($cellAddress), etc; and provide getters to retrieve rowIndex, columnIndex, columnString, cellAddress, etc, giving it a lot more flexibility.
These base methods will be re-defined to accept either a string, an array of columnId/RowId or a CellAddress object.
setCellValue(string|array|CellAddress $coordinate, $value){}
Those that accept a range of cells will be re-defined to accept either a string, an array of columnId/RowId, a CellAddress object, or a CellRange object.
mergeCells(string|array|CellAddress|CellRange $range){}
Discussed in #2706
Originally posted by MarkBaker March 20, 2022
I'm planning version 2.0 with some bc breaks, and I'm looking at dropping methods like
setCellValueByColumnAndRow()which accepts column and row number arguments, leaving onlysetCellValue()which requires a cell address as a string value(e.g. 'C5').There are 14 such methods defined in the
WorkSheetclass:setCellValueByColumnAndRow()has equivalentsetCellValue()setCellValueExplicitByColumnAndRow()has equivalentsetCellValueExplicit()getCellByColumnAndRow()has equivalentgetCell()cellExistsByColumnAndRow()has equivalentcellExists()getStyleByColumnAndRow()has equivalentgetStyle()setBreakByColumnAndRow()has equivalentsetBreak()mergeCellsByColumnAndRow()has equivalentmergeCells()unmergeCellsByColumnAndRow()has equivalentunmergeCells()protectCellsByColumnAndRow()has equivalentprotectCells()unprotectCellsByColumnAndRow()has equivalentunprotectCells()setAutoFilterByColumnAndRow()has equivalentsetAutoFilter()freezePaneByColumnAndRow()has equivalentfreezePane()getCommentByColumnAndRow()has equivalentgetComment()setSelectedCellByColumnAndRow()has equivalentsetSelectedCells()There is some inconsistency here, with other methods that only accept a cell address like
IV255and that have no "byColumnAndRow" eqivalent (e.gsetTopLeftCell()andsetSelectedCell()); so this deprecation will provide more consistency.The base methods already provide more flexibility than the
byColumnAndRow()methodsThere are also a couple of column-only methods:
getColumnDimensionByColumn()has equivalentgetColumnDimension()insertNewColumnBeforeByIndex()has equivalentinsertNewColumnBefore()A
CellAddressobject could be defined with static creator methods likefromRowAndColumn($rowIndex, $columnIndex),fromColumnAndRow($columnIndex, $rowIndex),fromCoordinate($cellAddress), etc; and providegettersto retrieve rowIndex, columnIndex, columnString, cellAddress, etc, giving it a lot more flexibility.These base methods will be re-defined to accept either a string, an array of columnId/RowId or a CellAddress object.
Those that accept a range of cells will be re-defined to accept either a string, an array of columnId/RowId, a CellAddress object, or a CellRange object.