Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






Spreadsheet in memory

PHPExcel’s architecture is built in a way that it can serve as an in-memory spreadsheet. This means that, if one would want to create a web based view of a spreadsheet which communicates with PHPExcel’s object model, he would only have to write the front-end code.

 

Just like desktop spreadsheet software, PHPExcel represents a spreadsheet containing one or more worksheets, which contain cells with data, formulas, images, …

Readers and writers

On its own, PHPExcel does not provide the functionality to read from or write to a persisted spreadsheet (on disk or in a database). To provide that functionality, readers and writers can be used.

 

By default, the PHPExcel package provides some readers and writers, including one for the Open XML spreadsheet format (a.k.a. Excel 2007 file format). You are not limited to the default readers and writers, as you are free to implement the PHPExcel_Writer_IReader and PHPExcel_Writer_IWriter interface in a custom class.

 

Fluent interfaces

PHPExcel supports fluent interfaces in most locations. This means that you can easily “chain” calls to specific methods without requiring a new PHP statement. For example, take the following code:

 

$objPHPExcel->getProperties()->setCreator("Maarten Balliauw");

$objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw");

$objPHPExcel->getProperties()->setTitle("Office 2007 XLSX Test Document");

$objPHPExcel->getProperties()->setSubject("Office 2007 XLSX Test Document");

$objPHPExcel->getProperties()->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.");

$objPHPExcel->getProperties()->setKeywords("office 2007 openxml php");

$objPHPExcel->getProperties()->setCategory("Test result file");

 

This can be rewritten as:

 

$objPHPExcel->getProperties()
->setCreator("Maarten Balliauw")

->setLastModifiedBy("Maarten Balliauw")

->setTitle("Office 2007 XLSX Test Document")

->setSubject("Office 2007 XLSX Test Document")

->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")

->setKeywords("office 2007 openxml php")

->setCategory("Test result file");

 

 

i Using fluent interfaces is not required
Fluent interfaces have been implemented to provide a convenient programming API. Use of them is not required, but can make your code easier to read and maintain.

 


Date: 2016-03-03; view: 1006


<== previous page | next page ==>
Software requirements | Creating a spreadsheet
doclecture.net - lectures - 2014-2024 year. Copyright infringement or personal data (0.006 sec.)