Page 1 of 1

MS Word plain text

Posted: Thu Feb 21, 2008 2:33 pm
by bdeonline
I have a php file that exports a plain text file. If I open the text file in a notepad it shows correctly. When I open it in MS Word it looses all the tags. Is there a additional header or something to get Word to stop trying to render the tags & display as plain text?

Code: Select all

 
header('Cache-Control: no-cache, must-revalidate');
header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename="' . $filename[$report] . '";');
 
<label><leadin>my</leadin>calendar</label><body>
<subhead>February 22<EP></subhead>
<bold>Info</bold>Description Text.<EP>
 

Re: MS Word plain text

Posted: Thu Feb 21, 2008 3:08 pm
by Christopher
Maybe try 'text/html' ?

Re: MS Word plain text

Posted: Thu Feb 21, 2008 3:26 pm
by bdeonline
Thing is I want to show the tags. I don't want word to render it.

Re: MS Word plain text

Posted: Thu Feb 21, 2008 5:55 pm
by alex.barylski
You want Word to show the tags but not render them?

Either of the content type used Word is likely handling the tags...if you don't need the tags rendered but just wish to show their source...why don't you use htmlspecialchars() - this way they are not interpreted by Word or IE or whatever but shown as regular tag soup.