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