RE:como obtener datos de un formulario para crear
Perdon por mla tardanza es que es mucho.
Hola, descargue la libreria phprtf lite.
Tengo un ejemplo que descargue de la pàgina de donde descargue la libreria (Document_sections.php), solo
le anexe la lìnea de la variable ($segun) del form:
con echo me muestra el valor de la variable, pero luego me muestra solo 'ffff'
y luego un error
<b>Fatal error</b>: Maximum execution time of 30 seconds exceeded in
<b>C:apachehtdocslocalhostpracticaDocument_sections.php</b> on line <b>93</b><br />
Si dejo el ejemplo tal cual lo baje, no me muestra errores y funciona bien:
Còdigo que yo modifique
<?php
ob_start();
function writeSectionText(&$sect, &$arial14, &$times12, &$segun, &$text2, &$text3) {
$sect->writeText('Sample RTF document', $arial14, new ParFormat());
$sect->writeText($segun,$times12, new ParFormat());
$sect->writeText('Character encoding', $arial14, new ParFormat());
$sect->writeText($text2, $times12, new ParFormat());
$sect->writeText('Common implementations', $arial14, new ParFormat());
$sect->writeText($text3, $times12, new ParFormat());
}
$TXTSEGUN=$_POST['TXTSEGUN']; //Variable qeu tomo del otro form
$segun="SEGÚN:$TXTSEGUN";
echo $segun;
$text2 = ' Prueba2 ';
$text3 = ' Prueba3 ';
require_once("rtf/Rtf.php");
$times12 = new Font(13, 'Times new Roman');
$arial14 = new Font(14, 'Arial', '#000066');
$parFormat = new ParFormat();
//rtf document
$rtf = new Rtf();
//borders
$rtf->setBorders(new BorderFormat(1, '#0000ff'), 1, 0, 1, 0);
$rtf->setBorders(new BorderFormat(2, '#ff0000'), 0, 1, 0, 1);
//headers
$rtf->setOddEvenDifferent(1);
$header = &$rtf->addHeader('left');
$header->addImage('sources/APA1.jpg', $parFormat);
$header->writeText("APASA <br><hr><br>AVALUOS S-0237", $times12, $parFormat);
$header = &$rtf->addHeader('right');
$header->addImage('sources/APA1.jpg', $parFormat);
$header->writeText("APASA <br><hr><br>AVALUOS S-0237", $times12, $parFormat);
//section 1
$sect = &$rtf->addSection();
$sect->setPaperHeight(16);
$sect->setPaperWidth(25);
//Borders overriden: No Borders
$sect->setBorders(new BorderFormat(0));
$sect->setSpaceBetweenColumns(1);
$sect->setColumnsCount(2);
$sect->setLineBetweenColumns();
writeSectionText($sect, $arial14, $times12, $text, $text2, $text3);
//section 2
$sect = &$rtf->addSection();
//Header overriden
$header = &$sect->addHeader('right');
$header->addImage('sources/APA1.jpg', $parFormat);
$header->writeText("APASA <br><hr><br>AVALUOS S-0237", $times12, $parFormat);
$header = &$sect->addHeader('left');
$header->addImage('sources/APA1.jpg', $parFormat);
$header->writeText("APASA <br><hr><br>AVALUOS S-0237", $times12, $parFormat);
//Borders overriden: Green border
$sect->setBorders(new BorderFormat(1, '#00ff00', 'dash', 1));
writeSectionText($sect, $arial14, $times12, $text, $text2, $text3);
//section 3
$sect = &$rtf->addSection();
$sect->setColumns(array(3, 3, 8));
//Border from rtf
//....
writeSectionText($sect, $arial14, $times12, $text, $text2, $text3);
$rtf->sendRtf('Sample Document');
ob_end_flush();
?>
Còdigo tal cual el ejemplo:
<?php
ob_start();
function writeSectionText(&$sect, &$arial14, &$times12, &$text, &$text2, &$text3) {
$sect->writeText('Sample RTF document', $arial14, new ParFormat());
$sect->writeText($text, $times12, new ParFormat());
$sect->writeText('Character encoding', $arial14, new ParFormat());
$sect->writeText($text2, $times12, new ParFormat());
$sect->writeText('Common implementations', $arial14, new ParFormat());
$sect->writeText($text3, $times12, new ParFormat());
}
$text = ' Prueba1 ';
$text2 = ' Prueba2 ';
$text3 = ' Prueba3 ';
require_once("rtf/Rtf.php");
$times12 = new Font(13, 'Times new Roman');
$arial14 = new Font(14, 'Arial', '#000066');
$parFormat = new ParFormat();
//rtf document
$rtf = new Rtf();
//borders
$rtf->setBorders(new BorderFormat(1, '#0000ff'), 1, 0, 1, 0);
$rtf->setBorders(new BorderFormat(2, '#ff0000'), 0, 1, 0, 1);
//headers
$rtf->setOddEvenDifferent(1);
$header = &$rtf->addHeader('left');
$header->addImage('sources/APA1.jpg', $parFormat);
$header->writeText("APASA <br><hr><br>AVALUOS S-0237", $times12, $parFormat);
$header = &$rtf->addHeader('right');
$header->addImage('sources/APA1.jpg', $parFormat);
$header->writeText("APASA <br><hr><br>AVALUOS S-0237", $times12, $parFormat);
//section 1
$sect = &$rtf->addSection();
$sect->setPaperHeight(16);
$sect->setPaperWidth(25);
//Borders overriden: No Borders
$sect->setBorders(new BorderFormat(0));
$sect->setSpaceBetweenColumns(1);
$sect->setColumnsCount(2);
$sect->setLineBetweenColumns();
writeSectionText($sect, $arial14, $times12, $text, $text2, $text3);
//section 2
$sect = &$rtf->addSection();
//Header overriden
$header = &$sect->addHeader('right');
$header->addImage('sources/APA1.jpg', $parFormat);
$header->writeText("APASA <br><hr><br>AVALUOS S-0237", $times12, $parFormat);
$header = &$sect->addHeader('left');
$header->addImage('sources/APA1.jpg', $parFormat);
$header->writeText("APASA <br><hr><br>AVALUOS S-0237", $times12, $parFormat);
//Borders overriden: Green border
$sect->setBorders(new BorderFormat(1, '#00ff00', 'dash', 1));
writeSectionText($sect, $arial14, $times12, $text, $text2, $text3);
//section 3
$sect = &$rtf->addSection();
$sect->setColumns(array(3, 3, 8));
//Border from rtf
//....
writeSectionText($sect, $arial14, $times12, $text, $text2, $text3);
$rtf->sendRtf('Sample Document');
ob_end_flush();
?>