Laravel-excel: csvから引用を削除

作成日 2015年05月22日  ·  3コメント  ·  ソース: Maatwebsite/Laravel-Excel

みなさん、こんにちは。エクスポートされたCSVファイルを取得しましたが、すべてのセルデータに引用符があります。CSVにエクスポートするときに引用符を削除するのを手伝ってもらえますか? ここに例があります:
"20150521"、 "62549"、 "2492"、 ""、 "16.52"、 "1.98"、 "0"、 "0"、 "0"、 ""、 "922330816001"、 ""、 ""、 "P "、" "、" 2492 "
"20150521"、 "71343"、 "2493"、 ""、 "8.26"、 "0.99"、 "0"、 "0"、 "0"、 ""、 "922330816001"、 ""、 ""、 "P "、" "、" 2493 "
これ欲しい..
20150521,62549,2492、、16.52,1.98,0,0,0、、922330816001 ,,, P ,, 2492
20150521,71343,2493、、8.26,0.99,0,0,0、、922330816001 ,,, P ,, 2493
ありがとう

これが私のコードです:

//generating .csv
$csv = Excel::create($conciliacion->nombre, function($excel){
            $excel->sheet('Lista', function($sheet) {
                $empresa = Empresa::find(1);
                $conciliacion = Session::get('conciliacion');
                Session::forget('conciliacion');
                $fecha_conciliacion = $conciliacion->fecha;

                $i = 1;
                $ordenes = Orden::whereBetween('fecha_emision', array($fecha_conciliacion.' 00:00', $fecha_conciliacion.' 23:59'))->get();
                var_dump($ordenes);
                foreach($ordenes as $o){
                    $sheet->row($i, array(
                        (int)date("Ymd", strtotime($o->fecha_emision)),
                        (int)date("His", strtotime($o->fecha_emision)),
                        (int)$o->numero_orden,
                        (int)$o->tipo_tarjeta,
                        (float)number_format(($o->subtotal_12+$o->subtotal_0), 2),
                        (float)number_format($o->iva, 2),
                        (float)'0.00',
                        (float)number_format($o->intereses/100, 2),
                        (float)number_format($o->total_intereses/100, 2),
                        (int)$o->numero_autorizacion,
                        (int)$empresa->ruc,
                        (int)$o->tipo_credito,
                        (int)$o->meses_credito,
                        'P',
                        '',
                        (int)$o->numero_orden,
                    ));
                    $i++;
                }
            });
        })->export('csv');

最も参考になるコメント

構成のenclosure設定を変更する必要があります: https

全てのコメント3件

構成のenclosure設定を変更する必要があります: https

すばらしい、Laravelでは、設定ファイルは次のとおりです。../ vendor / maatwebsite / excel / src / config /csv.phpありがとうございます。
構成に関する詳細なドキュメントが必要になります。 とにかくまたありがとう。

Laravel4の場合はそうです。 私が挙げた例は、configを処理する方法が異なるLaravel5の場合です。

このページは役に立ちましたか?
0 / 5 - 0 評価