开发者

Use C# to make Signature Line with intended signer, email, etc. in Excel

开发者 https://www.devze.com 2023-03-21 14:00 出处:网络
I\'m using Excel to automatically generate forms for my company\'s accounting department. I need each form to have an Excel Signature Line object in it with the intended signer\'s information (Name, t

I'm using Excel to automatically generate forms for my company's accounting department. I need each form to have an Excel Signature Line object in it with the intended signer's information (Name, title, email) filled in and ready for them to sign.

So far, I have the signature line being created with

xlApp.ActiveWorkbook.Signatures.AddSignatureLine();

where xlApp is my Excel Application. When I run the code, it generates the signature box, but has a pop up asking for the intended signer's name, title, and email. I tried using

SendKeys.Send(name + "{TAB}Peon{TAB}" + email + "{TAB}{TAB}{TAB}{TAB}~");

to 开发者_JAVA百科manually type in the information, since I couldn't find any methods for creating a Signature Line that accept this information. However, the code hangs up until the popup window is closed, never getting to the line where it fills in the information I need it to. I was thinking of suppressing alerts and popups in excel, but I can't find where to edit the attributes of the Signature Line object. Any thoughts on how to achieve my goal?

Thanks if you can help!


According to MSDN SignatureInfo "Represents the information used to create a digital or in-document signature".

I expect that you can make some settings (define SignatureComment, SignatureImage and SignatureText - these are all read/write) prior to executing the signature and these would be preset values that the signing user can agree with (i.e. sign) or not. But I have not found out how to do this. (I am working on a similar issue with the AddNonVisibleSignature() method. My question: Is there a way to programmatically predefine the purpose when signing an office document?)

Needless to say you cannot make these settings after signing, as you would change the document/signature and render the signature invalid. You can however read details of signatures in a document by looking at the Signature interface via the SignatureSet object:

    Set sigs = ActiveDocument.Signatures;

I assume some of the difficulties involved in handling signatures and making it uncomplicated for users to sign documents are due to the architecture that is necessary to make signatures safe.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号