From 1c206d06bc41d1b8a073613bdbe6d78bd79cdc28 Mon Sep 17 00:00:00 2001 From: Sergey Shuchkin Date: Sat, 12 Feb 2022 03:25:59 +0600 Subject: [PATCH] 1.1.11 --- src/SimpleXLSXGen.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/SimpleXLSXGen.php b/src/SimpleXLSXGen.php index ef6f679..4b86a8b 100644 --- a/src/SimpleXLSXGen.php +++ b/src/SimpleXLSXGen.php @@ -126,7 +126,11 @@ class SimpleXLSXGen { $names[ mb_strtoupper( $sh['name']) ] = 1; } for( $i = 0; $i < 100; $i++ ) { - $new_name = ($i === 0) ? $name : $name .' ('.$i.')'; + $postfix = ' ('.$i.')'; + $new_name = ($i === 0) ? $name : $name . $postfix; + if (mb_strlen($new_name) > 31) { + $new_name = mb_substr($name,0, 31-mb_strlen($postfix)) . $postfix; + } $NEW_NAME = mb_strtoupper( $new_name ); if ( !isset( $names[ $NEW_NAME ]) ) { $name = $new_name;