Is there a way to programmatically predefine the purpose when signing an office document?

冷暖自知 提交于 2019-12-11 21:25:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!