代碼
<?php
$workbook = "E:\\php\\htdocs\\Excel\\test.xls";
$sheet = "sheet1";
$ex = new com("Excel.sheet") or die ("鏈接錯誤");
$book = $ex->application->workbooks->open($workbook) or die ("鏈接錯誤");
$sheets = $book->worksheets($sheet);
$sheets->activate;
$cell = $sheets->cells(5,5);
$cell->activate;
$cell->value = 999;
$ex->application->activeworkbook->close("false");
unset ($ex);
?>報錯
Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `Excel.sheet': 存放裝置空間不足,無法完成此操作。 ' in E:\php\htdocs\Excel\Index.php:5 Stack trace: #0 E:\php\htdocs\Excel\Index.php(5): com->com('Excel.sheet') #1 {main} thrown in E:\php\htdocs\Excel\Index.php on line 5謝謝
<?php
$workbook = "E:\\php\\htdocs\\Excel\\test.xls";
$sheet = "sheet1";
$ex = new com("Excel.sheet") or die ("鏈接錯誤");
$book = $ex->application->workbooks->open($workbook) or die ("鏈接錯誤");
$sheets = $book->worksheets($sheet);
$sheets->activate;
$cell = $sheets->cells(5,5);
$cell->activate;
$cell->value = 999;
$ex->application->activeworkbook->close("false");
unset ($ex);
?>報錯
Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `Excel.sheet': 存放裝置空間不足,無法完成此操作。 ' in E:\php\htdocs\Excel\Index.php:5 Stack trace: #0 E:\php\htdocs\Excel\Index.php(5): com->com('Excel.sheet') #1 {main} thrown in E:\php\htdocs\Excel\Index.php on line 5謝謝
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货