Click to See Complete Forum and Search --> : new COM("com.sun.star.ServiceManager") Time Out Error


Cribz
02-29-2008, 05:44 PM
Hi can somewone help out...
I want to connect to openoffice using php
But my code stucks at

$osm = new COM("com.sun.star.ServiceManager") or die ("Please be sure that OpenOffice.org is installed.\n");

with a Time out message!

does anyone why this is???:(

chazzy
02-29-2008, 05:53 PM
you'll need to make sure that the java classes are on the classpath that PHP/COM can have access to...

but... this means that OpenOffice/StarOffice are installed on the server that PHP is running on. is that what your intention is?

Cribz
03-01-2008, 03:03 AM
Yes.. Ik have already installed OpenOffice on my localsystem, which is also my server...

Cribz
03-01-2008, 03:12 AM
How do i put the java classes on the classpath??
I am using Windows XP

chazzy
03-01-2008, 08:06 AM
How do i put the java classes on the classpath??
I am using Windows XP

I think it makes more sense to first ask what is it you're trying to do with open office?

Cribz
03-02-2008, 04:34 AM
I'm Trying to generate openoffice writer's document with php. This document can for example be an invoice.

-thanks in advance-:)

chazzy
03-02-2008, 11:49 AM
I'm guessing you're just following a tutorial? Maybe this one? http://www.oooforum.org/forum/viewtopic.phtml?t=3474

Just to point out, if you are using this one, it's quite old and for OOo 1.1. Might behave differently if you're using 2.

Cribz
03-02-2008, 03:48 PM
Is there another way to control OpenOffice from PHP?:(
I'm now using version 2.3

chazzy
03-02-2008, 06:16 PM
Is there another way to control OpenOffice from PHP?:(
I'm now using version 2.3

Well, if you look at the forum I linked to, there's http://www.oooforum.org/forum/viewtopic.phtml?t=68902 this (http://www.oooforum.org/forum/viewtopic.phtml?t=68902)

It looks like they have something working fairly well. Their description seems to work on linux, windows is probably slightly different (paths, etc).

Cribz
03-03-2008, 05:20 PM
I will take a look at it...

Thanks alot:)

mychastic
11-04-2008, 04:15 AM
Any Solution? I also want to open a writer doc...and I got the same Problem.
Where do i have to put which java files?
I use OpenOffice 3, Windows XP and PHP 5.2.6

thanks

mychastic
11-04-2008, 07:01 AM
Any Solution? I also want to open a writer doc...and I got the same Problem.
Where do i have to put which java files?
I use OpenOffice 3, Windows XP and PHP 5.2.6

thanks

I tried it with this code <?php

// get the ServiceManager.
// This step varies greatly from language to language.
// This technique is specifically for PHP running on Windows,
// where OOo has been installed onto the *same* computer that is running PHP.
$oServiceManager = new COM( "com.sun.star.ServiceManager" );

// Get the Desktop object
$*****top = $oServiceManager->createInstance( "com.sun.star.frame.Desktop" );

// Ask the Desktop object to create a new drawing.
// Note the empty array of arguments.
// This wold be an array of com.sun.star.beans.PropertyValue structs if
// you needed to specify additional arguments.
$oArgs = array();
$oDrawDoc = $*****top->loadComponentFromURL( "private:factory/sdraw", $oArgs );

?>

and then this error: "Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\Test\test.php on line 19"

So whats wrong here?

andre4s_y
11-05-2008, 01:57 PM
First,
I want you take a look at http://www.webdeveloper.com/forum/showthread.php?t=187281. There is 2 solution with OpenOffice. Using API or using MACRO. Macro is easiest way to do something like file conversion.

Second,
I want you take a look at PUNO : http://www.wstech2.net/index.php?do=puno. With PUNO, you can access OpenOffice API. I have using it quite a while.. The result is : i can control presentation file in a web browser. I have tested it using my ubuntu 7.10 + OpenOffice 2.4.1. Not test in OOo 3 yet, because no SDK at the moment. So, if there is another question about it, welcome... The COM windows tutorial in there is good too..

Third,
The main and usual problem call ServiceManager with COM extension is permission! Have you set the permission?? COM permission.

Forth,
There is a tool : JODConverter. You can take a tour on it and its guide(how to starting OOo as a service). http://www.artofsolving.com/opensource/jodconverter. This may insipire you..

Fifth,
For my experiment, the best result to control OOo is using java, not PHP! So, JSP or other technology may be suitable to you if you try to control OOo with its API.

Sixth,
Who is the man, installed OOo as a service, to satisfy web application, in a shared hosting?? None will!!

Hope this help you all..

@mychastic
Of cource there will be an error occured. You have created unfinish code. After loadComponentFromURL, what will you do about it? If there is nothing, then close it!