Skip to content

InsertRowBefore does not update named cell references #4804

@William-IRM

Description

@William-IRM

Migrating a really old internal tool from PHPExcel to PhpSpreadsheet, I was surprised and disappointed to discover that while the old PHPExcel correctly updated named cell references when inserting/deleting rows/columns, it doesn't appear that PhpSpreadsheet does the same.

I see that cross-sheet references are also not updated automatically, due to performance concerns. Can I propose a solution? Add an additional (optional?) parameter to the various insert/delete functions to allow the user to define what to check and update. I'm thinking a series of constants, use standard binary operators to combine as desired:

  • PHPSPREADSHEET_UPDATE_NONE: for those who know there's no references and want lightning fast inserts/deletes. Useful for cloning a style.
  • PHPSPREADSHEET_UPDATE_SAME_SHEET: as the current behaviour.
  • PHPSPREADSHEET_UPDATE_OTHER_SHEETS: Specifically only update references in other sheets. Probably not useful on its own, but you never know.
  • PHPSPREADSHEET_UPDATE_NAMED_REFERENCES: Specifically only update named cells/ranges.
  • PHPSPREADSHEET_UPDATE_ALL: Combination of same sheet, other sheets, and named references.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions