XpsSignatureDefinition.SpotId 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定這個 XpsSignatureDefinition 的唯一識別項。
public:
property Nullable<Guid> SpotId { Nullable<Guid> get(); void set(Nullable<Guid> value); };
public Guid? SpotId { get; set; }
member this.SpotId : Nullable<Guid> with get, set
Public Property SpotId As Nullable(Of Guid)
屬性值
表示簽章定義識別碼的 (Nullable) Guid 。 預設值是 null
。
範例
下列範例將示範如何設定這個屬性。
private void SignatureDefinitionCommandHandler(object sender, RoutedEventArgs e)
{
SignatureDefinition sigDefDialog = new SignatureDefinition();
if (sigDefDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
XpsSignatureDefinition signatureDefinition = new XpsSignatureDefinition();
signatureDefinition.RequestedSigner = sigDefDialog.RequestedSigner.Text;
signatureDefinition.Intent = sigDefDialog.Intent.Text;
signatureDefinition.SigningLocale = sigDefDialog.SigningLocale.Text;
try
{
signatureDefinition.SignBy = DateTime.Parse(sigDefDialog.SignBy.Text);
}
catch (FormatException)
{
}
signatureDefinition.SpotId = Guid.NewGuid();
IXpsFixedDocumentSequenceReader docSeq = _xpsDocument.FixedDocumentSequenceReader; //_xpsDocument is type System.Windows.Xps.Packaging.XpsDocument
IXpsFixedDocumentReader doc = docSeq.FixedDocuments[0];
doc.AddSignatureDefinition(signatureDefinition);
doc.CommitSignatureDefinition();
InitializeSignatureDisplay();
}
}
Private Sub SignatureDefinitionCommandHandler(sender As Object, e As RoutedEventArgs)
Using sigDefDialog As New SignatureDefinition()
If sigDefDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Dim signatureDefinition As New XpsSignatureDefinition With {
.RequestedSigner = sigDefDialog.RequestedSigner.Text,
.Intent = sigDefDialog.Intent.Text,
.SigningLocale = sigDefDialog.SigningLocale.Text
}
Try
signatureDefinition.SignBy = Date.Parse(sigDefDialog.SignBy.Text)
Catch e1 As FormatException
End Try
signatureDefinition.SpotId = Guid.NewGuid()
Dim docSeq As IXpsFixedDocumentSequenceReader = _xpsDocument.FixedDocumentSequenceReader '_xpsDocument is type System.Windows.Xps.Packaging.XpsDocument
Dim doc As IXpsFixedDocumentReader = docSeq.FixedDocuments(0)
doc.AddSignatureDefinition(signatureDefinition)
doc.CommitSignatureDefinition()
InitializeSignatureDisplay()
End If
End Using
End Sub
備註
若要將 專案連結 Signature
至這個 XpsSignatureDefinition ,您必須將 Id
的 Signature
屬性設定為 屬性的值 SpotId 。 如需專案的詳細資訊 Signature
,請參閱 開放式封裝慣例 架構。
如需 XML 紙張規格 (XPS) 套件中元素屬性 SignatureDefinition
的詳細資訊 SpotID
,請參閱 XML 紙張規格 (XPS) 規格中的第 10 章,您可以在XPS:規格和授權下載取得。