new line character

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zorgi
    Recognized Expert Contributor
    • Mar 2008
    • 431

    new line character

    I have a templet in word (*,rtf) that I am using for printing of some data. However when I pass string with "\n" character word ignores it. Here is the code.


    [PHP]header('Content-Type: application/msword'); header('Content-Disposition:
    attachment, filename=firma. rtf');
    $file_doc = "firma.rtf" ;
    $output = file_get_conten ts($file_doc);
    $firma = $_GET['firma'];
    $txt = $_GET['txt'];

    $output = str_replace("<< firma>>", $firma, $output);
    $output = str_replace("<< txt>>", $txt, $output);
    echo $output;
    ?>
    [/PHP]

    $txt becomes something like this "blah blah blah \n blah blah" but word ignores \n and word prints:

    "blah blah blah blah blah"

    instead of

    "blah blah blah
    blah blah"

    Thanks guys
  • Amzul
    New Member
    • Oct 2007
    • 130

    #2
    Originally posted by zorgi
    I have a templet in word (*,rtf) that I am using for printing of some data. However when I pass string with "\n" character word ignores it. Here is the code.


    [PHP]header('Content-Type: application/msword'); header('Content-Disposition:
    attachment, filename=firma. rtf');
    $file_doc = "firma.rtf" ;
    $output = file_get_conten ts($file_doc);
    $firma = $_GET['firma'];
    $txt = $_GET['txt'];

    $output = str_replace("<< firma>>", $firma, $output);
    $output = str_replace("<< txt>>", $txt, $output);
    echo $output;
    ?>
    [/PHP]

    $txt becomes something like this "blah blah blah \n blah blah" but word ignores \n and word prints:

    "blah blah blah blah blah"

    instead of

    "blah blah blah
    blah blah"

    Thanks guys
    i am assuming you work with windows os (word application gave you up) so insted or \n do \n\r
    hope it helps

    Comment

    • zorgi
      Recognized Expert Contributor
      • Mar 2008
      • 431

      #3
      Originally posted by Amzul
      i am assuming you work with windows os (word application gave you up) so insted or \n do \n\r
      hope it helps
      Hi Amzul and Thank you.

      Yes it is windows os but \n\r unfortunately didn't work . Any other ideas?

      Comment

      Working...