Outils pour utilisateurs

Outils du site


all:bibles:langages:perl

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
all:bibles:langages:perl [2026/01/07 10:09] – [Utilisation] omeylhocall:bibles:langages:perl [2026/01/07 10:13] (Version actuelle) – [Librairie Excel::Writer::XLSX] omeylhoc
Ligne 1550: Ligne 1550:
  
 ===== Fichier excel ===== ===== Fichier excel =====
 +
 +==== Librairie Excel::Writer::XLSX ====
 +
 +=== Installation ===
 +
 +<code bash>
 +sudo apt install libspreadsheet-writeexcel-perl libexcel-writer-xlsx-perl
 +</code>
 +
 +=== Utilisation ===
 +
 +<code perl>
 +#!/usr/bin/perl
 +use strict;
 +use warnings;
 +use Excel::Writer::XLSX;
 +
 +# Création du fichier Excel
 +my $workbook = Excel::Writer::XLSX->new('nouveau_document.xlsx');
 +my $worksheet = $workbook->add_worksheet('Ma Feuille');
 +
 +# Création d'un format pour les en-têtes
 +my $header_format = $workbook->add_format();
 +$header_format->set_bold();
 +
 +# Ajout des en-têtes
 +$worksheet->write(0, 0, 'Nom', $header_format);
 +$worksheet->write(0, 1, 'Prénom', $header_format);
 +$worksheet->write(0, 2, 'Âge', $header_format);
 +
 +# Ajout des données
 +$worksheet->write(1, 0, 'Dupont');
 +$worksheet->write(1, 1, 'Jean');
 +$worksheet->write(1, 2, 42);
 +
 +$worksheet->write(2, 0, 'Martin');
 +$worksheet->write(2, 1, 'Sophie');
 +$worksheet->write(2, 2, 38);
 +
 +# Fermeture du fichier
 +$workbook->close();
 +
 +print "Le fichier nouveau_document.xlsx a été créé avec succès.\n";
 +</code>
  
 ---- ----
all/bibles/langages/perl.1767776961.txt.gz · Dernière modification : de omeylhoc