親愛なるみんな
私はPHPの初心者で、英語が苦手です。
私はコントローラーを持っています
function download($id)
{
$file_name = 'report1';
$fieldnames ='Tanggal,Bulan,Block,Afdeling,Jumlah Panen Terakhir';
$query = $this->main_model->get_report($id);
to_excel($query,$file_name,$fieldnames,$judul);
}
これは私のリンク/アンカーです
anchor("report/report/download/$id",'download', array('class' => 'excel'))
これは私のヘルパーです
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
function to_excel($query, $filename='exceloutput', $fieldnames)
{
$columnnames = explode(",", $fieldnames); //better looking column names instead
$headers = ''; // just creating the var for field headers to append to below
$data = ''; // just creating the var for field data to append to below
$obj =& get_instance();
$fields = $query->field_data();
if ($query->num_rows() == 0) {
echo '<p>The table appears to have no data.</p>';
} else {
$i = 0;
foreach ($fields as $field) {
$headers .= $columnnames[$i]."\t";
$i++;
}
foreach ($query->result() as $row) {
$line = '';
foreach($row as $value) {
if ((!isset($value)) OR ($value == "")) {
$value = "\t";
} else {
$value = str_replace('"', '""', $value);
$value = '"' . $value . '"' . "\t";
}
$value = utf8_decode($value);
$line .= $value;
}
$data .= trim($line)."\n";
}
$data = str_replace("\r","",$data);
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=$filename.xls");
echo "$headers\n$data";
}
} ?>
これが私の出力です
そして質問は
「tanggal」mysql タイプはタイムスタンプですが、ドラッグしてセルのサイズを変更すると、値は次のように表示されます
では、to_excel_helper で大きなセルを設定する方法は?
タイトルとボーダーを設定する方法は?
だからこうなる
ご清聴ありがとうございました
この部分は1週間前から私をストレスにさせます
だから私はあなたの助けが必要です