There was a problem with naming sheets. I unload categories from the database, I want each category to have a separate sheet, I create it without problems, but as soon as it comes to assigning a name to the sheet, there are already problems, first I decided that the maximum length of the name is 30 characters, well, I cut the string to 30 characters , it still does not work, it is worth cutting the line to 10 characters, displays, but the names contain only 5 characters, who faced this problem, how to solve it?

Π’Π°Π±Π»ΠΈΡ†Π° ΠΊΠ°Ρ‚Π΅Π³ΠΎΡ€ΠΈΠΉ 7 БмСситСли Π½Π° Ρ€Π°ΠΊΠΎΠ²ΠΈΠ½Ρƒ 8 БмСситСли для Π²Π°Π½Π½Ρ‹ ΠΈ Π΄ΡƒΡˆΠ° 9 Π”ΡƒΡˆΠ΅Π²Ρ‹Π΅ систСмы 10 ΠšΠΎΠΌΠΏΠ»Π΅ΠΊΡ‚ΡƒΡŽΡ‰ΠΈΠ΅ для Π΄ΡƒΡˆΠ° 11 БмСситСли для ΠΊΡƒΡ…Π½ΠΈ 12 Π‘ΠΈΡ„ΠΎΠ½Ρ‹ ΠΈ Π΄ΠΎΠ½Π½Ρ‹Π΅ ΠΊΠ»Π°ΠΏΠ°Π½Ρ‹ 13 БмСситСли для гигиСничСского Π΄ΡƒΡˆΠ° 14 АксСссуары 15 ΠŸΠΎΠ»ΠΎΡ‚Π΅Π½Ρ†Π΅ΡΡƒΡˆΠΈΡ‚Π΅Π»ΠΈ 16 БмСситСли Π½Π° Π±ΠΎΡ€Ρ‚ Π²Π°Π½Π½Ρ‹ 17 Π‘ΠΌΠ΅ΡΠΈΡ‚Π΅Π»ΡŒ для Π±ΠΈΠ΄Π΅ 

Code itself

 $r=$this->get_typ(); $is=0; foreach ($r as $res){ if ($is!=0){ $objPHPExcel->createSheet(); $objPHPExcel->setActiveSheetIndex($is); $active_sheet = $objPHPExcel->getActiveSheet(); } $is++; $str=substr($res['nazv'], 0, 10); $active_sheet->setTitle($str); 
  • I have already decided the question, instead of substr you need to use mb_substr - Sergey Godovanyuk
  • try phpspreadsheet instead of phpExcel, which is closed and not supported. - n.osennij pm

0