Salman
Salman

Reputation: 1286

Reading Signature lines using OpenXMlSDK

I just started office development and have been trying to read a word 2013 document that holds signature fields in it using open xml sdk can some one help me how to do that.

 using (var document = WordprocessingDocument.Open(@"D:\Temp_Folder\tempfile.docx", false))
            {                  
                var docPart = document.MainDocumentPart;                      
            }

I have tried reading word file using ELdos (SBOffice) I can get signature lines but not able to get full details related to Signature Lines like Suggested Signer and Suggested Signer email.

Can some one suggest me which I have to prefer OpenXMLSDK or Eldos(SBOffice) bcz i need to find signature fields and then sign them by custom certificate using Third party Signing Service.

Upvotes: 0

Views: 759

Answers (1)

triad_Mike
triad_Mike

Reputation: 129

The best way would be to use the OpenXMLSDKTool to open the document and it will show you the code necessary to replicate it. I believe it would be within a shape something like

using (var document = WordprocessingDocument.Open("YourDoc.docx", false)
{
    var signature = document.MainDocumentPart.Document.Descendant<DocumentFormat.OpenXML.VML.Office.SignatureLine>().FirstOrDefault();
    var suggestedSigner = signature.SuggestedSigner;
    var suggestedSignerTitle = signature.SuggestedSigner2;
    var suggestedSignerEmail = signature.SuggestedSIgnerEmail;
}

You could get the actual signature image in this same area.

Upvotes: 1

Related Questions