ID: 34826
User updated by: george dot pitcher at ingenta dot com
Reported By: george dot pitcher at ingenta dot com
-Status: Feedback
+Status: Open
Bug Type: COM related
Operating System: Windows XP
PHP Version: 5.1.0RC1
New Comment:
<?php
$word = new COM("word.application") or die("Unable to instantiate
Word");
$word->Visible = 1;
$word->Documents->Add();
$word->Selection->PageSetup->TopMargin=28;
$word->Selection->PageSetup->LeftMargin=28;
$word->Selection->PageSetup->RightMargin=28;
$word->Selection->PageSetup->BottomMargin=28;
$logo = "C:\\inetpub\\wwwroot\\testsite\\images\\logo.jpg";
try {
$word->Selection->InlineShapes->AddPicture->FileName($logo,0,1);
} catch (com_exception $e) {
print_r($e); // or do some better error handling
}
$word->Documents[1]->SaveAs("C:\\Useless test2.doc");
$word->Quit();
$word = null;
?>
Previous Comments:
------------------------------------------------------------------------
[2005-10-11 13:38:54] [EMAIL PROTECTED]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc.
If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2005-10-11 13:26:02] george dot pitcher at ingenta dot com
Description:
------------
Building a Word document with COM works fine except where more than one
parameter is required. Code generates the following error:
Loaded Word, version 9.0 com_exception Object ( [message:protected] =>
Error [0x8002000e] Invalid number of parameters. [string:private] =>
[code:protected] => -2147352562 [file:protected] =>
C:\Inetpub\wwwroot\testsite\word_test.php [line:protected] => 19
[trace:private] => Array ( [0] => Array ( [file] =>
C:\Inetpub\wwwroot\testsite\word_test.php [line] => 19 [function] =>
unknown ) ) )
Reproduce code:
---------------
$logo = "_pathtofile_\\logo.jpg"
try {
$word->Selection->InlineShapes->AddPicture->FileName($logo,0,1);
} catch (com_exception $e) {
print_r($e); // or do some better error handling
}
Expected result:
----------------
an image loded into the Word document, not linked but saved with the
file
Actual result:
--------------
No image at all
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34826&edit=1