Create Excel .xlsx docs using 4D and PHP

Create xlsx Excel files easily by using 4D and PHPExcel.  Here is a video that shows a quick and easy way to generate Excel data from 4D…

Get Demo database here:
https://github.com/4dmethod/ExcelDemo

Basically this…

	// create new Excel5 reader object for original file 
	$objPHPExcel = PHPExcel_IOFactory::createReader('Excel5');

	// load data from original excel file
	$objPHPExcel = $objPHPExcel->load($excelFile); 
	// write the data out to an Excel2007 object
	$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
	
	// actual file creation
	$excelFileOut = str_replace(".xls",".xlsx",$excelFile);
	$objWriter->save($excelFileOut);
	// returns new file path
	return $excelFileOut;
This entry was posted in Demo and tagged , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s