none
Add watermark to existing headers RRS feed

  • Question

  • How can I add a watermark to all existing headers in a Open XML document (text only) ?

    I find each header with this code:

    myDoc = WordProcessingDocument.Open("c:\doc\test.docx",TRUE)
    Dim myPart as MainDocumentPart = myDoc.MainDocumentPart()
    For Each myHeader as HeaderPart In myPart.GetPartsOfType(Of HeaderPart)()
      myHeader. I'm stuck .....
    Next



    Monday, October 26, 2009 10:13 AM

Answers

  • Hi,

    Using the SDK to add watermark (even text only) is a big thing. If you really need to do this, i suggest you to do the following:

    1. create a document with something.
    2. copy that document, open it using Word, add a text watermark through the UI.
    3. use the OpenXmlDiff tool to find the differences between the orignal document and the one with watermark.
    4. write code to apply these differences (it is the logic to add a watermark)

    • Marked as answer by KrakatoaMe Wednesday, November 4, 2009 7:24 AM
    Tuesday, November 3, 2009 8:39 AM
  • I solved using a similar approach.
    Using the documentreflector program I was able to filter out the code which set the watermark.
    • Marked as answer by KrakatoaMe Wednesday, November 4, 2009 7:24 AM
    Wednesday, November 4, 2009 7:24 AM

All replies

  • Hi,

    Using the SDK to add watermark (even text only) is a big thing. If you really need to do this, i suggest you to do the following:

    1. create a document with something.
    2. copy that document, open it using Word, add a text watermark through the UI.
    3. use the OpenXmlDiff tool to find the differences between the orignal document and the one with watermark.
    4. write code to apply these differences (it is the logic to add a watermark)

    • Marked as answer by KrakatoaMe Wednesday, November 4, 2009 7:24 AM
    Tuesday, November 3, 2009 8:39 AM
  • I solved using a similar approach.
    Using the documentreflector program I was able to filter out the code which set the watermark.
    • Marked as answer by KrakatoaMe Wednesday, November 4, 2009 7:24 AM
    Wednesday, November 4, 2009 7:24 AM