php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18676 Type conflict error with $word->ActiveDocument->SaveAs
Submitted: 2002-07-31 13:00 UTC Modified: 2002-08-06 05:10 UTC
From: service at netwear dot de Assigned:
Status: Closed Package: COM related
PHP Version: 4.2.2 OS: Windows 98
Private report: No CVE-ID: None
 [2002-07-31 13:00 UTC] service at netwear dot de
Hi!

I am trying to open and save a document with Word 97.
I stripped the code down the the essential.

Everything goes well until the document should be saved.

<?
$word = new COM("word.application") or die("Unable to instanciate Word");
$word->Visible = 1;
$word->Documents->Open("d:\\docs\\tutorial.doc");
$word->ActiveDocument->SaveAs("test.doc");
$word->Quit();
?>

The saveas-Function produces the following error:

PHP Warning: Invoke() failed: Typ conflict. Argument: 2 in d:\php\wordsave.php on line 5

I tried also $word->Documents[1]->SaveAs("test.doc") with the same result.

Thanks

Harald


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-05 18:18 UTC] phanto@php.net
this is from words typelib, so it might be that you are missing one or two parameters :)


[id(0x00000178), helpcontext(0x096b0178)]
        void SaveAs(
                        [in, optional] VARIANT* FileName, 
                        [in, optional] VARIANT* FileFormat, 
                        [in, optional] VARIANT* LockComments, 
                        [in, optional] VARIANT* Password, 
                        [in, optional] VARIANT* AddToRecentFiles, 
                        [in, optional] VARIANT* WritePassword, 
                        [in, optional] VARIANT* ReadOnlyRecommended, 
                        [in, optional] VARIANT* EmbedTrueTypeFonts, 
                        [in, optional] VARIANT* SaveNativePictureFormat, 
                        [in, optional] VARIANT* SaveFormsData, 
                        [in, optional] VARIANT* SaveAsAOCELetter, 
                        [in, optional] VARIANT* Encoding, 
                        [in, optional] VARIANT* InsertLineBreaks, 
                        [in, optional] VARIANT* AllowSubstitutions, 
                        [in, optional] VARIANT* LineEnding, 
                        [in, optional] VARIANT* AddBiDiMarks);


regards,
Harald
 [2002-08-06 05:10 UTC] service at netwear dot de
Hello!

No, the syntax is ok. There is much code in the net using just the same syntax. But I just discovered what is wrong: It?s a microsoft bug with Word97 with only few commands. Have a look at the knowledge base:

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q169565

The solution is to use the older bordbasic syntax instead:
$word.WordBasic.FileSaveAs("test.doc");

This bug goes to Bill and PHP is just fine :->>

regards

Harald
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 18:01:31 2024 UTC