WorkbookBase.GetWorkflowTemplates 方法

定义

返回工作簿的工作流模板的集合。

public:
 Microsoft::Office::Core::WorkflowTemplates ^ GetWorkflowTemplates();
public Microsoft.Office.Core.WorkflowTemplates GetWorkflowTemplates ();
member this.GetWorkflowTemplates : unit -> Microsoft.Office.Core.WorkflowTemplates
Public Function GetWorkflowTemplates () As WorkflowTemplates

返回

一个 Microsoft.Office.Core.WorkflowTemplates 集合,包含工作簿的工作流模板。

示例

下面的代码示例显示可用于工作簿的工作流模板数。 如果存在一个或多个工作流模板,则本示例显示每个模板的名称和说明。

若要运行此代码示例,必须将工作簿发布到 Office SharePoint Server 网站。

此示例适用于文档级自定义项。

private void DisplayWorkflowTemplates()
{
    Office.WorkflowTemplates workflowTemplates = 
        this.GetWorkflowTemplates();
    MessageBox.Show("Number of workflow templates found: " 
        + workflowTemplates.Count.ToString());
    StringBuilder sb = new StringBuilder();
    sb.Append("Workflow Template List\r\n");
    foreach (Office.WorkflowTemplate template in workflowTemplates)
    {
        sb.Append("\r\n" + template.Name + " Template" 
            + "\r\nDescription: " + template.Description);
    }
    if (workflowTemplates.Count > 0)
    {
        MessageBox.Show(sb.ToString());
    }
}
Private Sub DisplayWorkflowTemplates()
    Dim workflowTemplates As Office.WorkflowTemplates = _
        Me.GetWorkflowTemplates()
    MessageBox.Show("Number of workflow templates found: " _
        + workflowTemplates.Count.ToString())
    Dim sb As StringBuilder = New StringBuilder()
    sb.Append("Workflow Template List" + vbCrLf)
    For Each template As Office.WorkflowTemplate In workflowTemplates
        sb.Append(vbCrLf + template.Name + " Template" + vbCrLf _
            + "Description: " + template.Description)
    Next
    If workflowTemplates.Count > 0 Then
        MessageBox.Show(sb.ToString())
    End If
End Sub

适用于