ITextDocumentFactoryService.CreateAndLoadTextDocument Method (String, IContentType, Encoding, Boolean%)
Creates an ITextDocument that opens and loads the contents of the file into a new ITextBuffer.
Namespace: Microsoft.VisualStudio.Text
Assembly: Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)
Syntax
'Declaration
Function CreateAndLoadTextDocument ( _
filePath As String, _
contentType As IContentType, _
encoding As Encoding, _
<OutAttribute> ByRef characterSubstitutionsOccurred As Boolean _
) As ITextDocument
ITextDocument CreateAndLoadTextDocument(
string filePath,
IContentType contentType,
Encoding encoding,
out bool characterSubstitutionsOccurred
)
ITextDocument^ CreateAndLoadTextDocument(
String^ filePath,
IContentType^ contentType,
Encoding^ encoding,
[OutAttribute] bool% characterSubstitutionsOccurred
)
abstract CreateAndLoadTextDocument :
filePath:string *
contentType:IContentType *
encoding:Encoding *
characterSubstitutionsOccurred:bool byref -> ITextDocument
function CreateAndLoadTextDocument(
filePath : String,
contentType : IContentType,
encoding : Encoding,
characterSubstitutionsOccurred : boolean
) : ITextDocument
Parameters
filePath
Type: StringThe full path to the file to be loaded.
contentType
Type: Microsoft.VisualStudio.Utilities.IContentTypeThe IContentType for the ITextBuffer.
encoding
Type: EncodingThe encoding to use. The decoder part of the Encoding object will not be used.
characterSubstitutionsOccurred
Type: Boolean%[out] Set to true if some of the file bytes could not be directly translated using the given encoding.
Return Value
Type: Microsoft.VisualStudio.Text.ITextDocument
The ITextDocument.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | filePath, contentType, or encoding is nulla null reference (Nothing in Visual Basic). |
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
ITextDocumentFactoryService Interface