Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






Office 2003 compatibility pack

Because of a bug in the Office2003 compatibility pack, there can be some small issues when opening Excel2007 spreadsheets (mostly related to formula calculation). You can enable Office2003 compatibility with the following code:

$objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
$objWriter->setOffice2003Compatibility(true);

$objWriter->save("05featuredemo.xlsx");

 

i Office2003 compatibility should only be used when needed
Office2003 compatibility option should only be used when needed. This option disables several Office2007 file format options, resulting in a lower-featured Office2007 spreadsheet when this option is used.

Serialized file format

Serialized file format is a manner of storing a PHPExcel spreadsheet to disk, creating a file containing a serialized PHPExcel instance. It offers a fast and easy way to store and read a spreadsheet.

 

i Serialized file format should not be used as a persistent storage method!
Since serialized files may not be compatible trough different PHPExcel versions, it is not a good idea to use this as a persistent storage method. Think of the serialized file format as a temporary storage, for example between 2 batch scripts that depend on each other’s output.

PHPExcel_Reader_Serialized

Reading a spreadsheet

You can read a .phpxl file using the following code:

$objReader = new PHPExcel_Reader_Serialized();

$objPHPExcel = $objReader->load("05featuredemo.phpxl");

PHPExcel_Writer_Serialized

Writing a spreadsheet

You can write a .phpxl file using the following code:

$objWriter = new PHPExcel_Writer_Serialized($objPHPExcel);

$objWriter->save("05featuredemo.phpxl");

Excel 5 (BIFF) file format

Excel5 file format is the old Excel file format, implemented in PHPExcel to provide a uniform manner to create both .xlsx and .xls files. It is basically a modified version of PEAR Spreadsheet_Excel_Writer, and has the same limitations and features as the PEAR library.

 

Excel5 file format will not be developed any further, it just provides an additional file format for PHPExcel.

 

i Excel5 (BIFF) limitations
Please note that BIFF file format has some limits regarding to styling cells and handling large spreadsheets via PHP.

PHPExcel_Reader_Excel5

Reading a spreadsheet

You can read an .xls file using the following code:

$objReader = new PHPExcel_Reader_Excel5();

$objPHPExcel = $objReader->load("05featuredemo.xls");

Read data only

You can set the option setReadDataOnly on the reader, to instruct the reader to ignore styling, data validation, … and just read cell data:

$objReader = new PHPExcel_Reader_Excel5();

$objReader->setReadDataOnly(true);

$objPHPExcel = $objReader->load("05featuredemo.xls");

Read specific sheets only



You can set the option setLoadSheetsOnly on the reader, to instruct the reader to only load the sheets with a given name:

$objReader = new PHPExcel_Reader_Excel5();

$objReader->setLoadSheetsOnly( array("Sheet 1", "My special sheet") );

$objPHPExcel = $objReader->load("05featuredemo.xls");


Date: 2016-03-03; view: 1179


<== previous page | next page ==>
Operator precedence | Setting CSV options
doclecture.net - lectures - 2014-2024 year. Copyright infringement or personal data (0.007 sec.)