Display Excel

Topics: Developer Forum, Project Management Forum, User Forum
Apr 6, 2013 at 12:48 AM
Good evening I would like to know how I can display a file open in excel or automatic with PHPExcel.

Thank you.

Atte.

Joel J. cross cross
Coordinator
Apr 8, 2013 at 11:11 AM
Display how? Do you mean display in a browser?
require_once '../Classes/PHPExcel/IOFactory.php';
$objPHPExcel = PHPExcel_IOFactory::load("myExcelFile.xlsx");
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
$objWriter->save('php://output');


Apr 8, 2013 at 1:30 PM
Good this way allows me to display the contents of the excel file, what I need is to open the excel file does not display it as html, please could help me.

Thank you.

Atte.

Joel J. de la cruz cruz
Coordinator
Apr 8, 2013 at 1:44 PM
If you need the generated file to be opened in MS Excel itself, then look at the 01simple-download-xls.php and 01simple-download-xlsx.php examples that are provide in /Tests or /Examples. These set the appropriate http headers to prompt for save/open when sent to a browser; but this will only allow a file to be opened in MS Excel if MS Excel is installed on the clients PC, and has the appropriate file extensions configured to open in Excel
Nov 16, 2013 at 3:07 AM
The code always displays the first sheet of the excel file. How can I display other sheets in the file?

Thank you very much.
Dec 6, 2013 at 6:42 AM
Could anyone help me? I still have not found a solution.
Dec 6, 2013 at 9:48 AM
If you need an another (single) sheet: $objWriter->setSheetIndex(9);

If you need all the worksheets: $objWriter->setGenerateSheetNavigationBlock (true)->writeAllSheets();
Dec 6, 2013 at 10:50 AM
LWol wrote:
If you need an another (single) sheet: $objWriter->setSheetIndex(9);

If you need all the worksheets: $objWriter->setGenerateSheetNavigationBlock (true)->writeAllSheets();
Thanks a lot! That is perfect.