I wrote how to get rid of UTF-8 character encoding problem while reading Excel files with PhpExcelReader. Now i want to warn you about numerics in PhpExcelWriter. For example when i write an 11 character word or a bigger one to the Excel file;
902321111111
it is always showed in excel file;
9,02321E+11
If you faced a problem like it, just write this value to the excel file not by write function;
$workSheet->write(0, 0, $value);
write it by writeString function;
$workSheet->writeString(0, 0, $value);
So the whole code seems like;
require_once("Spreadsheet/Excel/Writer.php");
$workbook = & new Spreadsheet_Excel_Writer();
$workbook->send('excel.xls');
$workbook->setVersion(8);
$worksheet = & $workbook->addWorksheet('Sheet1');
$worksheet->setInputEncoding('UTF-8');
$workSheet->writeString(0, 0, "902321111111");
$workbook->close();
Subscribe to:
Post Comments (Atom)
.bmp)
No comments:
Post a Comment