MS Word plain text

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bdeonline
Forum Commoner
Posts: 42
Joined: Sun Jul 18, 2004 10:45 am

MS Word plain text

Post 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>
 
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: MS Word plain text

Post by Christopher »

Maybe try 'text/html' ?
(#10850)
bdeonline
Forum Commoner
Posts: 42
Joined: Sun Jul 18, 2004 10:45 am

Re: MS Word plain text

Post by bdeonline »

Thing is I want to show the tags. I don't want word to render it.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: MS Word plain text

Post 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.
Post Reply