Skip to content

Add EscapeUtil.escapeForExcelSheetName#2726

Merged
labkey-danield merged 3 commits intodevelopfrom
fb_smExportExcelPageNameFix
Oct 7, 2025
Merged

Add EscapeUtil.escapeForExcelSheetName#2726
labkey-danield merged 3 commits intodevelopfrom
fb_smExportExcelPageNameFix

Conversation

@labkey-danield
Copy link
Contributor

@labkey-danield labkey-danield commented Oct 6, 2025

Rationale

Add EscapeUtil.escapeForExcelSheetName to replace : / with _ when looking at sheet names in excel.

Related Pull Requests

Changes

  • EscapeUtil.escapeForExcelSheetName

Call EscapeUtil.escapeForExcelSheetName in SMProSamplesCrossFolderCRUDTest.testUniqueSheetNamesForLongTypeNames
Comment on lines 228 to 231
public static String escapeForExcelSheetName(String value)
{
return excelPageNeedsEscaping.matcher(value).replaceAll("_");
}
Copy link
Member

@labkey-tchad labkey-tchad Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an existing, more thorough method for this (it's what is used on the server side). org.apache.poi.ss.util.WorkbookUtil#createSafeSheetName(java.lang.String, char)

Suggested change
public static String escapeForExcelSheetName(String value)
{
return excelPageNeedsEscaping.matcher(value).replaceAll("_");
}
public static String createSafeSheetName(String value)
{
return WorkbookUtil.createSafeSheetName(value, '_');
}

Also, this isn't escaping (escaping is reversible). Consider moving this method to ExcelHelper.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

@labkey-danield labkey-danield merged commit c8091f0 into develop Oct 7, 2025
8 checks passed
@labkey-danield labkey-danield deleted the fb_smExportExcelPageNameFix branch October 7, 2025 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants