xls not generated, rebuild it with ole_pps + xlsheet

Apr 6, 2009 at 6:33 PM
hi
because of my hosting's update, for a problem with permission the xls files weren't generated, but i've OLE_PPS_FileBBLHrH and XLSHEETfdxvXi files.
how can i generate xls file?
Developer
Apr 8, 2009 at 10:47 AM
Not sure what the problem is. What kind of error message are you getting?

Apr 8, 2009 at 1:57 PM
i've reported an error in writing files due to a problem with permission of a directory, so' many users has used my script but it didn't work.

so, i try to explain again hoping to be more clear :)
sorry for my english

so...

1) i have a /temp directory ( $objWriter->setTempDir($pValue = '/var/www/temp');
2) i have a /xls destination directory

i have writing permission in /temp, but i hadn't in /xls
now i have correct and all works, but in the past days it didn't (of course....)

otherwise, in /temp dir i have many files that weren't deleted beacuse xls wan't generated

so i have many files like OLE_PPS_FileBBLHrH and XLSHEETfdxvXi

my question is: can i rebuild xls from these kind of files?

thanks
Developer
Apr 8, 2009 at 3:18 PM
You can restore the files using the OLE_PPS_File* files. XLSHEET* are not needed.

This snippet shows the technique:

<?php
require_once '/PHPExcel/Classes/PHPExcel/Shared/OLE/OLE_File.php';

$OLE = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs('Book'));
$res = $OLE->init();

$OLE->append(file_get_contents('OLE_PPS_FileBBLHrH'));

$root = new PHPExcel_Shared_OLE_PPS_Root(time(), time(), array($OLE));
$res = $root->save('restore.xls');
?>

Apr 9, 2009 at 10:21 AM
it doesn't work. maybe ole_pps file is corrupted?
it generate a blank xls file
Developer
Apr 9, 2009 at 4:49 PM
Can you try to open one of the OLE_PPS_File* in an ordinary text editor. You should be able to see some of the strings in the Excel file scattered in the file. Otherwise try to send me the file (erik at phpexcel dot net).

Developer
Apr 21, 2009 at 9:25 PM
Thanks, I received the sample OLE_PPS_File* files. Indeed the script didn't seem to work.

What appears to be the problem is file corruption as a result of FTP ASCII mode transfer from Linux server to local Windows machine. This converts \n (0x0A) to \r\n (0x0D 0x0A)in those OLE_PPS_File* files which is unfortunate. Can you try to grab those files again using FTP binary transfer mode and retry that script?