2016-12-03 13:16:45 +00:00
|
|
|
# Frequently asked questions
|
|
|
|
|
|
|
|
## There seems to be a problem with character encoding...
|
|
|
|
|
2016-12-03 15:00:54 +00:00
|
|
|
It is necessary to use UTF-8 encoding for all texts in PhpSpreadsheet.
|
|
|
|
If the script uses different encoding then you can convert those texts
|
2017-03-13 05:57:37 +00:00
|
|
|
with PHP's `iconv()` or `mb_convert_encoding()` functions.
|
2016-12-03 13:16:45 +00:00
|
|
|
|
|
|
|
## Fatal error: Allowed memory size of xxx bytes exhausted (tried to allocate yyy bytes) in zzz on line aaa
|
|
|
|
|
2016-12-03 15:00:54 +00:00
|
|
|
PhpSpreadsheet holds an "in memory" representation of a spreadsheet, so
|
|
|
|
it is susceptible to PHP's memory limitations. The memory made available
|
2017-03-13 05:57:37 +00:00
|
|
|
to PHP can be increased by editing the value of the `memory_limit`
|
2017-12-30 10:07:22 +00:00
|
|
|
directive in your `php.ini` file, or by using
|
2017-03-13 05:57:37 +00:00
|
|
|
`ini_set('memory_limit', '128M')` within your code.
|
2016-12-03 15:00:54 +00:00
|
|
|
|
|
|
|
Some Readers and Writers are faster than others, and they also use
|
2017-12-30 10:07:22 +00:00
|
|
|
differing amounts of memory.
|
2016-12-03 13:16:45 +00:00
|
|
|
|
|
|
|
## Protection on my worksheet is not working?
|
|
|
|
|
2016-12-03 15:00:54 +00:00
|
|
|
When you make use of any of the worksheet protection features (e.g. cell
|
|
|
|
range protection, prohibiting deleting rows, ...), make sure you enable
|
|
|
|
worksheet security. This can for example be done like this:
|
2016-12-03 13:16:45 +00:00
|
|
|
|
2020-05-31 13:41:05 +00:00
|
|
|
```php
|
2016-12-03 13:16:45 +00:00
|
|
|
$spreadsheet->getActiveSheet()->getProtection()->setSheet(true);
|
|
|
|
```
|
|
|
|
|
2016-12-03 15:00:54 +00:00
|
|
|
## Feature X is not working with Reader\_Y / Writer\_Z
|
2016-12-03 13:16:45 +00:00
|
|
|
|
2016-12-03 15:00:54 +00:00
|
|
|
Not all features of PhpSpreadsheet are implemented in all of the Reader
|
|
|
|
/ Writer classes. This is mostly due to underlying libraries not
|
|
|
|
supporting a specific feature or not having implemented a specific
|
|
|
|
feature.
|
2016-12-03 13:16:45 +00:00
|
|
|
|
2016-12-03 15:00:54 +00:00
|
|
|
For example autofilter is not implemented in PEAR
|
|
|
|
Spreadsheet\_Excel\_writer, which is the base of our Xls writer.
|
2016-12-03 13:16:45 +00:00
|
|
|
|
2016-12-03 15:00:54 +00:00
|
|
|
We are slowly building up a list of features, together with the
|
2017-02-14 14:15:28 +00:00
|
|
|
different readers and writers that support them, in the [features cross
|
|
|
|
reference](./references/features-cross-reference.md).
|
2016-12-03 13:16:45 +00:00
|
|
|
|
|
|
|
## Formulas don't seem to be calculated in Excel2003 using compatibility pack?
|
|
|
|
|
2017-03-13 05:57:37 +00:00
|
|
|
This is normal behaviour of the compatibility pack, `Xlsx` displays this
|
|
|
|
correctly. Use `\PhpOffice\PhpSpreadsheet\Writer\Xls` if you really need
|
2016-12-03 15:00:54 +00:00
|
|
|
calculated values, or force recalculation in Excel2003.
|
2016-12-03 13:16:45 +00:00
|
|
|
|
|
|
|
## Setting column width is not 100% accurate
|
|
|
|
|
2016-12-03 15:00:54 +00:00
|
|
|
Trying to set column width, I experience one problem. When I open the
|
|
|
|
file in Excel, the actual width is 0.71 less than it should be.
|
2016-12-03 13:16:45 +00:00
|
|
|
|
2016-12-03 15:00:54 +00:00
|
|
|
The short answer is that PhpSpreadsheet uses a measure where padding is
|
2017-12-19 06:18:36 +00:00
|
|
|
included. See [how to set a column's width](./topics/recipes.md#setting-a-columns-width)
|
2017-03-13 05:57:37 +00:00
|
|
|
for more details.
|