Share via


WorkbookBase.ContentTypeProperties 屬性

取得屬性的集合,這些屬性會描述儲存於活頁簿的中繼資料。

命名空間:  Microsoft.Office.Tools.Excel
組件:  Microsoft.Office.Tools.Excel.v4.0.Utilities (在 Microsoft.Office.Tools.Excel.v4.0.Utilities.dll 中)

語法

'宣告
Public ReadOnly Property ContentTypeProperties As MetaProperties
public MetaProperties ContentTypeProperties { get; }

屬性值

型別:Microsoft.Office.Core.MetaProperties
Microsoft.Office.Core.MetaProperties 集合,其中包含的屬性會描述儲存於活頁簿的中繼資料。

範例

下列程式碼範例會擷取與目前活頁簿關聯的中繼資料 (Metadata)。 這個範例會顯示找到的中繼資料屬性總數,並隨後顯示每個屬性的名稱和值。 若要執行這個範例,您必須將活頁簿發行至 Microsoft Office SharePoint Server 文件庫,並為這個活頁簿提供自訂中繼資料屬性。 例如,您可以在已發行該活頁簿的文件庫中加入資料行。 如需內容類型屬性的詳細資訊,請參閱 Microsoft Office SharePoint Server 文件。

這是示範文件層級自訂的範例。

Private Sub GetContentTypeProperties()
    Dim props As Office.MetaProperties = Me.ContentTypeProperties
    MessageBox.Show("Number of metadata properties found: " _
                    + props.Count.ToString())
    For Each prop As Office.MetaProperty In props
        MessageBox.Show("Metadata property name: " + prop.Name _
                + vbCrLf + "Metadata property value: " _
                + prop.Value.ToString())
    Next
End Sub
private void GetContentTypeProperties()
{
    Office.MetaProperties props = this.ContentTypeProperties;
    MessageBox.Show("Number of metadata properties found: "
                    + props.Count.ToString());
    foreach (Office.MetaProperty prop in props)
    {
        MessageBox.Show("Metadata property name: " + prop.Name
                + "\r\nMetadata property value: "
                + prop.Value.ToString());
    }
}

.NET Framework 安全性

請參閱

參考

WorkbookBase 類別

Microsoft.Office.Tools.Excel 命名空間