public void TestSetWatermark() { XWPFDocument sampleDoc = XWPFTestDataSamples.OpenSampleDocument("SampleDoc.docx"); // no header is Set (yet) XWPFHeaderFooterPolicy policy = sampleDoc.GetHeaderFooterPolicy(); Assert.IsNull(policy.GetDefaultHeader()); Assert.IsNull(policy.GetFirstPageHeader()); Assert.IsNull(policy.GetDefaultFooter()); policy.CreateWatermark("DRAFT"); Assert.IsNotNull(policy.GetDefaultHeader()); Assert.IsNotNull(policy.GetFirstPageHeader()); Assert.IsNotNull(policy.GetEvenPageHeader()); // Re-open, and check XWPFDocument reopened = XWPFTestDataSamples.WriteOutAndReadBack(sampleDoc); policy = reopened.GetHeaderFooterPolicy(); Assert.IsNotNull(policy.GetDefaultHeader()); Assert.IsNotNull(policy.GetFirstPageHeader()); Assert.IsNotNull(policy.GetEvenPageHeader()); }
public void TestSetWatermark() { XWPFDocument sampleDoc = XWPFTestDataSamples.OpenSampleDocument("SampleDoc.docx"); // no header is Set (yet) XWPFHeaderFooterPolicy policy = sampleDoc.GetHeaderFooterPolicy(); Assert.IsNull(policy.GetDefaultHeader()); Assert.IsNull(policy.GetFirstPageHeader()); Assert.IsNull(policy.GetDefaultFooter()); policy.CreateWatermark("DRAFT"); Assert.IsNotNull(policy.GetDefaultHeader()); Assert.IsNotNull(policy.GetFirstPageHeader()); Assert.IsNotNull(policy.GetEvenPageHeader()); }