Bonjour,
J'utilise la librairie WriteExcel pour générer un fichier Excel ou je récupère des données de ma BD.
J'ai un problème avec un seul champs, pour expliquer plus, ce champs a été généré par "tinymce" le fameux éditeur des champs textarea, bref ce champs contient des balises "<>", et pour extraire juste mon texte j'applique la fonction "strip_tags".
au moment ou j'applique cette fonction, j'ai ce message ci-dessous qui s'affiche.
Je mets mon code qui génère l'erreur
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
47
48
49 <?php //connexion à la bd include"config.php"; $db = mysql_connect($serveur, $login, $password); mysql_select_db($base,$db); //set_time_limit(10); require_once "class.writeexcel_workbook.inc.php"; require_once "class.writeexcel_worksheet.inc.php"; $fname = tempnam("/tmp", "simple.xls"); $workbook = &new writeexcel_workbook($fname); $worksheet = &$workbook->addworksheet(); //requete $ListeOrien = "SELECT ID_ACT_CD, ACT_DESCRIP FROM PA_STRATEGIE s JOIN PA_ACTION a ON a.ID_STRAT_CD = s.ID_STRAT_CD JOIN PA_TERRITOIRE t ON s.ID_TER_CD=t.ID_TER_CD JOIN PA_UTILISATEUR u ON u.ID_USER = a.ID_USER "; $ListeOrien = mysql_query($ListeOrien) or die("pas de liste"); if (mysql_num_rows($ListeOrien)<>0) { for ($i=0; $i < mysql_num_rows($ListeOrien); ++$i) { $copie = mysql_fetch_array($ListeOrien); $ACT_DESCRIP=$copie[1]; $ACT_DESCRIP=strip_tags($ACT_DESCRIP); $worksheet->write($i, 0, $ACT_DESCRIP ); } } $workbook->close(); //header("Content-type: application/vnd.ms-excel"); //header('Content-Type: application/x-msexcel; charset=ISO-8859-1'); header("Content-Type: application/vnd.ms-excel; name=\"example-demo.xls\"" ); header("Content-Disposition: inline; filename=\"example-simple.xls\""); $fh=fopen($fname, "rb"); fpassthru($fh); unlink($fname); ?>
je mets le bout de code du fichier "class.writeexcel_formula.inc.php"
Code : Sélectionner tout - Visualiser dans une fenêtre à part Fatal error: Sintactic error: , lookahead: , current char: 0 in class.writeexcel_formula.inc.php on line 1446
La ligne 1446 c'est :
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63 function _fact() { if ($this->_current_token == SPREADSHEET_EXCEL_WRITER_OPEN) { $this->_advance(); // eat the "(" $result = $this->_parenthesizedExpression(); if ($this->_current_token != SPREADSHEET_EXCEL_WRITER_CLOSE) { trigger_error("')' token expected.",E_USER_ERROR); } $this->_advance(); // eat the ")" return $result; } if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/',$this->_current_token)) { // if it's a reference $result = $this->_createTree($this->_current_token, '', ''); $this->_advance(); return $result; } elseif (preg_match("/^[A-Za-z0-9_]+(\:[A-Za-z0-9_]+)?\![A-Ia-i]?[A-Za-z][0-9]+$/",$this->_current_token)) { // If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1) $result = $this->_createTree($this->_current_token, '', ''); $this->_advance(); return $result; } elseif (preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/",$this->_current_token) or preg_match("/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/",$this->_current_token)) { // if it's a range $result = $this->_current_token; $this->_advance(); return $result; } elseif (preg_match("/^[A-Za-z0-9_]+(\:[A-Za-z0-9_]+)?\!([A-Ia-i]?[A-Za-z])?[0-9]+:([A-Ia-i]?[A-Za-z])?[0-9]+$/",$this->_current_token)) { // If it's an external range (Sheet1!A1:B2) $result = $this->_current_token; $this->_advance(); return $result; } elseif (preg_match("/^'[A-Za-z0-9_ ]+(\:[A-Za-z0-9_ ]+)?'\!([A-Ia-i]?[A-Za-z])?[0-9]+:([A-Ia-i]?[A-Za-z])?[0-9]+$/",$this->_current_token)) { // If it's an external range ('Sheet1'!A1:B2) $result = $this->_current_token; $this->_advance(); return $result; } elseif (is_numeric($this->_current_token)) { $result = $this->_createTree($this->_current_token, '', ''); $this->_advance(); return $result; } elseif (eregi("^[A-Z0-9\xc0-\xdc\.]+$",$this->_current_token)) { // if it's a function call $result = $this->_func(); return $result; } trigger_error("Sintactic error: ".$this->_current_token.", lookahead: ". $this->_lookahead.", current char: ".$this->_current_char, E_USER_ERROR); }
Merci de votre aide .
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 trigger_error("Sintactic error: ".$this->_current_token.", lookahead: ". $this->_lookahead.", current char: ".$this->_current_char, E_USER_ERROR);
Cordialement.
Partager