Пример #1
7
        internal static void ReconcileWords(Word._Application app, string inPath1, string inPath2, string outPath)
        {
            var doc1 = app.Documents.Add(inPath1);
            var doc2 = app.Documents.Add(inPath2);

            if (new[] { doc1.ProtectionType, doc2.ProtectionType }.Any(pt => pt != Word.WdProtectionType.wdNoProtection))
            {
                app.Documents.Close(Word.WdSaveOptions.wdDoNotSaveChanges);
                return;
            }

            // CompareDocuments(...) makes an error if either one of the two docs is protected.
            app.CompareDocuments(doc1, doc2).SaveAs(outPath);

            app.Documents.Close();
        }