Update reading-and-writing-to-file.md

This commit is contained in:
Akira Taniguchi 2021-04-06 01:22:22 +09:00 committed by GitHub
parent 0bb625bc68
commit e13fcf27fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -580,6 +580,18 @@ $writer->setUseBOM(true);
$writer->save("05featuredemo.csv"); $writer->save("05featuredemo.csv");
``` ```
#### Writeing CSV files with desired encoding
It can be set to output with the encoding that can be specified by PHP's mb_convert_encoding.
This looks like the following code:
```php
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Csv($spreadsheet);
$writer->setUseBOM(false);
$writer->setOutputEncoding('SJIS-WIN');
$writer->save("05featuredemo.csv");
```
#### Decimal and thousands separators #### Decimal and thousands separators
If the worksheet you are exporting contains numbers with decimal or If the worksheet you are exporting contains numbers with decimal or