Exemple #1
0
        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());
        }
Exemple #2
0
        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());
        }