ServerDocument.IsCustomized 方法
取得值,指出指定的文件是否有利用 Visual Studio 2010 Tools for Office Runtime 所建立的自訂。
命名空間: Microsoft.VisualStudio.Tools.Applications
組件: Microsoft.VisualStudio.Tools.Applications.ServerDocument (在 Microsoft.VisualStudio.Tools.Applications.ServerDocument.dll 中)
語法
'宣告
Public Shared Function IsCustomized ( _
documentPath As String _
) As Boolean
public static bool IsCustomized(
string documentPath
)
參數
- documentPath
型別:System.String
您想要檢查自訂之文件的完整路徑。
傳回值
型別:System.Boolean
如果文件有利用 Visual Studio 2010 Tools for Office Runtime 所建立的自訂,則為 true,如果文件沒有自訂,則為 false。
例外狀況
例外狀況 | 條件 |
---|---|
ArgumentNullException | documentPath 參數為 nullnull 參考 (即 Visual Basic 中的 Nothing),或空字串,或整個都是空白字元。 |
FileNotFoundException | documentPath 中的檔案不存在。 |
DocumentCustomizedWithPreviousRuntimeException | documentPath 指定的檔案具有不以 Visual Studio 2010 Tools for Office Runtime 或 Visual Studio Tools for the Microsoft Office 系統 (3.0 版執行階段) 建立的自訂。 |
備註
這個方法會擲回例外狀況,如果指定的文件未以 Visual Studio 2010 Tools for Office Runtime 或 Visual Studio Tools for the Microsoft Office System 的自訂 (3.0 版 Runtime)。 例如,如果您所指定的文件,是透過在 Visual Studio 2008 中使用 Microsoft Office 2003 的專案範本建立的,這個方法便會擲回例外狀況,原因是這些專案範本使用 Visual Studio 2005 Tools for Office Second Edition runtime。
如果要判斷文件是否有使用任何版本的 Visual Studio 所建立的自訂,請使用 GetCustomizationVersion 方法,而非 IsCustomized 方法。 如果文件並沒有自訂,GetCustomizationVersion 就會傳回 0 (零)。
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。