How to remove watermarks from word document
How to remove watermarks from word document code#
But I want proper solution so that I can remove watermark with C# code without leaving the document corrupted. it removes watermark but leaves the document corrupted. Var header = (i=>maindoc.GetIdOfPart(i).Equals(headerId)) MainDocumentPart = maindoc = package.MainDocumentPart All versions of Word: If the document includes sections that are not linked, repeat these steps for each section. With the help of watermarks, people can generally add some attributes to their document created by Microsoft Word. In the Page Background group, choose Watermark. headerId is the id of the header section which contains the watermark Word for Windows or Word Online: Go to the Design tab and select Watermark > Remove Watermark. You can also add watermarks in a bid to avoid counterfeiting. Unclutter your Microsoft Word document by removing its watermark with just a couple of clicks. Because watermarks are often splashed across a page, they can be distracting or can cover up important text elements. Var watermark = head.GetPartById(watermarkId) Ĭode 2: public static void DeleteCustomWatermark(WordProcessingDocument package, string headerId) Adding a watermark to a Word document is important if you want to protect confidential data and to indicate the legality of a document. Watermarks also appear in electronic documents to protect against downloading and copying. Var head = headers.First() //we are sure that this header part contains the Watermark with id=watermarkId MainDocumentPart maindoc = package.MainDocumentPart I have tried following code block to delete the watermark from the documentĬode 1: private static void DeleteCustomWatermark(WordprocessingDocument package, string watermarkId)