Export formatted xlsb

Topics: Developer Forum
Feb 12, 2015 at 11:28 PM
Edited Feb 12, 2015 at 11:35 PM
Prueba un nuevo navegador con traducción automática.Descargar Google ChromeIgnorar
Export formatted xlsb

Hello Friends,

I am using PHPExcel to export an excel file in .xls format and works very well, the code is as follows:

require_once dirname ( FILE). '/Classes/PHPExcel/IOFactory.php';

// exported excel
header ('Content-Type: application / vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header ('Content-Disposition: attachment; filename = "lista.xlsx' ');

Now I want to export to xlsb format to reduce the size of the file with the following code:

require_once dirname ( FILE). '/Classes/PHPExcel/IOFactory.php';
header ('Content-Type: application / vnd.ms-excel.sheet.binary.macroEnabled.12');
header ('Content-Disposition: attachment; filename = "lista.xlsb' ');

the downloading, but when I open the file I get the following error

"Exel can not open the 'lista.xlsb' because the file format or extension of this are not valid.
Verify that the file has not been corrupted and that the extension of it matches the file format.

I tried to modify the file IOFactory.php, because the function createReaderForFile
not the extension case "xlsb" add case "xlsb" but it does not work, the same error is displayed.

Anyone have a similar example I want to do.

Note: I export the fields come from a MySql query

Thanks for the help.
file format.
Ver también
file, format
Traductor de Google para empresas:Translator ToolkitTraductor de sitios webGlobal Market Finder
Desactivar traducción instantáneaAcerca del Traductor de GoogleCelularesComunidadPrivacidad y condicionesAyudaEnviar comentarios
Feb 12, 2015 at 11:39 PM
If you want to create an xlsb file, then you'll need to create your own xlsb Writer, because no existing writer for xlsb format files exists
Feb 13, 2015 at 3:30 AM
MarkBaker ok thanks for the answer, then I have to use another library.
Feb 13, 2015 at 8:14 AM
You have a choice of three:
  • COM - requires a COM enabled spreadsheet program such as MS Excel or OpenOffice Calc running on the server
  • The Open Office alternative to COM, PUNO - requires Open Office installed on the server with Java support enabled)
  • Ilia Alshanetsky's Excel extension now on github - requires commercial libXL component
Can't guarantee that these all handle xlsb format as well, but they're the only likely options
Feb 16, 2015 at 1:21 AM
MarkBaker thanks for giving me some alternatives, I have no longer modify the entire report created with PHPExcel, I was asked to list some facts which are a function of the state, then just change the MySql query file and weight was reduced considerably.