How to iterate and count Revisions in a Word document using C#? -


I'm looking around for it, but no answer could be found anywhere, so hope is there to help someone Could.

I am doing a WinForms application in C #, in which I compare two documents to use WordApplcation.CompareDocuments and as a result, the document gets the changes marked with modification.

This amendment is hiding the contents in the text box well with additions and additions (I do not care so far) I really want what I want

Then the next step is how many words have been modified - especially wdRevisionDelete and wdRevisonInnsert.

The only problem is the last. Revival is sometimes empty or contains data in asurumas (500 words).

I have read on the MSDN page for modification. Tell that document Reviews will not show anything amendments, but only on the main story and which should use the limit - but this did not help.

Here's my current code:

  Interop.Word using Word = Microsoft.Office; {Foreach (s.Range.Revisions in Word.Revision) {counter + = R.Range.Words.Count; If (r.Type == Word.WdRevisionType.wdRevisionDelete) delcnt + = r.Range.Words.Count; If (r.Type == Word.WdRevisionType.wdRevisionInsert) inscnt + = r.Range.Words.Count; }}   

The Word document created by the last WordApplication.CompareDocuments

Therefore, as I said, and according to MSDN, I use the range. Modification, and go section by section.

Only one document with half a dozen amendments shows no one while others show 100.

So my question is, how to use the amendment to count / deleted words

I have opened the documents that make the comparison document in Word 2007 and the amendments are marked correctly and can be accepted or rejected within the Word

I Any ideas on what may be overlooked?

Edit: I have seen something weird - when I try to save as TXT file which is the original document file which is reporting 0 changes though the comparison Documents (correct) Some, I notice that not all pages are saved in the txt file - in which all fields are included with modification.

I tried to convert both to the txt file using both Word 2007 and LibreOffice 3.3 - both have the same result

Can be related in any way.

Find out what's wrong with this file.

Any thoughts?

There is nothing wrong with that code and works on simple files.

There was some strange thing in the file I was testing on.

Like my editing says, they can not save TXT files properly.

Anyone can tell me the reason for this, in the meantime it is a solution to Word document file problems.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -