This topic is locked

Export to word document

7/2/2009 1:18:59 AM
PHPRunner General questions
M
marcosanchez author

Hi, how can export to a word document or rtf document?

J
Jane 7/2/2009

Hi,
just use Export function on the Choose pages tab. You can export records to the Word, Excel or XML file.

M
marcosanchez author 7/2/2009

Sorry I did not explain good! I mean export to a template word or rtf , something like a fill the fields in a letter in word document. I got a Template document and I need to fill the fields with the data comes from MySQL.

Hi,

just use Export function on the Choose pages tab. You can export records to the Word, Excel or XML file.

J
Jane 7/3/2009

Unfortunately PHPRunner do not support that.

K
kondur 7/6/2009

Even I am looking for that option.

jpedwardspost 7/7/2009

Actually what would be a really useful feature is if there was some way of producing form letters from a template directly on the webserver. This would make it very convenient for providing customised / personal letters / reports / documentation for clients / customers.
I realise this probably doesn't fall within the core remit of phprunner but even so it would be a very useful feature.
Currently I have done this by installing a linux text editor called ted on my webserver. ted can read and write .rtf files which microsoft word can produce. rtf files are just plain ascii and you can edit them with any text editor (even notepad). I open the .rtf file and substitute bits and bobs with fields like #customername# or #customeraddress# etc to make a template form letter. I can then copy this template and using a php script replace these fields with actual data values from my myslq phprunner web application.
The nice thing about ted is it comes with a shell script called rtf2pdf which basically converts the rtf file into an adobe pdf document which can then be emailed to a customer or even just linked to from an email you send to your customer. The shell script rtf2pdf is also called via a php script.
ted has a very small footprint and is no problem to run on a webserver.
This is one way around your problem but obviously it does take a bit of effort to do all of this and you will end up with something very specific to your application.
Anyway, hope this gives you a few ideas.
Regards,
JP.

Hi, how can export to a word document or rtf document?

M
marcosanchez author 7/16/2009

Well finally solve it
I create a rtf, change the fields $field and create a Event in print
// Print page: Before SQL query

function BeforeQueryPrint(&$strSQL,&$strWhereClause,&$strOrderBy)

{

global $conn;
$pre=time();

// read rtf

$plantilla = file_get_contents('pelvica.rtf');
// Agregamos los escapes necesarios

$plantilla = addslashes($plantilla);

$plantilla = str_replace('\r','\\r',$plantilla);

$plantilla = str_replace('\t','\\t',$plantilla);
$sql=$strSQL;

$result=mysql_query($sql);

$row = @mysql_fetch_array($result); //Arreglo
// rtf field

$medicoqueenvia=$row[0];

$vejiga=$row[2];

$utero=$row[3];

$ovarios=$row[4];

$fondodesaco=$row[5];

$imdx=$row[6];

$fecha=$row[8];

$nombre=$row[11];

$edad=$row[12];
// RTF process

eval( '$rtf = <<<EOF_RTF

' . $plantilla . '

EOF_RTF;

' );
// save rtf generate

file_put_contents("$pre$nombre.rtf",$rtf);
I hope this helps to anybody else, sorry by the spanish language <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=42772&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />