hi,
i try to write a word doc at runtime through bookmark and it work in local system.
But "COM" was not working in Linux server..
pls give me some other code to do this operation.
i search in google but i cant find the exact code..


Thanks
Kumar.

Recommended Answers

All 5 Replies

hi,
i try to write a word doc at runtime through bookmark and it work in local system.
But "COM" was not working in Linux server..
pls give me some other code to do this operation.
i search in google but i cant find the exact code..


Thanks
Kumar.

COM is a Microsoft technology, it will not be available in Linux.
http://en.wikipedia.org/wiki/Component_Object_Model

You could try looking at the OpenOffice project. OpenOffice is written in Java and can convert between .doc, .pdf, and other formats.
Take a look at their API, you should be able to interface with it from PHP:
http://api.openoffice.org/

Here is an example of converting from .doc to PDF.
http://www.oooforum.org/forum/viewtopic.phtml?t=3772
You could have a PHP file invoke the macro through the command line. (exec(), system() functions etc.)

COM is a Microsoft technology, it will not be available in Linux.
http://en.wikipedia.org/wiki/Component_Object_Model

You could try looking at the OpenOffice project. OpenOffice is written in Java and can convert between .doc, .pdf, and other formats.
Take a look at their API, you should be able to interface with it from PHP:
http://api.openoffice.org/

Here is an example of converting from .doc to PDF.
http://www.oooforum.org/forum/viewtopic.phtml?t=3772
You could have a PHP file invoke the macro through the command line. (exec(), system() functions etc.)

hi
thanks for ur kind reply..
i doing this in PHP..so tell me the code in PHP..
my server is Linux.

hi
thanks for ur kind reply..
i doing this in PHP..so tell me the code in PHP..
my server is Linux.

You cannot do it easily with just PHP. That is why on windows, you need to the COM interface that invokes the necessary applications on the windows machine to do it for you. So in a sense PHP is doing nothing except to run the necessary applications through the COM interface that does the job of creating a word file, then pipe its output to PHP.

On a linux server you don't have a COM interface.
If you are able to install software on the Linux machine, you can install Java and OpenOffice. Then invoke OpenOffice through its API mentioned. Its similar to talking to a windows Application through the COM interface. However, PHP does not have extensions available for OpenOffice like it does for COM on Windows, or the interfaces used by Openoffice, so the simplest would be to invoke OpenOffice via the command line.
This can be done by calling the exec() or system() command in PHP.

If you can't install any software on the Linux Machine, such as with shared hosting, then you will have to create the word .doc files with just native PHP.
This would require an understanding of the format of .doc files. This will be hard to find since .doc is a proprietary Microsoft format.

I would search high and low for a native PHP class that can write word files before trying to write my own due to how hard it would be to get information on the .doc format.

Another route you could go if you can install on the Linux machine, is to install Wine and then install Word on the linux machine. I believe wine provides a COM interface that you may be able to use from PHP just like you do on windows. I'm just guessing though.

I need to create an interface code in open office document using php script . How can I do it?

On my computer the applications LAMP are installed I hqave created a database using phpMyadmin and Ineed to access that database using php script How can Ido that

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.