You are here: Opening an RTF and editing it... placing a table inside « All PHP « IT news, forums, messages
Opening an RTF and editing it... placing a table inside

Posted by GooderThanYou on 09/28/76 11:45

If I create a new blank word document, save it as a RTF and open it in
text editor... I can paste this code in it:

{\rtf\ansi\deff0{\fonttbl{\f0\froman Tms Rmn;}{\f1\fdecor
Symbol;}{\f2\fswiss Helv;}}
{\trowd
\trbrdrt\brdrs\brdrw10
\trbrdrl\brdrs\brdrw10
\trbrdrb\brdrs\brdrw10
\trbrdrr\brdrs\brdrw10
\trbrdrh\brdrs\brdrw10
\trbrdrv\brdrs\brdrw10
\clbrdrt\brdrs\brdrw10
\clbrdrl\brdrs\brdrw10
\clbrdrb\brdrs\brdrw10
\clbrdrr\brdrs\brdrw10
\intbl \cellx1 \cell \row }
\par}

which when I open it I get a blank table that is at least there.


In PHP, if I open a blank RTF or an existing RTF and place the code in
there the table keeps shifting up and down over and over and glitching
all over the place. Here is my PHP code of opening a RTF template and
replacing one of the key words with the table code:


header('Content-type: application/msword');
header('Content-Disposition: inline; filename=test.rtf');
$file = 'RCTPWORD.rtf';
$fp = fopen ($file, 'r');
$output = fread( $fp, filesize($file));
fclose($fp);
$rctp5 =
"
{\rtf\ansi\deff0{\fonttbl{\f0\froman Tms Rmn;}{\f1\fdecor
Symbol;}{\f2\fswiss Helv;}}
{\trowd
\trbrdrt\brdrs\brdrw10
\trbrdrl\brdrs\brdrw10
\trbrdrb\brdrs\brdrw10
\trbrdrr\brdrs\brdrw10
\trbrdrh\brdrs\brdrw10
\trbrdrv\brdrs\brdrw10
\clbrdrt\brdrs\brdrw10
\clbrdrl\brdrs\brdrw10
\clbrdrb\brdrs\brdrw10
\clbrdrr\brdrs\brdrw10
\intbl \cellx1 \cell \row }
\par}
";

$output = str_replace( '<<eductable>>', $rctp5, $output);
echo $output;

Everything is fine excep the <<eductable>> which is a table but jumping
all over like I said before.... Does anyone know what I'm trying to
accomplish and can help?

Thanks!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация