ITextDocumentFactoryService2.CreateAndLoadTextDocument Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates an ITextDocument that opens and loads the contents of filePath
into a new 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
Parameters
- filePath
- String
The full path to the file to be loaded.
- contentType
- IContentType
The IContentType for the ITextBuffer.
- attemptUtf8Detection
- Boolean
Whether to attempt to load the document as a UTF-8 file.
- allowCompressedStorage
- Boolean
Allow large files to be stored in a compressed buffer. Deprecated: regardless of passed value, internally true
is used.
- throwOnInvalidCharactersIfUnknownEncoding
- Boolean
Throw an exception if invalid characters are encountered and we do not have a well-defined encoding.
- characterSubstitutionsOccurred
- Boolean
Set to true if some of the file bytes could not be directly translated using the given encoding.
Returns
An ITextDocument.
Exceptions
filePath
or contentType
is null.