SIMITGROUP / phpjasperxml

This is a php wysiwyg report library
BSD 3-Clause "New" or "Revised" License
44 stars 45 forks source link

phpjasperxml XML source instead DB #14

Closed harvy76 closed 6 years ago

harvy76 commented 6 years ago

Hello, I would like to ask you, if it is possible use this project for print documents from XML source instead of DB.

Please, can you try to write me, how can I do it? do you have some example, please?

Thank you Jan Havranek

kstan79 commented 6 years ago

At the moment it is not supported. You can either:

  1. add new connection method, modify connect(),transferDBtoArray(), test it properly and send pull request. Or
  2. 'hack' by override the variable after function 'transferDBtoArray()'. you can override variable '$this->arraysqltable' and '$this->m'.
    $PHPJasperXML = new PHPJasperXML("en","TCPDF");
    $PHPJasperXML->arrayParameter =array();
    $PHPJasperXML->load_xml_file($templatefile);
    $PHPJasperXML->sql = $sql;  //if u wish to override the sql
    $PHPJasperXML->transferDBtoArray(DBSERVER,DBUSER,DBPASS,DBNAME);
    $data=getManyRowOfRecordsHere();
    $PHPJasperXML->arraysqltable=$data
    $PHPJasperXML->m=count($data);
    $PHPJasperXML->outpage('I');

Hope this help

kstan79 commented 6 years ago

$data=getManyRowOfRecordsHere();

$PHPJasperXML = new PHPJasperXML("en","TCPDF"); $PHPJasperXML->arrayParameter =array(); $PHPJasperXML->load_xml_file($templatefile); $PHPJasperXML->sql = $sql; //if u wish to override the sql $PHPJasperXML->transferDBtoArray(DBSERVER,DBUSER,DBPASS,DBNAME); $PHPJasperXML->setData($data); $PHPJasperXML->outpage('I');

You may try it

kstan79 commented 6 years ago

no more reply, then we close this issue