Download MS Word document

A place for users and developers of the Xataface to discuss and receive support.

Download MS Word document

Postby Gershy » Wed Jan 09, 2013 1:26 pm

Hey y'all, to allow the user to download ms word .doc files without COM or other libraries is very easy; this link here shows how:

(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
$lines = $_SESSION['msword_output'];

header("Content-type: application/");
header("Content-Disposition: attachment;Filename=doc.doc");

<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">      

foreach ($lines as $line) {
   echo $line; ?><br/><?php



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! :)
Posts: 25
Joined: Wed Nov 14, 2012 12:28 pm

Re: Download MS Word document

Postby shannah » Wed Jan 09, 2013 1:55 pm

Where is this code running? Is it a script by itself? If so it doesn't even look like Xataface comes into play here (you're not including any of Xataface in this example).
Steve Hannah
@shannah78 (on twitter) blog
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Return to Xataface Users

Who is online

Users browsing this forum: Google [Bot] and 6 guests

Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved