473,408 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

new line character

zorgi
431 Expert 256MB
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_contents($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
Apr 10 '08 #1
2 1424
Amzul
130 100+
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_contents($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
Apr 10 '08 #2
zorgi
431 Expert 256MB
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?
Apr 11 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Surya Kiran | last post by:
Hi all, I'm facing a wierd problem. I've a file, which is getting updated every now and then. and i'm having another program, which monitors the file. I've to read the file line by line, and in...
4
by: Charles Erwin | last post by:
Is there any way, upon scanning in a file line by line to avoid missing the last line if there is not a newline character (aka you have to hit return on the last line of input in your file). I was...
23
by: FrancisC | last post by:
#include <stdio.h> int file_copy( char *oldname, char *newname ); int main() { char source, destination; printf("\nEnter source file: ");
9
by: Jonny | last post by:
Hi, Please could you tell me what the quickest way would be to verify that a line of text exists in a file. I would like to be able to do something like: grep "^line of text$" filename.txt...
6
by: Seven Kast USA | last post by:
hi if we running a c program , that if u press ctrl +d or +z or +c , then program will closed.. what behind processing ......... by KAST
3
by: Chakkaradeep | last post by:
Hi all, i have a string, str_old="E:\a\b\c.exe", and i want to change to str_new="E:\\a\\b\\c.exe".
22
by: DraguVaso | last post by:
Hi, For my application I need the following behavior: When I press F4 the cursor has to move to the next line in my multiline textbox which begins with "0". Finding lines starting with 0 isn't...
5
by: Lyle A. Sieren | last post by:
I posted this earlier with another question but did not explain myself well... How do get a line feed character on the end of a line using the streamwriter.writeline fuction? Following are a list...
6
by: Stick | last post by:
Hi, I am trying to start my email app (in this case Eudora) with a programatically generated email. However, Eudora does not seem to recognize any of the ways I have tried to create line...
7
by: John den Haan | last post by:
Hello! When I use putchar to fill up an entire screen (of 80x25) with text, it seems to leave an empty line at the end, thus forcing me to scroll upwards in to see the first line. This forces me...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.