Page 1 of 1

comparing 2 document files(.DOC extension) by PHP??

Posted: Tue Dec 21, 2004 2:38 am
by shameermp
Hallo

i would like to ask about the solution for comparing 2 document files(.DOC extension) by PHP.

I used 'file' command to open the file in FTP and i transfered it's content to an array by
'foreach'command .Then the problem is how to compare two documents.

Then I have to do the following things...

If there is any gramatical or spelling mistake from second to first i have to specify(write)
that with in a bracket with different color (near to the correction).

The result for the "COMPARED FILE" will contain the first document content and it's correction

So please help me to solve the above problem.Specify if there is any correction in followed pattern.


i am waiting for your replay

shameer
[/php_man]

Posted: Tue Dec 21, 2004 3:31 am
by vietnamese
Filesystem Functions can't read MS word file as string.
I think this topic which you need.
You can read more at http://www.php.net/docs
COM
(no version information, might be only in CVS)

COM -- COM class
Synopsis
$obj = new COM("server.object")


Description
The COM class provides a framework to integrate (D)COM components into your PHP scripts.

Methods
string COM::COM ( string module_name [, string server_name [, int codepage]])


COM class constructor. Parameters:


module_name
name or class-id of the requested component.

server_name
name of the DCOM server from which the component should be fetched. If NULL, localhost is assumed. To allow DCOM com.allow_dcom has to be set to TRUE in php.ini.

codepage
specifies the codepage that is used to convert php-strings to unicode-strings and vice versa. Possible values are CP_ACP, CP_MACCP, CP_OEMCP, CP_SYMBOL, CP_THREAD_ACP, CP_UTF7 and CP_UTF8.


Example 1. COM example (1)

Code: Select all

<?php
// starting word
$word = new COM("word.application") or die("Unable to instanciate Word");
echo "Loaded Word, version {$word->Version}\n";

//bring it to front
$word->Visible = 1;

//open an empty document
$word->Documents->Add();

//do some weird stuff
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");

//closing word
$word->Quit();

//free the object
$word->Release();
$word = null;
?>