Connecting Tech Pros Worldwide Help | Site Map

Creating rtf file with php

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 04:19 AM
EJ
Guest
 
Posts: n/a
Default Creating rtf file with php

I would like to creat an rtf document with a php script - has anyone seen it
done?



  #2  
Old July 17th, 2005, 04:19 AM
pomho
Guest
 
Posts: n/a
Default Re: Creating rtf file with php

"EJ" <ejhannan$@uq.net.au> a écrit dans le message news:
405d22e0$1@news.comindico.com.au...[color=blue]
> I would like to creat an rtf document with a php script - has anyone seen[/color]
it[color=blue]
> done?[/color]

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

--
pomho


  #3  
Old July 17th, 2005, 04:19 AM
Phil Roberts
Guest
 
Posts: n/a
Default Re: Creating rtf file with php

With total disregard for any kind of safety measures "pomho"
<pomho@nospam.org> leapt forth and uttered:
[color=blue]
> "EJ" <ejhannan$@uq.net.au> a écrit dans le message news:
> 405d22e0$1@news.comindico.com.au...
> found this :
> http://www.bitfolge.de/rsscreator-en.html
>
> --
> pomho
>
>
>[/color]

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/
  #4  
Old July 17th, 2005, 04:19 AM
EJ
Guest
 
Posts: n/a
Default Re: Creating rtf file with php

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" <pomho@nospam.org> wrote in message
news:405d3f89$0$288$626a14ce@news.free.fr...[color=blue]
> "EJ" <ejhannan$@uq.net.au> a écrit dans le message news:
> 405d22e0$1@news.comindico.com.au...[color=green]
> > I would like to creat an rtf document with a php script - has anyone[/color][/color]
seen[color=blue]
> it[color=green]
> > done?[/color]
>
> found this :
> http://www.bitfolge.de/rsscreator-en.html
>
> --
> pomho
>
>[/color]


  #5  
Old July 17th, 2005, 04:19 AM
EJ
Guest
 
Posts: n/a
Default Re: Creating rtf file with php

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" <philrob@HOLYflatnetSHIT.net> wrote in message
news:Xns94B371262A567philroberts@216.196.97.132...[color=blue]
> With total disregard for any kind of safety measures "pomho"
> <pomho@nospam.org> leapt forth and uttered:
>[color=green]
> > "EJ" <ejhannan$@uq.net.au> a écrit dans le message news:
> > 405d22e0$1@news.comindico.com.au...
> > found this :
> > http://www.bitfolge.de/rsscreator-en.html
> >
> > --
> > pomho
> >
> >
> >[/color]
>
> 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/[/color]


  #6  
Old July 17th, 2005, 04:19 AM
Garp
Guest
 
Posts: n/a
Default Re: Creating rtf file with php


"EJ" <ejhannan$@uq.net.au> wrote in message
news:405d80d5@news.comindico.com.au...[color=blue]
> 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.
>[/color]

Post a sample?

Garp


  #7  
Old July 17th, 2005, 04:19 AM
EJ
Guest
 
Posts: n/a
Default Re: Creating rtf file with php

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" <garp7@no7.blueyonder.co.uk> wrote in message
news:jXf7c.22121$IL3.479036585@news-text.cableinet.net...[color=blue]
>
> "EJ" <ejhannan$@uq.net.au> wrote in message
> news:405d80d5@news.comindico.com.au...[color=green]
> > Phil
> > I have trouble I think with the ascii format - I have tried for example[/color][/color]
to[color=blue][color=green]
> > 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[/color][/color]
rtf[color=blue][color=green]
> > document.
> >[/color]
>
> Post a sample?
>
> Garp
>
>[/color]


  #8  
Old July 17th, 2005, 04:20 AM
Garp
Guest
 
Posts: n/a
Default Re: Creating rtf file with php

Oops, replied by email. Here it is again.
[color=blue]
> 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
>[/color]
\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\from an\fcharset0\fprq2{\*\pano[color=blue]
> se 02020603050405020304}Times New Roman;}{\f28\froman\fcharset238\fprq2[/color]

<snip>
[color=blue]
> \fs24\lang3081\langfe1033\cgrid\langnp3081\langfen p1033 {
> This is an rtf document.
> \par }\}
> EOD;
>
> echo $dataText;
>
> ?>[/color]

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


  #9  
Old July 17th, 2005, 04:20 AM
EJ
Guest
 
Posts: n/a
Default Re: Creating rtf file with php

Thanks Garp
I think I have it now - read a file and do string replaces etc - I have it
working now.
EJ

"Garp" <garp7@no7.blueyonder.co.uk> wrote in message
news:1Kl7c.22467$kK6.481698000@news-text.cableinet.net...[color=blue]
> Oops, replied by email. Here it is again.
>[color=green]
> > 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
> >[/color]
>[/color]
\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\from an\fcharset0\fprq2{\*\pano[color=blue][color=green]
> > se 02020603050405020304}Times New Roman;}{\f28\froman\fcharset238\fprq2[/color]
>
> <snip>
>[color=green]
> > \fs24\lang3081\langfe1033\cgrid\langnp3081\langfen p1033 {
> > This is an rtf document.
> > \par }\}
> > EOD;
> >
> > echo $dataText;
> >
> > ?>[/color]
>
> 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
>
>[/color]


  #10  
Old July 17th, 2005, 04:20 AM
pomho
Guest
 
Posts: n/a
Default Re: Creating rtf file with php

"EJ" <ejhannan$@uq.net.au> a écrit dans le message news:
405d781c@news.comindico.com.au...[color=blue]
> 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[/color]
module.[color=blue]
> 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.
>[/color]

ok, I thought RSS & RTF were the same.

--
pomho


  #11  
Old July 17th, 2005, 04:34 AM
Jet Lee
Guest
 
Posts: n/a
Default Re: Creating rtf file with php

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" <ejhannan$@uq.net.au> wrote in message news:<405ec82f$1@news.comindico.com.au>...[color=blue]
> Thanks Garp
> I think I have it now - read a file and do string replaces etc - I have it
> working now.
> EJ
>
> "Garp" <garp7@no7.blueyonder.co.uk> wrote in message
> news:1Kl7c.22467$kK6.481698000@news-text.cableinet.net...[color=green]
> > Oops, replied by email. Here it is again.
> >[color=darkred]
> > > 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
> > >[/color]
> >[/color]
> \deff0\deflang1033\deflangfe1033{\fonttbl{\f0\from an\fcharset0\fprq2{\*\pano[color=green][color=darkred]
> > > se 02020603050405020304}Times New Roman;}{\f28\froman\fcharset238\fprq2[/color]
> >
> > <snip>
> >[color=darkred]
> > > \fs24\lang3081\langfe1033\cgrid\langnp3081\langfen p1033 {
> > > This is an rtf document.
> > > \par }\}
> > > EOD;
> > >
> > > echo $dataText;
> > >
> > > ?>[/color]
> >
> > 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
> >
> >[/color][/color]
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.