ClosedXML icon indicating copy to clipboard operation
ClosedXML copied to clipboard

Added an option to not load defined names

Open adamscarlat opened this issue 1 year ago • 1 comments

In certain cases, the defined names section in an Excel workbook may contain broken links to ranges that no longer exist. While this doesn't prevent users from working with the Excel file directly in Excel, it poses a significant issue when loading these files with the ClosedXML library.

Currently, ClosedXML automatically attempts to load all defined names in the workbook. If it encounters any corrupt defined names or broken links, it throws an ArgumentOutOfRangeException exception (see XLTable.Table). This behavior prevents users from loading any Excel files with broken defined names, regardless of whether they need to use these for their processing or not.

This update addresses this issue by introducing a new option that allows users to skip the loading of defined names if they are not needed for their processing tasks. This enhancement ensures that users can still work with Excel files that have broken defined names without encountering exceptions.

Key points of this change include:

  • Optional Defined Names Loading: Users can now choose to bypass the loading of defined names, which is particularly useful for files with broken links.
  • Backward Compatibility: The change is fully backward compatible. By default, the option is set to true, meaning defined names will be loaded unless specified otherwise.
  • Improved Flexibility: This new feature provides greater flexibility and robustness in handling a wider variety of Excel files, enhancing the overall user experience with ClosedXML. This improvement ensures that users can process Excel files more reliably, even when encountering issues with defined names.

adamscarlat avatar May 20 '24 14:05 adamscarlat

thanks! this resolves: https://github.com/ClosedXML/ClosedXML/issues/1983 for me

fopsdev avatar Jun 28 '24 06:06 fopsdev