Error PHPExcel/Writer/.php

Jan 14, 2014 at 6:29 PM
Hello,

I get an error to write in excel document that I can not solve!
<?PHP
$path = './';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
function __autoload($classe)
{
$fichier = str_replace('_',DIRECTORY_SEPARATOR, $classe ) . '.php' ;
require_once($fichier) ; # Chargement de la classe.
}
 
$objet = new PHPExcel_Reader_Excel5();
$excel = $objet->load('../Examples/export-commande.xls');
$writer = new PHPExcel_Writer_Excel5($excel);
$writer->save('autreFichier.xls');
 
$objet = PHPExcel_IOFactory::createReader('Excel5');
$excel = $objet->load('export-commande.xls');
$sheet = $excel->getSheet(0);
$sheet->setCellValue('A50', 'MaitrePylos');
$writer = PHPExcel_IOFactory::createWriter($excel);
$writer->save('Exemple14.xls');
?>
[code]
 
PHPExcel_Reader_Excel5
 
PHPExcel\Reader\Excel5.php
 
PHPExcel_Shared_String
 
PHPExcel\Shared\String.php
 
PHPExcel_Reader_Abstract
 
PHPExcel\Reader\Abstract.php
 
PHPExcel_Reader_IReader
 
PHPExcel\Reader\IReader.php
 
PHPExcel_Reader_DefaultReadFilter
 
PHPExcel\Reader\DefaultReadFilter.php
 
PHPExcel_Reader_IReadFilter
 
PHPExcel\Reader\IReadFilter.php
 
PHPExcel_Shared_OLERead
 
PHPExcel\Shared\OLERead.php
 
PHPExcel
 
PHPExcel.php
 
PHPExcel_Calculation
 
PHPExcel\Calculation.php
 
PHPExcel_Calculation_Function
 
PHPExcel\Calculation\Function.php
 
PHPExcel_CalcEngine_CyclicReferenceStack
 
PHPExcel\CalcEngine\CyclicReferenceStack.php
 
PHPExcel_CalcEngine_Logger
 
PHPExcel\CalcEngine\Logger.php
 
PHPExcel_Worksheet
 
PHPExcel\Worksheet.php
 
PHPExcel_IComparable
 
PHPExcel\IComparable.php
 
PHPExcel_CachedObjectStorageFactory
 
PHPExcel\CachedObjectStorageFactory.php
 
PHPExcel_CachedObjectStorage_Memory
 
PHPExcel\CachedObjectStorage\Memory.php
 
PHPExcel_CachedObjectStorage_CacheBase
 
PHPExcel\CachedObjectStorage\CacheBase.php
 
PHPExcel_CachedObjectStorage_ICache
 
PHPExcel\CachedObjectStorage\ICache.php
 
PHPExcel_Worksheet_PageSetup
 
PHPExcel\Worksheet\PageSetup.php
 
PHPExcel_Worksheet_PageMargins
 
PHPExcel\Worksheet\PageMargins.php
 
PHPExcel_Worksheet_HeaderFooter
 
PHPExcel\Worksheet\HeaderFooter.php
 
PHPExcel_Worksheet_SheetView
 
PHPExcel\Worksheet\SheetView.php
 
PHPExcel_Worksheet_Protection
 
PHPExcel\Worksheet\Protection.php
 
PHPExcel_Worksheet_RowDimension
 
PHPExcel\Worksheet\RowDimension.php
 
PHPExcel_Worksheet_ColumnDimension
 
PHPExcel\Worksheet\ColumnDimension.php
 
PHPExcel_Worksheet_AutoFilter
 
PHPExcel\Worksheet\AutoFilter.php
 
PHPExcel_DocumentProperties
 
PHPExcel\DocumentProperties.php
 
PHPExcel_DocumentSecurity
 
PHPExcel\DocumentSecurity.php
 
PHPExcel_Style
 
PHPExcel\Style.php
 
PHPExcel_Style_Supervisor
 
PHPExcel\Style\Supervisor.php
 
PHPExcel_Style_Font
 
PHPExcel\Style\Font.php
 
PHPExcel_Style_Color
 
PHPExcel\Style\Color.php
 
PHPExcel_Style_Fill
 
PHPExcel\Style\Fill.php
 
PHPExcel_Style_Borders
 
PHPExcel\Style\Borders.php
 
PHPExcel_Style_Border
 
PHPExcel\Style\Border.php
 
PHPExcel_Style_Alignment
 
PHPExcel\Style\Alignment.php
 
PHPExcel_Style_NumberFormat
 
PHPExcel\Style\NumberFormat.php
 
PHPExcel_Style_Protection
 
PHPExcel\Style\Protection.php
 
PHPExcel_Shared_CodePage
 
PHPExcel\Shared\CodePage.php
 
PHPExcel_Shared_OLE
 
PHPExcel\Shared\OLE.php
 
PHPExcel_Shared_Date
 
PHPExcel\Shared\Date.php
 
PHPExcel_Cell
 
PHPExcel\Cell.php
 
PHPExcel_Cell_DataType
 
PHPExcel\Cell\DataType.php
 
PHPExcel_Writer_Excel5
 
PHPExcel\Writer\Excel5.php
 
PHPExcel_Writer_Abstract
 
PHPExcel\Writer\Abstract.php
 
PHPExcel_Writer_IWriter
 
PHPExcel\Writer\IWriter.php
 
PHPExcel_Writer_Excel5_Parser
 
PHPExcel\Writer\Excel5\Parser.php
 
PHPExcel_WorksheetIterator
 
PHPExcel\WorksheetIterator.php
 
PHPExcel_Calculation_Functions
 
PHPExcel\Calculation\Functions.php
 
PHPExcel_Writer_Excel5_Workbook
 
PHPExcel\Writer\Excel5\Workbook.php
 
PHPExcel_Writer_Excel5_BIFFwriter
 
PHPExcel\Writer\Excel5\BIFFwriter.php
 
PHPExcel_Writer_Excel5_Worksheet
 
PHPExcel\Writer\Excel5\Worksheet.php
 
PHPExcel_Writer_Excel5_Xf
 
PHPExcel\Writer\Excel5\Xf.php
 
PHPExcel_Writer_Excel5_Font
 
PHPExcel\Writer\Excel5\Font.php
 
PHPExcel_Shared_OLE_PPS_File
 
PHPExcel\Shared\OLE\PPS\File.php
 
PHPExcel_Shared_OLE_PPS
 
PHPExcel\Shared\OLE\PPS.php
 
PHPExcel_Shared_Font
 
PHPExcel\Shared\Font.php
 
PHPExcel_Shared_OLE_PPS_Root
 
PHPExcel\Shared\OLE\PPS\Root.php
 
PHPExcel_Shared_File
 
PHPExcel\Shared\File.php
 
PHPExcel_IOFactory
 
PHPExcel\IOFactory.php
 
PHPExcel_Cell_DefaultValueBinder
 
PHPExcel\Cell\DefaultValueBinder.php
 
PHPExcel_Cell_IValueBinder
 
PHPExcel\Cell\IValueBinder.php
 
PHPExcel_Writer_
 
PHPExcel\Writer\.php
Warning: require_once(PHPExcel/Writer/.php): failed to open stream: No such file or directory in /var/www/com/Classes/exemple-export-commande-v2.php on line 17 Fatal error: require_once(): Failed opening required 'PHPExcel/Writer/.php' (include_path='.:/usr/share/php:/usr/share/pear:./') in /var/www/com/Classes/exemple-export-commande-v2.php on line 17
How to fix error?

(Sorry don't speak english)

guigui69
Coordinator
Jan 14, 2014 at 6:35 PM
You need to specify which writer you want to use.

e.g.
$writer = PHPExcel_IOFactory::createWriter($excel);
should be
$writer = PHPExcel_IOFactory::createWriter($excel, 'Excel2007');
if you want to write a .xlsx file

or
$writer = PHPExcel_IOFactory::createWriter($excel, 'Excel5');
if you want to write a .xls file
Feb 4, 2015 at 1:29 PM
I've specified the writer(Excel2007), but still encountering this problem.

The error is :
Fatal error: Class 'PHPExcel_Style_Border' not found in Module.php on line  100
Coordinator
Feb 4, 2015 at 2:45 PM
Perhaps showing a bit of your code might help.... because my crystal ball can't see the content of Module.php
Feb 4, 2015 at 3:41 PM
Sorry, didn't investigated it enough by myself. And my problem is not related to this thread. The problem was in composer. In my export service I have const like
const BORDER_STYLE = \PHPExcel_Style_Border::BORDER_HAIR;
which I use several times in service, and on Zend initialization, Zend is trying to pass service locator to my service. PHPOffice is not installed, hence, service cannot be initialized, and that's why I see this error. I've re-updated all my packages and all works fine, but I really appreciate your quick response. Thanks