none
DocumentFormat.OpenXML add watermark RRS feed

  • Question

  • Hello together,

    my issues is to add a watermark (only text) to a Word document.

    As a library for accessing the Word document DocumentFormat.OpenXML is used, and I found one solution on the internet  which is really long and hardly readable.

    Is there any short solution to add a watermark via this library. In case the category is not correct a hint on which category would be more suitable would be good.

    Yours sincerely,

    Simon Rühle

    • Moved by CoolDadTx Thursday, October 13, 2016 4:59 PM Office related
    Thursday, October 13, 2016 3:19 PM

Answers

  • Hi,

    The project below is modified form the sample. It would add a WordArt "Test" as the watermark in the center of the page.

    using DocumentFormat.OpenXml;
    using DocumentFormat.OpenXml.Packaging;
    using DocumentFormat.OpenXml.Wordprocessing;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using V = DocumentFormat.OpenXml.Vml;
    using Ovml = DocumentFormat.OpenXml.Vml.Office;
    using Wvml = DocumentFormat.OpenXml.Vml.Wordprocessing;
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                using (WordprocessingDocument document = WordprocessingDocument.Open(@"C:\Users\Administrator\Desktop\2.docx", true))
                {
                    MainDocumentPart mainDocumentPart1 = document.MainDocumentPart;
                    if (mainDocumentPart1 != null)
                    {
                        mainDocumentPart1.DeleteParts(mainDocumentPart1.HeaderParts);
                        HeaderPart headPart1 = mainDocumentPart1.AddNewPart<HeaderPart>();
                        GenerateHeaderPart1Content(headPart1);
                        string rId = mainDocumentPart1.GetIdOfPart(headPart1);
                        ImagePart image = headPart1.AddNewPart<ImagePart>("image/jpeg", "rId1");
                        GenerateImagePart1Content(image);
                        IEnumerable<SectionProperties> sectPrs = mainDocumentPart1.Document.Body.Elements<SectionProperties>();
                        foreach (var sectPr in sectPrs)
                        {
                            sectPr.RemoveAllChildren<HeaderReference>();
                            sectPr.PrependChild<HeaderReference>(new HeaderReference() { Id = rId });
                        }
                    }
                }
            }
            private static void GenerateHeaderPart1Content(HeaderPart headerPart1)
            {
                Header header1 = new Header() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 w15 w16se wp14" } };
                header1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
                header1.AddNamespaceDeclaration("cx", "http://schemas.microsoft.com/office/drawing/2014/chartex");
                header1.AddNamespaceDeclaration("cx1", "http://schemas.microsoft.com/office/drawing/2015/9/8/chartex");
                header1.AddNamespaceDeclaration("cx2", "http://schemas.microsoft.com/office/drawing/2015/10/21/chartex");
                header1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
                header1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
                header1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
                header1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
                header1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
                header1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
                header1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
                header1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
                header1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
                header1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
                header1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml");
                header1.AddNamespaceDeclaration("w16se", "http://schemas.microsoft.com/office/word/2015/wordml/symex");
                header1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
                header1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
                header1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
                header1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");
    
                Paragraph paragraph2 = new Paragraph() { RsidParagraphAddition = "00936B9A", RsidRunAdditionDefault = "00936B9A" };
    
                ParagraphProperties paragraphProperties2 = new ParagraphProperties();
                ParagraphStyleId paragraphStyleId2 = new ParagraphStyleId() { Val = "Header" };
    
                paragraphProperties2.Append(paragraphStyleId2);
                BookmarkStart bookmarkStart1 = new BookmarkStart() { Name = "_GoBack", Id = "0" };
    
                Run run1 = new Run();
    
                RunProperties runProperties1 = new RunProperties();
                NoProof noProof1 = new NoProof();
    
                runProperties1.Append(noProof1);
    
                Picture picture1 = new Picture();
    
                V.Shapetype shapetype1 = new V.Shapetype() { Id = "_x0000_t136", CoordinateSize = "21600,21600", OptionalNumber = 136, Adjustment = "10800", EdgePath = "m@7,l@8,m@5,21600l@6,21600e" };
    
                V.Formulas formulas1 = new V.Formulas();
                V.Formula formula1 = new V.Formula() { Equation = "sum #0 0 10800" };
                V.Formula formula2 = new V.Formula() { Equation = "prod #0 2 1" };
                V.Formula formula3 = new V.Formula() { Equation = "sum 21600 0 @1" };
                V.Formula formula4 = new V.Formula() { Equation = "sum 0 0 @2" };
                V.Formula formula5 = new V.Formula() { Equation = "sum 21600 0 @3" };
                V.Formula formula6 = new V.Formula() { Equation = "if @0 @3 0" };
                V.Formula formula7 = new V.Formula() { Equation = "if @0 21600 @1" };
                V.Formula formula8 = new V.Formula() { Equation = "if @0 0 @2" };
                V.Formula formula9 = new V.Formula() { Equation = "if @0 @4 21600" };
                V.Formula formula10 = new V.Formula() { Equation = "mid @5 @6" };
                V.Formula formula11 = new V.Formula() { Equation = "mid @8 @5" };
                V.Formula formula12 = new V.Formula() { Equation = "mid @7 @8" };
                V.Formula formula13 = new V.Formula() { Equation = "mid @6 @7" };
                V.Formula formula14 = new V.Formula() { Equation = "sum @6 0 @5" };
    
                formulas1.Append(formula1);
                formulas1.Append(formula2);
                formulas1.Append(formula3);
                formulas1.Append(formula4);
                formulas1.Append(formula5);
                formulas1.Append(formula6);
                formulas1.Append(formula7);
                formulas1.Append(formula8);
                formulas1.Append(formula9);
                formulas1.Append(formula10);
                formulas1.Append(formula11);
                formulas1.Append(formula12);
                formulas1.Append(formula13);
                formulas1.Append(formula14);
                V.Path path1 = new V.Path() { AllowTextPath = true, ConnectionPointType = Ovml.ConnectValues.Custom, ConnectionPoints = "@9,0;@10,10800;@11,21600;@12,10800", ConnectAngles = "270,180,90,0" };
                V.TextPath textPath1 = new V.TextPath() { On = true, FitShape = true };
    
                V.ShapeHandles shapeHandles1 = new V.ShapeHandles();
                V.ShapeHandle shapeHandle1 = new V.ShapeHandle() { Position = "#0,bottomRight", XRange = "6629,14971" };
    
                shapeHandles1.Append(shapeHandle1);
                Ovml.Lock lock1 = new Ovml.Lock() { Extension = V.ExtensionHandlingBehaviorValues.Edit, TextLock = true, ShapeType = true };
    
                shapetype1.Append(formulas1);
                shapetype1.Append(path1);
                shapetype1.Append(textPath1);
                shapetype1.Append(shapeHandles1);
                shapetype1.Append(lock1);
    
                V.Shape shape1 = new V.Shape() { Id = "_x0000_s2049", Style = "margin-margin-width:87.75pt;height:51pt;mso-position-horizontal:center;mso-position-horizontal-relative:margin;mso-position-vertical:center;mso-position-vertical-relative:margin", Type = "#_x0000_t136" };
                V.Fill fill1 = new V.Fill() { Title = "", RelationshipId = "rId1" };
                V.Stroke stroke1 = new V.Stroke() { Title = "", RelationshipId = "rId1" };
                V.Shadow shadow1 = new V.Shadow() { Color = "#868686" };
                V.TextPath textPath2 = new V.TextPath() { Style = "font-family:\"Arial Black\";v-text-kern:t", FitPath = true, Trim = true, String = "Test" };
                Wvml.TextWrap textWrap1 = new Wvml.TextWrap() { Type = Wvml.WrapValues.Square, AnchorX = Wvml.HorizontalAnchorValues.Margin, AnchorY = Wvml.VerticalAnchorValues.Margin };
    
                shape1.Append(fill1);
                shape1.Append(stroke1);
                shape1.Append(shadow1);
                shape1.Append(textPath2);
                shape1.Append(textWrap1);
    
                picture1.Append(shapetype1);
                picture1.Append(shape1);
    
                run1.Append(runProperties1);
                run1.Append(picture1);
                BookmarkEnd bookmarkEnd1 = new BookmarkEnd() { Id = "0" };
    
                paragraph2.Append(paragraphProperties2);
                paragraph2.Append(bookmarkStart1);
                paragraph2.Append(run1);
                paragraph2.Append(bookmarkEnd1);
    
                header1.Append(paragraph2);
    
                headerPart1.Header = header1;
            }
    
            private static void GenerateImagePart1Content(ImagePart imagePart1)
            {
                System.IO.Stream data = GetBinaryDataStream(imagePart1Data);
                imagePart1.FeedData(data);
                data.Close();
            }
    
            private static string imagePart1Data = "/9j/4AAQSkZJRgABAQEASwBLAAD/4wMOTVNPIFBhbGV0dGUg27Vw37164cGF4sWO48B648SF5MmU5ciL5cyX5saJ5sqM58V/58+e6MuU6NGi6cmH6c2W6c6V6dCW6syL6tWo69Ce7M+S7NKg7NSf7dGV7dWn7diu79Wc79ik8Nut8d+206ll2LFs2LV12bl+27yD3Lhz3Lx53rZr3r2C3sCG3sGN37l13714379737+C38OO4MB84MGD4blq4bxy4bx54cOH4cSN4caN4caU4r594r974sF84sGB4sGH4sKE4sOB4smT4smX48OG48SI48SM48WD48WF48WN48aH48eP48iO48mY5Lxx5MOA5MmS5Myd5b9z5cF95cKE5ciG5ciK5ciN5ciT5cmN5cmT5cqS5cqX5cuU5cuY5cyU5cyZ5c6c5c6i5sF15sN75sSB5sSH5sWH5saA5saE5saK5seG5seN5siO5smL5suS5syV5s6Y5tCl58iH58mJ58mO58mT58qN58uN58uU58yT58yY582T582a586Y586c58+h59Ce59Km6MR56MSA6MeH6MiL6M+c6M+g6NCX6NGe6NSr6cZ86caC6cqM6cqT6cuJ6cuO6cyO6cyV6c2T6c2Y6c6R6c6U6c6Y6c6c6c+V6c+Y6dCe6dKf6dKm6dOg6dSl6dWt6siA6smB6smG6smL6sqM6syK6syR6s6O6s+R6s+e6tCW6tGb6tGf6tGj6tSn6tWm68yO682S686W68+b69CW69CX69Ge69Kd69Kg69Kl69Oe69am69as69ev7MyF7MyK7M6Q7M+R7NGT7NGY7NGc7NKU7NKZ7NKc7NOc7NSi7NSk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zmqI4V6ZsG3bCS4NPGVOksDftXOH6X6d3jKypmpY+d+M4u7os/6x6NMaHv59s4ikZU+McLIyWr227YJE7olf2y0orsXxgYuo3vfzhVE5E4wVX8ZopPvb5Mcj0JW4PLnLH1WN+LwvhPfbn7Zkt4xu/vlN6Kr7uCXFNV85usibxDSu/nJG8YwIy24yq1E3OebyUb1BYbuY40re6kTZrnDGzqS9P9r3xSXVLfb5zIjqWziqvHobNlZUN1ydSVWPOU6sVjC3bVTbmaHVzt234y+lHRI/Ttu+G8LtA33+crq9F/PfCqGNQko1+rvX7Yo6WxVzHi0efPtmxiU78dryiJCRd705lx1G211xjdo/q4yYusCbs+cbQ6VJw0l5OQnV23POUudfqarmvfD1LZMRkRfB75j6piqcHjjb5wIcbu3b4yjRP9XHO2TaItyb+PbOSiCjopvd98nVTicANGVpYg7F7lZyaeoew1mOFiH1Hm9i/fNjEepMvan/AJxFs1ONn9sI6ZytQ749TesH0Dnzs5kipulS+32ykmum9/8AnbCqeU2NvjL6UdFvpgjhZekU2rvmnDbuWZjwV2OMLpOuNbnL377YoUXQVhCKc73i6ahuu2KNYkW+nbXjJjFS4G3tlENNVfbA+mRQp7GNEZcFDRxT++YpLiKF4jQVVjt/OSa+oSiS3lxWYrS7It/p398EtBx0nnesdlcKVvtxthk3ezz+M3dMwSUfT6Et7/GIl/Vj6dt998DcGFDvKijCy1SjEJ1TzHCXwneqUjShtd9zFBPqUjX57uGDz6ZUVeznRX6m8Xb/AG5IpSJQXftf4wSnHVRdAUV7Y5SKjZTZtXzgbWq7HnD60o//2Q==";
            private static System.IO.Stream GetBinaryDataStream(string base64String)
            {
                return new System.IO.MemoryStream(System.Convert.FromBase64String(base64String));
            }
    
    
        }
    }

    Wednesday, October 19, 2016 5:08 AM
    Moderator

All replies

  • Hi,

    What do you want the watermark to look like? You could get the sample code from How to add a watermark in Microsoft Word using OpenXML

    Besides, I suggest you use Open XML SDK Tool to generate code by comparing files

    You could download it from https://www.microsoft.com/en-us/download/details.aspx?id=30425

    1. Create two documents with one is original file and one is the target file;

    2. Use Open XML SDK 2.5 productivity Tool for Microsoft Office

    3. Click the Compare Files, generate the code, and then you could get the code what you want

    Regards,

    Celeste

    Friday, October 14, 2016 5:52 AM
    Moderator
  • Hi,

    Here is an simple way to achieve this task:

    Document doc = new Document();
    doc.LoadFromFile("Example.doc");           
    TextWatermark txtWatermark = new TextWatermark();
    txtWatermark.Text = "Draft";
    txtWatermark.FontSize = 90;
    txtWatermark.Layout = WatermarkLayout.Diagonal;
    doc.Watermark = txtWatermark;
    doc.SaveToFile("TextWatermark.doc");
    Note above solution is base on a free word API from Nuget.


    • Edited by Jamesbn Friday, October 14, 2016 6:04 AM
    Friday, October 14, 2016 6:03 AM
  • Hi,

    the hint with Open XML SDK 2.5 productivity tool is great but the generated code seems to be quite adapated to the given document and is not readable at all.

    The sample would be great but is really specific for images, is there any similar (simple) sample for text only watermarks?

    To the second answer from Jamesbn, the tool looks nice, also the way to do it, but the free version is restricted in use, according to the official website (in the size of documents to be used with).

    Regards,

    Simon

    Monday, October 17, 2016 2:43 PM
  • There is no sample code for our reference.

    We could generate one by comparing files using Open XML SDK Tool and adjust for other documents. It depends on the specific requirement.

    Normally, if we want to add a text watermark, we would use textbox or WordArt in the headerfooter view and then put them into the proper location, like the center of the page.

    How do you want to add the watermark?

    Tuesday, October 18, 2016 4:44 PM
    Moderator
  • This sounds like the way I want to go. I will try if I manage to build this from your explanation or is there a sample for this?
    Tuesday, October 18, 2016 7:33 PM
  • Hi,

    The project below is modified form the sample. It would add a WordArt "Test" as the watermark in the center of the page.

    using DocumentFormat.OpenXml;
    using DocumentFormat.OpenXml.Packaging;
    using DocumentFormat.OpenXml.Wordprocessing;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using V = DocumentFormat.OpenXml.Vml;
    using Ovml = DocumentFormat.OpenXml.Vml.Office;
    using Wvml = DocumentFormat.OpenXml.Vml.Wordprocessing;
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                using (WordprocessingDocument document = WordprocessingDocument.Open(@"C:\Users\Administrator\Desktop\2.docx", true))
                {
                    MainDocumentPart mainDocumentPart1 = document.MainDocumentPart;
                    if (mainDocumentPart1 != null)
                    {
                        mainDocumentPart1.DeleteParts(mainDocumentPart1.HeaderParts);
                        HeaderPart headPart1 = mainDocumentPart1.AddNewPart<HeaderPart>();
                        GenerateHeaderPart1Content(headPart1);
                        string rId = mainDocumentPart1.GetIdOfPart(headPart1);
                        ImagePart image = headPart1.AddNewPart<ImagePart>("image/jpeg", "rId1");
                        GenerateImagePart1Content(image);
                        IEnumerable<SectionProperties> sectPrs = mainDocumentPart1.Document.Body.Elements<SectionProperties>();
                        foreach (var sectPr in sectPrs)
                        {
                            sectPr.RemoveAllChildren<HeaderReference>();
                            sectPr.PrependChild<HeaderReference>(new HeaderReference() { Id = rId });
                        }
                    }
                }
            }
            private static void GenerateHeaderPart1Content(HeaderPart headerPart1)
            {
                Header header1 = new Header() { MCAttributes = new MarkupCompatibilityAttributes() { Ignorable = "w14 w15 w16se wp14" } };
                header1.AddNamespaceDeclaration("wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas");
                header1.AddNamespaceDeclaration("cx", "http://schemas.microsoft.com/office/drawing/2014/chartex");
                header1.AddNamespaceDeclaration("cx1", "http://schemas.microsoft.com/office/drawing/2015/9/8/chartex");
                header1.AddNamespaceDeclaration("cx2", "http://schemas.microsoft.com/office/drawing/2015/10/21/chartex");
                header1.AddNamespaceDeclaration("mc", "http://schemas.openxmlformats.org/markup-compatibility/2006");
                header1.AddNamespaceDeclaration("o", "urn:schemas-microsoft-com:office:office");
                header1.AddNamespaceDeclaration("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships");
                header1.AddNamespaceDeclaration("m", "http://schemas.openxmlformats.org/officeDocument/2006/math");
                header1.AddNamespaceDeclaration("v", "urn:schemas-microsoft-com:vml");
                header1.AddNamespaceDeclaration("wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing");
                header1.AddNamespaceDeclaration("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing");
                header1.AddNamespaceDeclaration("w10", "urn:schemas-microsoft-com:office:word");
                header1.AddNamespaceDeclaration("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main");
                header1.AddNamespaceDeclaration("w14", "http://schemas.microsoft.com/office/word/2010/wordml");
                header1.AddNamespaceDeclaration("w15", "http://schemas.microsoft.com/office/word/2012/wordml");
                header1.AddNamespaceDeclaration("w16se", "http://schemas.microsoft.com/office/word/2015/wordml/symex");
                header1.AddNamespaceDeclaration("wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup");
                header1.AddNamespaceDeclaration("wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk");
                header1.AddNamespaceDeclaration("wne", "http://schemas.microsoft.com/office/word/2006/wordml");
                header1.AddNamespaceDeclaration("wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape");
    
                Paragraph paragraph2 = new Paragraph() { RsidParagraphAddition = "00936B9A", RsidRunAdditionDefault = "00936B9A" };
    
                ParagraphProperties paragraphProperties2 = new ParagraphProperties();
                ParagraphStyleId paragraphStyleId2 = new ParagraphStyleId() { Val = "Header" };
    
                paragraphProperties2.Append(paragraphStyleId2);
                BookmarkStart bookmarkStart1 = new BookmarkStart() { Name = "_GoBack", Id = "0" };
    
                Run run1 = new Run();
    
                RunProperties runProperties1 = new RunProperties();
                NoProof noProof1 = new NoProof();
    
                runProperties1.Append(noProof1);
    
                Picture picture1 = new Picture();
    
                V.Shapetype shapetype1 = new V.Shapetype() { Id = "_x0000_t136", CoordinateSize = "21600,21600", OptionalNumber = 136, Adjustment = "10800", EdgePath = "m@7,l@8,m@5,21600l@6,21600e" };
    
                V.Formulas formulas1 = new V.Formulas();
                V.Formula formula1 = new V.Formula() { Equation = "sum #0 0 10800" };
                V.Formula formula2 = new V.Formula() { Equation = "prod #0 2 1" };
                V.Formula formula3 = new V.Formula() { Equation = "sum 21600 0 @1" };
                V.Formula formula4 = new V.Formula() { Equation = "sum 0 0 @2" };
                V.Formula formula5 = new V.Formula() { Equation = "sum 21600 0 @3" };
                V.Formula formula6 = new V.Formula() { Equation = "if @0 @3 0" };
                V.Formula formula7 = new V.Formula() { Equation = "if @0 21600 @1" };
                V.Formula formula8 = new V.Formula() { Equation = "if @0 0 @2" };
                V.Formula formula9 = new V.Formula() { Equation = "if @0 @4 21600" };
                V.Formula formula10 = new V.Formula() { Equation = "mid @5 @6" };
                V.Formula formula11 = new V.Formula() { Equation = "mid @8 @5" };
                V.Formula formula12 = new V.Formula() { Equation = "mid @7 @8" };
                V.Formula formula13 = new V.Formula() { Equation = "mid @6 @7" };
                V.Formula formula14 = new V.Formula() { Equation = "sum @6 0 @5" };
    
                formulas1.Append(formula1);
                formulas1.Append(formula2);
                formulas1.Append(formula3);
                formulas1.Append(formula4);
                formulas1.Append(formula5);
                formulas1.Append(formula6);
                formulas1.Append(formula7);
                formulas1.Append(formula8);
                formulas1.Append(formula9);
                formulas1.Append(formula10);
                formulas1.Append(formula11);
                formulas1.Append(formula12);
                formulas1.Append(formula13);
                formulas1.Append(formula14);
                V.Path path1 = new V.Path() { AllowTextPath = true, ConnectionPointType = Ovml.ConnectValues.Custom, ConnectionPoints = "@9,0;@10,10800;@11,21600;@12,10800", ConnectAngles = "270,180,90,0" };
                V.TextPath textPath1 = new V.TextPath() { On = true, FitShape = true };
    
                V.ShapeHandles shapeHandles1 = new V.ShapeHandles();
                V.ShapeHandle shapeHandle1 = new V.ShapeHandle() { Position = "#0,bottomRight", XRange = "6629,14971" };
    
                shapeHandles1.Append(shapeHandle1);
                Ovml.Lock lock1 = new Ovml.Lock() { Extension = V.ExtensionHandlingBehaviorValues.Edit, TextLock = true, ShapeType = true };
    
                shapetype1.Append(formulas1);
                shapetype1.Append(path1);
                shapetype1.Append(textPath1);
                shapetype1.Append(shapeHandles1);
                shapetype1.Append(lock1);
    
                V.Shape shape1 = new V.Shape() { Id = "_x0000_s2049", Style = "margin-margin-width:87.75pt;height:51pt;mso-position-horizontal:center;mso-position-horizontal-relative:margin;mso-position-vertical:center;mso-position-vertical-relative:margin", Type = "#_x0000_t136" };
                V.Fill fill1 = new V.Fill() { Title = "", RelationshipId = "rId1" };
                V.Stroke stroke1 = new V.Stroke() { Title = "", RelationshipId = "rId1" };
                V.Shadow shadow1 = new V.Shadow() { Color = "#868686" };
                V.TextPath textPath2 = new V.TextPath() { Style = "font-family:\"Arial Black\";v-text-kern:t", FitPath = true, Trim = true, String = "Test" };
                Wvml.TextWrap textWrap1 = new Wvml.TextWrap() { Type = Wvml.WrapValues.Square, AnchorX = Wvml.HorizontalAnchorValues.Margin, AnchorY = Wvml.VerticalAnchorValues.Margin };
    
                shape1.Append(fill1);
                shape1.Append(stroke1);
                shape1.Append(shadow1);
                shape1.Append(textPath2);
                shape1.Append(textWrap1);
    
                picture1.Append(shapetype1);
                picture1.Append(shape1);
    
                run1.Append(runProperties1);
                run1.Append(picture1);
                BookmarkEnd bookmarkEnd1 = new BookmarkEnd() { Id = "0" };
    
                paragraph2.Append(paragraphProperties2);
                paragraph2.Append(bookmarkStart1);
                paragraph2.Append(run1);
                paragraph2.Append(bookmarkEnd1);
    
                header1.Append(paragraph2);
    
                headerPart1.Header = header1;
            }
    
            private static void GenerateImagePart1Content(ImagePart imagePart1)
            {
                System.IO.Stream data = GetBinaryDataStream(imagePart1Data);
                imagePart1.FeedData(data);
                data.Close();
            }
    
            private static string imagePart1Data = "/9j/4AAQSkZJRgABAQEASwBLAAD/4wMOTVNPIFBhbGV0dGUg27Vw37164cGF4sWO48B648SF5MmU5ciL5cyX5saJ5sqM58V/58+e6MuU6NGi6cmH6c2W6c6V6dCW6syL6tWo69Ce7M+S7NKg7NSf7dGV7dWn7diu79Wc79ik8Nut8d+206ll2LFs2LV12bl+27yD3Lhz3Lx53rZr3r2C3sCG3sGN37l13714379737+C38OO4MB84MGD4blq4bxy4bx54cOH4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s5kipulS+32ykmum9/8AnbCqeU2NvjL6UdFvpgjhZekU2rvmnDbuWZjwV2OMLpOuNbnL377YoUXQVhCKc73i6ahuu2KNYkW+nbXjJjFS4G3tlENNVfbA+mRQp7GNEZcFDRxT++YpLiKF4jQVVjt/OSa+oSiS3lxWYrS7It/p398EtBx0nnesdlcKVvtxthk3ezz+M3dMwSUfT6Et7/GIl/Vj6dt998DcGFDvKijCy1SjEJ1TzHCXwneqUjShtd9zFBPqUjX57uGDz6ZUVeznRX6m8Xb/AG5IpSJQXftf4wSnHVRdAUV7Y5SKjZTZtXzgbWq7HnD60o//2Q==";
            private static System.IO.Stream GetBinaryDataStream(string base64String)
            {
                return new System.IO.MemoryStream(System.Convert.FromBase64String(base64String));
            }
    
    
        }
    }

    Wednesday, October 19, 2016 5:08 AM
    Moderator