Quote class names in docs

This commit is contained in:
Adrien Crivelli 2017-12-30 19:44:32 +09:00
parent 4dd486fb94
commit c46008b2be
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
8 changed files with 80 additions and 80 deletions

View File

@ -356,9 +356,9 @@ Note that we have set the cell iterator's
`setIterateOnlyExistingCells()` to FALSE. This makes the iterator loop `setIterateOnlyExistingCells()` to FALSE. This makes the iterator loop
all cells within the worksheet range, even if they have not been set. all cells within the worksheet range, even if they have not been set.
The cell iterator will return a **NULL** as the cell value if it is not The cell iterator will return a `null` as the cell value if it is not
set in the worksheet. Setting the cell iterator's set in the worksheet. Setting the cell iterator's
setIterateOnlyExistingCells() to FALSE will loop all cells in the `setIterateOnlyExistingCells()` to `false` will loop all cells in the
worksheet that can be available at that moment. This will create new worksheet that can be available at that moment. This will create new
cells if required and increase memory usage! Only use it if it is cells if required and increase memory usage! Only use it if it is
intended to loop all cells that are possibly available. intended to loop all cells that are possibly available.
@ -433,14 +433,14 @@ while \$col != the incremented highest column.
## Using value binders to facilitate data entry ## Using value binders to facilitate data entry
Internally, PhpSpreadsheet uses a default Internally, PhpSpreadsheet uses a default
\PhpOffice\PhpSpreadsheet\Cell\IValueBinder implementation `\PhpOffice\PhpSpreadsheet\Cell\IValueBinder` implementation
(\PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder) to determine data (\PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder) to determine data
types of entered data using a cell's `setValue()` method (the types of entered data using a cell's `setValue()` method (the
`setValueExplicit()` method bypasses this check). `setValueExplicit()` method bypasses this check).
Optionally, the default behaviour of PhpSpreadsheet can be modified, Optionally, the default behaviour of PhpSpreadsheet can be modified,
allowing easier data entry. For example, a allowing easier data entry. For example, a
\PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder class is available. `\PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder` class is available.
It automatically converts percentages, number in scientific format, and It automatically converts percentages, number in scientific format, and
dates entered as strings to the correct format, also setting the cell's dates entered as strings to the correct format, also setting the cell's
style information. The following example demonstrates how to set the style information. The following example demonstrates how to set the
@ -469,6 +469,6 @@ $spreadsheet->getActiveSheet()->setCellValue('B5', '21 December 1983');
**Creating your own value binder is easy.** When advanced value binding **Creating your own value binder is easy.** When advanced value binding
is required, you can implement the is required, you can implement the
\PhpOffice\PhpSpreadsheet\Cell\IValueBinder interface or extend the `\PhpOffice\PhpSpreadsheet\Cell\IValueBinder` interface or extend the
\PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder or `\PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder` or
\PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder classes. `\PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder` classes.

View File

@ -32,8 +32,8 @@ By default, the PhpSpreadsheet package provides some readers and
writers, including one for the Open XML spreadsheet format (a.k.a. Excel 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 2007 file format). You are not limited to the default readers and
writers, as you are free to implement the writers, as you are free to implement the
\PhpOffice\PhpSpreadsheet\Reader\IReader and `\PhpOffice\PhpSpreadsheet\Reader\IReader` and
\PhpOffice\PhpSpreadsheet\Writer\IWriter interface in a custom class. `\PhpOffice\PhpSpreadsheet\Writer\IWriter` interface in a custom class.
![02-readers-writers.png](./images/02-readers-writers.png "Readers/Writers") ![02-readers-writers.png](./images/02-readers-writers.png "Readers/Writers")

View File

@ -296,7 +296,7 @@ $columnFilter->setAndOr(
``` ```
The valid set of operators for Custom Filters are defined in the The valid set of operators for Custom Filters are defined in the
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule class, and `\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule` class, and
comprise: comprise:
Operator Constant | Value Operator Constant | Value
@ -345,7 +345,7 @@ $columnFilter->createRule()
We also set the rule type to DYNAMICFILTER. We also set the rule type to DYNAMICFILTER.
The valid set of dynamic filter categories is defined in the The valid set of dynamic filter categories is defined in the
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule class, and `\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule` class, and
comprises: comprises:
Operator Constant | Value Operator Constant | Value
@ -458,7 +458,7 @@ $columnFilter->createRule()
The option values for TopTen Filters top/bottom value/percent are all The option values for TopTen Filters top/bottom value/percent are all
defined in the defined in the
\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule class, and `\PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule` class, and
comprise: comprise:
Operator Constant | Value Operator Constant | Value

View File

@ -79,7 +79,7 @@ content.
#### Formulas dont seem to be calculated in Excel2003 using compatibility pack? #### Formulas dont seem to be calculated in Excel2003 using compatibility pack?
This is normal behaviour of the compatibility pack, Xlsx displays this This is normal behaviour of the compatibility pack, Xlsx displays this
correctly. Use \PhpOffice\PhpSpreadsheet\Writer\Xls if you really need correctly. Use `\PhpOffice\PhpSpreadsheet\Writer\Xls` if you really need
calculated values, or force recalculation in Excel2003. calculated values, or force recalculation in Excel2003.
## Handling Date and Time Values ## Handling Date and Time Values
@ -107,7 +107,7 @@ where the following constants can be used for `$returnDateType`:
The method will return a Boolean True on success, False on failure (e.g. The method will return a Boolean True on success, False on failure (e.g.
if an invalid value is passed in for the return date type). if an invalid value is passed in for the return date type).
The \PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType() The `\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()`
method can be used to determine the current value of this setting: method can be used to determine the current value of this setting:
``` php ``` php
@ -146,7 +146,7 @@ base date for the Mac 1904 calendar.
It is possible for scripts to change the calendar used for calculating It is possible for scripts to change the calendar used for calculating
Excel date values by calling the Excel date values by calling the
\PhpOffice\PhpSpreadsheet\Shared\Date::setExcelCalendar() method: `\PhpOffice\PhpSpreadsheet\Shared\Date::setExcelCalendar()` method:
``` php ``` php
\PhpOffice\PhpSpreadsheet\Shared\Date::setExcelCalendar($baseDate); \PhpOffice\PhpSpreadsheet\Shared\Date::setExcelCalendar($baseDate);
@ -160,7 +160,7 @@ where the following constants can be used for `$baseDate`:
The method will return a Boolean True on success, False on failure (e.g. The method will return a Boolean True on success, False on failure (e.g.
if an invalid value is passed in). if an invalid value is passed in).
The \PhpOffice\PhpSpreadsheet\Shared\Date::getExcelCalendar() method can The `\PhpOffice\PhpSpreadsheet\Shared\Date::getExcelCalendar()` method can
be used to determine the current value of this setting: be used to determine the current value of this setting:
``` php ``` php
@ -237,7 +237,7 @@ rather than converted to Excel date timestamp values.
In addition to the `setExcelCalendar()` and `getExcelCalendar()` methods, a In addition to the `setExcelCalendar()` and `getExcelCalendar()` methods, a
number of other methods are available in the number of other methods are available in the
\PhpOffice\PhpSpreadsheet\Shared\Date class that can help when working `\PhpOffice\PhpSpreadsheet\Shared\Date` class that can help when working
with dates: with dates:
#### \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDate) #### \PhpOffice\PhpSpreadsheet\Shared\Date::excelToTimestamp($excelDate)
@ -1024,7 +1024,7 @@ February 27, 2008.
This could be a PHP timestamp value (integer), a PHP `DateTime` object, This could be a PHP timestamp value (integer), a PHP `DateTime` object,
or an Excel timestamp value (real), depending on the value of or an Excel timestamp value (real), depending on the value of
\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType(). `\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()`.
##### Examples ##### Examples
@ -1229,7 +1229,7 @@ A string, representing a date value.
This could be a PHP timestamp value (integer), a PHP `DateTime` object, This could be a PHP timestamp value (integer), a PHP `DateTime` object,
or an Excel timestamp value (real), depending on the value of or an Excel timestamp value (real), depending on the value of
\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType(). `\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()`.
##### Examples ##### Examples
@ -1351,7 +1351,7 @@ $retVal = call_user_func_array(
##### Notes ##### Notes
Note that the PhpSpreadsheet function is Note that the PhpSpreadsheet function is
\PhpOffice\PhpSpreadsheet\Calculation\Functions::DAYOFMONTH() when the `\PhpOffice\PhpSpreadsheet\Calculation\Functions::DAYOFMONTH()` when the
method is called statically. method is called statically.
#### DAYS360 #### DAYS360
@ -1479,7 +1479,7 @@ value yields a past date.
This could be a PHP timestamp value (integer), a PHP `DateTime` object, This could be a PHP timestamp value (integer), a PHP `DateTime` object,
or an Excel timestamp value (real), depending on the value of or an Excel timestamp value (real), depending on the value of
\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType(). `\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()`.
##### Examples ##### Examples
@ -1552,7 +1552,7 @@ value yields a past date.
This could be a PHP timestamp value (integer), a PHP `DateTime` object, This could be a PHP timestamp value (integer), a PHP `DateTime` object,
or an Excel timestamp value (real), depending on the value of or an Excel timestamp value (real), depending on the value of
\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType(). `\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()`.
##### Examples ##### Examples
@ -1646,7 +1646,7 @@ $retVal = call_user_func_array(
##### Notes ##### Notes
Note that the PhpSpreadsheet function is Note that the PhpSpreadsheet function is
\PhpOffice\PhpSpreadsheet\Calculation\Functions::HOUROFDAY() when the `\PhpOffice\PhpSpreadsheet\Calculation\Functions::HOUROFDAY()` when the
method is called statically. method is called statically.
#### MINUTE #### MINUTE
@ -1704,7 +1704,7 @@ $retVal = call_user_func_array(
##### Notes ##### Notes
Note that the PhpSpreadsheet function is Note that the PhpSpreadsheet function is
\PhpOffice\PhpSpreadsheet\Calculation\Functions::MINUTE() when the `\PhpOffice\PhpSpreadsheet\Calculation\Functions::MINUTE()` when the
method is called statically. method is called statically.
#### MONTH #### MONTH
@ -1757,7 +1757,7 @@ $retVal = call_user_func_array(
#### Notes #### Notes
Note that the PhpSpreadsheet function is Note that the PhpSpreadsheet function is
\PhpOffice\PhpSpreadsheet\Calculation\Functions::MONTHOFYEAR() when the `\PhpOffice\PhpSpreadsheet\Calculation\Functions::MONTHOFYEAR()` when the
method is called statically. method is called statically.
#### NETWORKDAYS #### NETWORKDAYS
@ -1830,7 +1830,7 @@ time.
This could be a PHP timestamp value (integer), a PHP `DateTime` object, This could be a PHP timestamp value (integer), a PHP `DateTime` object,
or an Excel timestamp value (real), depending on the value of or an Excel timestamp value (real), depending on the value of
\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType(). `\PhpOffice\PhpSpreadsheet\Calculation\Functions::getReturnDateType()`.
##### Examples ##### Examples
@ -1843,7 +1843,7 @@ or an Excel timestamp value (real), depending on the value of
##### Notes ##### Notes
Note that the PhpSpreadsheet function is Note that the PhpSpreadsheet function is
\PhpOffice\PhpSpreadsheet\Calculation\Functions::DATETIMENOW() when the `\PhpOffice\PhpSpreadsheet\Calculation\Functions::DATETIMENOW()` when the
method is called statically. method is called statically.
#### SECOND #### SECOND
@ -1902,7 +1902,7 @@ $retVal = call_user_func_array(
##### Notes ##### Notes
Note that the PhpSpreadsheet function is Note that the PhpSpreadsheet function is
\PhpOffice\PhpSpreadsheet\Calculation\Functions::SECOND() when the `\PhpOffice\PhpSpreadsheet\Calculation\Functions::SECOND()` when the
method is called statically. method is called statically.
#### TIME #### TIME
@ -1986,7 +1986,7 @@ $retVal = call_user_func_array(
##### Notes ##### Notes
Note that the PhpSpreadsheet function is Note that the PhpSpreadsheet function is
\PhpOffice\PhpSpreadsheet\Calculation\Functions::WEEKDAY() when the `\PhpOffice\PhpSpreadsheet\Calculation\Functions::WEEKDAY()` when the
method is called statically. method is called statically.
#### WEEKNUM #### WEEKNUM

View File

@ -4,33 +4,33 @@ As you already know from the [architecture](./architecture.md#readers-and-writer
reading and writing to a reading and writing to a
persisted storage is not possible using the base PhpSpreadsheet classes. persisted storage is not possible using the base PhpSpreadsheet classes.
For this purpose, PhpSpreadsheet provides readers and writers, which are For this purpose, PhpSpreadsheet provides readers and writers, which are
implementations of \PhpOffice\PhpSpreadsheet\Reader\IReader and implementations of `\PhpOffice\PhpSpreadsheet\Reader\IReader` and
\PhpOffice\PhpSpreadsheet\Writer\IWriter. `\PhpOffice\PhpSpreadsheet\Writer\IWriter`.
## \PhpOffice\PhpSpreadsheet\IOFactory ## \PhpOffice\PhpSpreadsheet\IOFactory
The PhpSpreadsheet API offers multiple methods to create a The PhpSpreadsheet API offers multiple methods to create a
\PhpOffice\PhpSpreadsheet\Reader\IReader or `\PhpOffice\PhpSpreadsheet\Reader\IReader` or
\PhpOffice\PhpSpreadsheet\Writer\IWriter instance: `\PhpOffice\PhpSpreadsheet\Writer\IWriter` instance:
Direct creation via \PhpOffice\PhpSpreadsheet\IOFactory. All examples Direct creation via `\PhpOffice\PhpSpreadsheet\IOFactory`. All examples
underneath demonstrate the direct creation method. Note that you can underneath demonstrate the direct creation method. Note that you can
also use the \PhpOffice\PhpSpreadsheet\IOFactory class to do this. also use the `\PhpOffice\PhpSpreadsheet\IOFactory` class to do this.
### Creating \PhpOffice\PhpSpreadsheet\Reader\IReader using \PhpOffice\PhpSpreadsheet\IOFactory ### Creating `\PhpOffice\PhpSpreadsheet\Reader\IReader` using `\PhpOffice\PhpSpreadsheet\IOFactory`
There are 2 methods for reading in a file into PhpSpreadsheet: using There are 2 methods for reading in a file into PhpSpreadsheet: using
automatic file type resolving or explicitly. automatic file type resolving or explicitly.
Automatic file type resolving checks the different Automatic file type resolving checks the different
\PhpOffice\PhpSpreadsheet\Reader\IReader distributed with `\PhpOffice\PhpSpreadsheet\Reader\IReader` distributed with
PhpSpreadsheet. If one of them can load the specified file name, the PhpSpreadsheet. If one of them can load the specified file name, the
file is loaded using that \PhpOffice\PhpSpreadsheet\Reader\IReader. file is loaded using that `\PhpOffice\PhpSpreadsheet\Reader\IReader`.
Explicit mode requires you to specify which Explicit mode requires you to specify which
\PhpOffice\PhpSpreadsheet\Reader\IReader should be used. `\PhpOffice\PhpSpreadsheet\Reader\IReader` should be used.
You can create a \PhpOffice\PhpSpreadsheet\Reader\IReader instance using You can create a `\PhpOffice\PhpSpreadsheet\Reader\IReader` instance using
\PhpOffice\PhpSpreadsheet\IOFactory in automatic file type resolving `\PhpOffice\PhpSpreadsheet\IOFactory` in automatic file type resolving
mode using the following code sample: mode using the following code sample:
``` php ``` php
@ -51,8 +51,8 @@ $reader->setReadDataOnly(true);
$reader->load("05featuredemo.xlsx"); $reader->load("05featuredemo.xlsx");
``` ```
You can create a \PhpOffice\PhpSpreadsheet\Reader\IReader instance using You can create a `\PhpOffice\PhpSpreadsheet\Reader\IReader` instance using
\PhpOffice\PhpSpreadsheet\IOFactory in explicit mode using the following `\PhpOffice\PhpSpreadsheet\IOFactory` in explicit mode using the following
code sample: code sample:
``` php ``` php
@ -63,10 +63,10 @@ $spreadsheet = $reader->load("05featuredemo.xlsx");
Note that automatic type resolving mode is slightly slower than explicit Note that automatic type resolving mode is slightly slower than explicit
mode. mode.
### Creating \PhpOffice\PhpSpreadsheet\Writer\IWriter using \PhpOffice\PhpSpreadsheet\IOFactory ### Creating `\PhpOffice\PhpSpreadsheet\Writer\IWriter` using `\PhpOffice\PhpSpreadsheet\IOFactory`
You can create a PhpOffice\PhpSpreadsheet\Writer\IWriter instance using You can create a `\PhpOffice\PhpSpreadsheet\Writer\IWriter` instance using
\PhpOffice\PhpSpreadsheet\IOFactory: `\PhpOffice\PhpSpreadsheet\IOFactory`:
``` php ``` php
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, "Xlsx"); $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, "Xlsx");
@ -116,8 +116,8 @@ $spreadsheet = $reader->load("05featuredemo.xlsx");
You can set the option setReadFilter on the reader, to instruct the You can set the option setReadFilter on the reader, to instruct the
reader to only load the cells which match a given rule. A read filter reader to only load the cells which match a given rule. A read filter
can be any class which implements can be any class which implements
\PhpOffice\PhpSpreadsheet\Reader\IReadFilter. By default, all cells are `\PhpOffice\PhpSpreadsheet\Reader\IReadFilter`. By default, all cells are
read using the \PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter. read using the `\PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter`.
The following code will only read row 1 and rows 20 30 of any sheet in The following code will only read row 1 and rows 20 30 of any sheet in
the Excel file: the Excel file:
@ -234,8 +234,8 @@ $spreadsheet = $reader->load("05featuredemo.xls");
You can set the option setReadFilter on the reader, to instruct the You can set the option setReadFilter on the reader, to instruct the
reader to only load the cells which match a given rule. A read filter reader to only load the cells which match a given rule. A read filter
can be any class which implements can be any class which implements
\PhpOffice\PhpSpreadsheet\Reader\IReadFilter. By default, all cells are `\PhpOffice\PhpSpreadsheet\Reader\IReadFilter`. By default, all cells are
read using the \PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter. read using the `\PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter`.
The following code will only read row 1 and rows 20 to 30 of any sheet The following code will only read row 1 and rows 20 to 30 of any sheet
in the Excel file: in the Excel file:
@ -293,8 +293,8 @@ $spreadsheet = $reader->load("05featuredemo.xml");
You can set the option setReadFilter on the reader, to instruct the You can set the option setReadFilter on the reader, to instruct the
reader to only load the cells which match a given rule. A read filter reader to only load the cells which match a given rule. A read filter
can be any class which implements can be any class which implements
\PhpOffice\PhpSpreadsheet\Reader\IReadFilter. By default, all cells are `\PhpOffice\PhpSpreadsheet\Reader\IReadFilter`. By default, all cells are
read using the \PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter. read using the `\PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter`.
The following code will only read row 1 and rows 20 to 30 of any sheet The following code will only read row 1 and rows 20 to 30 of any sheet
in the Excel file: in the Excel file:
@ -344,8 +344,8 @@ $spreadsheet = $reader->load("05featuredemo.slk");
You can set the option setReadFilter on the reader, to instruct the You can set the option setReadFilter on the reader, to instruct the
reader to only load the cells which match a given rule. A read filter reader to only load the cells which match a given rule. A read filter
can be any class which implements can be any class which implements
\PhpOffice\PhpSpreadsheet\Reader\IReadFilter. By default, all cells are `\PhpOffice\PhpSpreadsheet\Reader\IReadFilter`. By default, all cells are
read using the \PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter. read using the `\PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter`.
The following code will only read row 1 and rows 20 to 30 of any sheet The following code will only read row 1 and rows 20 to 30 of any sheet
in the SYLK file: in the SYLK file:
@ -389,8 +389,8 @@ $spreadsheet = $reader->load("05featuredemo.ods");
You can set the option setReadFilter on the reader, to instruct the You can set the option setReadFilter on the reader, to instruct the
reader to only load the cells which match a given rule. A read filter reader to only load the cells which match a given rule. A read filter
can be any class which implements can be any class which implements
\PhpOffice\PhpSpreadsheet\Reader\IReadFilter. By default, all cells are `\PhpOffice\PhpSpreadsheet\Reader\IReadFilter`. By default, all cells are
read using the \PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter. read using the `\PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter`.
The following code will only read row 1 and rows 20 to 30 of any sheet The following code will only read row 1 and rows 20 to 30 of any sheet
in the Calc file: in the Calc file:
@ -437,14 +437,14 @@ $spreadsheet = $reader->load("sample.csv");
Often, CSV files are not really "comma separated", or use semicolon (`;`) Often, CSV files are not really "comma separated", or use semicolon (`;`)
as a separator. You can instruct as a separator. You can instruct
\PhpOffice\PhpSpreadsheet\Reader\Csv some options before reading a CSV `\PhpOffice\PhpSpreadsheet\Reader\Csv` some options before reading a CSV
file. file.
The separator will be auto-detected, so in most cases it should not be necessary The separator will be auto-detected, so in most cases it should not be necessary
to specify it. But in cases where auto-detection does not fit the use-case, then to specify it. But in cases where auto-detection does not fit the use-case, then
it can be set manually. it can be set manually.
Note that \PhpOffice\PhpSpreadsheet\Reader\Csv by default assumes that Note that `\PhpOffice\PhpSpreadsheet\Reader\Csv` by default assumes that
the loaded CSV file is UTF-8 encoded. If you are reading CSV files that the loaded CSV file is UTF-8 encoded. If you are reading CSV files that
were created in Microsoft Office Excel the correct input encoding may were created in Microsoft Office Excel the correct input encoding may
rather be Windows-1252 (CP1252). Always make sure that the input rather be Windows-1252 (CP1252). Always make sure that the input
@ -500,7 +500,7 @@ $writer->save("05featuredemo.csv");
Often, CSV files are not really "comma separated", or use semicolon (`;`) Often, CSV files are not really "comma separated", or use semicolon (`;`)
as a separator. You can instruct as a separator. You can instruct
\PhpOffice\PhpSpreadsheet\Writer\Csv some options before writing a CSV `\PhpOffice\PhpSpreadsheet\Writer\Csv` some options before writing a CSV
file: file:
``` php ``` php
@ -600,7 +600,7 @@ and does not yet support merged cells or nested tables cleanly
### \PhpOffice\PhpSpreadsheet\Writer\Html ### \PhpOffice\PhpSpreadsheet\Writer\Html
Please note that \PhpOffice\PhpSpreadsheet\Writer\Html only outputs the Please note that `\PhpOffice\PhpSpreadsheet\Writer\Html` only outputs the
first worksheet by default. first worksheet by default.
#### Writing a spreadsheet #### Writing a spreadsheet
@ -723,7 +723,7 @@ $writer->save("05featuredemo.htm");
#### Decimal and thousands separators #### Decimal and thousands separators
See section \PhpOffice\PhpSpreadsheet\Writer\Csv how to control the See section `\PhpOffice\PhpSpreadsheet\Writer\Csv` how to control the
appearance of these. appearance of these.
## PDF ## PDF
@ -849,7 +849,7 @@ $writer->save("05featuredemo.pdf");
#### Decimal and thousands separators #### Decimal and thousands separators
See section \PhpOffice\PhpSpreadsheet\Writer\Csv how to control the See section `\PhpOffice\PhpSpreadsheet\Writer\Csv` how to control the
appearance of these. appearance of these.
## Generating Excel files from templates (read, modify, write) ## Generating Excel files from templates (read, modify, write)

View File

@ -100,9 +100,9 @@ $spreadsheet = $reader->load($inputFileName);
See `samples/Reader/03_Simple_file_reader_using_the_IOFactory_to_return_a_reader.php` See `samples/Reader/03_Simple_file_reader_using_the_IOFactory_to_return_a_reader.php`
for a working example of this code. for a working example of this code.
If you're uncertain of the filetype, you can use the IO Factory's If you're uncertain of the filetype, you can use the `IOFactory::identify()`
identify() method to identify the reader that you need, before using the method to identify the reader that you need, before using the
createReader() method to instantiate the reader object. `createReader()` method to instantiate the reader object.
``` php ``` php
$inputFileName = './sampleData/example1.xls'; $inputFileName = './sampleData/example1.xls';
@ -129,7 +129,7 @@ executing the `load()` method.
If you're only interested in the cell values in a workbook, but don't If you're only interested in the cell values in a workbook, but don't
need any of the cell formatting information, then you can set the reader need any of the cell formatting information, then you can set the reader
to read only the data values and any formulae from each cell using the to read only the data values and any formulae from each cell using the
setReadDataOnly() method. `setReadDataOnly()` method.
``` php ``` php
$inputFileType = 'Xls'; $inputFileType = 'Xls';
@ -170,7 +170,7 @@ CSV | NO | HTML | NO
If your workbook contains a number of worksheets, but you are only If your workbook contains a number of worksheets, but you are only
interested in reading some of those, then you can use the interested in reading some of those, then you can use the
setLoadSheetsOnly() method to identify those sheets you are interested `setLoadSheetsOnly()` method to identify those sheets you are interested
in reading. in reading.
To read a single sheet, you can pass that sheet name as a parameter to To read a single sheet, you can pass that sheet name as a parameter to
@ -242,8 +242,8 @@ CSV | NO | HTML | NO
If you are only interested in reading part of a worksheet, then you can If you are only interested in reading part of a worksheet, then you can
write a filter class that identifies whether or not individual cells write a filter class that identifies whether or not individual cells
should be read by the loader. A read filter must implement the should be read by the loader. A read filter must implement the
\PhpOffice\PhpSpreadsheet\Reader\IReadFilter interface, and contain a `\PhpOffice\PhpSpreadsheet\Reader\IReadFilter` interface, and contain a
readCell() method that accepts arguments of `$column`, `$row` and `readCell()` method that accepts arguments of `$column`, `$row` and
`$worksheetName`, and return a boolean true or false that indicates `$worksheetName`, and return a boolean true or false that indicates
whether a workbook cell identified by those arguments should be read or whether a workbook cell identified by those arguments should be read or
not. not.
@ -444,7 +444,7 @@ Xlsx | NO | Xls | NO | Xml | NO |
Ods | NO | SYLK | YES | Gnumeric | NO | Ods | NO | SYLK | YES | Gnumeric | NO |
CSV | YES | HTML | NO CSV | YES | HTML | NO
### Combining Read Filters with the setSheetIndex() method to split a large CSV file across multiple Worksheets ### Combining Read Filters with the `setSheetIndex()` method to split a large CSV file across multiple Worksheets
An Xls BIFF .xls file is limited to 65536 rows in a worksheet, while the An Xls BIFF .xls file is limited to 65536 rows in a worksheet, while the
Xlsx Microsoft Office Open XML SpreadsheetML .xlsx file is limited to Xlsx Microsoft Office Open XML SpreadsheetML .xlsx file is limited to
@ -624,7 +624,7 @@ any problems that are encountered, and deal with them in an appropriate
manner. manner.
The PhpSpreadsheet Readers throw a The PhpSpreadsheet Readers throw a
\PhpOffice\PhpSpreadsheet\Reader\Exception. `\PhpOffice\PhpSpreadsheet\Reader\Exception`.
``` php ``` php
$inputFileName = './sampleData/example-1.xls'; $inputFileName = './sampleData/example-1.xls';

View File

@ -96,10 +96,10 @@ $spreadsheet->getActiveSheet()->getStyle('D1')
``` ```
The above methods for entering a date all yield the same result. The above methods for entering a date all yield the same result.
\PhpOffice\PhpSpreadsheet\Style\NumberFormat provides a lot of `\PhpOffice\PhpSpreadsheet\Style\NumberFormat` provides a lot of
pre-defined date formats. pre-defined date formats.
The \PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel() method will also The `\PhpOffice\PhpSpreadsheet\Shared\Date::PHPToExcel()` method will also
work with a PHP DateTime object. work with a PHP DateTime object.
Similarly, times (or date and time values) can be entered in the same Similarly, times (or date and time values) can be entered in the same
@ -333,7 +333,7 @@ As you can see, it is not necessary to call setFitToPage(TRUE) since
setFitToWidth(...) and setFitToHeight(...) triggers this. setFitToWidth(...) and setFitToHeight(...) triggers this.
If you use `setFitToWidth()` you should in general also specify If you use `setFitToWidth()` you should in general also specify
setFitToHeight() explicitly like in the example. Be careful relying on `setFitToHeight()` explicitly like in the example. Be careful relying on
the initial values. the initial values.
### Page margins ### Page margins
@ -1197,7 +1197,7 @@ $spreadsheet->getActiveSheet()->insertNewRowBefore(7, 2);
A drawing is always represented as a separate object, which can be added A drawing is always represented as a separate object, which can be added
to a worksheet. Therefore, you must first instantiate a new to a worksheet. Therefore, you must first instantiate a new
\PhpOffice\PhpSpreadsheet\Worksheet\Drawing, and assign its properties a `\PhpOffice\PhpSpreadsheet\Worksheet\Drawing`, and assign its properties a
meaningful value: meaningful value:
``` php ``` php
@ -1299,7 +1299,7 @@ foreach ($spreadsheet->getActiveSheet()->getDrawingCollection() as $drawing) {
## Add rich text to a cell ## Add rich text to a cell
Adding rich text to a cell can be done using Adding rich text to a cell can be done using
\PhpOffice\PhpSpreadsheet\RichText instances. Here''s an example, which `\PhpOffice\PhpSpreadsheet\RichText` instances. Here''s an example, which
creates the following rich text string: creates the following rich text string:
> This invoice is ***payable within thirty days after the end of the > This invoice is ***payable within thirty days after the end of the
@ -1346,10 +1346,10 @@ steps that can be followed to do this:
1. Create your PhpSpreadsheet spreadsheet 1. Create your PhpSpreadsheet spreadsheet
2. Output HTTP headers for the type of document you wish to output 2. Output HTTP headers for the type of document you wish to output
3. Use the \PhpOffice\PhpSpreadsheet\Writer\* of your choice, and save 3. Use the `\PhpOffice\PhpSpreadsheet\Writer\*` of your choice, and save
to "php://output" to "php://output"
\PhpOffice\PhpSpreadsheet\Writer\Xlsx uses temporary storage when `\PhpOffice\PhpSpreadsheet\Writer\Xlsx` uses temporary storage when
writing to php://output. By default, temporary files are stored in the writing to php://output. By default, temporary files are stored in the
script's working directory. When there is no access, it falls back to script's working directory. When there is no access, it falls back to
the operating system's temporary files location. the operating system's temporary files location.
@ -1472,7 +1472,7 @@ $worksheet1 = $spreadsheet->createSheet();
$worksheet1->setTitle('Another sheet'); $worksheet1->setTitle('Another sheet');
``` ```
Think of createSheet() as the "Insert sheet" button in Excel. When you Think of `createSheet()` as the "Insert sheet" button in Excel. When you
hit that button a new sheet is appended to the existing collection of hit that button a new sheet is appended to the existing collection of
worksheets in the workbook. worksheets in the workbook.

View File

@ -76,7 +76,7 @@ guarantee that the title is unique.
Alternatively, you can instantiate a new worksheet (setting the title to Alternatively, you can instantiate a new worksheet (setting the title to
whatever you choose) and then insert it into your workbook using the whatever you choose) and then insert it into your workbook using the
addSheet() method. `addSheet()` method.
``` php ``` php
// Create a new worksheet called "My Data" // Create a new worksheet called "My Data"