Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This sample uses the WordApplication object to insert watermarks onto a template document.

Code

Code Block

  //The value of this string is the watermark
        string watermark = "Classified";

        public void GenerateDocument()
        {
            /* Create an instance of the WordApplication object */
            WordApplication wwApp = new WordApplication();

            /* Open the unclassified document */
            Document doc = wwApp.Open(@"..\..\Templates/PreWatermark.doc");

            /* Set the watermark */
            doc.Watermark.Text = watermark;

            /* Save the document to the Response stream */
            wwApp.Save(doc, @"..\..\Output\Watermarked_out.doc");
        }

Downloads

PreWatermark.doc