When exporting to xls, specially in report section in moodle quiz, and if the answer is too big (beyond MS excel limits: https://support.office.com/en-us/article/Excel-specifications-and-limits-16c69c74-3d6a-4aaf-ba35-e6eb276e8eaa) the Excel file gets damaged.
An Example of huge data in one specific cell: a drawing dataURI. when its too big (and usually it is!) then the export to xls feature should strip (substr) to max limit Excel accepts. The data (answer) is not human readable anyway, so it should not have a negative effect on the human reading ability and this missing piece of data (out of substr) is pretty useless for a human to worry about 'missing' it.
How to Reproduce:
- Create a quiz with drawing question type or any other question type where you can enter 'massive' amount of text in it
- Attempt the quiz and fill it with too much text, or draw a complex object.
- Go to Quiz -> Results -> Statistics
- Select Download full report as 'Microsoft Excel'
- Open the Excel file, an Error pops: 'The file is damaged, try to recover it'?
- Click yes, the report opens but missing the answers if they are bigger than the limit of MS Excel (limits: https://support.office.com/en-us/article/Excel-specifications-and-limits-16c69c74-3d6a-4aaf-ba35-e6eb276e8eaa)
- The underlying technical error is, for example: Exception - Trying to add a value that exceeds the maximum number of characters allowed in a cell (32,767).
- Note: as export to MS Excel is across moodle, the same issue could be produced in other components across moodle when/if underlying cell data is huge (beyond excel cell limit)
- Directly affected: PHPExcel
- Indirectly affected: Quiz module