Can BeyondCompare do .DOC files?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jdb
    New User
    • Dec 2010
    • 2

    Can BeyondCompare do .DOC files?

    Can BeyoneCompare be used to compare MS Office documents like .DOC, .PPT?
  • Aaron
    Team Scooter
    • Oct 2007
    • 15938

    #2
    Hello,

    Yes. Beyond Compare can compare Word files (.doc and .docx), by using a conversion process and comparing the plain text of the files. You can test this with our fully featured trial:
    http://www.scootersoftware.com/download.php

    .ppt is not a supported format, but we do have an older BC2 rule that could be modified to work in BC3. I would suggest working with .doc first, and then coming back to .ppt later.
    http://www.scootersoftware.com/downl...z=kb_morerules
    Aaron P Scooter Software

    Comment

    • Aaron
      Team Scooter
      • Oct 2007
      • 15938

      #3
      Correction: We have updated the rule to BC3 as well. It is available here:
      http://www.scootersoftware.com/downl...kb_moreformats
      Aaron P Scooter Software

      Comment

      • jdb
        New User
        • Dec 2010
        • 2

        #4
        How to use the rule

        Im on Windows XP Pro with MS Office 2007.

        I downloaded the .bcpkg for PPT files. I launched the icon and it said it was "importing" Then I launched BeyondCompare 3.2.2 But I don't see PPT as a file choice in left menu.

        How do I use these rules in BC?

        Thanks, Aaron, for your help. BC seems to be a fantastic tool and I'm just now digging into it.

        --dave

        Comment

        • Lutz
          Veteran
          • Oct 2007
          • 356

          #5
          Go to menu Tools/File Formats. This dialog should show the ppt-format on top of the list with a black mask "*.ppt;*.pptx" in the second column. If you didn't change BCs default settings ppt-files should automatically be detected and converted on opening.

          If you don't see the ppt-format in the list the import failed (but I have never seen this).

          There are some other settings to prevent automatic detection, but they shouldn't apply in your case.

          Greetings Lutz

          PS: BC is the BEST! (for me since BC1.7 of 1999)

          Comment

          • Aaron
            Team Scooter
            • Oct 2007
            • 15938

            #6
            Thanks, Lutz.

            In addition, File Formats are additional rules for each type of current comparsion/session type. So you may have a new File Format for the Text Compare, MP3 Compare, Picture Compare, etc.

            The Power Point file format is a Text Compare File Format. It is an additional rule found in the File Formats dialog, associated with the Text Compare session type.
            Aaron P Scooter Software

            Comment

            • terryhar
              New User
              • Oct 2011
              • 1

              #7
              Hi,

              I do not see the .doc format in the available Windows formats at this page..
              http://www.scootersoftware.com/downl...oreformats_win

              Do you have one that works for BC Version 3?

              Thanks,

              Terry

              Comment

              • Chris
                Team Scooter
                • Oct 2007
                • 5526

                #8
                Microsoft Word .doc file support is built-in to Beyond Compare 3, no additional download is required. To compare .doc files, open them in the Text Compare.
                Chris K Scooter Software

                Comment

                • Gurce
                  Enthusiast
                  • Jan 2012
                  • 22

                  #9
                  How about for Linux?

                  Hi guys,

                  How about for Linux users that want to diff doc files? I'm not sure if anything is available yet. If there is, let me know, and I'll give up my current effort

                  Ok, my current effort, not working yet, anyone know how I can get this working?

                  My attempt
                  • Make a macro for OpenOffice to save out the doc file as an html file
                  • Add a File-Format rule to let BC3 run this macro from the command-line


                  Here's my macro:
                  Code:
                  REM  *****  BASIC  *****
                  
                  ' Save document as Html file.
                  Sub SaveAsHTML( cFile, cOutFile )
                     'cFile = "/home/gurce/games/iTable/DisplayBuild/table_sign_protocol.doc"
                     'cOutFile = "/home/gurce/games/iTable/DisplayBuild/table_sign_protocol.html"
                     cURL = ConvertToURL( cFile )
                     ' Open the document. Just blindly assume that the document
                     ' is of a type that OOo will correctly recognize and open
                     ' without specifying an import filter.
                     oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, Array(MakePropertyValue( "Hidden", True )))
                  
                     ' cFile = Left( cFile, Len( cFile ) - 4 ) + ".html"
                     cURL = ConvertToURL( cOutFile )
                     
                     ' Save the document using a filter.   
                     oDoc.storeToURL( cURL, Array(_
                              MakePropertyValue( "FilterName", "HTML (StarWriter)" ),)
                     
                     oDoc.close( True )
                  End Sub
                  
                  Function MakePropertyValue( Optional cName As String, Optional uValue ) _
                     As com.sun.star.beans.PropertyValue
                     Dim oPropertyValue As New com.sun.star.beans.PropertyValue
                     If Not IsMissing( cName ) Then
                        oPropertyValue.Name = cName
                     EndIf
                     If Not IsMissing( uValue ) Then
                        oPropertyValue.Value = uValue
                     EndIf
                     MakePropertyValue() = oPropertyValue
                  End Function
                  Here's my BC3 doc/docx file-format rule:
                  Code:
                  soffice --invisible "macro:///Standard.MyMacros.SaveAsHtml(%s,%t)"
                  Doesn't seem to work yet for me. BC3 opens up with both the old/new doc files as empty.

                  I'm fairly sure this macro works, as when I run it from the console, it does generate the html file.
                  Code:
                  soffice --invisible "macro:///Standard.MyMacros.SaveAsHtml($PWD/table_sign_protocol.doc,$PWD/table_sign_protocol.html)"
                  Any ideas how I can tweak this to make this method work for BC3-Linux?

                  Comment

                  • Gurce
                    Enthusiast
                    • Jan 2012
                    • 22

                    #10
                    Ok, figured something out, I made a little bash script to call the macro, then add a BC3 rule that will call the bash-script.

                    Eg. my "bc_word_to_html" bash script is as follows:
                    Code:
                    #!/bin/bash
                    soffice --invisible "macro:///Standard.MyMacros.SaveAsHtml($1,$2)"
                    Then my file-format rule in BC3 is:
                    Code:
                    bc_word_to_html "%s" "%t"
                    This seems to work, although the html is densely packed with too many tags and attributes.

                    Perhaps I'd be better off saving it as pure text, although part of me thought it would make for an interesting diff if a minimal amount of html tags crept through. Eg, for tables, I find it hard to comprehend diffs of tables when a word doc is flattened into a text file, so I was hoping html might make diff'ing of doc tables easier to follow.

                    Ah well, nevermind... Maybe I could write a little app to filter out some bulkier tags, particularly lengthy attributes in tags, then feed this result into BC3, and then this idea might work out...

                    Comment

                    • Gurce
                      Enthusiast
                      • Jan 2012
                      • 22

                      #11
                      Linux - Doc to Text file method

                      Ok, here's the method for converting to plain text, in-case other Linux users want to go this way:

                      Add another macro into OpenOffice
                      Code:
                      ' Save document as Text file.
                      Sub SaveAsText( cFile, cOutFile )
                         cURL = ConvertToURL( cFile )
                         ' Open the document. Just blindly assume that the document
                         ' is of a type that OOo will correctly recognize and open
                         ' without specifying an import filter.
                         oDoc = StarDesktop.loadComponentFromURL( cURL, "_blank", 0, Array(MakePropertyValue( "Hidden", True )))
                      
                         ' cFile = Left( cFile, Len( cFile ) - 4 ) + ".html"
                         cURL = ConvertToURL( cOutFile )
                         
                         ' Save the document using a filter.   
                         oDoc.storeToURL( cURL, Array(_
                                  MakePropertyValue( "FilterName", "Text (encoded)" ),)
                         
                         oDoc.close( True )
                      End Sub
                      create another bash script, eg, "bc_word_to_text" (PS. don't forget to do a "chmod +x bc_word_to_text" to make it executable).

                      Code:
                      #!/bin/bash
                      
                      # --------------------------
                      # FUNCTION
                      # --------------------------
                      
                      function waitSOfficeClose {
                      export SOFFICE_ACTIVE=`ps aux | grep soffice | grep macro`
                      while [ "$SOFFICE_ACTIVE" != "" ]
                      do
                          echo "$$ : sleeping 1..."
                      	sleep 1
                      	export SOFFICE_ACTIVE=`ps aux | grep soffice | grep macro`
                      done
                      }
                      
                      
                      # --------------------------
                      # MAIN
                      # --------------------------
                      
                      echo "$$ : starting..."
                      echo $$ : soffice --invisible ""macro:///Standard.Module1.SaveAsText\($1,$2\)""
                      
                      waitSOfficeClose
                      
                      konsole -e soffice --invisible "macro:///Standard.Module1.SaveAsText($1,$2)"
                      
                      echo "$$ : soffice was run!"
                      
                      sleep 1
                      
                      waitSOfficeClose
                      
                      echo "$$ : exit..."
                      Then make the format-rule in BC3 to be:

                      Code:
                      bc_word_to_text "%s" "%t"

                      Post Edit History:
                      • (20/08/2013) - More fixes to the "bc_word_to_text" script
                        • bcompare will trigger the script twice for LHS and RHS instantaneously. So assure only one call to soffice at a time.
                        • After starting soffice, wait a second prior to testing if soffice has closed
                      • (09/02/2012) - The script needs to wait for the soffice macro process to complete before exiting the script
                      Last edited by Gurce; 20-Aug-2013, 12:05 AM. Reason: A bit of cleanup

                      Comment

                      • Chris
                        Team Scooter
                        • Oct 2007
                        • 5526

                        #12
                        Gurce,

                        Thank you for sharing, I'm sure some of our Linux users will find it useful.
                        Chris K Scooter Software

                        Comment

                        Working...