问题
I'm creating an Excel file *.xlsx in a C#environment with Microsoft Excel Interop.
I call the signing dialog programmatically with the following commands:
using Excel = Microsoft.Office.Interop.Excel;
Excel.Application xlapp = null;
xlapp = new Microsoft.Office.Interop.Excel.Application();
Excel.Workbook xlwb = xlapp.Workbooks.Add();
object sigID = "{00000000-0000-0000-0000-000000000000}";
xlwb.Signatures.AddNonVisibleSignature(sigID);
The "Sign" dialog appears and the user's credentials are generally displayed as they log on to the system with them. The user is prompted for "Purpose for signing this document".
I would like to predefine the purpose. (Users would still be able to edit it, if they have a differing purpose.) Am I overseeing something I should set in the xlwb.Signatures or am I looking in the wrong place?
回答1:
I think this should work:
xlapp.DisplayAlerts = false;
xlwb.Signatures.AddNonVisibleSignature(sigID);
xlapp.DisplayAlerts = true;
All I'm doing above is turning off the alerts while you set the signature, and then turning them back on right after.
来源:https://stackoverflow.com/questions/23955631/is-there-a-way-to-programmatically-predefine-the-purpose-when-signing-an-office