Jump to content

[SOLVED] Problem with RTF generating


Thierry

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/50454-solved-problem-with-rtf-generating/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.