Fatal error: Uncaught exception 'com_exception' with message
Bonjour à tous,
Erreur courante je suppose mais je ne trouve pas la solution sur le net :-(
suite à la saisie du code suivant, IE m'affiche comme erreur:
Citation:
Fatal error: Uncaught exception 'com_exception' with message ' in C:\wamp64\www\tests1\PhilTest1.php on line 18
com_exception: in C:\wamp64\www\tests1\PhilTest1.php on line 18
je ne comprend pas, il ne parait pas y avoir d'erreurs pourtant, mon fichier xlsx existe bien à l'endroit indiqué
je viens d'installer wamp
merci de votre aide svp
cdlt
Code:
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
| <!DOCTYPE html>
<html>
<head>
<title>Ceci est une page de test avec des balises PHP</title>
<meta charset="utf-8"/>
</head>
<body>
<?php
$varfilename='C:\wamp64\www\tests1\PhilTest1.xlsx'; //nom du fichier à ouvrir
echo $varfilename;
//ouverture du fichier
$varexcel=new COM("Excel.application" ) or die("Impossible d'instancier l'application Excel");
echo " - Excel lancé, version {$varexcel->Version}\n"; //Excel lancé, version 15.0
$varexcel->Visible=true;
$varworkbooks=$varexcel->Workbooks->Open($varfilename) or Die('Did not open filename');
$varbook=$varworkbooks(1);
$varsheet=$varbook->Worksheets(1);
$varcell=$varsheet->Range('A1'); //selection de la cellule
$varcell->value='15'; //remplissage
//sauvegarde et fermeture du fichier
unset($varsheet);
$varbook->Save();
unset($varbook);
$varworkbooks->Close();
unset($varworkbooks);
$varexcel->Quit();
unset($varexcel);
echo "opération terminée avec succès"
?>
</body>
</html> |