"Edward Peloke" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Thanks,
>
> I tried it and don't get a blank line but it still shows all the code when
> opened in word.  Forgive how lengthy it is but here is the actual code:  I
> tried escaping the special characters in the string but that doesn't help
> either.

-- snip --

Eddie,

   I do not know the rtf format, but i managed to get it to work. It is
better to use ' (single quote) instead of " (double) as single quotes will
take the special characters like \r, \n, \t.... literally whereas double
quotes will result in the special charater being ouputted. This is where you
messed up.

What i did was to create a blank document in Word, save it as rtf, open it
in notepad (Word wrap off) copy the source and paste it to your PHP variable
withing single quotes (luckily I dont have single or double quotes in my
rtf source, check the format details and escape them if they are present).

HTH, good luck

gamin.

(code tested with PHP 4.1.2 on WinXP running Apache 1.3.x)

<?
touch("off.rtf");

$fp=fopen("off.rtf", "wb");

$outputstring='{\rtf1\ansi\ansicpg1252\uc1
\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\froman\fcharset0\fprq2{\*\pano
se 02020603050405020304}Times New Roman;}{\f28\froman\fcharset238\fprq2
Times New Roman CE;}{\f29\froman\fcharset204\fprq2 Times New Roman Cyr;}

{\f31\froman\fcharset161\fprq2 Times New Roman
Greek;}{\f32\froman\fcharset162\fprq2 Times New Roman
Tur;}{\f33\froman\fcharset177\fprq2 Times New Roman
(Hebrew);}{\f34\froman\fcharset178\fprq2 Times New Roman (Arabic);}

{\f35\froman\fcharset186\fprq2 Times New Roman
Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\b
lue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red
255\green255\blue0;\red255\green255\blue255;

\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\gre
en0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blu
e128;\red192\green192\blue192;}{\stylesheet{

\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0
Normal;}{\*\cs10 \additive Default Paragraph Font;}}{\info{\title This is a
test}{\author kanav}{\operator kanav}

{\creatim\yr2002\mo12\dy31\hr15\min42}{\revtim\yr2002\mo12\dy31\hr15\min43}{
\version1}{\edmins1}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company
saice}{\nofcharsws0}{\vern8247}}

\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospacef
orul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1800\dgvori
gin1440\dghshow1\dgvshow1

\jexpand\viewkind1\viewscale75\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\
htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule
\fet0\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl {\*\pnseclvl1

\pnucrm\pnstart1\pnindent720\pnhang{\pntxta
.}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta
.}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta
.}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl
5

\pndec\pnstart1\pnindent720\pnhang{\pntxtb
(}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb
(}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb
(}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang

{\pntxtb
(}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb
(}{\pntxta )}}\pard\plain \ql
\li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
\fs24\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 {

This is a test. HAHAHAHA

\par

\par Have a look at this askfkas;f the quicj brown fox jumped over the lazy
dog.

\par }}';

fwrite($fp, $outputstring);

?>






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to