From 7a573ef659f478416ea07040a0dca2cb2cef00c0 Mon Sep 17 00:00:00 2001 From: Oleg Kosarev Date: Wed, 19 Apr 2023 20:17:36 -0500 Subject: [PATCH] Update SimpleXLSXGen.php Removing special characters known to me from the sheet name. Since if you do not delete these characters, then Excel says that the sheet is broken and offers to restore it. --- src/SimpleXLSXGen.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SimpleXLSXGen.php b/src/SimpleXLSXGen.php index 6419f32..f61d446 100644 --- a/src/SimpleXLSXGen.php +++ b/src/SimpleXLSXGen.php @@ -237,7 +237,7 @@ class SimpleXLSXGen if ($name === null) { // autogenerated sheet names $name = 'Sheet' . ($this->curSheet + 1); } else { - $name = mb_substr($name, 0, 31); + $name = mb_substr(str_replace(["/", "*", "/", "|", "\\", "[", "]", ":"], '', $name), 0, 31); $names = []; foreach ($this->sheets as $sh) { $names[mb_strtoupper($sh['name'])] = 1;