ファイルを開くときにタブ区切り文字を要求せずに XLS ファイルを作成する、以下のような軽量な方法はありますか?
$list = array (
array('Cell A1', 'Cell A2'),
array('Cell B1', 'Cell B2'),
);
$fp = fopen('file.xls', 'w');
foreach ($list as $fields) {
fputcsv($fp, $fields);
}
fclose($fp);
Solution #1
Save you data in an "XML Spreadsheet".
Since Microsoft Excel version 2002 and higher, you can open and save Excel documents in the "XML Spreadsheet" format. Those files are Excel documents saved with an XML source instead of a binary source. Such Excel documents saved in XML enable nearly all worksheets features (makeup, formats, formulas) but Graphics and Visual Basic Macros are not supported (all differences are documented here).
Solution #2
Use OpenTBS to easily build an XLSX file. OpenTBS is a small PHP tool that can easily build an XLSX file using the technique of templates. OpenTBS templates can be entirely designed with Ms Excel.