http://stackoverflow.com/questions/124959/create-word-document-using-php-in-linux
(I'm using a linux server)
I've done this before and its worked fine, but I have an action in xataface that causes database info to download in an ms word document.
Here's msword_output.php:
- Code: Select all
<?php
@session_start();
$lines = $_SESSION['msword_output'];
header("Content-type: application/vnd.ms-word");
header("Content-Disposition: attachment;Filename=doc.doc");
?>
<html><body>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<?php
foreach ($lines as $line) {
echo $line; ?><br/><?php
}
?>
</html></body>
<?php
unset($_SESSION['msword_output']);
?>
It's very simple to use; set $_SESSION['msword_output'] to an array of the lines you wish to download as .doc, call include('msword_output.php'), and there you go.
Everything works fine except my problem is: the html is taken literally and written to the document, so instead of a line break the .doc literally says <br/>.
This method has worked for me before, so I'm nearly positive that the issue has to do with xataface's html context which msword_output.php is operating within.
Could anyone shed some light on this matter?
Thanks in advance!