public void TestIntegration() { XWPFDocument doc = new XWPFDocument(); XWPFParagraph p1 = doc.CreateParagraph(); XWPFRun r1 = p1.CreateRun(); r1.SetText("Lorem ipsum dolor sit amet."); doc.EnforceCommentsProtection(); FileInfo tempFile = TempFile.CreateTempFile("documentProtectionFile", ".docx"); if (File.Exists(tempFile.FullName)) { File.Delete(tempFile.FullName); } Stream out1 = new FileStream(tempFile.FullName, FileMode.CreateNew); doc.Write(out1); out1.Close(); FileStream inputStream = new FileStream(tempFile.FullName, FileMode.Open); XWPFDocument document = new XWPFDocument(inputStream); inputStream.Close(); Assert.IsTrue(document.IsEnforcedCommentsProtection()); }
public void TestShouldEnforceForComments() { XWPFDocument document = XWPFTestDataSamples.OpenSampleDocument("documentProtection_no_protection.docx"); Assert.IsFalse(document.IsEnforcedCommentsProtection()); document.EnforceCommentsProtection(); Assert.IsTrue(document.IsEnforcedCommentsProtection()); }