php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9141 cannot call a COM function opening a word appli
Submitted: 2001-02-07 00:15 UTC Modified: 2001-02-09 07:22 UTC
From: shashank dot kadge at trigyn dot com Assigned:
Status: Closed Package: COM related
PHP Version: 4.0.3pl1 OS: windows NT
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: shashank dot kadge at trigyn dot com
New email:
PHP Version: OS:

 

 [2001-02-07 00:15 UTC] shashank dot kadge at trigyn dot com
This is the COM function being called from PHP.


Public Function setFile(filename as String)
    Set wproc = CreateObject("Word.Application")
    wproc.Visible = False
    wproc.Documents.Open (filename)
    str1 = Mid(filename, 1, Len(filename) - 3) & "txt"
    wproc.ActiveDocument.SaveAs str1, wdFormatText
    wproc.Quit
End Function

The error message popped is Invoke failed exception in the line where function is called.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-07 07:28 UTC] phanto@php.net
could you paste your php code and not this vb crap.

harald.
 [2001-02-08 04:28 UTC] shashank dot kadge at trigyn dot com
<?php

// get a web page into an array .

$Obj = new com('prjWord.clsWord'); 
echo "Loaded {$Obj}";
echo "<br>";
$Obj->filename1 = 'C:\shanky2.doc';
$Obj->setFile();

?>

shanky2.doc is the file to be read.

And this is the function in the Com component which gives error, otherwise other normal fuctions work properly. 


Public Function setFile(filename as String)
    Set wproc = CreateObject("Word.Application")
    wproc.Visible = False
    wproc.Documents.Open (filename)
    str1 = Mid(filename, 1, Len(filename) - 3) & "txt"
    wproc.ActiveDocument.SaveAs str1, wdFormatText
    wproc.Quit
End Function


 [2001-02-08 10:13 UTC] phanto@php.net
i can't follow you, you're calling a function that requires a parameter without it, how should this work ?

try $Obj->setFile("whatever.doc");

harald.
 [2001-02-09 07:22 UTC] shashank dot kadge at trigyn dot com

<?php
// get a web page into an array .

$Obj = new com('prjWord.clsWord'); 
echo "Loaded {$Obj}";
echo "<br>";
$Obj->filename1 = 'C:shanky2.doc';
$Obj->setFile();

?>

shanky2.doc is the file to be read.

And this is the function in the Com component which gives error, otherwise other normal fuctions work properly. 


Public Function setFile()
    Set wproc = CreateObject("Word.Application")
    wproc.Visible = False
    wproc.Documents.Open (filename)
    str1 = Mid(filename1, 1, Len(filename) - 3) & "txt"
    wproc.ActiveDocument.SaveAs str1, wdFormatText
    wproc.Quit
End Function




 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 17:01:33 2024 UTC