共用方式為


ITextDocumentFactoryService2.CreateAndLoadTextDocument 方法

定義

建立 , ITextDocument 開啟並將 的內容 filePath 載入新的 ITextBuffer

public:
 Microsoft::VisualStudio::Text::ITextDocument ^ CreateAndLoadTextDocument(System::String ^ filePath, Microsoft::VisualStudio::Utilities::IContentType ^ contentType, bool attemptUtf8Detection, bool allowCompressedStorage, bool throwOnInvalidCharactersIfUnknownEncoding, [Runtime::InteropServices::Out] bool % characterSubstitutionsOccurred);
public Microsoft.VisualStudio.Text.ITextDocument CreateAndLoadTextDocument (string filePath, Microsoft.VisualStudio.Utilities.IContentType contentType, bool attemptUtf8Detection, bool allowCompressedStorage, bool throwOnInvalidCharactersIfUnknownEncoding, out bool characterSubstitutionsOccurred);
abstract member CreateAndLoadTextDocument : string * Microsoft.VisualStudio.Utilities.IContentType * bool * bool * bool * bool -> Microsoft.VisualStudio.Text.ITextDocument
Public Function CreateAndLoadTextDocument (filePath As String, contentType As IContentType, attemptUtf8Detection As Boolean, allowCompressedStorage As Boolean, throwOnInvalidCharactersIfUnknownEncoding As Boolean, ByRef characterSubstitutionsOccurred As Boolean) As ITextDocument

參數

filePath
String

要載入之檔案的完整路徑。

attemptUtf8Detection
Boolean

是否嘗試將檔載入為UTF-8檔案。

allowCompressedStorage
Boolean

允許將大型檔案儲存在壓縮的緩衝區中。 已被取代:不論傳遞的值為何,都會在 true 內部使用。

throwOnInvalidCharactersIfUnknownEncoding
Boolean

如果遇到無效的字元,而且我們沒有妥善定義的編碼,則會擲回例外狀況。

characterSubstitutionsOccurred
Boolean

如果某些檔案位元組無法使用指定的編碼直接轉譯,請將 設定為 true。

傳回

ITextDocument

例外狀況

filePathcontentType 為 null。

適用於