|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-03-22 18:10 UTC] drmorgue at yandex dot ru
Description:
------------
On my WinXP computer with Office 2003 all work correctly, php-script (see it in
section 'test script') generates ms-excel file 1.xls. But on the computer with
windows2008server this php-script generates an error:
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b>
Microsoft Office Excel<br/><b>Description:</b> Невозможно получить свойство Save
класса Workbook' in C:\www\prj\1.php:12 Stack trace: #0 C:\www\prj\1.php(9):
variant->Save() #1 {main} thrown in C:\www\prj\1.php on line 9
My php installed as an apache handler.
How to solve it?
Test script:
---------------
$x = new COM("Excel.Application");
$x->Application->Visible = 1;
$x->Workbooks->Add();
$x->ActiveSheet->StandardWidth = 5;
$r = $x->Range("a:a");
$r->Select();
$rc = $x->Selection();
$rc->ColumnWidth = 50;
$x->Workbooks[1]->SaveAs("c:/1.xls");
$x->Quit();
$x->Release();
$x = Null;
$r = Null;
Expected result:
----------------
File 1.xls must be generated and saved into C:\
Actual result:
--------------
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b>
Microsoft Office Excel<br/><b>Description:</b> Невозможно получить свойство Save
класса Workbook' in C:\www\prj\1.php:12 Stack trace: #0 C:\www\prj\1.php(9):
variant->Save() #1 {main} thrown in C:\www\prj\1.php on line 9
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 04:00:01 2025 UTC |
Under Windows 7 Ultimate(32bit) & Office 2013's Excel & PHP 5.5.1, I got different error. (I changed save path to c:\php, since it raise write error) C:\php>php t.php PHP Fatal error: Uncaught exception 'com_exception' with message 'Error [0x80020003] メンバーが見つかりません。 ' in C:\php\t.php:12 Stack trace: #0 C:\php\t.php(12): com->Release() #1 {main} thrown in C:\php\t.php on line 12 Fatal error: Uncaught exception 'com_exception' with message 'Error [0x80020003] メンバーが見つかりません。 ("Cannot find member" in English) ' in C:\php\t.php:12 Stack trace: #0 C:\php\t.php(12): com->Release() #1 {main} thrown in C:\php\t.php on line 12This doesn't look like a PHP issue. Please try the following variant: <?php $x = new COM("Excel.Application"); $x->Application->Visible = 1; $wb = $x->Workbooks->Add(); $x->ActiveSheet->StandardWidth = 5; $r = $x->Range("a:a"); $r->Select(); $rc = $x->Selection(); $rc->ColumnWidth = 50; $wb->SaveAs("c:/1.xls"); $x->Quit(); $x->Release(); $x = Null; $r = Null; ?>