Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7517625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:30:47+00:00 2026-05-30T01:30:47+00:00

I reduced a php script to the exact code necessary to solve a perplexing

  • 0

I reduced a php script to the exact code necessary to solve a perplexing problem (at least to me!). All the script below is supposed to do is replace ‘++name’ in an rtf template with a hard coded variable that will print ‘me’ on one line, and ‘you’ on the next line. Besides trying “\r\n” to create the new line, I’ve also tried “\par” to no avail. The below code replaces ‘++name’ with “meyou” on one line. I have found a number of “solutions” on stackoverflow and other forums, but none have worked for me.

Any help is much appreciated.

    <?php
    $name = "me" . "\r\n" . "you";
    header('Content-type: application/msword');
    header('Content-Disposition: inline, filename=filenot.rtf');
    $filename = 'rtfnotice.rtf';
    $fp = fopen ($filename, 'r');
    $output = fread( $fp, filesize($filename));
    fclose ($fp);
    $output = str_replace('++name', $name, $output);
    echo $output;
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:30:50+00:00Added an answer on May 30, 2026 at 1:30 am

    With RTF, each formatted section is enclosed in mustaches. The “formatting” is placed at the beginnning. So to make something bold, {\b hey, this text is bold}

    To output “me” and “you” on seperate lines, you can put {\pard\par} between them, or you can make them their own paragraphs. {\pard me \par}{\pard you \par}

    I think, you can also simply put \line. Isn’t RTF fun?

    Some time ago I wrote a library for outputting RTF. You may find my “format” function useful. Basically you supply a bunch of properties to the text and it outputs it in RTF. This is AS3, but pretty eays to translate to PHP.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am generating a simple form with php. The following code has been reduced
So, I have page where a PHP script echoes out all of my HTML
I have the following piece of code for a very simple PHP polling script
As you know php code doesn't compile to run,they are only script. but I
Is there some script (better if php), which can do some operations like? resizing
This below output come from php json_encode.What we see here is 0849 is twice.Since
I was comparing an old PHP script of mine versus the newer, fancier Django
I just had some very strange behavior with a simple php script I was
Currently I'm using this jquery script combining with php (doesn't matter): <script type=text/javascript charset=utf-8>
I have no idea what's wrong with my code to call another PHP file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.