france english banniere

Create a file XLSX using PHP with PHP Excel

Le 01/09/2009 par Cyril GRANDJEAN

During my work for the company Planet Bourgogne, I must create a file XLS using PHP and MySQL. I’ve also discovered a library PHP 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 */
error_reporting(E_ALL);

/** 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
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(15);

//Gérer le style de la police
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(10);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);

//Make a bordure style
$objPHPExcel->getActiveSheet()->getStyle('A1')->getBorders()->getLeft()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getBorders()->getRight()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getBorders()->getTop()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getBorders()->getBottom()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);

// Save our file xlsx
$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
$objWriter->save('../data_xls/myfileXLS.xlsx');

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

Internship in the company Planet Bourgogne

Le 29/07/2009 par Cyril GRANDJEAN

logo_planetb
logo_planetb

I work from July 27th, 2009 till October 29th, 2009 within the company Planet Bourgogne. This IT services company occupies numerous fields of activity:

  • Web hosting
  • Web development
  • Advice and formation
  • Access and engineering

For more information, visit the site: www.planetb.fr.

For my part, I would work in the development of Web applications. It will allow me to increase my knowledge in the Web development by participating actively in the projects of the company but also to understand all the stages of the creation of the project up to its finalization.

Software for resizing pictures

Le 01/07/2009 par Cyril GRANDJEAN

Redim Picture v0.1
Redim Picture v0.1

I had made a personalized program in VB.NET for the estate agency Agora Immobilier who allowed them to resize a picture very easily. But after, I replaced this program by a PHP module who perform this task more easily. This software became deprecated, I decided to reuse the previous code to create a software for everybody.

Redim Picture v 0.1 :

- Description :

This software allows to resize in a very simple way an image. Select an image, indicate the name and the size of the image then click to resize. The version 0.1 supports only the images in the JPEG format.

- Minimal configuration :

Windows xp SP2

- Download : Cliquez-ici

If you have some questions, remarks or ideas of improvement, do not hesitate to send me a message via the CONTACT section.

Website in french and english

Le 14/03/2009 par Cyril GRANDJEAN

Français - Anglais
Français - Anglais

The blog is now available in french and english and the website will be gradually translated in this two languages.

Do not hesitate to contact me if you notice mistranslations (I am not still bilingual :-) )

Software of renting management Agoraimm v1.7

Le 11/03/2009 par Cyril GRANDJEAN

This is a preview of the software that I have create during my full-time internship (3 months) and during my part-time internship (A day a week).

This software of renting management Agoraimm v1.7 (Using the PHP – MySQL – Javascript – Ajax technologies) is integrated into the website agoraimmobilier.fr and allows an effective management of the rents.

Here are some fonctionalities of this software :

  • Monthly calendar (glimpes of the state of the rents)
  • Monthly report of management for the owners
  • Quarterly receipt of management fee
  • Annual receipt of management fee
  • Annual summarization of rent and service charges
  • State of the accounts tenants
  • List of the transfers to be made to the owners
  • Big quarterly book for the accounting
  • Edition of receipt in the PDF format

The owners, the tenants, the accountants have their own online interface in the website. If you want to have an outline of the various interfaces, click here.

The software is actually in version 1.7. I worked in the version 2.0 which will have a more intuitive interface and which will see the addition of new modules.

agoraimm107
agoraimm107

Website for the Vélo Club Montigny Roue Libre

Le 08/03/2009 par Cyril GRANDJEAN

vcmrl.fr
vcmrl.fr

I have create the website vcmrl.fr for the Vélo Club Montigny Roue Libre.

This association of cycle located to Montigny le Roi (Haute-Marne) proposes a lot of activities : roads cycle, mountain bike, cyclo-cross for amateurs or competitors.

You can find on this website informations about the club, life of the club, the list of the outings and the trainings, …

Oracle Certified SQL

Le 01/03/2009 par Cyril GRANDJEAN

Logo Oracle
Logo Oracle

After having revised during the holidays, I spent the Oracle certification that I succeeded with a 78 % percentage (70 % to have the certification).

The certification (1Z0-007 Introduction to Oracle9i:SQL) concerns essentially the SQL requests (More details)

Website for the real estate agency Agora Immobilier

Le 31/10/2008 par Cyril GRANDJEAN

Agora Immobilier
Agora Immobilier

Here is the website which I realized for the real estate agency Agora Immobilier.

On this website, you can find all announcements of rents, sales and investments.

For each property, you can find a description of the property, photos. Agora Immobilier is the first real estate agency in Aube to propose videos. Then if you try to rent, to buy or to invest, do not hesitate to consult this website.

Welcome to my new website

Le 31/08/2008 par Cyril GRANDJEAN

Welcome to my new website !

On this website, you will find tips and tricks in computer sciences but many other thinks too.

See you soon for more articles …