kasimbadami / php-excel-reader

Automatically exported from code.google.com/p/php-excel-reader
0 stars 0 forks source link

Text from a cell is partly truncated #98

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
We accept orders from our customers in Excel format. There is a Remarks column 
in the order. Sometimes (very rarely) value of the remarks cell is partly 
truncated. 
For example, the cell contains 'KRi3899562=00113899562001=ЖД=16 F 3-3=EEE1', 
but excel reader reads this cell as '13899562001=ЖД=16 F 3-3=EEE1'. As you 
can see, first part of the text is truncated.

You can download sample order here: http://uaezapchasti.com/Excel/test.xls
M145 cell contains 'KRi3899562=00113899562001=ЖД=16 F 3-3=EEE1'.

Here is the script which reads and outputs the last row with truncated remarks 
value: http://uaezapchasti.com/Excel/example.php
'13899562001=ЖД=16 F 3-3=EEE1' is read from the cell.

If you need any additional information - my skype is megosuyaya, email is 
register at bazanov dot net.

Original issue reported on code.google.com by BEZ...@gmail.com on 12 Nov 2010 at 11:32

GoogleCodeExporter commented 9 years ago
Please send / show the script source .

Original comment by ij%irj.c...@gtempaccount.com on 16 Nov 2010 at 5:31

GoogleCodeExporter commented 9 years ago
Script source is (it is also attached to this comment):

<?php

require_once 'reader.php';
$data = new Spreadsheet_Excel_Reader();
$data->setOutputEncoding('CP1251');
$data->read('test.xls');

for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++)
{
  echo "\"".$data->sheets[0]['cells'][145][$j]."\",";
}

?>

Original comment by BEZ...@gmail.com on 17 Nov 2010 at 2:42

Attachments:

GoogleCodeExporter commented 9 years ago
Change
   $newstr = $retstr[$j].chr(0);
into
   $newstr .= $retstr[$j].chr(0);
around line 547 in reader.php, that should solve the problem. It happens when 
your excel's SST record exceeds the BIFF record size (which may happen if you 
have more than 8kbyte of unique texts in cells), and a CONTINUE is inserted in 
the middle of a string.

Original comment by gergely....@gmail.com on 30 Nov 2010 at 2:48

GoogleCodeExporter commented 9 years ago
Thank you, gergoe, you are the saver!

Original comment by BEZ...@gmail.com on 30 Nov 2010 at 6:08