|
|
|
|
|
для: glsv (Дизайнер)
(24.11.2004 в 09:58)
| | Есть возможность работы c документом rft, вот код
<?
// check we have the parameters we need
if( !$name || !$score )
{
echo "<h1>Error:</h1>This page was called incorrectly";
}
else
{
//generate the headers to help a browser choose the correct application
header( "Content-type: application/msword" );
header( "Content-Disposition: inline, filename=cert.rtf");
$date = date( "F d, Y" );
// open our template file
$filename = "PHPCertification.rtf";
$fp = fopen ( $filename, "r" );
//read our template into a variable
$output = fread( $fp, filesize( $filename ) );
fclose ( $fp );
// replace the place holders in the template with our data
$output = str_replace( "<<NAME>>", strtoupper( $name ), $output );
$output = str_replace( "<<Name>>", $name, $output );
$output = str_replace( "<<score>>", $score, $output );
$output = str_replace( "<<mm/dd/yyyy>>", $date, $output );
// send the generated document to the browser
echo $output;
}
?>
|
Следовательно должет быть файл PHPCertification.rtf | |
|
|
|
|
|
|
|
для: nastya
(24.11.2004 в 08:18)
| | Для этого нужно иметь библиотеку, которая работает с Word-овскими документами.
Существует ли подобная библиотека в природе и где ее найти - не знаю :(
PS: Если же такой библиотеки нет, то задача работы с Word - ом представляется достаточно сложной и нетривиальной.
PPS: А может быть Вас устроит PDF? Для PHP есть библиотки, работающие c PDF. | |
|
|
|
|
автор: nastya (24.11.2004 в 08:18) |
|
| Посоветуйте, как написать скрипт на php, который бы добавлял данные через форму в документ Word? | |
|
|
|
|