- how to correctly display double quotations using PHPWord?
- include_once "../PHPWord.php";
- include_once "../debug.php";
- $file_name = "filename.docx";
- header("Cache-Control: public");
- header("Content-Description: File Transfer");
- header("Content-Disposition: attachment; filename=$file_name");
- //header("Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document");
- header("Content-Type: application/vnd.ms-word; charset=utf-8");
- header("Content-Transfer-Encoding: binary");
- $index = 1218;
- $mysqli = new mysqli("host","user","pass","database");
- $mysqli->set_charset("utf8");
- $qry1 = "SELECT * FROM table WHERE index = $index ORDER BY field DESC";
- $qry2 = "SELECT * FROM table2 WHERE index = $index";
- $PHPWord = new PHPWord();
- $section = $PHPWord->createSection();
- $section->addText("Connection Encoding: ".$mysqli->character_set_name());
- $section->addText("resuls");
- $res1 = $mysqli->query($qry1);
- while($row = $res1->fetch_assoc()){
- $section->addText($row[name]);
- $section->addText(mb_detect_encoding($row['name']));
- }
- $section->addText("results2");
- $res2 = $mysqli->query($qry2);
- while($row = $res2->fetch_assoc()){
- $section->addText(trim($row['title']));
- $section->addText(mb_detect_encoding($row['title']));
- }
- $objWriter = PHPWord_IOFactory::createWriter($PHPWord,'Word2007');
- $objWriter->save('php://output');
- exit;
- book:"Book Title"