c# - Programmatically Compare Microsoft Office Files -


itemprop = "text">

The easiest way to see two Office files using the same content python I am My first trend is to use filecmp.cmp , but this approach logically fails because two files do not necessarily have the same binary information, even if they have the same content

  [10]: Import win32com.client [11] the term = win32com.client.Dispatch ( "Word.Application") [12]: Dock = word.Documents.Add (in ) in [13]: doc.SaveAs (filename = "test.docx") in [14]: doc.SaveAs (filename = "test2.docx") [15] in import filecmp [16]: filecmp. CMP ("test.docx", "test2.docx") out [16]: false  

After this, I can try to compare the contents of files as much as manually :

  def compareWordDocs (self, worddoc1_path, worddoc2_path): worddoc1 = self._wordapp.Documents.Open (filename = worddoc1_path) worddoc2 = self._wordapp.Documents.Open (filename = worddoc2_path) worddoc1_content_text = Worddoc1.Content This issue since the stories worddoc2_content_text = worddoc2.Content.Text worddoc1.Close (SaveChanges = 0) worddoc2.Close (SaveChanges = 0) return worddoc1_content_text == worddoc2_content_text  
any Office

However, it can also be included in addition to the document text many things what Microsoft offers any functionality I __ eq __ () or .equals () function Will do something like that, with which the equality of the material can be determined? I would need to solve as many Microsoft Office products as possible, although I know that the solution can vary from product to nature according to the nature of the product.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -