Permalink
Browse files

Merge branch 'MDL-21446_19' of git://github.com/timhunt/moodle into M…

…OODLE_19_STABLE
  • Loading branch information...
stronk7 committed Mar 14, 2011
2 parents f8fb374 + 5cf3a84 commit 7e06e9ff4a07b7c4d0b65f68883a52be7785e66b
Showing with 10 additions and 1 deletion.
  1. +10 −1 lib/excellib.class.php
View
@@ -122,7 +122,16 @@ class MoodleExcelWorksheet {
*/
function MoodleExcelWorksheet($name, &$workbook, $latin_output=false) {
- /// Internally, add one sheet to the workbook
+ if (strlen($name) > 31) {
+ // Excel does not seem able to cope with sheet names > 31 chars.
+ // With $latin_output = false, it does not cope at all.
+ // With $latin_output = true it is supposed to work, but in our experience,
+ // it doesn't. Therefore, truncate in all circumstances.
+ $textlib = textlib_get_instance();
+ $name = $textlib->substr($name, 0, 31);
+ }
+
+ /// Internally, add one sheet to the workbook
$this->pear_excel_worksheet =& $workbook->addWorksheet($name);
$this->latin_output = $latin_output;
/// Set encoding to UTF-16LE

0 comments on commit 7e06e9f

Please sign in to comment.