IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

PHPExcel problème PDF


Sujet :

Langage PHP

  1. #1
    Membre du Club
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2013
    Messages
    72
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2013
    Messages : 72
    Points : 49
    Points
    49
    Par défaut PHPExcel problème PDF
    bonjour,
    je voudrait faire une fiche xls et une fiche php ma fiche xls fonctionne a la perfection mais je n'arrive pas a crée ma fiche pdf sa doit être une erreur toute bête car je les fait avec la méthode http://g-ernaelsten.developpez.com/t...age=fondements


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    <?php
     
    include 'PHPExcel.php';
    include 'PHPExcel/Writer/PDF.php';
     
    function getNameFromNumber($num) {
        $numeric = $num % 26;
        $letter = chr(65 + $numeric);
        $num2 = intval($num / 26);
        if ($num2 > 0) {
            return getNameFromNumber($num2 - 1) . $letter;
        } else {
            return $letter;
        }
    }
    $tfiche='xls';
    $produit='casque'; 
    $erreur=" fiche execel 1.0.4 crée";
     
    					$workbook = new PHPExcel;
     
    					$sheet =$workbook->getActiveSheet();
    					$sheet->duplicateStyleArray(array('alignment'=>array(
    					'wrap'=>true,'horizontal'=>PHPExcel_Style_Alignment::HORIZONTAL_CENTER,'vertical'=>PHPExcel_Style_Alignment::VERTICAL_CENTER)), 'A2:P37');
    $sheet->getColumnDimension('A')->setWidth(125*0.142);
    					$sheet->getColumnDimension('B')->setWidth(80*0.142);
     
    					$sheet->setCellValue('A1','-_-');
    					$sheet->mergeCells('A1:B3');
    					$sheet->setCellValue('C1',$xls01[0]);
    					$sheet->setCellValue('C2',$xls02[0]);
    					$sheet->setCellValue('A10',$xls14[0]);
    					$sheet->setCellValue('B10',$xls15[0]);
    					$sheet->setCellValue('A4', $xls16[0]);
    					$sheet->mergeCells('A4:B9');
    ......
    ......
     
     
     
     
    $writer = new PHPExcel_Writer_PDF();
    $writer->setSheetIndex(0);//Une seule feuille possible
    $records = './fichier.pdf';
    $writer->save($records);
    ?>

    sa me retourne sa comme erreur:
    Catchable fatal error: Argument 1 passed to PHPExcel_Writer_PDF::__construct() must be an instance of PHPExcel, none given, called in /public_html/saisie_EPI.php on line 499 and defined in /public_html/PHPExcel/Writer/PDF.php on line 45

  2. #2
    Modératrice
    Avatar de Celira
    Femme Profil pro
    Développeuse PHP/Java
    Inscrit en
    Avril 2007
    Messages
    8 633
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 39
    Localisation : France

    Informations professionnelles :
    Activité : Développeuse PHP/Java
    Secteur : Industrie

    Informations forums :
    Inscription : Avril 2007
    Messages : 8 633
    Points : 16 372
    Points
    16 372
    Par défaut
    Comme l'indique ton message d'erreur, le constructeur de PHPExcel_Writer_PDF doit prendre un objet PHPExcel en paramètre.
    Donc probablement : $writer = new PHPExcel_Writer_PDF($workbook);

  3. #3
    Membre du Club
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2013
    Messages
    72
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2013
    Messages : 72
    Points : 49
    Points
    49
    Par défaut
    justement j'avais essai sa me sa ne fonctionner pas non plus
    Fatal error: Uncaught exception 'Exception' with message 'PDF Rendering library has not been defined.' in /public_html/PHPExcel/Writer/PDF.php:49 Stack trace: #0 /public_html/saisie_EPI.php(699): PHPExcel_Writer_PDF->__construct(Object(PHPExcel)) #1 {main} thrown in /public_html/PHPExcel/Writer/PDF.php on line 49

  4. #4
    Membre du Club
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Avril 2013
    Messages
    72
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2013
    Messages : 72
    Points : 49
    Points
    49
    Par défaut
    DAns la version 1.7.8 il faux préciser la librairie
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    $cheminTCPDF = '/public_html/PHPExcel/Writer/PDF/tcpdf';
    PHPExcel_Settings::setPdfRenderer(PHPExcel_Settings::PDF_RENDERER_TCPDF, $cheminTCPDF);

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [PHP Excel] Problème PDF
    Par philodido dans le forum Bibliothèques et frameworks
    Réponses: 12
    Dernier message: 30/11/2010, 16h47
  2. [PHPExcel] Problème d'accents
    Par bellenthan dans le forum Bibliothèques et frameworks
    Réponses: 1
    Dernier message: 19/07/2010, 16h09
  3. [PHPExcel] Utilisation de la mémoire
    Par Mitaka dans le forum Bibliothèques et frameworks
    Réponses: 5
    Dernier message: 15/07/2010, 19h25
  4. Problème PDF et figure
    Par Eric06 dans le forum Tableaux - Graphiques - Images - Flottants
    Réponses: 14
    Dernier message: 06/03/2007, 13h19

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo