PhpSpreadsheet/samples
oleibman 7517cdd008
Improve Coverage for CSV (#1475)
I believe that both CSV Reader and Writer are 100% covered now.

There were some errors uncovered during development.

The reader specifically permits encodings other than UTF-8 to be used.
However, fgetcsv will not properly handle other encodings.
I tried replacing it with fgets/iconv/strgetcsv, but that could not
handle line breaks within a cell, even for UTF-8.
This is, I'm sure, a very rare use case.
I eventually handled it by using php://memory to hold the translated
file contents for non-UTF8. There were no tests for this situation,
and now there are (probably too many).

"Contiguous" read was not handle correctly. There is a file
in samples which uses it. It was designed to read a large sheet,
and split it into three. The first sheet was corrrect, but the
second and third were almost entirely empty. This has been corrected,
and the sample code was adapted into a formal test with assertions
to confirm that it works as designed.

I made a minor documentation change. Unlike HTML, where you never
need a BOM because you can declare the encoding in the file,
a CSV with non-ASCII characters must explicitly include a BOM
for Excel to handle it correctly. This was explained in the Reading CSV
section, but was glossed over in the Writing CSV section, which I
have updated.
2020-05-17 18:15:18 +09:00
..
Autofilter Scrutiniser recommendations (#1004) 2019-06-10 17:59:44 +02:00
Basic Improve Coverage for CSV (#1475) 2020-05-17 18:15:18 +09:00
Calculations Merge all examples together 2017-10-01 17:48:59 +09:00
Chart Custom color for pie and donut charts 2018-12-10 18:43:55 +11:00
Pdf Simplify IOFactory to rely on autoloading 2017-10-22 01:54:14 +09:00
Reader String value binder (#901) 2019-02-23 18:40:07 +01:00
Reading_workbook_data Upgrade to latest PHP_CodeSniffer 2018-08-06 11:02:16 +09:00
bootstrap Reorganize code samples 2016-09-01 01:17:13 +09:00
images Add missing sample image 2016-11-28 00:53:19 +09:00
templates Prefer https:// URLs when available in docs & comments 2018-10-28 13:55:00 +11:00
Header.php Drop unused code and fix some PhpStorm warnings 2017-10-08 01:21:32 +09:00
index.php Drop PHP 7.1 2020-04-27 18:42:32 +09:00