示例#1
0
        public void UnprotectRemovesWrightProtectionFromFile()
        {
            using (var @protected = new DocxDocument(Resources.Protected))
                using (var @unprotected = new DocxDocument(Resources.Unprotected))
                {
                    @protected.Unprotect();

                    var unprotectedOuterXml = @unprotected.GetWordDocument().MainDocumentPart.DocumentSettingsPart.Settings.OuterXml;
                    var protectedOuterXml   = @protected.GetWordDocument().MainDocumentPart.DocumentSettingsPart.Settings.OuterXml;

                    Assert.IsTrue(unprotectedOuterXml.Equals(protectedOuterXml, StringComparison.InvariantCultureIgnoreCase));
                }
        }