Trying to insert a digital signature line in a docx file


I'm trying to insert a digital signature line in an openxml (docx) version of a word document. I don't get any errors but I realize I might be missing a step. Here's my code. It's a windows forms application. Can some one tell me how to properly append a digital signature line to a Run instance? The //S// serves as a marker where we want to insert the digital signature line. It's easy to find with a foreach statement.

using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Vml.Office;
using DocumentFormat.OpenXml.Wordprocessing;

namespace KeywordSearch
{
    public partial class Form1 : Form
    {
        FileInfo[] tempfiles;
        List<FileInfo> files = new List<FileInfo>();

        public Form1()
        {
            InitializeComponent();
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            string fileName = txtPath.Text;
            using (WordprocessingDocument doc =
            WordprocessingDocument.Open(fileName, false))
            {
                foreach (Text t in doc.MainDocumentPart.Document.Body.Descendants<Text>())
                {
                    if (t.Text == "//S//")
                    {
                        lbxResults.Items.Add(t.Text);

                        Run r = (Run)t.Parent;

                        SignatureLine signature = new SignatureLine();
                        signature.SuggestedSigner = "Pete Smith";
                        signature.SuggestedSigner2 = "Programmer";
                        signature.SuggestedSignerEmail = "[email protected]";
                        signature.SigningInstructions = "Please sign";
                        signature.ShowSignDate = true;
                        signature.AllowComments = true;



                        r.AppendChild<SignatureLine>(signature);
                    }
                }
            }

            lbxResults.Items.Add("Completed adding digital signature liens.");
        }
    private void btnBrowse_Click(object sender, EventArgs e)
    {
        openFileDialog1.ShowDialog();

        txtPath.Text = openFileDialog1.FileName;
    }
}

}


Answers:


This code contains a function AddSiganture() which searches for a ContentControl with tag "topsoft", and adds a SignatureLine to it. More information about the SignatureLine can be found here http://msdn.microsoft.com/en-us/library/documentformat.openxml.vml.office.signatureline.aspx Actually a signature line is a Picture with a shape and a shape type inside. Also it's very important to add an ImagePart to the document with a corresponding ID. The ID of the image part must correspond to the RelationshipId of the image object inside the Picture object.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using DocumentFormat.OpenXml.Packaging;
using Ap = DocumentFormat.OpenXml.ExtendedProperties;
using Vt = DocumentFormat.OpenXml.VariantTypes;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Wordprocessing;
using V = DocumentFormat.OpenXml.Vml;
using Ovml = DocumentFormat.OpenXml.Vml.Office;
using Ds = DocumentFormat.OpenXml.CustomXmlDataProperties;
using A = DocumentFormat.OpenXml.Drawing;
using M = DocumentFormat.OpenXml.Math;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        public void button1_Click(object sender, EventArgs e)
        {
            using (WordprocessingDocument document = WordprocessingDocument.Open(@"C:\Users\Tigran\Documents\qw.docx", true))
            {
                AddSiganture(document, "Tigran Topchyan", "Head of Development", "[email protected]");
                document.Close();
            } 
        }

        public void AddSiganture(WordprocessingDocument document, string signerName, string signerTitle, string signerEmail)
        {
            MainDocumentPart mainDocumentPart1 = document.MainDocumentPart;

            string imagePartID = "ID_" + Guid.NewGuid().ToString("N");
            string signatureID = Guid.NewGuid().ToString("B");
            Picture picture1 = new Picture();

            V.Shapetype shapetype1 = new V.Shapetype() { Id = "_x0000_t75", CoordinateSize = "21600,21600", Filled = false, Stroked = false, OptionalNumber = 75, PreferRelative = true, EdgePath = "[email protected]@[email protected]@[email protected]@[email protected]@5xe" };
            V.Stroke stroke1 = new V.Stroke() { JoinStyle = V.StrokeJoinStyleValues.Miter };

            V.Formulas formulas1 = new V.Formulas();
            V.Formula formula1 = new V.Formula() { Equation = "if lineDrawn pixelLineWidth 0" };
            V.Formula formula2 = new V.Formula() { Equation = "sum @0 1 0" };
            V.Formula formula3 = new V.Formula() { Equation = "sum 0 0 @1" };
            V.Formula formula4 = new V.Formula() { Equation = "prod @2 1 2" };
            V.Formula formula5 = new V.Formula() { Equation = "prod @3 21600 pixelWidth" };
            V.Formula formula6 = new V.Formula() { Equation = "prod @3 21600 pixelHeight" };
            V.Formula formula7 = new V.Formula() { Equation = "sum @0 0 1" };
            V.Formula formula8 = new V.Formula() { Equation = "prod @6 1 2" };
            V.Formula formula9 = new V.Formula() { Equation = "prod @7 21600 pixelWidth" };
            V.Formula formula10 = new V.Formula() { Equation = "sum @8 21600 0" };
            V.Formula formula11 = new V.Formula() { Equation = "prod @7 21600 pixelHeight" };
            V.Formula formula12 = new V.Formula() { Equation = "sum @10 21600 0" };

            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);
            V.Path path1 = new V.Path() { AllowGradientShape = true, ConnectionPointType = Ovml.ConnectValues.Rectangle, AllowExtrusion = false };
            Ovml.Lock lock1 = new Ovml.Lock() { Extension = V.ExtensionHandlingBehaviorValues.Edit, AspectRatio = true };

            shapetype1.Append(stroke1);
            shapetype1.Append(formulas1);
            shapetype1.Append(path1);
            shapetype1.Append(lock1);

            V.Shape shape1 = new V.Shape() 
            {
                Id = "_x0000_i1025", 
                Style = "width:192pt;height:96pt", 
                Alternate = "Microsoft Office Signature Line...", 
                Type = "#_x0000_t75" 
            };
            V.ImageData imageData1 = new V.ImageData() { Title = "", RelationshipId = imagePartID };

            Ovml.Lock lock2 = new Ovml.Lock()
            { 
                Extension = V.ExtensionHandlingBehaviorValues.Edit, 
                Grouping = true, Ungrouping = true, Rotation = true, Cropping = true, Verticies = true, TextLock = true 
            };

            Ovml.SignatureLine signatureLine1 = new Ovml.SignatureLine() 
            {
                Extension = V.ExtensionHandlingBehaviorValues.Edit, 
                IsSignatureLine = true, 
                Id = signatureID, 
                ProviderId = "{00000000-0000-0000-0000-000000000000}", 
                SuggestedSigner = signerName, 
                SuggestedSigner2 = signerTitle,
                SuggestedSignerEmail = signerEmail
            };

            shape1.Append(imageData1);
            shape1.Append(lock2);
            shape1.Append(signatureLine1);

            picture1.Append(shapetype1);
            picture1.Append(shape1);

            var contentControls = mainDocumentPart1.Document.Descendants<SdtElement>();
            foreach (SdtElement elem in contentControls)
            {
                if (elem.SdtProperties.GetFirstChild<Tag>().Val == "topsoft")
                {
                    var content = elem.GetFirstChild<SdtContentBlock>();
                    content.RemoveAllChildren();
                    content.Append(picture1);
                }
            }

            ImagePart imagePart1 = mainDocumentPart1.AddNewPart<ImagePart>("image/x-emf", imagePartID);
            GenerateImagePartContent(imagePart1);
        }

        public void GenerateImagePartContent(ImagePart imagePart1)
        {
            System.IO.Stream data = GetBinaryDataStream(imagePart1Data);
            imagePart1.FeedData(data);
            data.Close();
        }

        #region Binary Data
        public string imagePart1Data = "AQAAAGwAAAAAAAAAAAAAAP8AAAB/AAAAAAAAAAAAAABQIwAAoBEAACBFTUYAAAEAtBQAAIMAAAAFAAAAAAAAAAAAAAAAAAAAAAUAACADAADEAQAAGgEAAAAAAAAAAAAAAAAAAOPjBgBuTgQACgAAABAAAAAAAAAAAAAAAEsAAAAQAAAAAAAAAAUAAAAeAAAAGAAAAAAAAAAAAAAAAAEAAIAAAAAnAAAAGAAAAAEAAAAAAAAAAAAAAAAAAAAlAAAADAAAAAEAAABMAAAAZAAAAAAAAAAAAAAA/wAAAH8AAAAAAAAAAAAAAAABAACAAAAAIQDwAAAAAAAAAAAAAACAPwAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJQAAAAwAAAAAAACAKAAAAAwAAAABAAAAJwAAABgAAAABAAAAAAAAAP///wAAAAAAJQAAAAwAAAABAAAATAAAAGQAAAAAAAAAAAAAAP8AAAB/AAAAAAAAAAAAAAAAAQAAgAAAACEA8AAAAAAAAAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACUAAAAMAAA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AAAUAAAAPcAAABdAAAAJQAAAAwAAAADAAAAVAAAAKgAAAAKAAAAUAAAAFkAAABcAAAAAQAAAABADUIAAA1CCgAAAFAAAAAPAAAATAAAAAAAAAAAAAAAAAAAAP//////////bAAAAFQAaQBnAHIAYQBuACAAVABvAHAAYwBoAHkAYQBuAEMABgAAAAIAAAAGAAAABAAAAAYAAAAGAAAAAwAAAAYAAAAGAAAABgAAAAUAAAAGAAAABgAAAAYAAAAGAAAASwAAAEAAAAAwAAAABQAAACAAAAABAAAAAQAAABAAAAAAAAAAAAAAAAABAACAAAAAAAAAAAAAAAAAAQAAgAAAACUAAAAMAAAAAgAAACcAAAAYAAAABAAAAAAAAAD///8AAAAAACUAAAAMAAAABAAAAEwAAABkAAAACQAAAGAAAAD2AAAAbAAAAAkAAABgAAAA7gAAAA0AAAAhAPAAAAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlAAAADAAAAAAAAIAoAAAADAAAAAQAAAAlAAAADAAAAAMAAAAYAAAADAAAAAAAAAISAAAADAAAAAEAAAAeAAAAGAAAAAkAAABgAAAA9wAAAG0AAAAlAAAADAAAAAMAAABUAAAAwAAAAAoAAABgAAAAcQAAAGwAAAABAAAAAEANQgAADUIKAAAAYAAAABMAAABMAAAAAAAAAAAAAAAAAAAA//////////90AAAASABlAGEAZAAgAG8AZgAgAEQAZQB2AGUAbABvAHAAbQBlAG4AdAA2AAcAAAAGAAAABgAAAAYAAAADAAAABgAAAAQAAAADAAAABwAAAAYAAAAGAAAABgAAAAIAAAAGAAAABgAAAAgAAAAGAAAABgAAAAQAAABLAAAAQAAAADAAAAAFAAAAIAAAAAEAAAABAAAAEAAAAAAAAAAAAAAAAAEAAIAAAAAAAAAAAAAAAAABAACAAAAAJQAAAAwAAAACAAAADgAAABQAAAAAAAAAEAAAABQAAAA=";

        public System.IO.Stream GetBinaryDataStream(string base64String)
        {
            return new System.IO.MemoryStream(System.Convert.FromBase64String(base64String));
        }

        #endregion
    }
}