[PHP-users 14284] Re: Excelの書込みから表示まで

熊谷 悟 php-users@php.gr.jp
2003年 3月 25日 (火) 07:07:52 JST


いわきり様,ご指導ありがとうございます。
よく手順を理解していませんでした。
下記のコードで,とりあえずうまく動きました。

<?php
header("Content-type: application/vnd.ms-excel");
header("Content-Transfer-Encoding: base64");
header("Content-Disposition: inline;filename=test.xls");
$exapp=new COM("Excel.Application");
$exapp->DisplayAlerts ="False";
$wkb=$exapp->Workbooks->add();
$sheets=$wkb->Worksheets(1);
$cell=$sheets->Cells(1,1);
$cell->activate;
$cell->value=100;
$wkb->SaveAs("E:/web/PHP/Index_html/test/test.xls");
$wkb->Close();
$exapp->Quit();
unset($exapp);
$fd = fopen("E:/web/PHP/Index_html/test/test.xls", "rb");
echo fread($fd, filesize("E:/web/PHP/Index_html/test/test.xls"));

unlink("E:/web/PHP/Index_html/test/test.xls");
?>

ありがとうございました。




PHP-users メーリングリストの案内