[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: diff-doc.js does not support Microsoft Word 2000 on Windows 2000 Professional

From: Sean O Ceirin <sean.oceirin_at_fineos.com>
Date: 2007-01-22 11:48:54 CET

Jared Silva <jayrod@...> writes:

>
> Sean O'Ceirin wrote:
> > I recently upgraded from tortoiseSVN 1.3.2.5840 to tortoiseSVN 1.4.1.7992
> > I am working on a Windows 2000 machine with Microsoft Office 2000 installed.
> > Using the earlier version of tortoiseSVN I was able to diff word documents.
> > Since I upgraded I have not been able to diff word documents.
> >
> > When I diff a word file a Windows Script Host Dialog Box appears, reporting
an error in diff-doc.js on line 48
> > Error: Type mismatch
> > Code: 800A000D
> >
> > This exact same script seems to work on machines with Word 2003 installed.
> >
> > Looking at the javascript file the following is the javascript line throwing
the error.
> >
> > destination.Compare(sBaseDoc, "", wdCompareTargetNew, true, true);
> >
>
> I apologize for introducing this incompatibility.
>
> Re: Make diff-doc.js use Merge instead of Compare for documents with
> existing Track Changes.
> http://svn.haxx.se/tsvnusers/archive-2006-11/0079.shtml
>
> > This seems to be an issue between the diff-doc.js script only supporting
Microsoft Word 2003.
> > Looking at msdn there is a Compare function and a Compare2000 function. The
Compare2000 Function
> > only takes in one parameter.
> >
> > This seems to indicate that the script will have to be version aware so that
it can call the correct function.
> > After searching MSDN for a while I found the following information that kind
of relates the Version number
> to the Microsoft Office version intalled.
> >
> > 2007 Build Info: http://support.microsoft.com/kb/928116
> > 2000 Build Info: http://support.microsoft.com/kb/255275
> >
> > Based on this I but the code below in place of line 48.
> >
> > if ( Number(word.Version) <= 10 ){
> > //WScript.Echo('Word is 2000 or older');
> > destination.Compare(sBaseDoc);
> > }
> > else{
> > //WScript.Echo('Word is 2003 or later');
> > destination.Compare(sBaseDoc, "", wdCompareTargetNew, true, true);
> > }
> >
> >
> > I have tested locally on a machine with Word 2000 and on a machine with Word
2003 and this fix seems to work.
> > I am not happy about checking that Version is less than 10 as it seems
completely arbitrary. There is also a
> Compare2002 method that may need to be accounted for.
> >
>
> The current code accounts for Compare and Compare2002.
>
> Compare:
>
http://msdn2.microsoft.com/en-us/library/microsoft.office.interop.word._document.compare(VS.80).aspx
> Compare2000:
>
http://msdn2.microsoft.com/en-gb/library/microsoft.office.tools.word.document.compare2000(VS.80).aspx
> Compare2002:
>
http://msdn2.microsoft.com/en-us/library/microsoft.office.interop.word._document.compare2002(VS.80).aspx
>
> > If anyone has a cleaner fix please reply.
> >
> > Test Steps:
> > Assuming a normal install on Windows
> > 1. Open a cmd prompt. Run the script below, replacing the <> entries with
valid URLS.
> >
> > wscript.exe "C:\Program Files\TortoiseSVN\Diff-Scripts\diff-doc.js"
<insert_url_to_word_doc> <insert_url_to_another_word_doc>
> >
> > Expected Result:
> > Word document opens with Track Changes turned on.
> >
>
> The expected result, for Word 2003, is Word comparing two documents
> whether Track Changes (Revisions) exist or not.
>
> > Actual Result:
> > On Windows 2000, Document Opens but with no Track Changes. A dialog box
appears with the title 'Windows
> Script Host Dialog Box'.
> >
>
> Can you explain this further? I would like to release a patch ASAP.
>

The signature of the compare method has changed from 2000 to the current compare
method.

What I'm guessing has happened, it that in Office 2000 a method called compare
was available which only took one parameter, String name.

function Compare(
     Name : String
);

Then for 2002 a new compare method was release to allow users specify more about
how they wanted files compared. As part of this process, the old compare(String)
method was renamed to compare2000.

function Compare2000(
     Name : String
);

function Compare(
     Name : String,
     AuthorName : Object,
     CompareTarget : Object,
     DetectFormatChanges : Object,
     IgnoreAllComparisonWarnings : Object,
     AddToRecentFiles : Object
);

Then, for Office 2003, a further overloading of the method occured. The old
(2002) compare function was renamed to compare2002.

JScript
(from
http://msdn2.microsoft.com/en-us/library/microsoft.office.interop.word._document.compare(VS.80).aspx)

function Compare2000(
     Name : String
);

function Compare2002(
     Name : String,
     AuthorName : Object,
     CompareTarget : Object,
     DetectFormatChanges : Object,
     IgnoreAllComparisonWarnings : Object,
     AddToRecentFiles : Object
);

function Compare(
     Name : String,
     AuthorName : Object,
     CompareTarget : Object,
     DetectFormatChanges : Object,
     IgnoreAllComparisonWarnings : Object,
     AddToRecentFiles : Object,
     RemovePersonalInformation : Object,
     RemoveDateAndTime : Object
);

As all attributes other than name are optional this works fine for all existing
code. However, for new code that wants to take advantage of the new attributes,
they have to be aware of the Office version that is installed and only call the
method that is available.

I hope this makes sense. If you have a machine with Office 2000 installed you'll
see what I mean straight away.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tortoisesvn.tigris.org
For additional commands, e-mail: users-help@tortoisesvn.tigris.org
Received on Mon Jan 22 12:40:21 2007

This is an archived mail posted to the TortoiseSVN Users mailing list.