Page 1 of 1

nuBuilder Forte with PhpSpreadsheet

Posted: Mon Oct 14, 2019 10:05 pm
by Arunas
Hi.

I export data to Excel with PhpExcel or PhpSpreadsheet libraries. Works well with nuBuilder Pro. I want to do the same with nuBuilder Forte and I get an error. Why?

Re: nuBuilder Forte with PhpSpreadsheet

Posted: Tue Oct 15, 2019 1:49 am
by kev1n
Hi,

It's very hard to tell without knowing where and how you include the libraries and how you use them.

Re: nuBuilder Forte with PhpSpreadsheet

Posted: Tue Oct 15, 2019 8:33 am
by Arunas
Library include:
nuBuilder Home directory/Classes/PHPExcel (library directory)

In Builders-Procedure (nuBuilder Forte) and Code-PHP Procedures (nuBuilder Pro) write:

require_once dirname(__FILE__) . '/Classes/PHPExcel/IOFactory.php';
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = $objReader->load("filename.xlsx");
$xlsName = 'filename1.xlsx';

$objPHPExcel->setActiveSheetIndex(0)->SetCellValue('A2', 'Test');

header("Content-Type:application/vnd.ms-excel");
header('Content-Disposition: attachment;filename="'.$xlsName.'"');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');

Then Run Procedure. Works with nuBuilder Pro, does not work with nuBuilder Forte.

Re: nuBuilder Forte with PhpSpreadsheet

Posted: Tue Oct 15, 2019 9:25 am
by kev1n
You can add a

Code: Select all

nuDebug(dirname(__FILE__) . '/Classes/PHPExcel/IOFactory.php');
in the first line of the procedure and then check the nuDebug log to verify if the path to IOFactory.php is correct.

Re: nuBuilder Forte with PhpSpreadsheet

Posted: Tue Oct 15, 2019 11:12 am
by Arunas
The directory was created "classes". I changed the capitalization to lowercase and it works.

Thank you