problem with the insertion of text

Topics: Developer Forum, User Forum
Feb 13, 2009 at 8:26 AM
Hello,

I have a problem with the insertion of text in cells from an array.

In fact only a part of my data appears and sometimes the data is also truncated.

Here is the kind of array I am trying to pass:

array(13) {
[0] => array(16) {
[0] => string(2) "27"
[1] => string(9) "THIRIFAYS"
[2] => string(5) "David"
[3] => string(14) "Rue Albert 1er"
[4] => string(4) "5640"
[5] => string(10) "1990-08-09"
[6] => string(1) "M"
[7] => object(SimpleXMLElement)#70 (1) {
[0] => string(2) "01"
}
[8] => string(3) "B30"
[9] => NULL
[10] => string(0) ""
[11] => string(2) "13"
[12] => string(1) "O"
[13] => string(10) "2008-09-08"
[14] => NULL
[15] => string(0) ""
}
[1] => array(16) {
[0] => string(2) "28"
[1] => string(8) "COLLINET"
[2] => string(4) "Yoni"
[3] => string(15) "Place du Centre"
[4] => string(4) "5600"
[5] => string(10) "1990-07-03"
[6] => string(1) "M"
[7] => object(SimpleXMLElement)#72 (1) {
[0] => string(2) "01"
}
[8] => string(3) "B30"
[9] => NULL
[10] => string(0) ""
[11] => string(2) "13"
[12] => string(1) "O"
[13] => string(10) "2008-09-08"
[14] => NULL
[15] => string(0) ""
}
[2] => array(16) {
[0] => string(2) "29"
[1] => string(7) "PALOMBA"
[2] => string(6) "Pascal"
[3] => string(10) "Rue Sinton"
[4] => string(4) "5070"
[5] => string(10) "1971-05-06"
[6] => string(1) "M"
[7] => object(SimpleXMLElement)#74 (1) {
[0] => string(2) "01"
}
[8] => string(3) "B10"
[9] => NULL
[10] => string(0) ""
[11] => string(2) "00"
[12] => string(1) "O"
[13] => string(10) "2008-09-01"
[14] => NULL
[15] => string(0) ""
}.....
Here is how I pass the array:

for ($i=0;$i<$count;$i++){
(string)$nom = $formData[$i][1];
(string)$prenom = $formData[$i][2];
(string)$adresse = $formData[$i][3];
$cellule = (12+$i);
$sheet->setCellValueByColumnAndRow(0,$cellule,($i+1));
//$sheet->setCellValueByColumnAndRow(2,$cellule,$formData[$i][1]);
$sheet->setCellValueExplicitByColumnAndRow(2,$cellule,$nom,PHPExcel_Cell_DataType::TYPE_STRING);
$sheet->setCellValueExplicitByColumnAndRow(3,$cellule,$prenom,PHPExcel_Cell_DataType::TYPE_STRING);
$sheet->setCellValueExplicitByColumnAndRow(4,$cellule,$adresse,PHPExcel_Cell_DataType::TYPE_STRING);

....

You see a reason for this error.

Thank you.

MaitrePylos

Developer
Feb 14, 2009 at 1:46 AM
Is $formData the array you are showing? I don't see what the error could be. Can you perhaps explain where the data truncation occurs? For which values?

Feb 16, 2009 at 1:58 PM
Example :

 PALOMBA => PA
Rue Sinton => Rue Sin
Usually the first two cells are correct, then the rest is truncated as in the examples mentioned above.

Thank you for your help.


        
    
Developer
Feb 16, 2009 at 7:24 PM
Can you say if this is happening with both PHPExcel_Writer_Excel5 and PHPExcel_Writer_Excel2007?

Feb 18, 2009 at 10:24 AM
Sorry, it was just a problem with utf-8.

Thank you for your help.

MaitrePylos