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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.