-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Copy link
Labels
bugSomething isn't workingSomething isn't working
Description
Description
Renaming a sheet might cause Microsoft Excel to show a warning that the file contains broken links. This happens if the sheet name contains whitespaces for example and definedNames referencing this sheet. This is also the reason why some sheet names are escaped and others not. This PR checks via regex for non word characters and escapes sheet names in definedNames if required. The current implementation only preserves already present escaping, even if it is not required anymore.
Currently "Sheet 2!$A$1:$A$2"
Required "'Sheet 2'!$A$1:$A$2"
Steps to reproduce the issue
DefinedName = "Sheet1!$A$1:$A$2"
if err := f.SetSheetName("Sheet1", "Requires escaping"); err != nil {
log.Println(err)
return err
}
Describe the results you received
DefinedName = "Requires escaping!$A$1:$A$2"
Describe the results you expected
DefinedName = "'Requires escaping'!$A$1:$A$2"
Go version
1.24.2
Excelize version or commit ID
2.9.0 / master
Environment
Alpine, Microsoft Excel 365
Validations
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working