php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34826 multiple parameters not being passed
Submitted: 2005-10-11 13:26 UTC Modified: 2005-10-11 16:25 UTC
From: george dot pitcher at ingenta dot com Assigned: wez (profile)
Status: Not a bug Package: COM related
PHP Version: 5.1.0RC1 OS: Windows XP
Private report: No CVE-ID: None
 [2005-10-11 13:26 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-11 13:38 UTC] tony2001@php.net
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 14:18 UTC] george dot pitcher at ingenta dot com
<?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;
?>
 [2005-10-11 14:22 UTC] tony2001@php.net
Assigned to the maintainer.
 [2005-10-11 16:22 UTC] george dot pitcher at ingenta dot com
Problem solved. I was including a property name as part of the object. Once that was removed, it worked fine. So no bug after all. Just me being stupid.
 [2005-10-11 16:25 UTC] tony2001@php.net
Marked as bogus by user request.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sun Nov 27 16:05:53 2022 UTC