Problems with apostrophos using Phpspreadsheet to write xlsx

Asked

Viewed 41 times

2

I have the following problem, I fill out a spreadsheet with a person’s information, however, names like D'Ana generate a problem in xlsx. D'Anna gets a square instead of the bet. the form of writing I use is this:

$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($this->planilha, 'Xlsx');
$writer->save('php://output');

and when setting the value in the cell, I use:

planilha->setCellValue(utf8_encode($value['nome']);

For the other values, it works correctly, only for the apostrophe that creates problem. Can someone help me? grateful!

  • I don’t know if it’ll do much good, but I could try something like this: planilha->setCellValue(utf8_encode("$value['nome']");

  • This generates a syntax error due to variable. Thanks anyway!

  • Pity! Phpspreadsheet has even problem with simple quotes.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.