|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 00:00:01 2025 UTC |
<?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; ?>