ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

PHPExcel Developer Documentation


Enviado por   •  2 de Julio de 2014  •  Tesinas  •  10.471 Palabras (42 Páginas)  •  332 Visitas

Página 1 de 42

PHPExcel Developer Documentation

1. Contents

PHPExcel Developer Documentation 1

1. Contents 2

2. Prerequisites 4

2.1. Software requirements 4

2.2. Installation instructions 4

2.3. Getting started 4

2.4. Useful links and tools 4

2.4.1. OpenXML / SpreadsheetML 4

2.4.2. Frequently asked questions 5

2.4.3. Tutorials 5

3. Architecture 6

3.1. Schematical 6

3.2. Lazy Loader 6

3.3. Spreadsheet in memory 6

3.4. Readers and writers 6

3.5. Fluent interfaces 7

4. Creating a spreadsheet 9

4.1. The PHPExcel class 9

4.2. Configuration Settings 9

4.2.1. Cell Caching 9

4.2.2. Language/Locale 11

4.3. Clearing a Workbook from memory 11

4.4. Worksheets 11

4.5. Accessing cells 11

4.5.1. Setting a cell value by coordinate 11

4.5.2. Retrieving a cell by coordinate 11

4.5.3. Setting a cell value by column and row 11

4.5.4. Retrieving a cell by column and row 12

4.5.5. Looping cells 12

4.5.6. Using value binders to facilitate data entry 13

4.6. PHPExcel recipes 14

4.6.1. Setting a spreadsheet’s metadata 14

4.6.2. Setting a spreadsheet’s active sheet 14

4.6.3. Write a date into a cell 14

4.6.4. Write a formula into a cell 15

4.6.5. Locale Settings for Formulae 15

4.6.6. Write a newline character "\n" in a cell (ALT+"Enter") 16

4.6.7. Explicitly set a cell’s datatype 17

4.6.8. Change a cell into a clickable URL 17

4.6.9. Setting a worksheet’s page orientation and size 17

4.6.10. Page Setup: Scaling options 17

4.6.11. Page margins 18

4.6.12. Center a page horizontally/vertically 19

4.6.13. Setting the print header and footer of a worksheet 19

4.6.14. Setting printing breaks on a row or column 20

4.6.15. Show/hide gridlines when printing 20

4.6.16. Setting rows/columns to repeat at top/left 21

4.6.17. Specify printing area 21

4.6.18. Formatting cells 21

4.6.19. Number formats 22

4.6.20. Alignment and wrap text 23

4.6.21. Setting the default style of a workbook 23

4.6.22. Styling cell borders 23

4.6.23. Conditional formatting a cell 24

4.6.24. Add a comment to a cell 25

4.6.25. Apply autofilter to a range of cells 25

4.6.26. Setting security on a spreadsheet 25

4.6.27. Setting data validation on a cell 26

4.6.28. Setting a column’s width 27

4.6.29. Show/hide a column 27

4.6.30. Group/outline a column 27

4.6.31. Setting a row’s height 28

4.6.32. Show/hide a row 28

4.6.33. Group/outline a row 28

4.6.34. Merge/unmerge cells 28

4.6.35. Inserting rows/columns 28

4.6.36. Add a drawing to a worksheet 29

4.6.37. Add rich text to a cell 29

4.6.38. Define a named range 29

4.6.39. Redirect output to a client’s web browser 30

4.6.40. Setting the default column width 31

4.6.41. Setting the default row height 31

4.6.42. Add a GD drawing to a worksheet 31

4.6.43. Setting worksheet zoom level 31

4.6.44. Sheet tab color 31

4.6.45. Creating worksheets in a workbook 31

4.6.46. Hidden worksheets (Sheet states) 31

4.6.47. Right-to-left worksheet 32

5. Performing formula calculations 33

5.1. Using the PHPExcel calculation engine 33

5.2. Known limitations 34

5.2.1. Operator precedence 34

5.2.2. Formulas involving numbers and text 34

6. Reading and writing to file 35

6.1. PHPExcel_IOFactory 35

6.1.1. Creating PHPExcel_Reader_IReader using PHPExcel_IOFactory 35

6.1.2. Creating PHPExcel_Writer_IWriter using PHPExcel_IOFactory 35

6.2. Excel 2007 (SpreadsheetML) file format 35

6.2.1. PHPExcel_Reader_Excel2007 36

6.2.2. PHPExcel_Writer_Excel2007 36

6.3. Serialized file format 37

6.3.1. PHPExcel_Reader_Serialized 37

6.3.2. PHPExcel_Writer_Serialized 37

6.4. Excel 5 (BIFF) file format 37

6.4.1. PHPExcel_Reader_Excel5 37

6.4.2. PHPExcel_Writer_Excel5 38

6.5. Excel 2003 XML file format 38

6.5.1. PHPExcel_Reader_Excel2003XML 38

6.6. Symbolic LinK (SYLK) 39

6.6.1. PHPExcel_Reader_SYLK 39

6.7. CSV (Comma Separated Values) 40

6.7.1. PHPExcel_Reader_CSV 40

6.7.2. PHPExcel_Writer_CSV 40

6.8. HTML 41

6.8.1. PHPExcel_Writer_HTML 41

6.9. PDF 43

6.9.1. PHPExcel_Writer_PDF 43

6.10. Generating Excel files from templates (read, modify, write) 44

7. Credits 45

Appendix A: Valid array keys for style applyFromArray() 46

2. Prerequisites

2.1. Software requirements

The following software is required to develop using PHPExcel:

» PHP version 5.2.0 or newer

» PHP extension php_zip enabled *)

» PHP extension php_xml enabled

» PHP extension php_gd2 enabled (if not compiled in)

*) php_zip is only needed by PHPExcel_Reader_Excel2007, PHPExcel_Writer_Excel2007 and PHPExcel_Reader_OOCalc. In other words, if you need PHPExcel to handle .xlsx or .ods files you will need the zip extension, but otherwise not.

2.2. Installation instructions

Installation is quite easy: copy the contents of the Classes folder to any location

in your application required.

Example:

If your web root folder is /var/www/ you may want to create a subfolder called /var/www/Classes/ and copy the files into that folder so you end up with files:

/var/www/Classes/PHPExcel.php

/var/www/Classes/PHPExcel/Calculation.php

/var/www/Classes/PHPExcel/Cell.php

...

2.3. Getting started

A good way to get started is to run some of the tests included in the download.

Copy the "Tests" folder next to your "Classes" folder from above so you end up with:

/var/www/Tests/01simple.php

/var/www/Tests/02types.php

...

Start running the tests by pointing your browser to the test scripts:

http://example.com/Tests/01simple.php

http://example.com/Tests/02types.php

...

Note: It may be necessary to modify the include/require statements at the beginning of each of the test scripts if your "Classes" folder from above is named differently.

2.4. Useful links and tools

There are some links and tools

...

Descargar como (para miembros actualizados) txt (95 Kb)
Leer 41 páginas más »
Disponible sólo en Clubensayos.com