13/09/2009 Written by Cyril GRANDJEAN

Synology DS 109

Here is my last acquisition for my home server.

This NAS is not a simple storage system. This is a complete server, customisable, energy-efficient who allows natively to reach very easily its files in FTP and HTTP in local area network or on internet. He can also host websites, share files, photos and videos with a beautiful AJAX interface. To see the features integrated natively, click here.

To be able to add other features, the forum www.nas-forum.com can help you.

01/09/2009 Written by Cyril GRANDJEAN

During my work for the company Planet Bourgogne, I had to create an XLS file using PHP and MySQL. I’ve also discovered a PHP library for reading and writing XLSX files.

The format XLSX is supported by Excel 2007 and later. For the previous versions, it requires the installation of the following module : http://www.microsoft.com/downloads/details.aspx?displaylang=fr&FamilyID=941b3470-3ae9-4aee-8f43-c6bb74cd1466.

Here are some lines of codes which are going to allow you to create your first file XLS by using PHP.

  1. Download and copy the library PHPExcel in your PHP Project
  2. Create a PHP file by using the following syntax :
/** Errors report */

/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . 'PHPExcel/Classes/');

/** PHPExcel */
include 'PHPExcel.php';

/** PHPExcel_Writer_Excel2007 */
include 'PHPExcel/Writer/Excel2007.php';

// Create new PHPExcel object
$objPHPExcel = new PHPExcel();

//We add contents
//Warning, a utf8_encode() is necessary for the character like 'é', 'è', ..
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Ligne 1 Colonne 1');
$objPHPExcel->getActiveSheet()->setCellValue('A2', utf8_encode('Durée'));

//Manage the size of the column

//Manage font style

//Make a border style

// Save our file xlsx
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);

This tutorial is only the bases necessary for the creation of a simple file XLSLX. For advanced used : click here.