469,288 Members | 2,357 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,288 developers. It's quick & easy.

Creating rtf file with php

EJ
I would like to creat an rtf document with a php script - has anyone seen it
done?
Jul 17 '05 #1
10 11994
"EJ" <ej*******@uq.net.au> a écrit dans le message news:
40********@news.comindico.com.au...
I would like to creat an rtf document with a php script - has anyone seen it done?


found this :
http://www.bitfolge.de/rsscreator-en.html

--
pomho
Jul 17 '05 #2
With total disregard for any kind of safety measures "pomho"
<po***@nospam.org> leapt forth and uttered:
"EJ" <ej*******@uq.net.au> a écrit dans le message news:
40********@news.comindico.com.au...
found this :
http://www.bitfolge.de/rsscreator-en.html

--
pomho


Thats *RTF* not *RSS*. He wants to create a Rich Text Document.

Rich-text is a text-based format. So if you're reasonably good with
PHP theres no reaosn why you wouldn't be able to generate an RTF
format just by reading the RTF specification.

Try it for yourself, create a simple file using Wordpad, then open
the rtf file using an ASCII text editor.
--
Phil Roberts | Dork Pretending To Be Hard | http://www.flatnet.net/
Jul 17 '05 #3
EJ
Thanks but can that be used to create an rtf document (ie rich text format
doc). I have only seen doc files produced on win servers using a com module.
I am trying to use a linux server - I have used an excel class that
generated a spreadsheet output - I was wondering if the same could be done
with word or rtf as substitute for word.

"pomho" <po***@nospam.org> wrote in message
news:40*********************@news.free.fr...
"EJ" <ej*******@uq.net.au> a écrit dans le message news:
40********@news.comindico.com.au...
I would like to creat an rtf document with a php script - has anyone
seen it
done?


found this :
http://www.bitfolge.de/rsscreator-en.html

--
pomho

Jul 17 '05 #4
EJ
Phil
I have trouble I think with the ascii format - I have tried for example to
cut and paste the rtf headers from editpad lite into a php variable but
there is some kind of problem - I just get the headers appearing in my rtf
document.

"Phil Roberts" <ph*****@HOLYflatnetSHIT.net> wrote in message
news:Xn*************************@216.196.97.132...
With total disregard for any kind of safety measures "pomho"
<po***@nospam.org> leapt forth and uttered:
"EJ" <ej*******@uq.net.au> a écrit dans le message news:
40********@news.comindico.com.au...
found this :
http://www.bitfolge.de/rsscreator-en.html

--
pomho


Thats *RTF* not *RSS*. He wants to create a Rich Text Document.

Rich-text is a text-based format. So if you're reasonably good with
PHP theres no reaosn why you wouldn't be able to generate an RTF
format just by reading the RTF specification.

Try it for yourself, create a simple file using Wordpad, then open
the rtf file using an ASCII text editor.
--
Phil Roberts | Dork Pretending To Be Hard | http://www.flatnet.net/

Jul 17 '05 #5

"EJ" <ej*******@uq.net.au> wrote in message
news:40******@news.comindico.com.au...
Phil
I have trouble I think with the ascii format - I have tried for example to
cut and paste the rtf headers from editpad lite into a php variable but
there is some kind of problem - I just get the headers appearing in my rtf
document.


Post a sample?

Garp
Jul 17 '05 #6
EJ
This is what I was trying

<?php
header("Content-type: text/rtf");
header("Content-Disposition: attachment; filename=overdue.rtf");

$dataText = <<<EOD
\{\rtf1\ansi\ansicpg1252\uc1
\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\from an\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\green 0\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\adjustri ght\rin0\lin0\itap0
\fs24\lang3081\langfe1033\cgrid\langnp3081\langfen p1033 \snext0
Normal;}{\*\cs10 \additive Default Paragraph Font;}}{\info{\title This is an
rtf document}{\author Eamon Hannan}
{\operator Eamon
Hannan}{\creatim\yr2004\mo3\dy21\hr21\min30}{\revt im\yr2004\mo3\dy21\hr21\mi
n30}{\version1}{\edmins0}{\nofpages1}{\nofwords0}{ \nofchars0}{\*\company
CMC}{\nofcharsws0}{\vern8247}}\paperw11906\paperh1 6838
\widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noul trlspc\dntblnsbdb\nospacef
orul\formshade\horzdoc\dgmargin\dghspace180\dgvspa ce180\dghorigin1800\dgvori
gin1440\dghshow1\dgvshow1
\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrf oot\splytwnine\ftnlytwnine
\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalc tblwd\lyttblrtgr\lnbrkrule
\fet0\sectd
\linex0\headery708\footery708\colsx708\endnhere\se ctlinegrid360\sectdefaultc
l
{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\ pntxta .}}{\*\pnseclvl2\pn
ucltr\pnstart1\pnindent720\pnhang{\pntxta
..}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhan g{\pntxta
..}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnh ang{\pntxta )}}{\*\pnseclvl
5
\pndec\pnstart1\pnindent720\pnhang{\pntxtb
(}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnha ng{\pntxtb
(}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhan g{\pntxtb
(}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnha ng
{\pntxtb
(}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhan g{\pntxtb
(}{\pntxta )}}\pard\plain \ql
\li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustri ght\rin0\lin0\itap0
\fs24\lang3081\langfe1033\cgrid\langnp3081\langfen p1033 {
This is an rtf document.
\par }\}
EOD;

echo $dataText;

?>

"Garp" <ga***@no7.blueyonder.co.uk> wrote in message
news:jX***********************@news-text.cableinet.net...

"EJ" <ej*******@uq.net.au> wrote in message
news:40******@news.comindico.com.au...
Phil
I have trouble I think with the ascii format - I have tried for example to cut and paste the rtf headers from editpad lite into a php variable but
there is some kind of problem - I just get the headers appearing in my rtf document.


Post a sample?

Garp

Jul 17 '05 #7
Oops, replied by email. Here it is again.
This is what I was trying

<?php
header("Content-type: text/rtf");
header("Content-Disposition: attachment; filename=overdue.rtf");

$dataText = <<<EOD
\{\rtf1\ansi\ansicpg1252\uc1
\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\from an\fcharset0\fprq2{\*\pano se 02020603050405020304}Times New Roman;}{\f28\froman\fcharset238\fprq2
<snip>
\fs24\lang3081\langfe1033\cgrid\langnp3081\langfen p1033 {
This is an rtf document.
\par }\}
EOD;

echo $dataText;

?>


Your enemy here is whitespace - using the <<</EOD form is injecting spaces
where the linebreaks are, and they're poison to RTF.

I'd suggest you put the original RTF template into a text file and
substitute the text you want changed with scalar variables:
{\author $author}

Garp
Jul 17 '05 #8
EJ
Thanks Garp
I think I have it now - read a file and do string replaces etc - I have it
working now.
EJ

"Garp" <ga***@no7.blueyonder.co.uk> wrote in message
news:1K***********************@news-text.cableinet.net...
Oops, replied by email. Here it is again.
This is what I was trying

<?php
header("Content-type: text/rtf");
header("Content-Disposition: attachment; filename=overdue.rtf");

$dataText = <<<EOD
\{\rtf1\ansi\ansicpg1252\uc1

\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\from an\fcharset0\fprq2{\*\pano
se 02020603050405020304}Times New Roman;}{\f28\froman\fcharset238\fprq2


<snip>
\fs24\lang3081\langfe1033\cgrid\langnp3081\langfen p1033 {
This is an rtf document.
\par }\}
EOD;

echo $dataText;

?>


Your enemy here is whitespace - using the <<</EOD form is injecting spaces
where the linebreaks are, and they're poison to RTF.

I'd suggest you put the original RTF template into a text file and
substitute the text you want changed with scalar variables:
{\author $author}

Garp

Jul 17 '05 #9
"EJ" <ej*******@uq.net.au> a écrit dans le message news:
40******@news.comindico.com.au...
Thanks but can that be used to create an rtf document (ie rich text format
doc). I have only seen doc files produced on win servers using a com module. I am trying to use a linux server - I have used an excel class that
generated a spreadsheet output - I was wondering if the same could be done
with word or rtf as substitute for word.


ok, I thought RSS & RTF were the same.

--
pomho
Jul 17 '05 #10
Can I know how to do this?

I have a form and would like the results to be send in rtf as an
attachment in an email.
Regards,
Jet

"EJ" <ej*******@uq.net.au> wrote in message news:<40********@news.comindico.com.au>...
Thanks Garp
I think I have it now - read a file and do string replaces etc - I have it
working now.
EJ

"Garp" <ga***@no7.blueyonder.co.uk> wrote in message
news:1K***********************@news-text.cableinet.net...
Oops, replied by email. Here it is again.
This is what I was trying

<?php
header("Content-type: text/rtf");
header("Content-Disposition: attachment; filename=overdue.rtf");

$dataText = <<<EOD
\{\rtf1\ansi\ansicpg1252\uc1

\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\from an\fcharset0\fprq2{\*\pano
se 02020603050405020304}Times New Roman;}{\f28\froman\fcharset238\fprq2


<snip>
\fs24\lang3081\langfe1033\cgrid\langnp3081\langfen p1033 {
This is an rtf document.
\par }\}
EOD;

echo $dataText;

?>


Your enemy here is whitespace - using the <<</EOD form is injecting spaces
where the linebreaks are, and they're poison to RTF.

I'd suggest you put the original RTF template into a text file and
substitute the text you want changed with scalar variables:
{\author $author}

Garp

Jul 17 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Jeremy Langworthy | last post: by
1 post views Thread by Inpreet | last post: by
2 posts views Thread by George Marsaglia | last post: by
15 posts views Thread by Carlos Lozano | last post: by
12 posts views Thread by Mats Lycken | last post: by
15 posts views Thread by David Thielen | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.