Thierry Posted May 8, 2007 Share Posted May 8, 2007 I'm trying to use RTF files to generate my word documents instead of COM, due to it being faster and more compatible with other systems. However I haven't been able to get any kind of style to work in the document, it just displays everything including all the tags. <? //get the template $template_file = "template.rtf"; $template_content = file_get_contents($template_file); //make a temporary file, so we dont edit the original template $new_temp = "new_document.rtf"; $new_temp_file = fopen($new_temp,"w"); $new_content = fwrite($new_temp_file,$template_content); fclose($new_temp_file); //get the contents of our newly created temp file and edit it $content = file_get_contents($new_temp); $content = str_replace("*TEXT*","Line1<br>Line2<br>Line3",$content); //and save it over the temp file $new_file = fopen($new_temp,"w"); $new_file_content = fwrite($new_file,$content); fclose($new_file); ?> But instead of showing: Line1 Line2 Line3 It shows Line1<br>Line2<br>Line3 I tried using \r\n to no avail. Any idea what I'm doing wrong? Quote Link to comment https://forums.phpfreaks.com/topic/50454-solved-problem-with-rtf-generating/ Share on other sites More sharing options...
MadTechie Posted May 8, 2007 Share Posted May 8, 2007 try using "\par\n" or "\par\r\n" Quote Link to comment https://forums.phpfreaks.com/topic/50454-solved-problem-with-rtf-generating/#findComment-247948 Share on other sites More sharing options...
Thierry Posted May 8, 2007 Author Share Posted May 8, 2007 Yeh, that did it, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/50454-solved-problem-with-rtf-generating/#findComment-247988 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.