SPONSORS:






User Tag List

Page 1 of 3 123 LastLast
Results 1 to 10 of 21
  1. #1
    Senior Member
    Join Date
    Jul 2001
    Posts
    147
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Comparing two MS Word documents.

    I'm testing a windows application that contains reports that take you to MS Word. My plan was to compare the report in MS Word to an Original MS Word document. However, I have notice that even if the documents are identical it still fails. I'm using SYS_VerifyText to compare the files.

    To test this even more, I got 1 file and Saved As. I then compared both files and they didn't match even though they were the same 2 files.

    Another issue is that my reports have dates in the header. That means that this testcase will always fail as the dates never match.

    Has anyone come a cross a situation similiar to this, where they needed to compare two MS Word documents, and if so, what method they used?

    Thanks in Advance...

    ------------------
    Who Tests The Tester...
    Who Tests The Tester...

  2. #2
    Senior Member
    Join Date
    Jul 2001
    Location
    Elizabeth, CO, USA
    Posts
    653
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Comparing two MS Word documents.

    Unfortunately, there's lots of hidden information in Word documents such as revision number (thus, the same file saved twice will be different), user, dates saved, etc.

    The only way to compare two Word files is to save them off as standard ASCII.

    As for the different lines in there, I ran into a similar situation on a contract a while back that prompted me to write the attached function. It's a FileCompare function for ASCII files that allows you to specify lines to exclude from the comparison.

    I hope this helps.

    - Dave


    ------------------
    Amelior Technology
    dreed@ameliortech.com
    WaltzingRhino.com
    A concerned Borland customer, a fly in the ointment, a wrench in the works.

  3. #3
    Senior Member
    Join Date
    Oct 1999
    Location
    Tyngsborough, MA
    Posts
    211
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Comparing two MS Word documents.

    Word has a file compare feature built into it. The result may not be very usable, however. It displayes differences with colored markings, like the change tracking feature.

    All Office apps are very programmable however. There are books dedicated to programming inside Office apps. I would imagine the task would be very simple if you could get your hands on one of those ref books.

    ------------------

  4. #4
    Senior Member
    Join Date
    Jul 2001
    Posts
    147
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Comparing two MS Word documents.

    Brian,

    Is there a way I can just view the changes in a word document, rather than scrolling through the document and manually finding them.

    All I want to see is just the lines that differ, can MS Word do this. The reason is that the reports are about 100 pages each and I have many reports to test.

    Thanks...

    ------------------
    Who Tests The Tester...
    Who Tests The Tester...

  5. #5
    Senior Member
    Join Date
    Jul 1999
    Location
    Burlingame CA 94010
    Posts
    502
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Comparing two MS Word documents.

    Dave has a good idea. Export the files as ascii text, then you can build an intelligent comparison of actual and expected results.

    Use the ListRead () function to read the file from the disk.

    Hope this helps.


    ------------------
    John W Green
    jwgreen@automationexpertise.com
    http://www.automationexpertise.com

  6. #6
    Senior Member
    Join Date
    Jul 2001
    Posts
    147
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Comparing two MS Word documents.

    I'm not sure that converting the Word Document to ASCII is the right approach. My document contains tables, graphs and different font styles and colours.

    By saving it as an ASCII file won't I lose this?

    ------------------
    Who Tests The Tester...
    Who Tests The Tester...

  7. #7
    Senior Member
    Join Date
    Jul 2001
    Location
    Elizabeth, CO, USA
    Posts
    653
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Comparing two MS Word documents.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by tsika:
    I'm not sure that converting the Word Document to ASCII is the right approach. My document contains tables, graphs and different font styles and colours.

    By saving it as an ASCII file won't I lose this?

    <HR></BLOCKQUOTE>

    Yep, you'll lose all that when saving it to ASCII. I was more concerned about verifying the content rather than the appearance.

    However, you could save the Word document off to an HTML file which should preserve most of the formatting, colors, tables, etc. HTML is just ASCII. You can then use the function I posted earlier to Verify the contents, being careful not to verify the stuff you don't want. Not sure what Word puts into Meta tags and the like.

    Then again, with two HTML documents, you could load the new file into a browser and verify it there with SilkTest.

    ****- Dave


    ------------------
    Amelior Technology
    dreed@ameliortech.com

    [This message has been edited by dcreed (edited 09-25-2001).]
    WaltzingRhino.com
    A concerned Borland customer, a fly in the ointment, a wrench in the works.

  8. #8
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Comparing two MS Word documents.

    This kind of test is very hard using Silk, especially for visual diff. Unless all your documents have some kind of pattern.

    The only way is to write your own compare program using Visual Studio. Basically break down the documents and start comparing the smaller objects. Also object properties must be store like font size, font type, color, position...

    I am sure you can do it using windows application programming stuff. Basically a set of api for MS Office.

    ------------------

  9. #9
    Senior Member
    Join Date
    Nov 2000
    Location
    Bloomington, IL
    Posts
    142
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Comparing two MS Word documents.

    In Word you can conpare two files and it will produce a new document that can be saved.
    1. Open either the original or modified file in Word.
    2. Click on Tools\Track Changes\Compare Documents.
    3. You will be prompted for the file you want to compare the first file to.
    4. A new file will be created that will show the differences in red. The new statements or words (second file) will be shown crossed out, the original statements or words will be underlined (first file).
    5. You can then save this file under a new name.

    You cannot save this new file in text and see the modifications to the file, this is purely a Word usage.

    MikeF

    ------------------

  10. #10
    Senior Member
    Join Date
    Jul 2001
    Posts
    147
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Comparing two MS Word documents.

    Mike,

    I do agree in using MS Word, however, is there a way in just displaying the lines that don't match, rather than the whole document and having to search for the differences.

    I have many documents to compare and they each contain more than 100 pages.

    Thanks in Advance...

    ------------------
    Who Tests The Tester...
    Who Tests The Tester...

 

 
Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 02:02 PM.

Copyright BetaSoft Inc.