You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.md 3.1 KiB

4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. # Welcome to PhpSpreadsheet's documentation
  2. ![Logo](./assets/logo.svg)
  3. PhpSpreadsheet is a library written in pure PHP and providing a set of
  4. classes that allow you to read from and to write to different
  5. spreadsheet file formats, like Excel and LibreOffice Calc.
  6. ## File formats supported
  7. |Format |Reading|Writing|
  8. |--------------------------------------------|:-----:|:-----:|
  9. |Open Document Format/OASIS (.ods) | ✓ | ✓ |
  10. |Office Open XML (.xlsx) Excel 2007 and above| ✓ | ✓ |
  11. |BIFF 8 (.xls) Excel 97 and above | ✓ | ✓ |
  12. |BIFF 5 (.xls) Excel 95 | ✓ | |
  13. |SpreadsheetML (.xml) Excel 2003 | ✓ | |
  14. |Gnumeric | ✓ | |
  15. |HTML | ✓ | ✓ |
  16. |SYLK | ✓ | |
  17. |CSV | ✓ | ✓ |
  18. |PDF (using either the TCPDF, Dompdf or mPDF libraries, which need to be installed separately)| | ✓ |
  19. # Getting started
  20. ## Software requirements
  21. PHP version 7.1 or newer to develop using PhpSpreadsheet. Other requirements, such as PHP extensions, are enforced by
  22. composer. See the `require` section of [the composer.json file](https://github.com/PHPOffice/PhpSpreadsheet/blob/master/composer.json)
  23. for details.
  24. ### PHP version support
  25. Support for PHP versions will only be maintained for a period of six months beyond the end-of-life of that PHP version
  26. ## Installation
  27. Use [composer](https://getcomposer.org) to install PhpSpreadsheet into your project:
  28. ```sh
  29. composer require phpoffice/phpspreadsheet
  30. ```
  31. ## Hello World
  32. This would be the simplest way to write a spreadsheet:
  33. ```php
  34. <?php
  35. require 'vendor/autoload.php';
  36. use PhpOffice\PhpSpreadsheet\Spreadsheet;
  37. use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
  38. $spreadsheet = new Spreadsheet();
  39. $sheet = $spreadsheet->getActiveSheet();
  40. $sheet->setCellValue('A1', 'Hello World !');
  41. $writer = new Xlsx($spreadsheet);
  42. $writer->save('hello world.xlsx');
  43. ```
  44. ## Learn by example
  45. A good way to get started is to run some of the samples. Serve the samples via
  46. PHP built-in webserver:
  47. ```sh
  48. php -S localhost:8000 -t vendor/phpoffice/phpspreadsheet/samples
  49. ```
  50. Then point your browser to:
  51. > http://localhost:8000/
  52. The samples may also be run directly from the command line, for example:
  53. ```sh
  54. php vendor/phpoffice/phpspreadsheet/samples/Basic/01_Simple.php
  55. ```
  56. ## Learn by documentation
  57. For more in-depth documentation, you may read about an [overview of the
  58. architecture](./topics/architecture.md),
  59. [creating a spreadsheet](./topics/creating-spreadsheet.md),
  60. [worksheets](./topics/worksheets.md),
  61. [accessing cells](./topics/accessing-cells.md) and
  62. [reading and writing to files](./topics/reading-and-writing-to-file.md).
  63. Or browse the [API documentation](https://phpoffice.github.io/PhpSpreadsheet).
  64. # Credits
  65. Please refer to the [contributor
  66. list](https://github.com/PHPOffice/PhpSpreadsheet/graphs/contributors)
  67. for up-to-date credits.