21-04-2023

Failed to load DOM Document

So I had to make a shiny export in one of my project. 
I used laravel-excel, as usual, this time I wanted to manipulate the view, so went with the FromView option 💪

The thing is, that this error message just occured 🤯

Failed to load ..../storage/framework/cache/laravel-excel/laravel-excel-8lspGG64fgmF9TsDybO36s1uvhkDq3VP.html as a DOM Document

Of course, I stripped html tags, decoded html entities, but the error was still occured...
I found that this is a PhpOffice error, and you can solve it if you do everything well ( don't let html content, close every tag, etc), but not this time.

So in this case, when nothing works, here is a solution 🥁:

Add this line to the export class, and you are good to go:

libxml_use_internal_errors(true);


© 2024 PappZ. All rights reserved.