Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files from any .NET platform (C#, VB.NET, ASP.NET, .NET Core) and Java applications (J2SE and J2EE) with fast and high quality performance.

Tue Jan 25, 2011 2:38 am

I have created a Word doucment with 10 pages. Now, I want to insert watermark in even pages, how should I do?

Posts: 9
Joined: Tue Dec 28, 2010 1:16 am

Thu Jan 27, 2011 1:12 am

The function can't be supported with Microsoft Word. So in Spire.Doc, we can't insert a watermark only in the odd pages. However, you may use header and footer method to realize it. You can first set different header or footer between odd and even pages. And then you may insert a picture in the odd pages, then set the picture behind text. If your picture is big enough, it will look like watermark in the word document. Following is the code:
section.PageSetup.DifferentOddAndEvenPagesHeaderFooter = true;
Paragraph efp = section.HeadersFooters.EvenHeader.AddParagraph();
//header picture layout - text wrapping
headerPicture.TextWrappingStyle = TextWrappingStyle.Behind;
//header picture layout - position
headerPicture.HorizontalOrigin = HorizontalOrigin.Page;
headerPicture.HorizontalAlignment = ShapeHorizontalAlignment.Left;
headerPicture.VerticalOrigin = VerticalOrigin.Page;
headerPicture.VerticalAlignment = ShapeVerticalAlignment.Top;
e-iceblue support
User avatar

iceblue support
Posts: 240
Joined: Tue Dec 21, 2010 2:56 am

Return to Spire.Doc