EvotecIT / OfficeIMO

Fast and easy to use cross-platform .NET library that creates or modifies Microsoft Word (DocX) and later also Excel (XLSX) files without installing any software. Library is based on Open XML SDK
MIT License
279 stars 49 forks source link

Watermark only a page #119

Closed geraluca closed 8 months ago

geraluca commented 1 year ago

Hello, is it possible to insert the watermark only on a specific page?

PrzemyslawKlys commented 1 year ago

I've not tried but I guess you would need to add a section and add watermark to section.

geraluca commented 1 year ago

I already tried, I created a new section and I added the watermark in the new section, the watermark appears throughout the document

PrzemyslawKlys commented 1 year ago

Then it's either not possible (can it be done in Word?) or requires some code changes.

geraluca commented 1 year ago

I in Word can not do it but I know that you can do, I also read on the Microsoft site

PrzemyslawKlys commented 1 year ago

Unless you provide a sample document showing this and some kind of docs to confirm it's hard to help. If you say "in word you can't do it I doubt you can do it outside of word. Maybe it's just image that is sized as whole page and added in header being behind text and this acts as a watermark.

PrzemyslawKlys commented 1 year ago

I was able to add 3 custom watermarks (one one 1st page, one on 2nd page and one that goes on all pages). So it's definitely possible to do it in Word. The question is how to do in code.

3 watermarks.docx

PrzemyslawKlys commented 1 year ago

image

So it seems if you put watermark in header it's on all pages but if you put it between Paragraphs it's going to afect only certain pages.

PrzemyslawKlys commented 8 months ago

PR was created to address this issue. See PR for details on changes (including breaking changes).