Phpexcel Chinese Development Manual translation (2)

Source: Internet
Author: User
Tags configuration settings ziparchive kohana

Phpexcel Developer Documentation

1. Catalogue
2.4 Prerequisites
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. of openxml/spreadsheetml in 4
2.4.2. FAQ 5
2.4.3. 6 Tutorials
3. Construction 7
3.1. 7 schematic
3.2. Delay Loader 7
3.3. Spreadsheet in memory 7
3.4. Readers and Writers 7
3.5. Fluent Interface 8
4. Create a spreadsheet 10
4.1. The Phpexcel level 10
4.1.1. Load 10 workbooks from a file
4.1.2. Create a new workbook 10
4.2. Configuration Settings 10
4.2.1. Battery Cache 10
4.2.2. Language/Regional Settings 12
4.3. Clear 13 Workbooks from memory
4.4. 13 Worksheets
4.4.1. Add a new sheet 14
4.4.2. Copy Sheet 14
4.4.3. Delete Sheet 14
4.5. Access Unit 14
4.5.1. Setting cell values by coordinate 14
4.5.2. Retrieving cells from coordinates 15
4.5.3. Setting cell values by row and column 15
4.5.4. Retrieving cells from columns and rows 15
4.5.5. Cycle Unit 15
4.5.6. Use of value adhesives for easy Data Entry 16
4.6. Phpexcel 17 Recipes
4.6.1. Set metadata for a spreadsheet 17
4.6.2. Set up a spreadsheet for the activity Board 17
4.6.3. Write a date or time to cell 17
4.6.4. Cell 18 that wrote the formula
4.6.5. 19-Zone settings
4.6.6. Write the newline character "\ n" (ALT + "carriage return") in the cell 20
4.6.7. Explicitly set the data type of a cell 20
4.6.8. A cell becomes clickable URL 20
4.6.9. Set page orientation and size for worksheets 20
4.6.10. Page Setup: Zoom options 21
4.6.11. Margins 22
4.6.12. Horizontal Center page/Vertical 22
4.6.13. Set up print headers and footers for sheet 22
4.6.14. Set a print break in one row or column 24
4.6.15. 24 Show/Hide gridlines when printing
4.6.16. Set row/column top repeat/left 24
4.6.17. Designated printing Area 24
4.6.18. Set Cell 24
4.6.19. Number Format 26
4.6.20. Calibrating and Wrapping 26
4.6.21. Set a default style for workbook 27
4.6.22. Styling cell Border 27
4.6.23. Cell 28 for conditional formatting
4.6.24. Comments added to cell 28
4.6.25. Apply AutoFilter cell range 29
4.6.26. Set up security in spreadsheet 29
4.6.27. Setting data validation on battery 30
4.6.28. Set Column width 30
April 6, 29. Show/Hide Columns 31
4.6.30. Group/Outline of the Dequeue 31
April 6, 31. Set line Height 31
4.6.32. Show/Hide Row 31
April 6, 33. Group/sketched out a row of 32
April 6, 34. Merging/separating units 32
April 6, 35. Insert row/Column 32
April 6, 36. Graphics added to worksheet 32
April 6, 37. Reading a picture from table 33
April 6, 38. Rich text added to a cell 34
April 6, 39. Define a name range of 34
April 6, 40. Output redirected to the client's Web browser 34
April 6, 41. Set default column width 35
April 6, 42. Set default Row Height 35
April 6, 43. Add GD drawing to sheet 35
April 6, 44. Set the zoom level of a worksheet 36
April 6, 45. sheet Tab Color 36
April 6, 46. At work?? Create 36 worksheets in a book
April 6, 47. Hidden Sheet (table State) 36
April 6, 48. Right-to-left worksheet 36
5. Perform formula calculation 37
5.1. Using the Phpexcel Compute Engine 37
5.2. Known Limitations 38
5.2.1. Operator Precedence 38
5.2.2. 38 formulas involving numbers and text
6. Read and write to file 39
6.1. Phpexcel_iofactory 39
6.1.1. Create Phpexcel_reader_ireader using Phpexcel_iofactory 39
6.1.2. Create Phpexcel_writer_iwriter using Phpexcel_iofactory 39
6.2. File format in Excel 2007 (spreadsheetml) 39
6.2.1. PHPEXCEL_READER_EXCEL2007 40
6.2.2. PHPEXCEL_WRITER_EXCEL2007 40
6.3. Excel 5 (BIFF) file format 41
6.3.1. Phpexcel_reader_excel5 41
6.3.2. Phpexcel_writer_excel5 42
6.4. XML file format in Excel 2003 42
6.4.1. Phpexcel_reader_excel2003xml 42
6.5. Symbolic Link (SYLK) 43
6.5.1. PHPEXCEL_READER_SYLK 43
6.6. Open/free office (. ODS) 43
6.6.1. Phpexcel_reader_oocalc 43
6.7. CSV (comma Separated values) 44
6.7.1. Phpexcel_reader_csv 44
6.7.2. Phpexcel_writer_csv 45
6.8. HTML 46
6.8.1. Phpexcel_reader_html 46
6.8.2. Phpexcel_writer_html 46
6.9. PDF 47
6.9.1. Phpexcel_writer_pdf 47
6.10. Generate Excel files from templates (read, modify, write) 49
7. Cash 50
Appendix A: Style Applyfromarray valid array key () 51

2. Prerequisites 2.1. Software Requirements

The following software needs to use the Phpexcel extension:

»php version 5.2.0 or later
»php Extended Php_zip enabled *)
»php extension Php_xml Enabled
»php extension PHP_GD2 enabled (if not compiled)

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 the. xlsx or. ODS archive file, you need to compress the extension, but otherwise it is not.
You can delete this dependent write Excel2007 file (although not yet read) by using the bundled Phpexcel Pclzip library. See the FAQ section of this document (2.4.2) for this information. Pclzip does have an extended dependency on PHP-enabled zlib.

2.2. Installation Instructions
Installation is easy: the contents of the classes folder are copied to any location in your application's source directory.

Cases:
If your Web root is/var/www/You may want to create a file named/Var/www/class sub/and file copied to that folder??, so you end up getting the files:

/var/www/classes/phpexcel.php
/var/www/classes/phpexcel/calculation.php
/var/www/classes/phpexcel/cell.php

2.3. Entry
A good way to get started is to run some tests that are included in the download.

The "Examples" folder is copied next to the "class" Classes, so you end up getting the folder:

/var/www/examples/01simple.php
/var/www/examples/02types.php


Start your browser, point to test scripts, run tests

http://example.com/Examples/01simple.php
http://example.com/Examples/02types.php

Note: You may need to modify the start statement that includes/needs to be named differently in each test script if the folder from the "class" above is renamed.

2.4. Useful links and tools
There are also links and tools that are useful when developing with phpexcel. Please refer to Phpexcel CodePlex for an updated version of the following list.
2.4.1. In the openxml/spreadsheetml
» Documents in file format
Http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm

»openxml's explanation ebook
Http://openxmldeveloper.org/articles/1970.aspx

»microsoft Office Compatibility Pack for Word,excel and PowerPoint 2007 File formats
http://www.microsoft.com/downloads/details.aspx?familyid=941b3470-3ae9-4aee-8f43-c6bb74cd1466&displaylang= En

»openxml's Package browser
http://www.codeplex.com/PackageExplorer/
2.4.2. Frequently Asked Questions
Up-to-date f.a.q. For phpexcel pages, you can http://www.codeplex.com/PHPExcel/Wiki/View.aspx?title=FAQ&referringTitle= Requirements found.
There seems to be a problem with character encoding ...
It must use UTF-8 encoded phpexcel all text. If the script uses a different encoding, then you can put the text of PHP's Iconv () or mb_convert_encoding () function.
PHP complains ziparchive not found
Ensure that you meet all requirements, especially the php_zip extension should be enabled

The Ziparchive class is required when reading or writing to the format using ZIP compression (Excel2007 and Oocalc). Because the 1.7.6 version of the Pclzip library has been bundled with Phpexcel as an alternative to the Ziparchive class.

This can be enabled by calling:
Phpexcel_settings:: Setzipclass (phpexcel_settings:: Pclzip);
Before calling the author's Save method in Excel2007.

You can revert to using ziparchive to call:
Phpexcel_settings:: Setzipclass (phpexcel_settings:: ziparchive);

Currently, this allows you to write only Excel2007 files without the need for ziparchive (unread Excel2007 or Oocalc)
Files that are generated by phpexcel_writer_2007 on Windows cannot be opened in Excel 2007
"Excel Found" *. xlsx "Unable to read content. Do you want to restore the contents of this workbook? If you trust the source of the workbook, click Yes. “

When you create a zip file, some older versions of the 5.2.x php_zip extension on Windows contain an error. Versions that can be found in http://snaps.php.net/win32/php5.2-win32-latest.zip should work at all times.

Also, upgrade to at least 5.2.9 PHP should solve the problem.

If you can't find a new copy of Ziparchive, then you can write the Excel2007 file as described above using the Pclzip library as an alternative.
Fatal error: Ran out of xxx bytes allowed memory size (attempted to allocate yyy bytes) zzz online AAA
Phpexcel holds the "memory" display of the spreadsheet, so it is constrained by the memory limitations of PHP. Providing PHP memory can improve the value of editing memory_limit instructions in your php.ini file, or use the Ini_set (' Memory_limit ', ' 128M ') in your code (ISP license).

Some readers and writers are faster than others, and they also use different amounts of memory. You can find some indications of relative performance and memory usage for different readers and writers, in different versions of Phpexcel, in discussion boards.

If you have increased the memory to the maximum, or you cannot change your memory limit, the board discussion describes some methods that you can use to reduce memory usage with Phpexcel scripts.
Protect my work from work?
When you use any of the worksheet protection features (for example, cell-wide protection, prohibit deletion of rows, ... ), make sure that you enable security for the worksheet. This can be done for example such as:

$objPHPExcel->getactivesheet ()->getprotection ()->setsheet (true);

Feature X is not working with Phpexcel_reader_y/phpexcel_writer_z
Not all features of Phpexcel are implemented in all read/write classes. This is primarily due to the fact that the underlying library does not support specific features or does not perform a specific function.

For example, automatic filtering is not in Pear Spreadsheet_excel_writer, which is based on our Excel5 writers.

We are gradually building a list of features with different readers and writers to support them together in the/Documents folder in the "feature cross Reference.xls" file.
It seems that the formula does not use a Compatibility Pack to calculate in Excel2003?
This is the normal behavior of the compatibility Pack, which is shown correctly in Excel2007. Use Phpexcel_writer_excel5 If you really need to calculate a value, or recalculate in force Excel2003.
Set column width is not 100% accurate
Trying to set the column width, I ran into a problem. When I open a file in Excel, the actual width is 0.71 lower than it should be.

The short answer is that phpexcel is used, which includes measures for padding. See: "Setting column widths" for more details.
How to use Phpexcel with my frame
» Use Phpexcel with Joomla on the message board of Joomla for some instructions
» The YII Framework on the consulting page uses Phpexcel
» Bakery has certain auxiliary classes of reading and internal and cakephp writing Phpexcel
» Integrated Phpexcel to Kohana http://www.flynsarmy.com/2010/07/phpexcel-module-for-kohana-3/and Интеграцияphpexcelиkohana frames
» Using Phpexcel with TYPO3
Automatic loading of Joomla jamming Phpexcel automatic reload machine
Due to the peterrlynch for the following comments between the Phpexcel Autoloader and the Joomla automatic loading tape drive solves the problem

2.4.3. Tutorial
» English Phpexcel Tutorials
http://openxmldeveloper.org
» French Phpexcel Tutorials
http://g-ernaelsten.developpez.com/tutoriels/excel2007/
» Russian Phpexcel Blog Posts
http://www.web-junior.net/sozdanie-excel-fajjlov-s-pomoshhyu-phpexcel/
» Introducing Phpexcel http://journal.mycom.co.jp/articles/2009/03/06/phpexcel/index.html in Japanese

Phpexcel Chinese Development Manual Translation (2)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.